diff --git a/.github/actions/qt5-build/Dockerfile b/.github/actions/qt5-build/Dockerfile index 078015b..8d2f3d1 100644 --- a/.github/actions/qt5-build/Dockerfile +++ b/.github/actions/qt5-build/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/maplibre/linux-builder:centos7-gcc8-cmake3.19 +FROM ghcr.io/maplibre/linux-builder:centos7-gcc8 # Copy and set the entry point COPY entrypoint.sh /entrypoint.sh diff --git a/.github/actions/qt5-build/entrypoint.sh b/.github/actions/qt5-build/entrypoint.sh index 70ce633..063f86d 100755 --- a/.github/actions/qt5-build/entrypoint.sh +++ b/.github/actions/qt5-build/entrypoint.sh @@ -9,13 +9,7 @@ export CCACHE_DIR="$GITHUB_WORKSPACE/.ccache" export PATH="$Qt5_Dir/bin:$PATH" qmake --version -mkdir build && cd build -cmake ../source/ \ - -G Ninja \ - -DCMAKE_BUILD_TYPE="Release" \ - -DCMAKE_C_COMPILER_LAUNCHER="ccache" \ - -DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \ - -DCMAKE_INSTALL_PREFIX="../install" -ninja -# ninja test -ninja install +# Main project +pushd source +cmake --workflow --preset Linux-legacy-CI +popd diff --git a/.github/actions/qt6-build/entrypoint.sh b/.github/actions/qt6-build/entrypoint.sh index c9cd64f..52be860 100755 --- a/.github/actions/qt6-build/entrypoint.sh +++ b/.github/actions/qt6-build/entrypoint.sh @@ -7,38 +7,24 @@ export CCACHE_DIR="$GITHUB_WORKSPACE/.ccache" export PATH="$Qt6_DIR/bin:$PATH" qmake --version -mkdir build && cd build -qt-cmake ../source/ \ - -G Ninja \ - -DCMAKE_BUILD_TYPE="Release" \ - -DCMAKE_C_COMPILER_LAUNCHER="ccache" \ - -DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \ - -DCMAKE_INSTALL_PREFIX="../install" -ninja -# ninja test -ninja install -cd .. +# Main project +pushd source +cmake --workflow --preset Linux-CI +popd -export PREFIX_PATH="$(pwd)/install" +mkdir install && pushd install +tar xf ../build/qt6-Linux/maplibre-native-qt_*.tar.bz2 +mv maplibre-native-qt_* maplibre-native-qt +popd + +export QMapLibre_DIR="$(pwd)/install/maplibre-native-qt" # QtQuick example -mkdir build-example-quick && cd build-example-quick -qt-cmake ../source/examples/quick/ \ - -G Ninja \ - -DCMAKE_BUILD_TYPE="Release" \ - -DCMAKE_C_COMPILER_LAUNCHER="ccache" \ - -DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \ - -DCMAKE_PREFIX_PATH="$PREFIX_PATH" -ninja -cd .. +pushd source/examples/quick +cmake --workflow --preset default +popd # QtWidgets example -mkdir build-example-widgets && cd build-example-widgets -qt-cmake ../source/examples/widgets/ \ - -G Ninja \ - -DCMAKE_BUILD_TYPE="Release" \ - -DCMAKE_C_COMPILER_LAUNCHER="ccache" \ - -DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \ - -DCMAKE_PREFIX_PATH="$PREFIX_PATH" -ninja -cd .. +pushd source/examples/widgets +cmake --workflow --preset default +popd diff --git a/.github/workflows/Linux.yml b/.github/workflows/Linux.yml index d91f6ff..a49a881 100644 --- a/.github/workflows/Linux.yml +++ b/.github/workflows/Linux.yml @@ -37,7 +37,7 @@ concurrency: jobs: build-and-test: - name: Build QMapLibre for Linux (Qt${{ matrix.qt_version}}, ${{ matrix.compiler }}) + name: Build MapLibre Native Qt for Linux (Qt${{ matrix.qt_version}}, ${{ matrix.compiler }}) runs-on: ubuntu-22.04 strategy: matrix: @@ -45,21 +45,28 @@ jobs: - qt_series: 5 qt_version: 5.15.2 qt_modules: "" + preset: Linux-legacy-CI compiler: default - qt_series: 6 qt_version: 6.5.3 qt_modules: qtlocation qtpositioning + preset: Linux-CI compiler: default - qt_series: 6 qt_version: 6.6.2 qt_modules: qtlocation qtpositioning + preset: Linux-CI compiler: default - qt_series: 6 qt_version: 6.6.2 qt_modules: qtlocation qtpositioning + preset: Linux-coverage compiler: gcc-13 gcov: gcov-13 + env: + PRESET: ${{ matrix.preset }} + steps: - name: Checkout uses: actions/checkout@v4 @@ -132,99 +139,79 @@ jobs: - name: Set up ccache uses: hendrikmuhs/ccache-action@v1 with: - key: Linux_QMapLibre_${{ matrix.qt_version }}_${{ matrix.compiler }} + key: Linux_${{ matrix.qt_version }}_${{ matrix.compiler }} max-size: 200M - - name: Build QMapLibre (Qt5) + - name: Build (Qt5) if: matrix.qt_series == 5 uses: ./source/.github/actions/qt5-build - - name: Build QMapLibre (Qt6) + - name: Build (Qt6) if: matrix.qt_series == 6 && matrix.compiler == 'default' uses: ./source/.github/actions/qt6-build - - name: Build QMapLibre (Qt6, custom compiler) + - name: Build (Qt6, custom compiler) if: matrix.qt_series == 6 && matrix.compiler != 'default' env: CC: ${{ steps.install_compiler.outputs.cc }} CXX: ${{ steps.install_compiler.outputs.cxx }} GCOV: ${{ matrix.gcov }} + working-directory: source run: | - mkdir build && cd build - qt-cmake ../source/ \ - -G Ninja \ - -DCMAKE_BUILD_TYPE="RelWithDebInfo" \ - -DCMAKE_C_COMPILER_LAUNCHER="ccache" \ - -DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \ - -DCMAKE_INSTALL_PREFIX="../install" \ - -DMLN_QT_WITH_COVERAGE=ON \ - -DGCOV_PATH="$(which ${GCOV})" - ninja - ninja install + export GCOV_PATH="$(which ${GCOV})" + cmake --workflow --preset ${PRESET} - name: Run tests if: matrix.qt_series == 6 && matrix.compiler != 'default' uses: coactions/setup-xvfb@v1 with: run: ctest --output-on-failure - working-directory: build + working-directory: build/qt6-Linux - name: Run code coverage if: matrix.qt_series == 6 && matrix.compiler != 'default' uses: coactions/setup-xvfb@v1 with: run: ninja coverage - working-directory: build + working-directory: build/qt6-Linux - - name: Build QtQuick Example (Qt6) + - name: Install if: matrix.qt_series == 6 && matrix.compiler != 'default' run: | - export PREFIX_PATH="$(pwd)/install" - mkdir build-example-quick && cd build-example-quick - qt-cmake ../source/examples/quick/ \ - -G Ninja \ - -DCMAKE_BUILD_TYPE="RelWithDebInfo" \ - -DCMAKE_C_COMPILER_LAUNCHER="ccache" \ - -DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \ - -DCMAKE_PREFIX_PATH="$PREFIX_PATH" - ninja - - - name: Build QtWidgets Example (Qt6) + mkdir install && cd install + tar xf ../build/qt${{ matrix.qt_series }}-Linux/maplibre-native-qt_*.tar.bz2 + mv maplibre-native-qt_* maplibre-native-qt + + - name: Build QtQuick Example if: matrix.qt_series == 6 && matrix.compiler != 'default' + working-directory: source/examples/quick run: | - export PREFIX_PATH="$(pwd)/install" - mkdir build-example-widgets && cd build-example-widgets - qt-cmake ../source/examples/widgets/ \ - -G Ninja \ - -DCMAKE_BUILD_TYPE="RelWithDebInfo" \ - -DCMAKE_C_COMPILER_LAUNCHER="ccache" \ - -DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \ - -DCMAKE_PREFIX_PATH="$PREFIX_PATH" - ninja - - - name: Compress installation - if: matrix.compiler == 'default' + export QMapLibre_DIR="$GITHUB_WORKSPACE/install/maplibre-native-qt" + cmake --workflow --preset default + + - name: Build QtWidgets Example + if: matrix.qt_series == 6 && matrix.compiler != 'default' + working-directory: source/examples/widgets run: | - pushd install - tar cjvf ../QMapLibre_Linux.tar.bz2 * - popd + export QMapLibre_DIR="$GITHUB_WORKSPACE/install/maplibre-native-qt" + cmake --workflow --preset default - name: Upload installation if: matrix.compiler == 'default' uses: actions/upload-artifact@v4 with: - name: QMapLibre_Linux_${{ matrix.qt_version }} - path: QMapLibre_Linux.tar.bz2 + name: Linux_${{ matrix.qt_version }} + path: build/qt${{ matrix.qt_series }}-Linux/maplibre-native-qt_*.tar.bz2 - name: Upload coverage reports to Codecov if: matrix.qt_series == 6 && matrix.compiler != 'default' uses: codecov/codecov-action@v3 with: - files: build/coverage.info + files: build/qt${{ matrix.qt_series }}-Linux/coverage.info verbose: true release: - name: Release QMapLibre + name: Release if: github.ref_type == 'tag' runs-on: ubuntu-22.04 needs: build-and-test @@ -238,18 +225,11 @@ jobs: - name: Download artifacts uses: actions/download-artifact@v4 with: - name: QMapLibre_Linux_${{ matrix.qt_version }} - - - name: Make tarball - env: - TAG_NAME: ${{ github.ref_name }} - QT_VERSION: ${{ matrix.qt_version }} - run: | - mv QMapLibre_Linux.tar.bz2 QMapLibre_${TAG_NAME}_Qt${QT_VERSION}_Linux.tar.bz2 + name: Linux_${{ matrix.qt_version }} - name: Release uses: ncipollo/release-action@v1 with: - artifacts: QMapLibre_${{ github.ref_name }}_Qt${{ matrix.qt_version }}_Linux.tar.bz2 + artifacts: maplibre-native-qt_${{ github.ref_name }}_Qt${{ matrix.qt_version }}_Linux.tar.bz2 allowUpdates: true draft: true diff --git a/.github/workflows/iOS.yml b/.github/workflows/iOS.yml index a87dfd1..d5743ed 100644 --- a/.github/workflows/iOS.yml +++ b/.github/workflows/iOS.yml @@ -39,18 +39,18 @@ concurrency: jobs: build: - name: Build QMapLibre for iOS (Qt${{ matrix.qt_version}}) + name: Build MapLibre Native Qt for iOS (Qt${{ matrix.qt_version}}) runs-on: macos-14 strategy: matrix: include: - qt_version: 6.5.3 - deployment_target: 14.0 + preset: iOS-ccache - qt_version: 6.6.2 - deployment_target: 14.0 + preset: iOS-ccache env: - DEPLOYMENT_TARGET: ${{ matrix.deployment_target }} + PRESET: ${{ matrix.preset }} steps: - name: Checkout @@ -90,38 +90,23 @@ jobs: - name: Set up ccache uses: hendrikmuhs/ccache-action@v1 with: - key: iOS_QMapLibre_${{ matrix.qt_version }} + key: iOS_${{ matrix.qt_version }} max-size: 200M - - name: Build QMapLibre + - name: Build + working-directory: source run: | - mkdir build && cd build - qt-cmake ../source/ \ - -G"Ninja Multi-Config" \ - -DCMAKE_CONFIGURATION_TYPES="Release;Debug" \ - -DCMAKE_C_COMPILER_LAUNCHER="ccache" \ - -DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \ - -DCMAKE_INSTALL_PREFIX="../install" \ - -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \ - -DCMAKE_OSX_DEPLOYMENT_TARGET="${DEPLOYMENT_TARGET}" \ - -DQT_HOST_PATH="$(readlink -f "$Qt6_DIR/../macos")" - ninja - ninja install - - - name: Compress installation - run: | - pushd install - tar cjvf ../QMapLibre_iOS.tar.bz2 * - popd + export QT_HOST_PATH="$(readlink -f "$Qt6_DIR/../macos")" + cmake --workflow --preset ${PRESET} - name: Upload installation uses: actions/upload-artifact@v4 with: - name: QMapLibre_iOS_${{ matrix.qt_version }} - path: QMapLibre_iOS.tar.bz2 + name: iOS_${{ matrix.qt_version }} + path: build/qt6-iOS/maplibre-native-qt_*_iOS.tar.bz2 release: - name: Release QMapLibre + name: Release if: github.ref_type == 'tag' runs-on: macos-14 needs: build @@ -135,18 +120,11 @@ jobs: - name: Download artifacts uses: actions/download-artifact@v4 with: - name: QMapLibre_iOS_${{ matrix.qt_version }} - - - name: Make tarball - env: - TAG_NAME: ${{ github.ref_name }} - QT_VERSION: ${{ matrix.qt_version }} - run: | - mv QMapLibre_iOS.tar.bz2 QMapLibre_${TAG_NAME}_Qt${QT_VERSION}_iOS.tar.bz2 + name: iOS_${{ matrix.qt_version }} - name: Release uses: ncipollo/release-action@v1 with: - artifacts: QMapLibre_${{ github.ref_name }}_Qt${{ matrix.qt_version }}_iOS.tar.bz2 + artifacts: maplibre-native-qt_${{ github.ref_name }}_Qt${{ matrix.qt_version }}_iOS.tar.bz2 allowUpdates: true draft: true diff --git a/.github/workflows/macOS.yml b/.github/workflows/macOS.yml index 17467d5..b2ab77d 100644 --- a/.github/workflows/macOS.yml +++ b/.github/workflows/macOS.yml @@ -39,7 +39,7 @@ concurrency: jobs: build-and-test: - name: Build QMapLibre for macOS (Qt${{ matrix.qt_version}}, ${{ matrix.compiler }}) + name: Build MapLibre Native Qt for macOS (Qt${{ matrix.qt_version}}, ${{ matrix.compiler }}) runs-on: ${{ matrix.runs_on }} strategy: matrix: @@ -47,36 +47,31 @@ jobs: - qt_series: 5 qt_version: 5.15.2 qt_modules: "" + preset: macOS-legacy-ccache compiler: default - deployment_target: 10.13 - deployment_arch: x86_64 runs_on: macos-13 - qt_series: 6 qt_version: 6.5.3 qt_modules: qtlocation qtpositioning + preset: macOS-ccache compiler: default - deployment_target: 11.0 - deployment_arch: x86_64 runs_on: macos-14 - qt_series: 6 qt_version: 6.6.2 qt_modules: qtlocation qtpositioning + preset: macOS-ccache compiler: default - deployment_target: 11.0 - deployment_arch: x86_64;arm64 runs_on: macos-14 - qt_series: 6 qt_version: 6.6.2 qt_modules: qtlocation qtpositioning + preset: macOS-clang-tidy compiler: llvm@17 - deployment_target: 11.0 - deployment_arch: arm64 runs_on: macos-14 env: COMPILER: ${{ matrix.compiler }} - DEPLOYMENT_TARGET: ${{ matrix.deployment_target }} - DEPLOYMENT_ARCH: ${{ matrix.deployment_arch }} + PRESET: ${{ matrix.preset }} steps: - name: Checkout @@ -118,109 +113,50 @@ jobs: - name: Set up ccache uses: hendrikmuhs/ccache-action@v1 with: - key: macOS_QMapLibre_${{ matrix.qt_version }}_${{ matrix.compiler }} + key: macOS_${{ matrix.qt_version }}_${{ matrix.compiler }} max-size: 200M - - name: Build QMapLibre (Qt5) - if: matrix.qt_series == 5 + - name: Build + working-directory: source run: | - mkdir build && cd build - cmake ../source/ \ - -G Ninja \ - -DCMAKE_BUILD_TYPE="RelWithDebInfo" \ - -DCMAKE_C_COMPILER_LAUNCHER="ccache" \ - -DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \ - -DCMAKE_INSTALL_PREFIX="../install" \ - -DCMAKE_OSX_DEPLOYMENT_TARGET="${DEPLOYMENT_TARGET}" - ninja - ninja test - ninja install - - - name: Build QMapLibre (Qt 6) - if: matrix.qt_series == 6 - env: - MLN_QT_WITH_CLANG_TIDY: ${{ matrix.compiler != 'default' }} - run: | - mkdir build && cd build - qt-cmake ../source/ \ - -G Ninja \ - -DCMAKE_BUILD_TYPE="RelWithDebInfo" \ - -DCMAKE_C_COMPILER_LAUNCHER="ccache" \ - -DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \ - -DCMAKE_INSTALL_PREFIX="../install" \ - -DCMAKE_OSX_DEPLOYMENT_TARGET="${DEPLOYMENT_TARGET}" \ - -DCMAKE_OSX_ARCHITECTURES="${DEPLOYMENT_ARCH}" \ - -DMLN_QT_WITH_CLANG_TIDY="${MLN_QT_WITH_CLANG_TIDY}" - ninja - ninja test - ninja install - - - name: Build QtQuick Example (Qt 6) - if: matrix.qt_series == 6 - run: | - export PREFIX_PATH="$(pwd)/install" - mkdir build-example-quick && cd build-example-quick - qt-cmake ../source/examples/quick/ \ - -G Ninja \ - -DCMAKE_BUILD_TYPE="RelWithDebInfo" \ - -DCMAKE_C_COMPILER_LAUNCHER="ccache" \ - -DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \ - -DCMAKE_INSTALL_PREFIX="../install-example-quick" \ - -DCMAKE_OSX_DEPLOYMENT_TARGET="${DEPLOYMENT_TARGET}" \ - -DCMAKE_OSX_ARCHITECTURES="${DEPLOYMENT_ARCH}" \ - -DCMAKE_PREFIX_PATH="$PREFIX_PATH" - ninja - ninja install - - - name: Build QtWidgets Example (Qt 6) - if: matrix.qt_series == 6 + cmake --workflow --preset ${PRESET} + + - name: Install run: | - export PREFIX_PATH="$(pwd)/install" - mkdir build-example-widgets && cd build-example-widgets - qt-cmake ../source/examples/widgets/ \ - -G Ninja \ - -DCMAKE_BUILD_TYPE="RelWithDebInfo" \ - -DCMAKE_C_COMPILER_LAUNCHER="ccache" \ - -DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \ - -DCMAKE_INSTALL_PREFIX="../install-example-widgets" \ - -DCMAKE_OSX_DEPLOYMENT_TARGET="${DEPLOYMENT_TARGET}" \ - -DCMAKE_OSX_ARCHITECTURES="${DEPLOYMENT_ARCH}" \ - -DCMAKE_PREFIX_PATH="$PREFIX_PATH" - ninja - ninja install - - - name: Compress installation - if: matrix.compiler == 'default' + mkdir install && cd install + tar xf ../build/qt${{ matrix.qt_series }}-macOS/maplibre-native-qt_*.tar.bz2 + mv maplibre-native-qt_* maplibre-native-qt + + - name: Build QtQuick Example + if: matrix.qt_series == 6 && matrix.compiler == 'default' + working-directory: source/examples/quick run: | - pushd install - tar cjvf ../QMapLibre_macOS.tar.bz2 * - popd + export QMapLibre_DIR="$GITHUB_WORKSPACE/install/maplibre-native-qt" + cmake --workflow --preset default - - name: Compress examples + - name: Build QtWidgets Example if: matrix.qt_series == 6 && matrix.compiler == 'default' + working-directory: source/examples/widgets run: | - mkdir examples && pushd examples - cp -a ../install-example-quick/QMapLibreExampleQuick.app . - cp -a ../install-example-widgets/QMapLibreExampleWidgets.app . - tar cjvf ../QMapLibre_macOS_examples.tar.bz2 * - popd + export QMapLibre_DIR="$GITHUB_WORKSPACE/install/maplibre-native-qt" + cmake --workflow --preset default - name: Upload installation if: matrix.compiler == 'default' uses: actions/upload-artifact@v4 with: - name: QMapLibre_macOS_${{ matrix.qt_version }} - path: QMapLibre_macOS.tar.bz2 + name: macOS_${{ matrix.qt_version }} + path: build/qt${{ matrix.qt_series }}-macOS/maplibre-native-qt_*.tar.bz2 - name: Upload examples if: matrix.qt_series == 6 && matrix.compiler == 'default' uses: actions/upload-artifact@v4 with: - name: QMapLibre_macOS_${{ matrix.qt_version }}_examples - path: QMapLibre_macOS_examples.tar.bz2 + name: macOS_${{ matrix.qt_version }}_examples + path: build/qt${{ matrix.qt_series }}-example-*/*.tar.bz2 release: - name: Release QMapLibre + name: Release if: github.ref_type == 'tag' runs-on: macos-14 needs: build-and-test @@ -234,18 +170,11 @@ jobs: - name: Download artifacts uses: actions/download-artifact@v4 with: - name: QMapLibre_macOS_${{ matrix.qt_version }} - - - name: Make tarball - env: - TAG_NAME: ${{ github.ref_name }} - QT_VERSION: ${{ matrix.qt_version }} - run: | - mv QMapLibre_macOS.tar.bz2 QMapLibre_${TAG_NAME}_Qt${QT_VERSION}_macOS.tar.bz2 + name: macOS_${{ matrix.qt_version }} - name: Release uses: ncipollo/release-action@v1 with: - artifacts: QMapLibre_${{ github.ref_name }}_Qt${{ matrix.qt_version }}_macOS.tar.bz2 + artifacts: maplibre-native-qt_${{ github.ref_name }}_Qt${{ matrix.qt_version }}_macOS.tar.bz2 allowUpdates: true draft: true diff --git a/CMakeLists.txt b/CMakeLists.txt index c843c21..1204fa0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ message(STATUS "Version ${MLN_QT_VERSION}") # Project definition project( - MapLibreNativeQt + maplibre-native-qt VERSION "${MLN_QT_VERSION}" DESCRIPTION "MapLibre Native Qt Bindings" LANGUAGES CXX @@ -39,7 +39,11 @@ option(MLN_QT_WITH_COVERAGE "Build QMapLibre with code coverage collection" OFF) option(MLN_QT_WITH_CLANG_TIDY "Build QMapLibre with clang-tidy checks enabled" OFF) # Find Qt -find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED) +if("${QT_VERSION_MAJOR}" STREQUAL "") + find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED) +else() + find_package(Qt${QT_VERSION_MAJOR} NAMES Qt6 Qt5 COMPONENTS Core REQUIRED) +endif() find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Gui Network REQUIRED) # main dependencies if(NOT MLN_QT_WITH_INTERNAL_SQLITE) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Sql REQUIRED) @@ -85,7 +89,7 @@ endif() if(ANDROID) message(STATUS "Building for ABI: ${ANDROID_ABI}") set(CMAKE_STATIC_LIBRARY_SUFFIX "_${ANDROID_ABI}.a") -elseif(CMAKE_SYSTEM_NAME STREQUAL iOS) +elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS") set(CMAKE_DEBUG_POSTFIX "_debug") elseif(MSVC OR CMAKE_SYSTEM_NAME STREQUAL "Windows") set(CMAKE_DEBUG_POSTFIX "d") @@ -116,3 +120,25 @@ if(MLN_QT_WITH_COVERAGE) include(cmake/coverage.cmake) setup_target_for_coverage(coverage ${CMAKE_CTEST_COMMAND} "${CMAKE_BINARY_DIR}/coverage" "-V") endif() + +# Packaging +set(CPACK_GENERATOR TBZ2) +if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set(CPACK_SYSTEM_NAME "macOS") +else() + set(CPACK_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}") +endif() +set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}_${PROJECT_VERSION}_Qt${QT_VERSION}_${CPACK_SYSTEM_NAME}") +set(CPACK_SOURCE_GENERATOR TBZ2) +set(CPACK_SOURCE_IGNORE_FILES + "/docs/" + "/geometry-test-data/" + "\\\\.clang" + "\\\\.DS_Store" + "\\\\.git" + "\\\\.mason" + "\\\\.pre-commit-config.yaml" + "codecov.yml" +) + +include(CPack) diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000..67743cf --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,16 @@ +{ + "version": 6, + "cmakeMinimumRequired": { + "major": 3, + "minor": 25, + "patch": 0 + }, + "include": [ + "cmake/presets/common.json", + "cmake/presets/macOS.json", + "cmake/presets/iOS.json", + "cmake/presets/Android.json", + "cmake/presets/Linux.json", + "cmake/presets/WASM.json" + ] +} diff --git a/cmake/presets/Android.json b/cmake/presets/Android.json new file mode 100644 index 0000000..b8e3bbe --- /dev/null +++ b/cmake/presets/Android.json @@ -0,0 +1,65 @@ +{ + "version": 6, + "include": ["common.json"], + "configurePresets": [ + { + "name": "Android", + "displayName": "Android configuration using Qt6", + "generator": "Ninja", + "binaryDir": "${sourceParentDir}/build/qt6-Android", + "toolchainFile": "$penv{Qt6_DIR}/lib/cmake/Qt6/qt.toolchain.cmake", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "RelWithDebInfo" + } + }, + { + "name": "Android-ccache", + "displayName": "Android configuration using Qt6 and ccache", + "inherits": ["dev", "ccache", "Android"] + } + ], + "buildPresets": [ + { + "name": "Android", + "displayName": "Android build using Qt6", + "configurePreset": "Android" + }, + { + "name": "Android-ccache", + "displayName": "Android build using Qt6 and ccache", + "configurePreset": "Android-ccache" + } + ], + "packagePresets": [ + { + "name": "Android", + "displayName": "Android package using Qt6", + "configurePreset": "Android" + }, + { + "name": "Android-ccache", + "displayName": "Android package using Qt6 and ccache", + "configurePreset": "Android-ccache" + } + ], + "workflowPresets": [ + { + "name": "Android-ccache", + "displayName": "Android workflow using Qt6 and ccache", + "steps": [ + { + "type": "configure", + "name": "Android-ccache" + }, + { + "type": "build", + "name": "Android-ccache" + }, + { + "type": "package", + "name": "Android-ccache" + } + ] + } + ] +} diff --git a/cmake/presets/Linux.json b/cmake/presets/Linux.json new file mode 100644 index 0000000..c4b8143 --- /dev/null +++ b/cmake/presets/Linux.json @@ -0,0 +1,228 @@ +{ + "version": 6, + "include": ["common.json"], + "configurePresets": [ + { + "name": "Linux", + "displayName": "Linux configuration using Qt6", + "generator": "Ninja", + "binaryDir": "${sourceParentDir}/build/qt6-Linux", + "toolchainFile": "$penv{Qt6_DIR}/lib/cmake/Qt6/qt.toolchain.cmake", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release", + "QT_VERSION_MAJOR": "6" + } + }, + { + "name": "Linux-ccache", + "displayName": "Linux configuration using Qt6 and ccache", + "inherits": ["dev", "ccache", "Linux"] + }, + { + "name": "Linux-coverage", + "displayName": "Linux configuration using Qt6, ccache and code coverage", + "inherits": ["Linux-ccache"], + "cacheVariables": { + "CMAKE_BUILD_TYPE": "RelWithDebInfo", + "MLN_QT_WITH_COVERAGE": "ON", + "GCOV_PATH": "$penv{GCOV_PATH}" + } + }, + { + "name": "Linux-legacy", + "displayName": "Linux configuration using Qt5", + "generator": "Ninja", + "binaryDir": "${sourceParentDir}/build/qt5-Linux", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release", + "QT_VERSION_MAJOR": "5" + } + }, + { + "name": "Linux-legacy-ccache", + "displayName": "Linux configuration using Qt5 and ccache", + "inherits": ["dev", "ccache", "Linux-legacy"] + } + ], + "buildPresets": [ + { + "name": "Linux", + "displayName": "Linux build using Qt6", + "configurePreset": "Linux" + }, + { + "name": "Linux-ccache", + "displayName": "Linux build using Qt6 and ccache", + "configurePreset": "Linux-ccache" + }, + { + "name": "Linux-coverage", + "displayName": "Linux build using Qt6, ccache and code coverage", + "configurePreset": "Linux-coverage" + }, + { + "name": "Linux-legacy", + "displayName": "Linux build using Qt5", + "configurePreset": "Linux-legacy" + }, + { + "name": "Linux-legacy-ccache", + "displayName": "Linux build using Qt5 and ccache", + "configurePreset": "Linux-legacy-ccache" + } + ], + "testPresets": [ + { + "name": "Linux", + "displayName": "Linux tests using Qt6", + "configurePreset": "Linux", + "inherits": ["default"] + }, + { + "name": "Linux-ccache", + "displayName": "Linux tests using Qt6 and ccache", + "configurePreset": "Linux-ccache", + "inherits": ["default"] + }, + { + "name": "Linux-coverage", + "displayName": "Linux tests using Qt6, ccache and code coverage", + "configurePreset": "Linux-coverage", + "inherits": ["default"] + }, + { + "name": "Linux-legacy", + "displayName": "Linux tests using Qt5", + "configurePreset": "Linux-legacy", + "inherits": ["default"] + }, + { + "name": "Linux-legacy-ccache", + "displayName": "Linux tests using Qt5 and ccache", + "configurePreset": "Linux-legacy-ccache", + "inherits": ["default"] + } + ], + "packagePresets": [ + { + "name": "Linux", + "displayName": "Linux package using Qt6", + "configurePreset": "Linux" + }, + { + "name": "Linux-ccache", + "displayName": "Linux package using Qt6 and ccache", + "configurePreset": "Linux-ccache" + }, + { + "name": "Linux-coverage", + "displayName": "Linux package using Qt6, ccache and code coverage", + "configurePreset": "Linux-coverage" + }, + { + "name": "Linux-legacy-ccache", + "displayName": "Linux package using Qt5 and ccache", + "configurePreset": "Linux-legacy-ccache" + } + ], + "workflowPresets": [ + { + "name": "Linux-ccache", + "displayName": "Linux workflow using Qt6 and ccache", + "steps": [ + { + "type": "configure", + "name": "Linux-ccache" + }, + { + "type": "build", + "name": "Linux-ccache" + }, + { + "type": "test", + "name": "Linux-ccache" + }, + { + "type": "package", + "name": "Linux-ccache" + } + ] + }, + { + "name": "Linux-CI", + "displayName": "Linux workflow using Qt6 and ccache for CI", + "steps": [ + { + "type": "configure", + "name": "Linux-ccache" + }, + { + "type": "build", + "name": "Linux-ccache" + }, + { + "type": "package", + "name": "Linux-ccache" + } + ] + }, + { + "name": "Linux-coverage", + "displayName": "Linux workflow using Qt6, ccache and code coverage", + "steps": [ + { + "type": "configure", + "name": "Linux-coverage" + }, + { + "type": "build", + "name": "Linux-coverage" + }, + { + "type": "package", + "name": "Linux-coverage" + } + ] + }, + { + "name": "Linux-legacy-ccache", + "displayName": "Linux workflow using Qt5 and ccache", + "steps": [ + { + "type": "configure", + "name": "Linux-legacy-ccache" + }, + { + "type": "build", + "name": "Linux-legacy-ccache" + }, + { + "type": "test", + "name": "Linux-legacy-ccache" + }, + { + "type": "package", + "name": "Linux-legacy-ccache" + } + ] + }, + { + "name": "Linux-legacy-CI", + "displayName": "Linux workflow using Qt5 and ccache for CI", + "steps": [ + { + "type": "configure", + "name": "Linux-legacy-ccache" + }, + { + "type": "build", + "name": "Linux-legacy-ccache" + }, + { + "type": "package", + "name": "Linux-legacy-ccache" + } + ] + } + ] +} diff --git a/cmake/presets/WASM.json b/cmake/presets/WASM.json new file mode 100644 index 0000000..53bdd37 --- /dev/null +++ b/cmake/presets/WASM.json @@ -0,0 +1,66 @@ +{ + "version": 6, + "include": ["common.json"], + "configurePresets": [ + { + "name": "WASM", + "displayName": "WASM configuration using Qt6", + "generator": "Ninja", + "binaryDir": "${sourceParentDir}/build/qt6-WASM", + "toolchainFile": "$penv{Qt6_DIR}/lib/cmake/Qt6/qt.toolchain.cmake", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "RelWithDebInfo", + "MLN_QT_WITH_LOCATION": "OFF" + } + }, + { + "name": "WASM-ccache", + "displayName": "WASM configuration using Qt6 and ccache", + "inherits": ["dev", "ccache", "WASM"] + } + ], + "buildPresets": [ + { + "name": "WASM", + "displayName": "WASM build using Qt6", + "configurePreset": "WASM" + }, + { + "name": "WASM-ccache", + "displayName": "WASM build using Qt6 and ccache", + "configurePreset": "WASM-ccache" + } + ], + "packagePresets": [ + { + "name": "WASM", + "displayName": "WASM package using Qt6", + "configurePreset": "WASM" + }, + { + "name": "WASM-ccache", + "displayName": "WASM package using Qt6 and ccache", + "configurePreset": "WASM-ccache" + } + ], + "workflowPresets": [ + { + "name": "WASM-ccache", + "displayName": "WASM workflow using Qt6 and ccache", + "steps": [ + { + "type": "configure", + "name": "WASM-ccache" + }, + { + "type": "build", + "name": "WASM-ccache" + }, + { + "type": "package", + "name": "WASM-ccache" + } + ] + } + ] +} diff --git a/cmake/presets/common.json b/cmake/presets/common.json new file mode 100644 index 0000000..ead509e --- /dev/null +++ b/cmake/presets/common.json @@ -0,0 +1,35 @@ +{ + "version": 6, + "configurePresets": [ + { + "name": "dev", + "hidden": true, + "warnings": { + "dev": true, + "deprecated": true, + "uninitialized": false, + "unusedCli": true, + "systemVars": true + }, + "errors": { + "dev": true, + "deprecated": true + } + }, + { + "name": "ccache", + "hidden": true, + "cacheVariables": { + "CMAKE_C_COMPILER_LAUNCHER": "ccache", + "CMAKE_CXX_COMPILER_LAUNCHER": "ccache" + } + } + ], + "testPresets": [ + { + "name": "default", + "hidden": true, + "output": { "outputOnFailure": true } + } + ] +} diff --git a/cmake/presets/iOS.json b/cmake/presets/iOS.json new file mode 100644 index 0000000..47eb982 --- /dev/null +++ b/cmake/presets/iOS.json @@ -0,0 +1,87 @@ +{ + "version": 6, + "include": ["common.json"], + "configurePresets": [ + { + "name": "iOS", + "displayName": "iOS configuration using Qt6", + "generator": "Ninja Multi-Config", + "binaryDir": "${sourceParentDir}/build/qt6-iOS", + "toolchainFile": "$penv{Qt6_DIR}/lib/cmake/Qt6/qt.toolchain.cmake", + "cacheVariables": { + "CMAKE_CONFIGURATION_TYPES": "Release;Debug", + "CMAKE_OSX_ARCHITECTURES": "arm64;x86_64", + "CMAKE_OSX_DEPLOYMENT_TARGET": "14.0" + } + }, + { + "name": "iOS-ccache", + "displayName": "iOS configuration using Qt6 and ccache", + "inherits": ["dev", "ccache", "iOS"] + } + ], + "buildPresets": [ + { + "name": "iOS", + "displayName": "iOS release build using Qt6", + "configurePreset": "iOS", + "configuration": "Release" + }, + { + "name": "iOS-debug", + "displayName": "iOS debug build using Qt6", + "configurePreset": "iOS", + "configuration": "Debug" + }, + { + "name": "iOS-ccache", + "displayName": "iOS release build using Qt6 and ccache", + "configurePreset": "iOS-ccache", + "configuration": "Release" + }, + { + "name": "iOS-debug-ccache", + "displayName": "iOS debug build using Qt6 and ccache", + "configurePreset": "iOS-ccache", + "configuration": "Debug" + } + ], + "packagePresets": [ + { + "name": "iOS", + "displayName": "iOS package using Qt6", + "configurePreset": "iOS", + "configurations": ["Release", "Debug"] + }, + { + "name": "iOS-ccache", + "displayName": "iOS package using Qt6 and ccache", + "configurePreset": "iOS-ccache", + "configurations": ["Release", "Debug"] + } + ], + "workflowPresets": [ + { + "name": "iOS-ccache", + "displayName": "iOS workflow using Qt6 and ccache", + "steps": [ + { + "type": "configure", + "name": "iOS-ccache" + }, + { + "type": "build", + "name": "iOS-debug-ccache" + }, + { + "type": "build", + "name": "iOS-ccache" + }, + { + "type": "package", + "name": "iOS-ccache" + } + ] + } + ] +} diff --git a/cmake/presets/macOS.json b/cmake/presets/macOS.json new file mode 100644 index 0000000..8e8b7ca --- /dev/null +++ b/cmake/presets/macOS.json @@ -0,0 +1,202 @@ +{ + "version": 6, + "include": ["common.json"], + "configurePresets": [ + { + "name": "macOS", + "displayName": "macOS configuration using Qt6", + "generator": "Ninja", + "binaryDir": "${sourceParentDir}/build/qt6-macOS", + "toolchainFile": "$penv{Qt6_DIR}/lib/cmake/Qt6/qt.toolchain.cmake", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "RelWithDebInfo", + "CMAKE_OSX_ARCHITECTURES": "x86_64;arm64", + "CMAKE_OSX_DEPLOYMENT_TARGET": "11.0" + } + }, + { + "name": "macOS-ccache", + "displayName": "macOS configuration using Qt6 and ccache", + "inherits": ["dev", "ccache", "macOS"] + }, + { + "name": "macOS-clang-tidy", + "displayName": "macOS configuration using Qt6, ccache and clang-tidy", + "inherits": ["macOS-ccache"], + "cacheVariables": { + "CMAKE_OSX_ARCHITECTURES": "arm64", + "MLN_QT_WITH_CLANG_TIDY": "ON" + } + }, + { + "name": "macOS-legacy", + "displayName": "macOS configuration using Qt5", + "generator": "Ninja", + "binaryDir": "${sourceParentDir}/build/qt5-macOS", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "RelWithDebInfo", + "CMAKE_OSX_ARCHITECTURES": "x86_64", + "CMAKE_OSX_DEPLOYMENT_TARGET": "10.13" + } + }, + { + "name": "macOS-legacy-ccache", + "displayName": "macOS configuration using Qt5 and ccache", + "inherits": ["dev", "ccache", "macOS-legacy"] + } + ], + "buildPresets": [ + { + "name": "macOS", + "displayName": "macOS build using Qt6", + "configurePreset": "macOS" + }, + { + "name": "macOS-ccache", + "displayName": "macOS build using Qt6 and ccache", + "configurePreset": "macOS-ccache" + }, + { + "name": "macOS-clang-tidy", + "displayName": "macOS build using Qt6, ccache and clang-tidy", + "configurePreset": "macOS-clang-tidy" + }, + { + "name": "macOS-legacy", + "displayName": "macOS build using Qt5", + "configurePreset": "macOS-legacy" + }, + { + "name": "macOS-legacy-ccache", + "displayName": "macOS build using Qt5 and ccache", + "configurePreset": "macOS-legacy-ccache" + } + ], + "testPresets": [ + { + "name": "macOS", + "displayName": "macOS tests using Qt6", + "configurePreset": "macOS", + "inherits": ["default"] + }, + { + "name": "macOS-ccache", + "displayName": "macOS tests using Qt6 and ccache", + "configurePreset": "macOS-ccache", + "inherits": ["default"] + }, + { + "name": "macOS-clang-tidy", + "displayName": "macOS tests using Qt6, ccache and clang-tidy", + "configurePreset": "macOS-clang-tidy", + "inherits": ["default"] + }, + { + "name": "macOS-legacy", + "displayName": "macOS tests using Qt5", + "configurePreset": "macOS-legacy", + "inherits": ["default"] + }, + { + "name": "macOS-legacy-ccache", + "displayName": "macOS tests using Qt5 and ccache", + "configurePreset": "macOS-legacy-ccache", + "inherits": ["default"] + } + ], + "packagePresets": [ + { + "name": "macOS", + "displayName": "macOS package using Qt6", + "configurePreset": "macOS" + }, + { + "name": "macOS-ccache", + "displayName": "macOS package using Qt6 and ccache", + "configurePreset": "macOS-ccache" + }, + { + "name": "macOS-clang-tidy", + "displayName": "macOS package using Qt6, ccache and clang-tidy", + "configurePreset": "macOS-clang-tidy" + }, + { + "name": "macOS-legacy", + "displayName": "macOS package using Qt5", + "configurePreset": "macOS-legacy" + }, + { + "name": "macOS-legacy-ccache", + "displayName": "macOS package using Qt5 and ccache", + "configurePreset": "macOS-legacy-ccache" + } + ], + "workflowPresets": [ + { + "name": "macOS-ccache", + "displayName": "macOS workflow using Qt6 and ccache", + "steps": [ + { + "type": "configure", + "name": "macOS-ccache" + }, + { + "type": "build", + "name": "macOS-ccache" + }, + { + "type": "test", + "name": "macOS-ccache" + }, + { + "type": "package", + "name": "macOS-ccache" + } + ] + }, + { + "name": "macOS-clang-tidy", + "displayName": "macOS workflow using Qt6, ccache and clang-tidy", + "steps": [ + { + "type": "configure", + "name": "macOS-clang-tidy" + }, + { + "type": "build", + "name": "macOS-clang-tidy" + }, + { + "type": "test", + "name": "macOS-clang-tidy" + }, + { + "type": "package", + "name": "macOS-clang-tidy" + } + ] + }, + { + "name": "macOS-legacy-ccache", + "displayName": "macOS workflow using Qt5 and ccache", + "steps": [ + { + "type": "configure", + "name": "macOS-legacy-ccache" + }, + { + "type": "build", + "name": "macOS-legacy-ccache" + }, + { + "type": "test", + "name": "macOS-legacy-ccache" + }, + { + "type": "package", + "name": "macOS-legacy-ccache" + } + ] + } + ] +} diff --git a/examples/quick/CMakeLists.txt b/examples/quick/CMakeLists.txt index bf027c3..8f4a8c0 100644 --- a/examples/quick/CMakeLists.txt +++ b/examples/quick/CMakeLists.txt @@ -77,3 +77,13 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES "Android") add_android_openssl_libraries(QMapLibreExampleQuick) endif() + +# Packaging +set(CPACK_GENERATOR TBZ2) +if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set(CPACK_SYSTEM_NAME "macOS") +else() + set(CPACK_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}") +endif() + +include(CPack) diff --git a/examples/quick/CMakePresets.json b/examples/quick/CMakePresets.json new file mode 100644 index 0000000..38709db --- /dev/null +++ b/examples/quick/CMakePresets.json @@ -0,0 +1,59 @@ +{ + "version": 6, + "cmakeMinimumRequired": { + "major": 3, + "minor": 25, + "patch": 0 + }, + "configurePresets": [ + { + "name": "default", + "displayName": "MapLibre Qt Quick example configuration", + "generator": "Ninja", + "binaryDir": "${sourceParentDir}/../../build/qt6-example-quick", + "toolchainFile": "$penv{Qt6_DIR}/lib/cmake/Qt6/qt.toolchain.cmake", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release", + "CMAKE_C_COMPILER_LAUNCHER": "ccache", + "CMAKE_CXX_COMPILER_LAUNCHER": "ccache", + "CMAKE_OSX_ARCHITECTURES": "x86_64;arm64", + "CMAKE_OSX_DEPLOYMENT_TARGET": "11.0", + "QMapLibre_DIR": "$penv{QMapLibre_DIR}/lib/cmake/QMapLibre" + } + } + ], + "buildPresets": [ + { + "name": "default", + "displayName": "MapLibre Qt Quick example build", + "configurePreset": "default" + } + ], + "packagePresets": [ + { + "name": "default", + "displayName": "MapLibre Qt Quick example package", + "configurePreset": "default" + } + ], + "workflowPresets": [ + { + "name": "default", + "displayName": "MapLibre Qt Quick example workflow", + "steps": [ + { + "type": "configure", + "name": "default" + }, + { + "type": "build", + "name": "default" + }, + { + "type": "package", + "name": "default" + } + ] + } + ] +} diff --git a/examples/widgets/CMakeLists.txt b/examples/widgets/CMakeLists.txt index 3d8f2a2..2be6ac1 100644 --- a/examples/widgets/CMakeLists.txt +++ b/examples/widgets/CMakeLists.txt @@ -54,3 +54,13 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) endif() + +# Packaging +set(CPACK_GENERATOR TBZ2) +if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set(CPACK_SYSTEM_NAME "macOS") +else() + set(CPACK_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}") +endif() + +include(CPack) diff --git a/examples/widgets/CMakePresets.json b/examples/widgets/CMakePresets.json new file mode 100644 index 0000000..7afebec --- /dev/null +++ b/examples/widgets/CMakePresets.json @@ -0,0 +1,59 @@ +{ + "version": 6, + "cmakeMinimumRequired": { + "major": 3, + "minor": 25, + "patch": 0 + }, + "configurePresets": [ + { + "name": "default", + "displayName": "MapLibre Qt Widgets example configuration", + "generator": "Ninja", + "binaryDir": "${sourceParentDir}/../../build/qt6-example-widgets", + "toolchainFile": "$penv{Qt6_DIR}/lib/cmake/Qt6/qt.toolchain.cmake", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release", + "CMAKE_C_COMPILER_LAUNCHER": "ccache", + "CMAKE_CXX_COMPILER_LAUNCHER": "ccache", + "CMAKE_OSX_ARCHITECTURES": "x86_64;arm64", + "CMAKE_OSX_DEPLOYMENT_TARGET": "11.0", + "QMapLibre_DIR": "$penv{QMapLibre_DIR}/lib/cmake/QMapLibre" + } + } + ], + "buildPresets": [ + { + "name": "default", + "displayName": "MapLibre Qt Widgets example build", + "configurePreset": "default" + } + ], + "packagePresets": [ + { + "name": "default", + "displayName": "MapLibre Qt Widgets example package", + "configurePreset": "default" + } + ], + "workflowPresets": [ + { + "name": "default", + "displayName": "MapLibre Qt Widgets example workflow", + "steps": [ + { + "type": "configure", + "name": "default" + }, + { + "type": "build", + "name": "default" + }, + { + "type": "package", + "name": "default" + } + ] + } + ] +}