Skip to content

Update CMakeLists.txt #556

Update CMakeLists.txt

Update CMakeLists.txt #556

Workflow file for this run

name: Build and test
on:
push:
pull_request:
release:
workflow_dispatch:
jobs:
build:
name: "g++ ${{matrix.gcc}}, swig ${{matrix.swig}}, shared ${{matrix.shared}}, ${{matrix.build_type}}"
runs-on: ubuntu-latest
container: "osgeo/gdal:ubuntu-full-${{ matrix.gdal }}"
strategy:
fail-fast: false
matrix:
gcc: [9, 10, 11, 12]
gdal: ["3.6.3"]
swig: ["v4.0.0", "v4.0.1", "v4.0.2", "v4.1.0", "v4.1.1", "v4.2.0", "v4.2.1"]
shared: ["ON"]
generators: ["Unix Makefiles"]
build_type: ["Debug", "Release"]
include:
- gcc: 12
gdal: "3.6.2"
swig: "v4.2.1"
shared: "OFF"
generators: "Unix Makefiles"
build_type: "Release"
steps:
- uses: actions/checkout@v4
- name: Print env
run: |
echo github.event.action: ${{ github.event.action }}
echo github.event_name: ${{ github.event_name }}
- uses: lukka/get-cmake@latest
- name: Ubuntu system dependencies
run: |
export DEBIAN_FRONTEND=noninteractive
apt-get update --allow-insecure-repositories -y
apt-get install -y --allow-unauthenticated --no-install-recommends ca-certificates
apt-get install -y --allow-unauthenticated --no-install-recommends build-essential doxygen g++-${{ matrix.gcc }} gcc-${{ matrix.gcc }} gnuplot git lcov libboost-dev libeigen3-dev libgeos-dev libgtest-dev libpython3-dev libtbb-dev python3 python3-matplotlib python3-pip python3-pytest python3-tk libtinyxml2-dev libtinyxml2-9 nlohmann-json3-dev
python3 -m pip install gcovr setuptools
# Solve issue with matplotlib
python3 -c "import matplotlib"
echo "backend: Agg" > ~/.config/matplotlib/matplotlibrc
# Install Gtest
cd /usr/src/gtest
cmake CMakeLists.txt
make
cp *.a /usr/lib/ 2>\dev\null || :
cp lib/*.a /usr/lib/ 2>\dev\null || :
ln -s /usr/lib/libgtest.a /usr/local/lib/libgtest.a
ln -s /usr/lib/libgtest_main.a /usr/local/lib/libgtest_main.a
# Install swig
apt-get install -y --allow-unauthenticated --no-install-recommends autoconf automake autotools-dev bison libpcre3 libpcre3-dev libpcre2-dev
cd /
mkdir folder_to_compile_swig
cd folder_to_compile_swig
git clone --depth 1 --branch ${{ matrix.swig }} https://github.com/swig/swig.git
cd swig
./autogen.sh
./configure
make -j2
make install
- name: Configure GDAL
shell: bash
run: |
mkdir -p /usr/include/new_gdal
cp -r /usr/include/gdal* /usr/include/new_gdal/
cp /usr/include/ogr* /usr/include/new_gdal/
cp /usr/include/cpl* /usr/include/new_gdal/
mv /usr/include/new_gdal/ /usr/include/gdal/
- name: Configure Or-tools
shell: bash
run: |
wget https://github.com/google/or-tools/releases/download/v9.9/or-tools_amd64_ubuntu-22.04_cpp_v9.9.3963.tar.gz -q -O /tmp/ortools.tar.gz
mkdir -p /tmp/ortools
tar -zxf /tmp/ortools.tar.gz -C /tmp/ortools --strip-components=1
cp -r /tmp/ortools/bin/. /usr/bin
cp -r /tmp/ortools/include/. /usr/include
cp -r /tmp/ortools/lib/. /usr/lib
cp -r /tmp/ortools/lib/cmake/. /usr/share
cp -r /tmp/ortools/share/. /usr/share/ortools
- name: Configure
working-directory: ${{github.workspace}}
shell: bash
run: |
mkdir build
mkdir instdir
cd build
cmake \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-G "${{matrix.generators}}" \
-D CMAKE_C_COMPILER=gcc-${{ matrix.gcc }} \
-D CMAKE_CXX_COMPILER=g++-${{ matrix.gcc }} \
-DCMAKE_INSTALL_PREFIX:PATH=../instdir \
-DBUILD_PYTHON=ON \
-DALLOW_PARALLELIZATION=ON \
-DBUILD_TUTORIALS=OFF \
-DBUILD_TESTS=ON \
-DBUILD_DOC=OFF \
-DBUILD_SHARED_LIBS={{ matrix.shared }} \
-DUSE_ORTOOLS_RELEASE=ON \
..
- name: Build
working-directory: ${{github.workspace}}/build
run: make -j2
- name: Install Strip
working-directory: ${{github.workspace}}/build
run: |
export LC_CTYPE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=C.UTF-8
make install
- name: Test C++
working-directory: ${{github.workspace}}/build
run: make check
- name: Test Python
working-directory: ${{github.workspace}}
run: PYTHONPATH=${PYTHONPATH}:instdir/lib/python$(python3 -c 'import sys; print("%i.%i" % (sys.version_info.major, sys.version_info.minor))')/site-packages pytest-3 tests/python/