diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..bd69f61 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "third_party/tomlplusplus"] + path = third_party/tomlplusplus + url = https://github.com/marzer/tomlplusplus diff --git a/CMakeLists.txt b/CMakeLists.txt index 88eb805..a344415 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,10 +10,13 @@ include(Policies) include(ProjectFuncs) include(CompilerFlags) +add_subdirectory(third_party/tomlplusplus) add_executable(nanosm src/main.cpp + src/tomlpp_src.cpp + # glue code src/EventLoop.cpp src/Timer.cpp @@ -21,6 +24,14 @@ add_executable(nanosm src/Process.cpp ) +target_compile_definitions(nanosm PRIVATE + -DTOML_HEADER_ONLY=0 +) + +target_link_libraries(nanosm PRIVATE + tomlplusplus::tomlplusplus +) + nanosm_target(nanosm) # todo: cmake install sex diff --git a/cmake/CompilerFlags-GNU.cmake b/cmake/CompilerFlags-GNU.cmake index b67a82a..bd93fee 100644 --- a/cmake/CompilerFlags-GNU.cmake +++ b/cmake/CompilerFlags-GNU.cmake @@ -58,10 +58,10 @@ set(CMAKE_CXX_FLAGS "${NANOSM_CORE_COMPILE_ARGS}") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -O0 -g3") set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -O3 -g3") -set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O3") +set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O3 -s") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -O0 -g3") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS} -O3 -g3") -set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3") +set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3 -s") set(CMAKE_EXE_LINKER_FLAGS "${NANOSM_CORE_LINKER_ARGS} -Wl,-z,noexecstack,-z,relro,-z,now") diff --git a/src/main.cpp b/src/main.cpp index e234212..3dc14c5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -23,12 +23,12 @@ void test() { printf("exited with %d exitcode\n", exitCode); timer->SetExpiryCallback([pp = p]() { - printf("5s elapsed, restarting Nowr\n"); + printf("Timer elapsed, restarting Nowr\n"); pp->Respawn(); }); // Start the timer to wait a bit before restarting the process - timer->Arm(5); + timer->Arm(1); }); ev.AddObject(timer); diff --git a/src/tomlpp_src.cpp b/src/tomlpp_src.cpp new file mode 100644 index 0000000..e69de29 diff --git a/third_party/tomlplusplus b/third_party/tomlplusplus new file mode 160000 index 0000000..89406c7 --- /dev/null +++ b/third_party/tomlplusplus @@ -0,0 +1 @@ +Subproject commit 89406c77e6480c212b17e0ce7939f9ee833e909d