From d55ed06c04977267e516e0760c804a1a8d1c46e4 Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Tue, 27 Aug 2024 18:06:14 +0200 Subject: [PATCH] CMake: Build only one FEXConfig and make Qt/ImGui exclusive choices --- CMakeLists.txt | 2 +- Source/Tools/CMakeLists.txt | 12 +++++------- Source/Tools/FEXQonfig/CMakeLists.txt | 18 +++++++++--------- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 09b1906f7a..0f3d3384a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ CHECK_INCLUDE_FILES ("gdb/jit-reader.h" HAVE_GDB_JIT_READER_H) option(BUILD_TESTS "Build unit tests to ensure sanity" TRUE) option(BUILD_FEX_LINUX_TESTS "Build FEXLinuxTests, requires x86 compiler" FALSE) option(BUILD_THUNKS "Build thunks" FALSE) -option(BUILD_FEXCONFIG "Build FEXConfig, requires SDL2 and X11" TRUE) +set(USE_FEXCONFIG_TOOLKIT "qt" CACHE STRING "If set, build FEXConfig (qt or imgui)") option(ENABLE_CLANG_THUNKS "Build thunks with clang" FALSE) option(ENABLE_IWYU "Enables include what you use program" FALSE) option(ENABLE_LTO "Enable LTO with compilation" TRUE) diff --git a/Source/Tools/CMakeLists.txt b/Source/Tools/CMakeLists.txt index 5698af716c..2b41cb8b10 100644 --- a/Source/Tools/CMakeLists.txt +++ b/Source/Tools/CMakeLists.txt @@ -1,18 +1,16 @@ add_subdirectory(CommonTools) if (NOT MINGW_BUILD) - if (BUILD_FEXCONFIG) + if (USE_FEXCONFIG_TOOLKIT STREQUAL "imgui") add_subdirectory(FEXConfig/) - + elseif (USE_FEXCONFIG_TOOLKIT STREQUAL "qt") find_package(Qt6 COMPONENTS Qml Quick Widgets) if (NOT Qt6_FOUND) - find_package(Qt5 COMPONENTS Qml Quick Widgets) - endif() - if (Qt6_FOUND OR Qt5_FOUND) - add_subdirectory(FEXQonfig/) + find_package(Qt5 COMPONENTS Qml Quick Widgets REQUIRED) endif() - endif() + add_subdirectory(FEXQonfig/) + endif() if (ENABLE_GDB_SYMBOLS) add_subdirectory(FEXGDBReader/) diff --git a/Source/Tools/FEXQonfig/CMakeLists.txt b/Source/Tools/FEXQonfig/CMakeLists.txt index 61329ed62b..145a016347 100644 --- a/Source/Tools/FEXQonfig/CMakeLists.txt +++ b/Source/Tools/FEXQonfig/CMakeLists.txt @@ -1,20 +1,20 @@ set(CMAKE_AUTOMOC ON) -add_executable(FEXQonfig) -target_sources(FEXQonfig PRIVATE Main.cpp Main.h) -target_include_directories(FEXQonfig PRIVATE ${CMAKE_SOURCE_DIR}/Source/) -target_link_libraries(FEXQonfig PRIVATE Common) +add_executable(FEXConfig) +target_sources(FEXConfig PRIVATE Main.cpp Main.h) +target_include_directories(FEXConfig PRIVATE ${CMAKE_SOURCE_DIR}/Source/) +target_link_libraries(FEXConfig PRIVATE Common) if (Qt6_FOUND) qt_add_resources(QT_RESOURCES qml6.qrc) - target_link_libraries(FEXQonfig PRIVATE Qt6::Qml Qt6::Quick Qt6::Widgets) + target_link_libraries(FEXConfig PRIVATE Qt6::Qml Qt6::Quick Qt6::Widgets) else() qt_add_resources(QT_RESOURCES qml5.qrc) - target_link_libraries(FEXQonfig PRIVATE Qt5::Qml Qt5::Quick Qt5::Widgets) + target_link_libraries(FEXConfig PRIVATE Qt5::Qml Qt5::Quick Qt5::Widgets) endif() -target_sources(FEXQonfig PRIVATE ${QT_RESOURCES}) +target_sources(FEXConfig PRIVATE ${QT_RESOURCES}) if (CMAKE_BUILD_TYPE MATCHES "RELEASE") - target_link_options(FEXQonfig + target_link_options(FEXConfig PRIVATE "LINKER:--gc-sections" "LINKER:--strip-all" @@ -22,7 +22,7 @@ if (CMAKE_BUILD_TYPE MATCHES "RELEASE") ) endif() -install(TARGETS FEXQonfig +install(TARGETS FEXConfig RUNTIME DESTINATION bin COMPONENT runtime)