From 20b1a5ccfe7acee8f286cbc01566399f1908a177 Mon Sep 17 00:00:00 2001 From: Matthias Braun <30432154+braunms@users.noreply.github.com> Date: Wed, 3 Dec 2025 18:35:58 +0100 Subject: [PATCH] Make the profile editor (launcher GUI) and thus the Qt6 dependency optional (#3857) --- apps/OpenSpace/CMakeLists.txt | 32 ++++++++++++++++++-------------- apps/OpenSpace/main.cpp | 6 ++++++ 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/apps/OpenSpace/CMakeLists.txt b/apps/OpenSpace/CMakeLists.txt index d6f99b9c5e..03100a7f16 100644 --- a/apps/OpenSpace/CMakeLists.txt +++ b/apps/OpenSpace/CMakeLists.txt @@ -143,23 +143,27 @@ add_custom_command(TARGET OpenSpace POST_BUILD end_header("Dependency: SGCT") -begin_header("Dependency: Profile Editor") -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/ext/launcher) -target_link_libraries(OpenSpace PRIVATE openspace-ui-launcher) -end_header("Dependency: Profile Editor") +# Profile Editor / Launcher GUI +option(OPENSPACE_APPLICATION_OPENSPACE-LAUNCHER "Build Launcher GUI" ON) +if (OPENSPACE_APPLICATION_OPENSPACE-LAUNCHER) + begin_header("Dependency: Profile Editor") + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/ext/launcher) + target_link_libraries(OpenSpace PRIVATE openspace-ui-launcher) + target_compile_definitions(OpenSpace PRIVATE OPENSPACE_HAS_LAUNCHER) + end_header("Dependency: Profile Editor") -if (WIN32) - # Find the windeployqt application - get_target_property(_qmake_executable Qt6::qmake IMPORTED_LOCATION) - get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY) - add_custom_command( - TARGET OpenSpace POST_BUILD - COMMAND "${WINDEPLOYQT_EXECUTABLE}" --verbose 0 --no-compiler-runtime --no-translations \"$\" - COMMENT "Deploying Qt libraries" - ) + if (WIN32) + # Find the windeployqt application + get_target_property(_qmake_executable Qt6::qmake IMPORTED_LOCATION) + get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY) + add_custom_command( + TARGET OpenSpace POST_BUILD + COMMAND "${WINDEPLOYQT_EXECUTABLE}" --verbose 0 --no-compiler-runtime --no-translations \"$\" + COMMENT "Deploying Qt libraries" + ) + endif () endif () - # Web Browser and Web gui # Why not put these in the module's path? Because they do not have access to the # target as of July 2017, which is needed. diff --git a/apps/OpenSpace/main.cpp b/apps/OpenSpace/main.cpp index 40daa211bf..969b90fc53 100644 --- a/apps/OpenSpace/main.cpp +++ b/apps/OpenSpace/main.cpp @@ -79,9 +79,11 @@ #include #endif // OPENSPACE_BREAK_ON_FLOATING_POINT_EXCEPTION +#ifdef OPENSPACE_HAS_LAUNCHER #include #include #include +#endif // OPENSPACE_HAS_LAUNCHER #ifdef WIN32 extern "C" { @@ -1450,6 +1452,7 @@ int main(int argc, char* argv[]) { #endif // __APPLE__ if (!global::configuration->bypassLauncher) { +#ifdef OPENSPACE_HAS_LAUNCHER #ifndef __APPLE__ int qac = 0; QApplication app(qac, nullptr); @@ -1542,6 +1545,9 @@ int main(int argc, char* argv[]) { } global::configuration->windowConfiguration = config; } +#else // ^^^^ OPENSPACE_HAS_LAUNCHER // !OPENSPACE_HAS_LAUNCHER + glfwInit(); +#endif // OPENSPACE_HAS_LAUNCHER } else { glfwInit();