From f0d98216ca3de4bda5fa159d015f98477d3a4513 Mon Sep 17 00:00:00 2001 From: 0scar Date: Fri, 28 Jul 2023 20:44:08 +0200 Subject: Disable pedantics when compilining hostreload --- CMakeLists.txt | 6 ++++-- include/engine/state.h | 4 ++++ src/state.c | 6 ++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c7355a6..5310b19 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ cmake_dependent_option(DAW_BUILD_DEBUG # unused cmake_dependent_option(DAW_BUILD_HOTRELOAD "Compile daw engine with hot reloading enabled" ON - "NOT CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME;CMAKE_BUILD_TYPE STREQUAL Debug;NOT WIN32" OFF) + "NOT CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME;CMAKE_BUILD_TYPE STREQUAL Debug;NOT WIN32;BUILD_SHARED_LIBS" OFF) cmake_dependent_option(DAW_BUILD_ASAN "Compile daw engine with address sanitizer (asan)" ON @@ -87,7 +87,9 @@ target_link_libraries(${PROJECT_NAME} target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) target_compile_options(${PROJECT_NAME} PUBLIC - $<$>:-Wall -Wextra -pedantic> + $<$>:-Wall -Wextra> + # Dont be pedantic when using hot reloading. + $<$>,$>>:-pedantic> $<$:/W4> # Debug related flags. sorry windows, you're just not that important. $<$>,$>:-Og -ggdb3 -fno-omit-frame-pointer> diff --git a/include/engine/state.h b/include/engine/state.h index cf486cc..dcd2966 100644 --- a/include/engine/state.h +++ b/include/engine/state.h @@ -21,6 +21,10 @@ void State_free(StateType type, memory *mem); StateType State_update(StateType type, memory *mem); /* Reloads shared object file associated with state */ +#ifdef DAW_BUILD_HOTRELOAD bool State_reload(StateType type); +#else +#define State_reload(_) true +#endif #endif diff --git a/src/state.c b/src/state.c index 1d59ad7..0710127 100644 --- a/src/state.c +++ b/src/state.c @@ -132,8 +132,8 @@ StateType State_update(StateType type, memory *mem) { return next_state; } -bool State_reload(StateType type) { #ifdef DAW_BUILD_HOTRELOAD +bool State_reload(StateType type) { switch (type) { #define State(name) \ case (STATE_##name): { \ @@ -165,6 +165,8 @@ bool State_reload(StateType type) { default: exit(EXIT_FAILURE); } -#endif return true; } +#else +#define State_reload(_) true +#endif -- cgit v1.3