diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 309c0d3f..036958b2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ jobs: steps: - run: git config --global core.autocrlf input shell: bash - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: msys2/setup-msys2@v2 @@ -22,6 +22,11 @@ jobs: shell: msys2 {0} run: | ./ci/travis-windows-script.sh + - uses: actions/upload-artifact@v4 + name: Upload artifacts to github + with: + name: binaries-win64 + path: build/merkaartor-*.exe - name: Upload artifacts env: CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }} @@ -32,33 +37,46 @@ jobs: ./build/upload-artifacts.sh macosx: - runs-on: macos-latest + runs-on: macos-13 strategy: matrix: - QT_MAJOR: [5, 6] + QT_MAJOR: [6] name: MacOS X / Qt${{ matrix.QT_MAJOR }} env: QT_MAJOR: ${{ matrix.QT_MAJOR }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Install dependencies + - uses: conda-incubator/setup-miniconda@v3 + with: + auto-update-conda: true + channels: conda-forge,anaconda,defaults + auto-activate-base: true + - name: Conda info + shell: bash -el {0} run: | - brew list - brew install gdal exiv2 proj qt${{ matrix.QT_MAJOR }} cmake inih - brew unlink exiv2 - brew install --HEAD exiv2 - brew link qt${{ matrix.QT_MAJOR }} + conda install gdal exiv2 proj qtbase=6.7.2 qttools qt5compat cmake pkg-config poppler # poppler is required for gdal, but missing as a dependency + git clone https://github.com/qt/qtnetworkauth.git && cd qtnetworkauth + git checkout v6.7.2 + mkdir build && cd build + cmake .. + make install - name: Build + shell: bash -el {0} run: | ./ci/travis-osx-script.sh - - name: Upload artifacts + - uses: actions/upload-artifact@v4 + name: Upload artifacts to github + with: + name: binaries-osx + path: build/merkaartor-*.dmg + - name: Upload artifacts to cloudsmith env: CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }} if: (matrix.QT_MAJOR == 6) && (contains('refs/heads/master refs/heads/gh-actions', github.ref) || startsWith(github.ref, 'refs/tags/')) run: | - pip3 install cloudsmith-cli + pip3 install cloudsmith-cli --break-system-packages ./build/upload-artifacts.sh linux-qt5: @@ -75,7 +93,7 @@ jobs: SNAPSHOT: ${{ matrix.SNAPSHOT }} CMAKE_UNITY_BUILD: ${{ matrix.CMAKE_UNITY_BUILD }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Install dependencies @@ -96,7 +114,7 @@ jobs: SNAPSHOT: ${{ matrix.SNAPSHOT }} CMAKE_UNITY_BUILD: ${{ matrix.CMAKE_UNITY_BUILD }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Install dependencies @@ -111,7 +129,7 @@ jobs: runs-on: ubuntu-22.04 name: Linux / AppImage steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Install dependencies @@ -127,6 +145,11 @@ jobs: make -j3 make DESTDIR=AppDir install appimage-builder --skip-tests + - uses: actions/upload-artifact@v4 + name: Upload artifacts to github + with: + name: binaries-linux + path: build/merkaartor-*.AppImage - name: Upload artifacts env: CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }} diff --git a/CMakeLists.txt b/CMakeLists.txt index aa134cfa..473e7c10 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,6 +55,11 @@ message(STATUS " * Qt version found: ${QT_VERSION}") if (${QT_VERSION_MAJOR} EQUAL 6) list(APPEND MERKAARTOR_QT_LIBS Core5Compat) endif() +if (APPLE) + # macdeployqt does not properly bundle dbus + # see https://bugreports.qt.io/browse/QTBUG-127075 + list(APPEND MERKAARTOR_QT_LIBS DBus) +endif() find_package(Qt${QT_VERSION_MAJOR} COMPONENTS ${MERKAARTOR_QT_LIBS} ${MERKAARTOR_QT_TOOLS} CONFIG REQUIRED) set(MERKAARTOR_LINK_LIBS ${MERKAARTOR_QT_LIBS}) @@ -547,8 +552,6 @@ message(STATUS "") list(APPEND MERKAARTOR_LINK_LIBS ${PKGCONFIG_DEPS_LIBRARIES}) link_directories(${PKGCONFIG_DEPS_LIBRARY_DIRS}) - - ############################################## # Create the Merkaartor binary ############################################## @@ -632,7 +635,7 @@ configure_file("${PROJECT_SOURCE_DIR}/cmake/AppImageBuilder.yml.in" "${PROJECT_B # Mac OS X specific deploy scripts ############################################## if (APPLE) - find_program(MACDEPLOYQT macdeployqt) + find_program(MACDEPLOYQT macdeployqt6) message("Found macdeployqt: ${MACDEPLOYQT}") configure_file("${PROJECT_SOURCE_DIR}/cmake/deploy-osx.cmake.in" "${PROJECT_BINARY_DIR}/deploy-osx.cmake" @ONLY) set (CPACK_PRE_BUILD_SCRIPTS "${PROJECT_BINARY_DIR}/deploy-osx.cmake") diff --git a/ci/travis-osx-script.sh b/ci/travis-osx-script.sh index 7203a7a7..c62887bd 100755 --- a/ci/travis-osx-script.sh +++ b/ci/travis-osx-script.sh @@ -3,8 +3,17 @@ set -ev mkdir build && cd build -QT_PREFIX=`brew --prefix qt${QT_MAJOR}` -cmake .. -G"Unix Makefiles" -DCMAKE_PREFIX_PATH="$QT_PREFIX" -DCMAKE_BUILD_TYPE=Release -DEXTRA_TESTS=OFF +conda info +echo $PATH +ls /Users/runner/miniconda3/condabin +cmake .. -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DEXTRA_TESTS=OFF make -j4 -make test -make package +make test ARGS=--output-on-failure +for i in {0..10}; do + # make package seems to fail due to race conditions: + # https://github.com/actions/runner-images/issues/7522 + # https://gitlab.kitware.com/cmake/cmake/-/issues/25671 + make package && break + echo "Failed attempt #${i}. Retrying..." +done +echo "Passed on attempt #${i}." diff --git a/ci/travis-windows-script.sh b/ci/travis-windows-script.sh index fd69a8f8..79bb02fc 100644 --- a/ci/travis-windows-script.sh +++ b/ci/travis-windows-script.sh @@ -5,5 +5,5 @@ set -e mkdir build && cd build cmake .. -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DEXTRA_TESTS=OFF make -j4 -make test +make test ARGS=--output-on-failure make package diff --git a/cmake/AppImageBuilder.yml.in b/cmake/AppImageBuilder.yml.in index 14e66e40..3c749481 100644 --- a/cmake/AppImageBuilder.yml.in +++ b/cmake/AppImageBuilder.yml.in @@ -32,6 +32,7 @@ AppDir: - libqt6core5compat6 - libqt6networkauth6 - qt6-qpa-plugins + - libprotobuf23 files: exclude: diff --git a/cmake/deploy-osx.cmake.in b/cmake/deploy-osx.cmake.in index ba822293..c10b9d18 100644 --- a/cmake/deploy-osx.cmake.in +++ b/cmake/deploy-osx.cmake.in @@ -9,7 +9,12 @@ foreach (_variableName ${_variableNames}) endforeach() #message("Prefix is: ${CMAKE_INSTALL_PREFIX}") #execute_process(COMMAND ls ${CMAKE_INSTALL_PREFIX}) +set(TMP_APPDIR "${CPACK_TEMPORARY_INSTALL_DIRECTORY}/@PROJECT_NAME@.app") execute_process(COMMAND find "${CPACK_TEMPORARY_INSTALL_DIRECTORY}") -execute_process(COMMAND ${MACDEPLOYQT} "${CPACK_TEMPORARY_INSTALL_DIRECTORY}/@PROJECT_NAME@.app") +message("Running macdeployqt on ${TMP_APPDIR}") +execute_process(COMMAND ${MACDEPLOYQT} "${TMP_APPDIR}" -verbose=3) +execute_process(COMMAND install_name_tool -add_rpath "@executable_path/../Frameworks" "${CPACK_TEMPORARY_INSTALL_DIRECTORY}/@PROJECT_NAME@.app/Contents/MacOS/merkaartor") +execute_process(COMMAND otool -l "${CPACK_TEMPORARY_INSTALL_DIRECTORY}/@PROJECT_NAME@.app/Contents/MacOS/merkaartor") +message("Done bundling.") execute_process(COMMAND find "${CPACK_TEMPORARY_INSTALL_DIRECTORY}") diff --git a/cmake/deploy-windows.cmake.in b/cmake/deploy-windows.cmake.in index 27b77b20..56512f57 100644 --- a/cmake/deploy-windows.cmake.in +++ b/cmake/deploy-windows.cmake.in @@ -7,7 +7,8 @@ message("Working on binary: ${MERKAARTOR_BINARY}") # Copy whole packages of gdal and proj, as they need other files than dlls to work! # Also copy openssl directly, as it appears to be preinstalled by github actions in system paths and ignored by the toling below -execute_process(COMMAND pacman -Qlq mingw-w64-x86_64-openssl mingw-w64-x86_64-gdal mingw-w64-x86_64-proj OUTPUT_VARIABLE DEP_PKGS_FILES OUTPUT_STRIP_TRAILING_WHITESPACE) +# Also copy opencl-icd, as is overridden by the system files +execute_process(COMMAND pacman -Qlq mingw-w64-x86_64-openssl mingw-w64-x86_64-opencl-icd mingw-w64-x86_64-gdal mingw-w64-x86_64-proj OUTPUT_VARIABLE DEP_PKGS_FILES OUTPUT_STRIP_TRAILING_WHITESPACE) string(REPLACE "\n" ";" DEP_PKGS_FILES_LIST ${DEP_PKGS_FILES}) foreach(DEP_PKGS_FILE IN LISTS DEP_PKGS_FILES_LIST) if (${DEP_PKGS_FILE} MATCHES "/include/|/man/|/doc/|/$|.a$|.pc$|.cmake$")