summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt6
-rw-r--r--include/engine/state.h4
-rw-r--r--src/state.c6
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
- $<$<NOT:$<C_COMPILER_ID:MSVC>>:-Wall -Wextra -pedantic>
+ $<$<NOT:$<C_COMPILER_ID:MSVC>>:-Wall -Wextra>
+ # Dont be pedantic when using hot reloading.
+ $<$<AND:$<NOT:$<C_COMPILER_ID:MSVC>>,$<NOT:$<BOOL:${DAW_BUILD_HOTRELOAD}>>>:-pedantic>
$<$<C_COMPILER_ID:MSVC>:/W4>
# Debug related flags. sorry windows, you're just not that important.
$<$<AND:$<NOT:$<C_COMPILER_ID:MSVC>>,$<BOOL:${DAW_BUILD_DEBUG}>>:-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