mirror of
https://github.com/dhewm/dhewm3.git
synced 2024-11-25 13:51:06 +00:00
Allow disabling Dear ImGui integration in CMake
and do it automatically when using SDL1.2, as it requires SDL2 (or SDL3 once we support it)
This commit is contained in:
parent
ecee402927
commit
10312f6998
2 changed files with 26 additions and 6 deletions
|
@ -56,6 +56,7 @@ endif()
|
|||
option(DEDICATED "Build the dedicated server" OFF)
|
||||
option(ONATIVE "Optimize for the host CPU" OFF)
|
||||
option(SDL2 "Use SDL2 instead of SDL1.2" ON)
|
||||
option(IMGUI "Build with Dear ImGui integration - requires SDL2 and C++11" ON)
|
||||
option(REPRODUCIBLE_BUILD "Replace __DATE__ and __TIME__ by hardcoded values for reproducible builds" OFF)
|
||||
|
||||
option(HARDLINK_GAME "Compile gamecode into executable (no game DLLs)" OFF)
|
||||
|
@ -71,10 +72,6 @@ if(NOT MSVC) # GCC/clang or compatible, hopefully
|
|||
endif()
|
||||
endif()
|
||||
|
||||
# we need C++11 for ImGui
|
||||
# TODO: if we allow disabling ImGui, we could disable setting the c++ standard - or maybe just embrace C++11?
|
||||
set (CMAKE_CXX_STANDARD 11)
|
||||
|
||||
if(NOT CMAKE_SYSTEM_PROCESSOR)
|
||||
message(FATAL_ERROR "No target CPU architecture set")
|
||||
endif()
|
||||
|
@ -222,6 +219,20 @@ if(REPRODUCIBLE_BUILD)
|
|||
add_definitions(-DID_REPRODUCIBLE_BUILD)
|
||||
endif()
|
||||
|
||||
if(IMGUI)
|
||||
if(SDL2)
|
||||
# we need C++11 for ImGui
|
||||
set (CMAKE_CXX_STANDARD 11)
|
||||
message(STATUS "Dear ImGui integration enabled")
|
||||
else()
|
||||
message(WARNING "Disabling IMGUI because SDL1.2 is used - it needs SDL2!")
|
||||
set(IMGUI OFF)
|
||||
add_definitions(-DIMGUI_DISABLE)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Dear ImGui integration disabled")
|
||||
add_definitions(-DIMGUI_DISABLE)
|
||||
endif()
|
||||
|
||||
find_package(CURL QUIET)
|
||||
if(CURL_FOUND)
|
||||
|
@ -757,6 +768,7 @@ set(src_idlib
|
|||
|
||||
add_globbed_headers(src_idlib "idlib")
|
||||
|
||||
if(IMGUI)
|
||||
set(src_imgui
|
||||
libs/imgui/backends/imgui_impl_sdl2.cpp
|
||||
libs/imgui/backends/imgui_impl_opengl2.cpp
|
||||
|
@ -773,6 +785,9 @@ set(src_imgui
|
|||
sys/sys_imgui.cpp
|
||||
sys/imgui_savestyle.cpp
|
||||
)
|
||||
else()
|
||||
set(src_imgui sys/sys_imgui.h)
|
||||
endif()
|
||||
|
||||
|
||||
set(src_game
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef IMGUI_DISABLE
|
||||
|
||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
#ifndef IMGUI_DISABLE
|
||||
|
||||
#include "idlib/LangDict.h"
|
||||
|
||||
|
@ -2386,6 +2386,11 @@ void Com_Dhewm3Settings_f( const idCmdArgs &args )
|
|||
|
||||
#else // IMGUI_DISABLE - just a stub function
|
||||
|
||||
void Com_Dhewm3Settings_f( const idCmdArgs &args ) {}
|
||||
#include "Common.h"
|
||||
|
||||
void Com_Dhewm3Settings_f( const idCmdArgs &args )
|
||||
{
|
||||
common->Warning( "Dear ImGui is disabled in this build, so the dhewm3 settings menu is not available!" );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue