From a40275007e6fd77f115f009264d63a9969a30ed3 Mon Sep 17 00:00:00 2001 From: bialger Date: Tue, 17 Sep 2024 23:03:56 +0300 Subject: [PATCH 01/10] Fix Ubuntu CI --- .github/workflows/ci_tests.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index 3c0ec20..00384a3 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -15,11 +15,11 @@ jobs: # os: windows-latest, # build_type: "Release", cc: "gcc", cxx: "g++", # } -# - { -# name: "Ubuntu Latest GCC", artifact: "Linux.tar.xz", -# os: ubuntu-latest, -# build_type: "Release", cc: "gcc", cxx: "g++" -# } + - { + name: "Ubuntu Latest GCC", artifact: "Linux.tar.xz", + os: ubuntu-latest, + build_type: "Release", cc: "gcc", cxx: "g++" + } - { name: "macOS Latest Clang", artifact: "macOS.tar.xz", os: macos-latest, @@ -29,9 +29,13 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: seanmiddleditch/gha-setup-ninja@master + - name: Install Qt dependencies for Linux + if: ${{ matrix.config.os == 'ubuntu-latest' }} + run: | + sudo apt install libgl1-mesa-dev libglu1-mesa-dev + - name: Create CMake cache shell: bash run: | From 4948c1e76e31880e16d2d1c6ac81d0455b797d4e Mon Sep 17 00:00:00 2001 From: bialger Date: Tue, 17 Sep 2024 23:28:12 +0300 Subject: [PATCH 02/10] Exclude QtZlib from build --- lib/qt/CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/qt/CMakeLists.txt b/lib/qt/CMakeLists.txt index ddc0824..a53d1d4 100644 --- a/lib/qt/CMakeLists.txt +++ b/lib/qt/CMakeLists.txt @@ -8,8 +8,10 @@ endif () if (WIN32) set(PATH_DELIMITER ";") + set(QT_CONFIG_OPTIONS "-c++std c++20 -static-runtime -skip qtzlib") else () set(PATH_DELIMITER ":") + set(QT_CONFIG_OPTIONS "-c++std c++20 -static-runtime") endif () # Set necessary environment variables to use Qt @@ -27,7 +29,7 @@ if (NOT Qt6_FOUND) # Set Ninja for compilation set(CMAKE_GENERATOR "Ninja" CACHE STRING "CMake generator" FORCE) # Initial message - message(STATUS "Qt 6.7.2 not found. Downloading and configuring Qt...") + message(STATUS "Qt 6 not found. Downloading and configuring Qt...") # Download and extract archive of Qt 6.7.2 set(QT_VERSION "6.7.2") @@ -53,7 +55,7 @@ if (NOT Qt6_FOUND) set(QT_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/qt-build") file(MAKE_DIRECTORY ${QT_BUILD_DIR}) message(STATUS "Configuring...") - execute_process(COMMAND "${QT_SOURCE_DIR}/configure${CONFIG_SCRIPT_EXT}" -static -prefix ${QT_BUILD_DIR} + execute_process(COMMAND "${QT_SOURCE_DIR}/configure${CONFIG_SCRIPT_EXT}" ${QT_CONFIG_OPTIONS} -static -prefix ${QT_BUILD_DIR} WORKING_DIRECTORY ${QT_BUILD_DIR}) # Build Qt @@ -62,7 +64,7 @@ if (NOT Qt6_FOUND) find_package(Qt6 COMPONENTS Core Gui Widgets REQUIRED) else () - message(STATUS "Qt 6.7.2 found in the system.") + message(STATUS "Qt 6 found in the system.") endif () qt_standard_project_setup() From d715fef4477b1e016fd044a44905b463d429c2cf Mon Sep 17 00:00:00 2001 From: bialger Date: Tue, 17 Sep 2024 23:29:22 +0300 Subject: [PATCH 03/10] Fix Windows (attempt) --- .github/workflows/ci_tests.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index 00384a3..08b51dd 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -10,11 +10,11 @@ jobs: fail-fast: false matrix: config: -# - { -# name: "Windows Latest MinGW", artifact: "Windows-Ninja.tar.xz", -# os: windows-latest, -# build_type: "Release", cc: "gcc", cxx: "g++", -# } + - { + name: "Windows Latest MinGW", artifact: "Windows-Ninja.tar.xz", + os: windows-latest, + build_type: "Release", cc: "gcc", cxx: "g++", + } - { name: "Ubuntu Latest GCC", artifact: "Linux.tar.xz", os: ubuntu-latest, From 32a6990c18e76b2fd2e6ed167b9f026aab94e5f7 Mon Sep 17 00:00:00 2001 From: bialger Date: Tue, 17 Sep 2024 23:35:18 +0300 Subject: [PATCH 04/10] Fix wrong config options CMakeLists --- lib/qt/CMakeLists.txt | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/qt/CMakeLists.txt b/lib/qt/CMakeLists.txt index a53d1d4..228f2d3 100644 --- a/lib/qt/CMakeLists.txt +++ b/lib/qt/CMakeLists.txt @@ -8,10 +8,8 @@ endif () if (WIN32) set(PATH_DELIMITER ";") - set(QT_CONFIG_OPTIONS "-c++std c++20 -static-runtime -skip qtzlib") else () set(PATH_DELIMITER ":") - set(QT_CONFIG_OPTIONS "-c++std c++20 -static-runtime") endif () # Set necessary environment variables to use Qt @@ -45,18 +43,18 @@ if (NOT Qt6_FOUND) OUTPUT_QUIET ) - if (WIN32) - set(CONFIG_SCRIPT_EXT ".bat") - else () - set(CONFIG_SCRIPT_EXT "") - endif () - # Configure Qt (skip building of useless modules) set(QT_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/qt-build") file(MAKE_DIRECTORY ${QT_BUILD_DIR}) message(STATUS "Configuring...") - execute_process(COMMAND "${QT_SOURCE_DIR}/configure${CONFIG_SCRIPT_EXT}" ${QT_CONFIG_OPTIONS} -static -prefix ${QT_BUILD_DIR} - WORKING_DIRECTORY ${QT_BUILD_DIR}) + + if (WIN32) + execute_process(COMMAND "${QT_SOURCE_DIR}/configure.bat" -static -c++std c++20 -skip qtzlib -prefix ${QT_BUILD_DIR} + WORKING_DIRECTORY ${QT_BUILD_DIR}) + else () + execute_process(COMMAND "${QT_SOURCE_DIR}/configure" -static -c++std c++20 -prefix ${QT_BUILD_DIR} + WORKING_DIRECTORY ${QT_BUILD_DIR}) + endif () # Build Qt execute_process(COMMAND ${CMAKE_COMMAND} --build . From 69664d0654974820fe536fd8fcebbae55c1de995 Mon Sep 17 00:00:00 2001 From: bialger Date: Tue, 17 Sep 2024 23:47:18 +0300 Subject: [PATCH 05/10] Make configure options a variable --- lib/qt/CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/qt/CMakeLists.txt b/lib/qt/CMakeLists.txt index 228f2d3..eea9c2f 100644 --- a/lib/qt/CMakeLists.txt +++ b/lib/qt/CMakeLists.txt @@ -47,12 +47,13 @@ if (NOT Qt6_FOUND) set(QT_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/qt-build") file(MAKE_DIRECTORY ${QT_BUILD_DIR}) message(STATUS "Configuring...") + set(QT_CONFIGURE_OPTIONS -static -c++std c++20 -static-runtime -prefix ${QT_BUILD_DIR}) if (WIN32) - execute_process(COMMAND "${QT_SOURCE_DIR}/configure.bat" -static -c++std c++20 -skip qtzlib -prefix ${QT_BUILD_DIR} + execute_process(COMMAND "${QT_SOURCE_DIR}/configure.bat" ${QT_CONFIGURE_OPTIONS} WORKING_DIRECTORY ${QT_BUILD_DIR}) else () - execute_process(COMMAND "${QT_SOURCE_DIR}/configure" -static -c++std c++20 -prefix ${QT_BUILD_DIR} + execute_process(COMMAND "${QT_SOURCE_DIR}/configure" ${QT_CONFIGURE_OPTIONS} WORKING_DIRECTORY ${QT_BUILD_DIR}) endif () From beecd29b58eb98fcdb041a60cb5e5f944584c95f Mon Sep 17 00:00:00 2001 From: bialger Date: Tue, 17 Sep 2024 23:51:36 +0300 Subject: [PATCH 06/10] Exclude zlib properly --- lib/qt/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/qt/CMakeLists.txt b/lib/qt/CMakeLists.txt index eea9c2f..ed487c9 100644 --- a/lib/qt/CMakeLists.txt +++ b/lib/qt/CMakeLists.txt @@ -50,7 +50,7 @@ if (NOT Qt6_FOUND) set(QT_CONFIGURE_OPTIONS -static -c++std c++20 -static-runtime -prefix ${QT_BUILD_DIR}) if (WIN32) - execute_process(COMMAND "${QT_SOURCE_DIR}/configure.bat" ${QT_CONFIGURE_OPTIONS} + execute_process(COMMAND "${QT_SOURCE_DIR}/configure.bat" ${QT_CONFIGURE_OPTIONS} -no-zlib WORKING_DIRECTORY ${QT_BUILD_DIR}) else () execute_process(COMMAND "${QT_SOURCE_DIR}/configure" ${QT_CONFIGURE_OPTIONS} From fcfb763a5c8fdce2831e6e96c3be65d4f89923d4 Mon Sep 17 00:00:00 2001 From: bialger Date: Tue, 17 Sep 2024 23:53:53 +0300 Subject: [PATCH 07/10] Rollback zlib exclusion --- lib/qt/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/qt/CMakeLists.txt b/lib/qt/CMakeLists.txt index ed487c9..eea9c2f 100644 --- a/lib/qt/CMakeLists.txt +++ b/lib/qt/CMakeLists.txt @@ -50,7 +50,7 @@ if (NOT Qt6_FOUND) set(QT_CONFIGURE_OPTIONS -static -c++std c++20 -static-runtime -prefix ${QT_BUILD_DIR}) if (WIN32) - execute_process(COMMAND "${QT_SOURCE_DIR}/configure.bat" ${QT_CONFIGURE_OPTIONS} -no-zlib + execute_process(COMMAND "${QT_SOURCE_DIR}/configure.bat" ${QT_CONFIGURE_OPTIONS} WORKING_DIRECTORY ${QT_BUILD_DIR}) else () execute_process(COMMAND "${QT_SOURCE_DIR}/configure" ${QT_CONFIGURE_OPTIONS} From 685134fd2372bb1c7dd533643c3522eb1033ce45 Mon Sep 17 00:00:00 2001 From: bialger Date: Wed, 18 Sep 2024 00:59:11 +0300 Subject: [PATCH 08/10] Add some more Qt build parameters --- lib/qt/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/qt/CMakeLists.txt b/lib/qt/CMakeLists.txt index eea9c2f..5e504fa 100644 --- a/lib/qt/CMakeLists.txt +++ b/lib/qt/CMakeLists.txt @@ -47,7 +47,7 @@ if (NOT Qt6_FOUND) set(QT_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/qt-build") file(MAKE_DIRECTORY ${QT_BUILD_DIR}) message(STATUS "Configuring...") - set(QT_CONFIGURE_OPTIONS -static -c++std c++20 -static-runtime -prefix ${QT_BUILD_DIR}) + set(QT_CONFIGURE_OPTIONS -static -c++std c++20 -static-runtime -release -nomake examples -nomake tests -prefix ${QT_BUILD_DIR}) if (WIN32) execute_process(COMMAND "${QT_SOURCE_DIR}/configure.bat" ${QT_CONFIGURE_OPTIONS} From c66a097ca48aaa9018795d11e94e44fdd2f069fd Mon Sep 17 00:00:00 2001 From: bialger Date: Wed, 18 Sep 2024 00:59:32 +0300 Subject: [PATCH 09/10] Update version to 1.0.0 --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 61acb28..d413182 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16) project( QtCMake - VERSION 0.9.0 + VERSION 1.0.0 DESCRIPTION "CMake project for easy Qt connection to other CMake projects" LANGUAGES CXX ) @@ -15,6 +15,8 @@ if (NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release) endif () +message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") + if (WIN32) set(USER_HOME_DIRECTORY $ENV{USERPROFILE}) else () From ff23b415dceece3087f33e883b6694208e1dc6b3 Mon Sep 17 00:00:00 2001 From: bialger Date: Wed, 18 Sep 2024 00:59:43 +0300 Subject: [PATCH 10/10] Update README --- README.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index fd0db50..75a89b3 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,6 @@ The resulting app is an executable that can be run on a system without Qt. The main Qt6 configuration is found in the [correspondent](lib/qt/CMakeLists.txt) CMakeLists.txt file. -> Note: Although the project has CI compilation tests, they somehow only succeed on macOS. -> I don't know why. -> I tested manually on Windows and Linux, and it works perfectly. - > Note that statically compiled Qt6 weights more than 5 GB. > The good thing is that user does not need whole compiled Qt6 with this configuration. @@ -17,7 +13,8 @@ The main Qt6 configuration is found in the [correspondent](lib/qt/CMakeLists.txt * Ninja * Git -On Linux: most of the libraries that match `*xcb*` and `*xkb*` are required. +On Linux: `libgl1-mesa-dev libglu1-mesa-dev` and all dependencies are required. +> Note that most of the libraries that match `*xcb*` and `*xkb*` may be required on Linux. ## How to build and run