Skip to content

Commit c12df29

Browse files
HuidaeChorkanavathnetelerlbartolettiaaronsms
authored
cmake: initial commit adding CMake support
Based on original work by Rashad Kanavath in 2020 with pull request: #289 This update introduces preliminary support for building and installing GRASS GIS using CMake across multiple platforms, including Windows with MSVS, Linux, and macOS. The installation can be performed using either the traditional GRASS file structure or a structure that complies with the Filesystem Hierarchy Standard (FHS). Co-authored-by: Rashad Kanavath <[email protected]> Co-authored-by: Markus Neteler <[email protected]> Co-authored-by: Loïc Bartoletti <[email protected]> Co-authored-by: Aaron Saw <[email protected]> Co-authored-by: Nicklas Larsson <[email protected]> Co-authored-by: Huidae Cho <[email protected]> Co-authored-by: Mahesh Maddineni <[email protected]> Co-authored-by: Kandel Nelson <[email protected]> Co-authored-by: Edouard Choinière <[email protected]>
1 parent b7bf228 commit c12df29

File tree

172 files changed

+12056
-122
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

172 files changed

+12056
-122
lines changed

.github/workflows/cmake.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
---
2+
name: CMake
3+
4+
on:
5+
push:
6+
paths-ignore:
7+
- 'doc/**'
8+
branches:
9+
- main
10+
- releasebranch_*
11+
pull_request:
12+
paths-ignore:
13+
- 'doc/**'
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
17+
cancel-in-progress: true
18+
19+
env:
20+
CMAKE_UNITY_BUILD: OFF
21+
22+
permissions:
23+
contents: read
24+
25+
jobs:
26+
27+
build-cmake:
28+
runs-on: ubuntu-22.04
29+
env:
30+
CMakeVersion: "3.16.0"
31+
steps:
32+
- name: Checkout GRASS
33+
uses: actions/[email protected]
34+
- name: Install CMake
35+
run: |
36+
cd ${GITHUB_WORKSPACE}
37+
arch=$(uname -s)-$(uname -m)
38+
wget https://github.com/Kitware/CMake/releases/download/v3.16.0/cmake-3.16.0-${arch}.tar.gz
39+
tar xzf cmake-${{ env.CMakeVersion }}-${arch}.tar.gz
40+
echo "CMAKE_DIR=$GITHUB_WORKSPACE/cmake-${{ env.CMakeVersion }}-${arch}/bin" >> $GITHUB_ENV
41+
echo "$GITHUB_WORKSPACE/cmake-${{ env.CMakeVersion }}-${arch}/bin" >> $GITHUB_PATH
42+
- run: |
43+
cmake --version
44+
- name: Install dependencies
45+
run: |
46+
sudo apt-get update -y
47+
sudo apt-get install -y wget git gawk findutils ninja-build
48+
xargs -a <(awk '! /^ *(#|$)/' ".github/workflows/apt.txt") -r -- \
49+
sudo apt-get install -y --no-install-recommends --no-install-suggests
50+
- name: Print build environment variables
51+
shell: bash -el {0}
52+
run: |
53+
printenv | sort
54+
gcc --version
55+
ldd --version
56+
- name: Create installation directory
57+
run: |
58+
mkdir $HOME/install
59+
- name: Configure
60+
run: |
61+
cmake ${CMAKE_OPTIONS} -S $GITHUB_WORKSPACE -B $GITHUB_WORKSPACE/build -G Ninja \
62+
-DCMAKE_C_FLAGS="-I/usr/include -I/usr/include/gdal" \
63+
-DCMAKE_CXX_FLAGS="-I/usr/include -I/usr/include/gdal" \
64+
-DCMAKE_INSTALL_PREFIX=$HOME/install -DWITH_NLS=OFF -DWITH_GUI=OFF -DWITH_DOCS=OFF
65+
- name: Print CMakeCache.txt
66+
shell: bash -el {0}
67+
run: |
68+
cat ${GITHUB_WORKSPACE}/build/CMakeCache.txt
69+
- name: Build
70+
run: |
71+
cmake --build build --verbose -j$(nproc)
72+
- name: Install
73+
run: |
74+
cmake --install $GITHUB_WORKSPACE/build --verbose
75+
- name: Add the bin directory to PATH
76+
run: |
77+
echo "$HOME/install/bin" >> $GITHUB_PATH
78+
- name: Print installed versions
79+
if: always()
80+
run: .github/workflows/print_versions.sh
81+
- name: Test executing of the grass command
82+
run: .github/workflows/test_simple.sh
83+
- name: Run tests
84+
run: .github/workflows/test_thorough.sh --config .gunittest.cfg --min-success 72
85+
- name: Make HTML test report available
86+
if: ${{ !cancelled() }}
87+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
88+
with:
89+
name: testreport-CMake
90+
path: testreport
91+
retention-days: 3

0 commit comments

Comments
 (0)