From e484698ba27673b88233bedb571dd1df5edeae64 Mon Sep 17 00:00:00 2001 From: numzero Date: Mon, 6 Mar 2023 14:21:58 +0300 Subject: [PATCH] Restrict X11 options to X11 device --- source/Irrlicht/CMakeLists.txt | 46 +++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/source/Irrlicht/CMakeLists.txt b/source/Irrlicht/CMakeLists.txt index 7a29d37..cfd3bbe 100644 --- a/source/Irrlicht/CMakeLists.txt +++ b/source/Irrlicht/CMakeLists.txt @@ -113,38 +113,32 @@ else() set(DEVICE "X11") endif() -if(USE_SDL2) - set(DEVICE "SDL") -endif() - -option(USE_X11 "Use X11" TRUE) -if(USE_X11) - add_definitions(-D_IRR_COMPILE_WITH_X11_) -endif() - if(LINUX_PLATFORM) add_definitions(-D_IRR_LINUX_PLATFORM_) endif() +if(USE_SDL2) + set(DEVICE "SDL") +endif() + +add_definitions("-D_IRR_COMPILE_WITH_${DEVICE}_DEVICE_") + +# X11 + +if(DEVICE STREQUAL "X11") + option(USE_X11 "Use X11" TRUE) +else() + set(USE_X11 FALSE) +endif() + if(LINUX_PLATFORM AND USE_X11) - add_definitions(-D_IRR_COMPILE_WITH_X11_) - option(USE_XINPUT2 "Use XInput2" TRUE) - if(USE_XINPUT2) - add_definitions(-D_IRR_LINUX_X11_XINPUT2_) - endif() - option(USE_XCURSOR "Use XCursor" FALSE) - if(USE_XCURSOR) - add_definitions(-D_IRR_LINUX_XCURSOR_) - endif() else() set(USE_XINPUT2 FALSE) set(USE_XCURSOR FALSE) endif() -add_definitions("-D_IRR_COMPILE_WITH_${DEVICE}_DEVICE_") - # Joystick if(NOT (BSD OR SOLARIS OR EMSCRIPTEN)) @@ -421,6 +415,18 @@ elseif(APPLE) ) endif() +if(USE_X11) + target_compile_definitions(IRROTHEROBJ PRIVATE _IRR_COMPILE_WITH_X11_) +endif() + +if(USE_XINPUT2) + target_compile_definitions(IRROTHEROBJ PRIVATE _IRR_LINUX_X11_XINPUT2_) +endif() + +if(USE_XCURSOR) + target_compile_definitions(IRROTHEROBJ PRIVATE _IRR_LINUX_XCURSOR_) +endif() + add_library(IRRGUIOBJ OBJECT CGUIButton.cpp CGUICheckBox.cpp