add license, fix clipp
This commit is contained in:
parent
dd28afc1ef
commit
34b337172a
|
|
@ -108,6 +108,19 @@ FetchContent_Declare(
|
|||
|
||||
FetchContent_MakeAvailable(spdlog)
|
||||
|
||||
FetchContent_Declare(
|
||||
clipp
|
||||
GIT_REPOSITORY https://github.com/muellan/clipp.git
|
||||
GIT_TAG v1.2.3
|
||||
GIT_SHALLOW TRUE
|
||||
GIT_PROGRESS TRUE
|
||||
)
|
||||
|
||||
FetchContent_GetProperties(clipp)
|
||||
if(NOT clipp_POPULATED)
|
||||
FetchContent_Populate(clipp)
|
||||
endif()
|
||||
|
||||
project(canscope)
|
||||
file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
|
||||
add_executable(${CMAKE_PROJECT_NAME} ${SOURCES})
|
||||
|
|
@ -120,6 +133,7 @@ target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE
|
|||
${fmt_SOURCE_DIR}/include
|
||||
${json_SOURCE_DIR}/include
|
||||
${sqlite_modern_SOURCE_DIR}/hdr
|
||||
${clipp_SOURCE_DIR}/include
|
||||
)
|
||||
|
||||
target_link_directories(${CMAKE_PROJECT_NAME}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2026 Oleg Shishlyannikov
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
7023
src/clipp.hpp
7023
src/clipp.hpp
File diff suppressed because it is too large
Load Diff
16
src/main.cpp
16
src/main.cpp
|
|
@ -27,7 +27,6 @@
|
|||
#include <boost/spirit/include/phoenix.hpp>
|
||||
#include <boost/spirit/include/qi.hpp>
|
||||
|
||||
#include "clipp.hpp"
|
||||
#include "ftxui/component/component.hpp"
|
||||
#include "ftxui/component/screen_interactive.hpp"
|
||||
#include "ftxui/dom/elements.hpp"
|
||||
|
|
@ -35,6 +34,7 @@
|
|||
#include "process.hpp"
|
||||
#include "recorder.hpp"
|
||||
#include "signals.hpp"
|
||||
#include <clipp.h>
|
||||
|
||||
std::mutex g_j1939_db_mtx;
|
||||
|
||||
|
|
@ -172,7 +172,6 @@ int32_t main(int32_t argc, char *argv[]) {
|
|||
auto aggregator_task = std::async(
|
||||
std::launch::async,
|
||||
[command = cli_opts.command](std::stop_token stop_token) {
|
||||
fmt::println(stderr, "[task] aggregator started");
|
||||
if (command.empty()) {
|
||||
|
||||
// Read from the saved pipe fd using epoll to avoid blocking on stop
|
||||
|
|
@ -250,7 +249,6 @@ int32_t main(int32_t argc, char *argv[]) {
|
|||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
}
|
||||
}
|
||||
fmt::println(stderr, "[task] aggregator finished");
|
||||
},
|
||||
|
||||
aggregator_task_stop.get_token());
|
||||
|
|
@ -259,7 +257,6 @@ int32_t main(int32_t argc, char *argv[]) {
|
|||
auto refresh_task = std::async(
|
||||
std::launch::async,
|
||||
[](std::stop_token stop_token) {
|
||||
fmt::println(stderr, "[task] refresh started");
|
||||
using aggregated_t = std::map<std::string, std::map<std::string, std::shared_ptr<can_frame_data_s>>>;
|
||||
aggregated_t old_data;
|
||||
|
||||
|
|
@ -323,8 +320,6 @@ int32_t main(int32_t argc, char *argv[]) {
|
|||
|
||||
old_data.swap(current);
|
||||
}
|
||||
|
||||
fmt::println(stderr, "[task] refresh finished");
|
||||
},
|
||||
|
||||
refresh_task_stop.get_token());
|
||||
|
|
@ -332,7 +327,6 @@ int32_t main(int32_t argc, char *argv[]) {
|
|||
// Stop all tasks on SIGINT
|
||||
{
|
||||
static auto signal_handler = [](int sig) {
|
||||
fmt::println(stderr, "[signal] SIGINT received, stopping tasks...");
|
||||
for (auto *source : {&aggregator_task_stop, &refresh_task_stop, &headless_task_stop}) {
|
||||
if (!source->stop_requested()) {
|
||||
source->request_stop();
|
||||
|
|
@ -393,7 +387,6 @@ int32_t main(int32_t argc, char *argv[]) {
|
|||
}));
|
||||
|
||||
signals.map.get<void()>("canplayer_stopped")->operator()();
|
||||
fmt::println(stderr, "[exit] TUI exited, stopping tasks...");
|
||||
for (auto *source : {&aggregator_task_stop, &refresh_task_stop, &headless_task_stop}) {
|
||||
if (!source->stop_requested()) {
|
||||
source->request_stop();
|
||||
|
|
@ -423,12 +416,7 @@ int32_t main(int32_t argc, char *argv[]) {
|
|||
int idx = 0;
|
||||
for (auto *task : {&xlsx_parser_task, &aggregator_task, &refresh_task, &headless_task}) {
|
||||
if (task && task->valid()) {
|
||||
fmt::println(stderr, "[exit] waiting for {}...", names[idx]);
|
||||
if (task->wait_for(std::chrono::seconds(3)) == std::future_status::timeout) {
|
||||
fmt::println(stderr, "[exit] {} timed out!", names[idx]);
|
||||
} else {
|
||||
fmt::println(stderr, "[exit] {} done", names[idx]);
|
||||
}
|
||||
task->wait_for(std::chrono::seconds(3));
|
||||
}
|
||||
|
||||
idx++;
|
||||
|
|
|
|||
Loading…
Reference in New Issue