Make the profile editor (launcher GUI) and thus the Qt6 dependency optional (#3857)

This commit is contained in:
Matthias Braun
2025-12-03 18:35:58 +01:00
committed by GitHub
parent ee0fe58535
commit 20b1a5ccfe
2 changed files with 24 additions and 14 deletions

View File

@@ -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 \"$<TARGET_FILE:OpenSpace>\"
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 \"$<TARGET_FILE:OpenSpace>\"
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.

View File

@@ -79,9 +79,11 @@
#include <float.h>
#endif // OPENSPACE_BREAK_ON_FLOATING_POINT_EXCEPTION
#ifdef OPENSPACE_HAS_LAUNCHER
#include <launcherwindow.h>
#include <QApplication>
#include <QMessageBox>
#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();