Skip to content

Commit

Permalink
CMake: Build only one FEXConfig and make Qt/ImGui exclusive choices
Browse files Browse the repository at this point in the history
  • Loading branch information
neobrain committed Aug 27, 2024
1 parent 6c92f94 commit d55ed06
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 5 additions & 7 deletions Source/Tools/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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/)
Expand Down
18 changes: 9 additions & 9 deletions Source/Tools/FEXQonfig/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
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"
"LINKER:--as-needed"
)
endif()

install(TARGETS FEXQonfig
install(TARGETS FEXConfig
RUNTIME
DESTINATION bin
COMPONENT runtime)

0 comments on commit d55ed06

Please sign in to comment.