diff --git a/CMakeLists.txt b/CMakeLists.txt index 2e951374..48356d66 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -111,14 +111,14 @@ include(cmake/sdl2.cmake) # Asar include(cmake/asar.cmake) -# ImGui -include(cmake/imgui.cmake) - # Google Test (if needed for main app integration) if (YAZE_BUILD_TESTS) include(cmake/gtest.cmake) endif() +# ImGui (after minimal build flags are set) +include(cmake/imgui.cmake) + # Project Files add_subdirectory(src) diff --git a/cmake/imgui.cmake b/cmake/imgui.cmake index 774e9d9c..6928efb6 100644 --- a/cmake/imgui.cmake +++ b/cmake/imgui.cmake @@ -16,7 +16,14 @@ if(YAZE_ENABLE_UI_TESTS) target_link_libraries(ImGuiTestEngine PUBLIC ImGui) # Enable test engine definitions only when UI tests are enabled - add_definitions("-DIMGUI_ENABLE_TEST_ENGINE -DIMGUI_TEST_ENGINE_ENABLE_COROUTINE_STDTHREAD_IMPL=1") + target_compile_definitions(ImGuiTestEngine PUBLIC + IMGUI_ENABLE_TEST_ENGINE=1 + IMGUI_TEST_ENGINE_ENABLE_COROUTINE_STDTHREAD_IMPL=1) + + # Also define for targets that link to ImGuiTestEngine + set(IMGUI_TEST_ENGINE_DEFINITIONS + IMGUI_ENABLE_TEST_ENGINE=1 + IMGUI_TEST_ENGINE_ENABLE_COROUTINE_STDTHREAD_IMPL=1) # Make ImGuiTestEngine target available set(IMGUI_TEST_ENGINE_TARGET ImGuiTestEngine) @@ -24,6 +31,7 @@ else() # Create empty variables when UI tests are disabled set(IMGUI_TEST_ENGINE_SOURCES "") set(IMGUI_TEST_ENGINE_TARGET "") + set(IMGUI_TEST_ENGINE_DEFINITIONS "") endif() set( diff --git a/src/app/app.cmake b/src/app/app.cmake index 95d3af4c..b5284880 100644 --- a/src/app/app.cmake +++ b/src/app/app.cmake @@ -94,7 +94,9 @@ if(YAZE_ENABLE_UI_TESTS) if(TARGET ImGuiTestEngine) target_include_directories(yaze PUBLIC ${CMAKE_SOURCE_DIR}/src/lib/imgui_test_engine) target_link_libraries(yaze PUBLIC ImGuiTestEngine) - target_compile_definitions(yaze PRIVATE YAZE_ENABLE_IMGUI_TEST_ENGINE=1) + target_compile_definitions(yaze PRIVATE + YAZE_ENABLE_IMGUI_TEST_ENGINE=1 + ${IMGUI_TEST_ENGINE_DEFINITIONS}) else() target_compile_definitions(yaze PRIVATE YAZE_ENABLE_IMGUI_TEST_ENGINE=0) endif() diff --git a/src/app/core/features.h b/src/app/core/features.h index 393e79f1..e10ef334 100644 --- a/src/app/core/features.h +++ b/src/app/core/features.h @@ -39,7 +39,11 @@ class FeatureFlags { bool kLogToConsole = false; // Use NFD (Native File Dialog) instead of bespoke file dialog implementation. +#if defined(YAZE_ENABLE_NFD) && YAZE_ENABLE_NFD bool kUseNativeFileDialog = true; +#else + bool kUseNativeFileDialog = false; +#endif // Overworld flags struct Overworld { diff --git a/src/app/gui/input.cc b/src/app/gui/input.cc index 8394dbda..18fe1877 100644 --- a/src/app/gui/input.cc +++ b/src/app/gui/input.cc @@ -240,7 +240,7 @@ void ItemLabel(absl::string_view title, ItemLabelFlags flags) { const ImGuiStyle& style = ImGui::GetStyle(); float fullWidth = ImGui::GetContentRegionAvail().x; float itemWidth = ImGui::CalcItemWidth() + style.ItemSpacing.x; - ImVec2 textSize = ImGui::CalcTextSize(title.begin(), title.end()); + ImVec2 textSize = ImGui::CalcTextSize(title.data(), title.data() + title.size()); ImRect textRect; textRect.Min = ImGui::GetCursorScreenPos(); if (flags & ItemLabelFlag::Right) textRect.Min.x = textRect.Min.x + itemWidth; diff --git a/src/util/bps.cc b/src/util/bps.cc index 6a7e47d4..212300e0 100644 --- a/src/util/bps.cc +++ b/src/util/bps.cc @@ -7,7 +7,7 @@ #include #include -#ifdef YAZE_LIB_PNG +#if YAZE_LIB_PNG == 1 #include #endif @@ -16,7 +16,7 @@ namespace util { namespace { -#ifdef YAZE_LIB_PNG +#if YAZE_LIB_PNG == 1 uint32_t crc32(const std::vector &data) { uint32_t crc = ::crc32(0L, Z_NULL, 0); return ::crc32(crc, data.data(), data.size());