add tomlpp

This commit is contained in:
Lily Tsuru 2024-02-01 23:20:42 -05:00
parent 507e0c88a8
commit f71cfbdfe9
6 changed files with 19 additions and 4 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "third_party/tomlplusplus"]
path = third_party/tomlplusplus
url = https://github.com/marzer/tomlplusplus

View File

@ -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

View File

@ -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")

View File

@ -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);

0
src/tomlpp_src.cpp Normal file
View File

1
third_party/tomlplusplus vendored Submodule

@ -0,0 +1 @@
Subproject commit 89406c77e6480c212b17e0ce7939f9ee833e909d