Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CMake presets for easier usage #112

Merged
merged 1 commit into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/qt5-build/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
14 changes: 4 additions & 10 deletions .github/actions/qt5-build/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
46 changes: 16 additions & 30 deletions .github/actions/qt6-build/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
90 changes: 45 additions & 45 deletions .github/workflows/Android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ concurrency:

jobs:
build:
name: Build QMapLibre for Android (Qt${{ matrix.qt_version}}, ${{ matrix.abi }})
name: Build (Qt${{ matrix.qt_version}}, ${{ matrix.abi }})
runs-on: ubuntu-22.04
strategy:
matrix:
Expand Down Expand Up @@ -104,50 +104,37 @@ jobs:
chmod +x "$Qt6_DIR/bin/qt-cmake"
sed -i "s/C:\/Qt\/Qt-${QT_VERSION}/\/usr\/local\/Qt-${QT_VERSION}/g" "$Qt6_DIR/lib/cmake/Qt6BuildInternals/QtBuildInternalsExtra.cmake"

- name: Set up OpenJDK 11
- name: Set up OpenJDK 17
uses: actions/setup-java@v4
with:
distribution: adopt
java-version: 11
java-version: 17

- name: Setup ninja
uses: seanmiddleditch/gha-setup-ninja@v4

- name: Set up ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: Android_QMapLibre_${{ matrix.qt_version }}_${{ matrix.abi }}
key: Android_${{ matrix.qt_version }}_${{ matrix.abi }}
max-size: 200M

- name: Build QMapLibre
- name: Build
env:
ANDROID_ABI: ${{ matrix.abi }}
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" \
-DQT_HOST_PATH="$(readlink -f "$Qt6_DIR/../gcc_64")"
ninja
ninja install

- name: Compress installation
run: |
pushd install
tar cjvf ../QMapLibre_Android.tar.bz2 *
popd
export QT_HOST_PATH="$(readlink -f "$Qt6_DIR/../gcc_64")"
cmake --workflow --preset Android-ccache

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: QMapLibre_Android_${{ matrix.qt_version }}_${{ matrix.abi }}
path: QMapLibre_Android.tar.bz2
name: Android_${{ matrix.qt_version }}_${{ matrix.abi }}
path: build/qt6-Android/maplibre-native-qt_*_Android.tar.bz2

combine:
name: Combine QMapLibre
name: Combine
runs-on: ubuntu-22.04
needs: build
strategy:
Expand All @@ -158,50 +145,63 @@ jobs:
- name: Download artifacts for x86
uses: actions/download-artifact@v4
with:
name: QMapLibre_Android_${{ matrix.qt_version}}_x86
path: x86
name: Android_${{ matrix.qt_version}}_x86
path: install/x86

- name: Download artifacts for x86_64
uses: actions/download-artifact@v4
with:
name: QMapLibre_Android_${{ matrix.qt_version}}_x86_64
path: x86_64
name: Android_${{ matrix.qt_version}}_x86_64
path: install/x86_64

- name: Download artifacts for armeabi-v7a
uses: actions/download-artifact@v4
with:
name: QMapLibre_Android_${{ matrix.qt_version}}_armeabi-v7a
path: armeabi-v7a
name: Android_${{ matrix.qt_version}}_armeabi-v7a
path: install/armeabi-v7a

- name: Download artifacts for arm64-v8a
uses: actions/download-artifact@v4
with:
name: QMapLibre_Android_${{ matrix.qt_version}}_arm64-v8a
path: arm64-v8a
name: Android_${{ matrix.qt_version}}_arm64-v8a
path: install/arm64-v8a

- name: Combine artifacts
run: |
mkdir install && pushd install
tar xf ../x86/QMapLibre_Android.tar.bz2
tar xf ../x86_64/QMapLibre_Android.tar.bz2
tar xf ../armeabi-v7a/QMapLibre_Android.tar.bz2
tar xf ../arm64-v8a/QMapLibre_Android.tar.bz2
pushd install

tar xf x86/*.tar.bz2 -C x86/
mv x86/maplibre-native-qt_*/* x86/
rm -r x86/maplibre-native-qt_*

tar xf x86_64/*.tar.bz2 -C x86_64/
mv x86_64/maplibre-native-qt_*/* x86_64/
rm -r x86_64/maplibre-native-qt_*

tar xf armeabi-v7a/*.tar.bz2 -C armeabi-v7a/
mv armeabi-v7a/maplibre-native-qt_*/* armeabi-v7a/
rm -r armeabi-v7a/maplibre-native-qt_*

tar xf arm64-v8a/*.tar.bz2 -C arm64-v8a/
mv arm64-v8a/maplibre-native-qt_*/* arm64-v8a/
rm -r arm64-v8a/maplibre-native-qt_*

popd

- name: Create artifacts
run: |
pushd install
tar cjvf ../QMapLibre_Android.tar.bz2 *
tar cjvf ../maplibre-native-qt_Android.tar.bz2 *
popd

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: QMapLibre_Android_${{ matrix.qt_version}}
path: QMapLibre_Android.tar.bz2
name: Android_${{ matrix.qt_version}}
path: maplibre-native-qt_Android.tar.bz2

release:
name: Release QMapLibre
name: Release
if: github.ref_type == 'tag'
runs-on: ubuntu-22.04
needs: combine
Expand All @@ -215,18 +215,18 @@ jobs:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: QMapLibre_Android_${{ matrix.qt_version }}
name: Android_${{ matrix.qt_version }}

- name: Make tarball
- name: Rename tarball
env:
TAG_NAME: ${{ github.ref_name }}
QT_VERSION: ${{ matrix.qt_version }}
run: |
mv QMapLibre_Android.tar.bz2 QMapLibre_${TAG_NAME}_Qt${QT_VERSION}_Android.tar.bz2
mv maplibre-native-qt_Android.tar.bz2 maplibre-native-qt_${TAG_NAME}_Qt${QT_VERSION}_Android.tar.bz2

- name: Release
uses: ncipollo/release-action@v1
with:
artifacts: QMapLibre_${{ github.ref_name }}_Qt${{ matrix.qt_version }}_Android.tar.bz2
artifacts: maplibre-native-qt_${{ github.ref_name }}_Qt${{ matrix.qt_version }}_Android.tar.bz2
allowUpdates: true
draft: true
Loading
Loading