[qt] Add a test for library usage (#538)

This commit is contained in:
Tadej Novak
2022-10-24 08:39:08 +02:00
committed by GitHub
parent e12c4d6be4
commit e64b5b111b
3 changed files with 87 additions and 1 deletions

View File

@@ -18,3 +18,5 @@ qt-cmake ../source/ \
-DMBGL_QT_LIBRARY_ONLY=ON
ninja
ninja install
cd ../install
ln -s lib64 lib

View File

@@ -236,11 +236,65 @@ jobs:
name: maplibre-gl-native_${{ matrix.name }}_Qt${{ matrix.qt_version }}
path: maplibre-gl-native_${{ matrix.name }}_Qt${{ matrix.qt_version }}.tar.bz2
test-tarball:
needs: build
strategy:
matrix:
include:
- name: Linux
os: ubuntu-22.04
qt_version: 6.4.0
qt_target: desktop
- name: macOS
os: macos-12
qt_version: 6.4.0
qt_target: desktop
runs-on: ${{ matrix.os }}
env:
QT_ARCH: ${{ matrix.name }}
QT_VERSION: ${{ matrix.qt_version }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
path: source
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: maplibre-gl-native_${{ matrix.name }}_Qt${{ matrix.qt_version }}
- name: Download Qt
uses: jurplel/install-qt-action@v3
with:
aqtversion: ==2.1.*
version: ${{ env.QT_VERSION }}
dir: ${{ github.workspace }}
target: ${{ matrix.qt_target }}
- name: Setup Xcode
if: runner.os == 'macOS'
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Build test app
run: |
mkdir install && cd install
tar xf ../maplibre-gl-native_${QT_ARCH}_Qt${QT_VERSION}.tar.bz2
cd ..
export CMAKE_PREFIX_PATH=$PWD/install
mkdir build && cd build
cmake ../source/platform/qt/app/
make
release:
name: Release QMapLibreGL
if: github.ref_type == 'tag'
runs-on: ubuntu-22.04
needs: build
needs: test-tarball
strategy:
max-parallel: 1
matrix:

View File

@@ -0,0 +1,30 @@
# minimal CMakeLists.txt for QMapLibreGL usage
cmake_minimum_required(VERSION 3.16)
project(hellomaplibre VERSION 1.0.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(APPLE) # suppress some warnings in Qt6
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
endif()
find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGLWidgets Widgets)
qt_standard_project_setup()
find_package(QMapLibreGL REQUIRED)
add_executable(hellomaplibre
main.cpp
mapwindow.cpp
mapwindow.hpp
)
target_link_libraries(hellomaplibre
PRIVATE
Qt6::Core
Qt6::Gui
Qt6::OpenGLWidgets
Qt6::Widgets
QMapLibreGL
)