Skip to content
32 changes: 9 additions & 23 deletions .github/workflows/ci_tests_dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,44 +103,30 @@ jobs:

# Build GMT from source on Linux/macOS, script is adapted from
# https://github.com/GenericMappingTools/gmt/blob/6.5.0/ci/build-gmt.sh
- name: Build GMT on Linux/macOS
run: |
cd gmt/
mkdir build
cd build
cmake -G Ninja .. \
-DCMAKE_INSTALL_PREFIX=${GMT_INSTALL_DIR} \
-DCMAKE_BUILD_TYPE=Release \
-DGMT_ENABLE_OPENMP=TRUE \
-DGMT_USE_THREADS=TRUE
cmake --build .
cmake --build . --target install
cd ..
rm -rf gmt/
env:
GMT_INSTALL_DIR: ${{ runner.temp }}/gmt-install-dir
if: runner.os != 'Windows'

- name: Build GMT on Windows
- name: Build GMT from source
shell: bash
run: |
cd gmt/
mkdir build
cd build
cmd.exe /c "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
if [[ "$RUNNER_OS" == "Windows" ]]; then
cmd.exe /c "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
CMAKE_PREFIX_PATH="$MAMBA_ROOT_PREFIX/envs/pygmt/Library"
else
CMAKE_PREFIX_PATH="$MAMBA_ROOT_PREFIX/envs/pygmt"
fi
cmake -G Ninja .. \
-DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \
-DCMAKE_INSTALL_PREFIX="$GMT_INSTALL_DIR" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="$MAMBA_ROOT_PREFIX/envs/pygmt/Library" \
-DGMT_ENABLE_OPENMP=TRUE \
-DGMT_USE_THREADS=TRUE
cmake --build .
cmake --build . --target install
cd ..
rm -rf gmt/
rm -rf build
env:
GMT_INSTALL_DIR: ${{ runner.temp }}/gmt-install-dir
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See if this would work, based on https://docs.github.com/en/actions/reference/workflows-and-actions/expressions#example

Suggested change
GMT_INSTALL_DIR: ${{ runner.temp }}/gmt-install-dir
CMAKE_PREFIX_PATH: ${{ startsWith(matrix.os, 'windows') && '' || '-DCMAKE_PREFIX_PATH=$MAMBA_ROOT_PREFIX/envs/pygmt/Library' }}
GMT_INSTALL_DIR: ${{ runner.temp }}/gmt-install-dir

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't try this, because now we need to set CMAKE_PREFIX_PATH to different values based on the OS.

if: runner.os == 'Windows'

- name: Add GMT's bin to PATH
run: echo '${{ runner.temp }}/gmt-install-dir/bin' >> $GITHUB_PATH
Expand Down
Loading