From d73afbf22e7c940cd3a64fd8376830822e5f23b1 Mon Sep 17 00:00:00 2001 From: Martin Brodbeck Date: Mon, 17 Mar 2025 14:23:46 +0100 Subject: [PATCH] Simplify singleapplication integration --- .gitmodules | 3 --- src/gui/CMakeLists.txt | 20 ++++++++++--------- .../singleapplication/singleapplication.git | 1 - 3 files changed, 11 insertions(+), 13 deletions(-) delete mode 160000 subprojects/singleapplication/singleapplication.git diff --git a/.gitmodules b/.gitmodules index 934c21f..23e007e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ [submodule "subprojects/nlohmann_json"] path = subprojects/nlohmann_json url = https://github.com/nlohmann/json.git -[submodule "subprojects/singleapplication"] - path = subprojects/singleapplication/singleapplication.git - url = https://github.com/itay-grudev/SingleApplication.git \ No newline at end of file diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 8830628..54f3c40 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -9,13 +9,18 @@ set(CMAKE_AUTORCC ON) # Find the QtWidgets library find_package(Qt6 COMPONENTS Widgets Network PrintSupport CONFIG REQUIRED) -#find_package(Qt5Widgets CONFIG REQUIRED) -#find_package(Qt5PrintSupport CONFIG REQUIRED) # For SingleApplication: -#find_package(Qt5Network CONFIG REQUIRED) +include(FetchContent) set(QT_DEFAULT_MAJOR_VERSION 6 CACHE STRING "Qt version to use, defaults to 6") -set(QAPPLICATION_CLASS QApplication) +set(QAPPLICATION_CLASS QApplication CACHE STRING "Inheritance class for SingleApplication") +FetchContent_Declare( + SingleApplication + GIT_REPOSITORY https://github.com/itay-grudev/SingleApplication + GIT_TAG v3.5.2 + #GIT_TAG master +) +FetchContent_MakeAvailable(SingleApplication) add_compile_definitions(QAPPLICATION_CLASS=${QAPPLICATION_CLASS}) set(GUI_SOURCES @@ -35,15 +40,12 @@ set(GUI_SOURCES settingsdialog.cpp settingsdialog.ui ../../kima2.qrc - ${PROJECT_SOURCE_DIR}/subprojects/singleapplication/singleapplication.git/singleapplication.cpp - ${PROJECT_SOURCE_DIR}/subprojects/singleapplication/singleapplication.git/singleapplication_p.cpp ) add_executable(kima2 ${GUI_SOURCES} kima2.rc) target_include_directories(kima2 PRIVATE ${PROJECT_BINARY_DIR}) -target_include_directories(kima2 PRIVATE ${PROJECT_SOURCE_DIR}/subprojects/singleapplication/singleapplication.git) -# target_link_libraries(kima2 core printer Qt5::Widgets Qt5::PrintSupport Qt5::Network stdc++fs) -target_link_libraries(kima2 core printer Qt::Core Qt::PrintSupport Qt::Network) +#target_include_directories(kima2 PRIVATE ${PROJECT_SOURCE_DIR}/subprojects/singleapplication/singleapplication.git) +target_link_libraries(kima2 core printer Qt::Core Qt::PrintSupport Qt::Network SingleApplication::SingleApplication) if(WIN32) set_target_properties(kima2 PROPERTIES LINK_FLAGS "-mwindows") diff --git a/subprojects/singleapplication/singleapplication.git b/subprojects/singleapplication/singleapplication.git deleted file mode 160000 index 494772e..0000000 --- a/subprojects/singleapplication/singleapplication.git +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 494772e98cef0aa88124f154feb575cc60b08b38