Skip to content

Commit e846f46

Browse files
committed
Add vcpkg ci
1 parent 027883e commit e846f46

File tree

2 files changed

+151
-0
lines changed

2 files changed

+151
-0
lines changed

.github/workflows/vcpkg.yml

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
name: vcpkg
2+
on:
3+
pull_request:
4+
5+
# Every time you make a push to your PR, it cancel immediately the previous checks,
6+
# and start a new one. The other runner will be available more quickly to your PR.
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
9+
cancel-in-progress: true
10+
11+
jobs:
12+
build:
13+
name: ${{ matrix.os }}
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
include:
19+
- os: windows-latest
20+
triplet: x64-windows-release
21+
build_type: Release
22+
test_target: RUN_TESTS
23+
binary_cache: C:\Users\runneradmin\AppData\Local\vcpkg\archives
24+
vcpkg_info: C:/vcpkg/installed/vcpkg/info/*
25+
- os: ubuntu-latest
26+
triplet: x64-linux
27+
build_type: Release
28+
test_target: test
29+
binary_cache: /home/runner/.cache/vcpkg/archives
30+
vcpkg_info: /usr/local/share/vcpkg/installed/vcpkg/info/*
31+
- os: macos-latest
32+
triplet: arm64-osx
33+
build_type: Release
34+
test_target: test
35+
binary_cache: /Users/runner/.cache/vcpkg/archives
36+
vcpkg_info: /usr/local/share/vcpkg/installed/vcpkg/info/*
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v4
40+
41+
- name: Restore cache dependencies
42+
uses: actions/cache/restore@v3
43+
with:
44+
path: ${{ matrix.binary_cache }}
45+
key: ${{ matrix.os }}
46+
restore-keys: ${{ matrix.os }}
47+
48+
- name: Setup msbuild
49+
if: runner.os == 'Windows'
50+
uses: ilammy/msvc-dev-cmd@v1
51+
with:
52+
arch: x64
53+
toolset: 14.40
54+
55+
- name: cl version
56+
if: runner.os == 'Windows'
57+
shell: cmd
58+
run: cl
59+
60+
- name: Install vcpkg python dependencies
61+
if: runner.os == 'Linux'
62+
shell: bash
63+
run: |
64+
sudo apt-get install autoconf automake autoconf-archive
65+
66+
- name: Install vcpkg python dependencies
67+
if: runner.os == 'macOS'
68+
shell: bash
69+
run: |
70+
brew install autoconf automake autoconf-archive
71+
72+
- name: "Install dependencies"
73+
run: >
74+
vcpkg x-set-installed --triplet ${{ matrix.triplet }}
75+
boost-assign
76+
boost-bimap
77+
boost-chrono
78+
boost-date-time
79+
boost-filesystem
80+
boost-format
81+
boost-graph
82+
boost-math
83+
boost-program-options
84+
boost-regex
85+
boost-serialization
86+
boost-system
87+
boost-thread
88+
boost-timer
89+
eigen3
90+
metis
91+
tbb
92+
pybind11
93+
geographiclib
94+
95+
- name: copy files for hash
96+
shell: bash
97+
run: |
98+
mkdir -p vcpkg-info
99+
cp ${{ matrix.vcpkg_info }} vcpkg-info
100+
101+
- name: Save cache dependencies
102+
uses: actions/cache/save@v4
103+
with:
104+
path: ${{ matrix.binary_cache }}
105+
key: ${{ matrix.os }}-${{ hashFiles('vcpkg-info/*') }}
106+
107+
- name: Install python packages
108+
if: success()
109+
shell: bash
110+
run: |
111+
$VCPKG_INSTALLATION_ROOT/installed/${{ matrix.triplet }}/tools/python3/python3 -m ensurepip --upgrade
112+
$VCPKG_INSTALLATION_ROOT/installed/${{ matrix.triplet }}/tools/python3/python3 -m pip install -r python/dev_requirements.txt
113+
114+
- name: cmake config
115+
if: success()
116+
shell: bash
117+
run: |
118+
export CL=-openmp:experimental
119+
cmake . -B build -G Ninja \
120+
-DCMAKE_TOOLCHAIN_FILE=$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake \
121+
-DVCPKG_INSTALLED_DIR=$VCPKG_INSTALLATION_ROOT/installed \
122+
-DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} \
123+
-DCMAKE_BUILD_TYPE=Release \
124+
-DGTSAM_BUILD_EXAMPLES_ALWAYS=ON \
125+
-DGTSAM_ROT3_EXPMAP=ON \
126+
-DGTSAM_POSE3_EXPMAP=ON \
127+
-DGTSAM_BUILD_PYTHON=ON \
128+
-DGTSAM_BUILD_TESTS=ON \
129+
-DGTSAM_BUILD_UNSTABLE=OFF \
130+
-DGTSAM_USE_SYSTEM_EIGEN=ON \
131+
-DGTSAM_USE_SYSTEM_METIS=ON \
132+
-DGTSAM_SUPPORT_NESTED_DISSECTION=ON
133+
134+
- name: cmake build
135+
shell: bash
136+
run: |
137+
cmake --build build --config Release -j 2
138+
139+
- name: Run Python tests
140+
shell: bash
141+
run: |
142+
cmake --build build --target python-install
143+
cmake --build build --target python-test
144+
145+
- name: Run tests
146+
shell: bash
147+
run: |
148+
# metis test are failing. remove this comment when fix it.
149+
cmake --build build --target check -j 1

cmake/FindNumPy.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,13 @@
3939
#============================================================================
4040

4141
# Finding NumPy involves calling the Python interpreter
42+
if(NOT PYTHONINTERP_FOUND)s
4243
if(NumPy_FIND_REQUIRED)
4344
find_package(PythonInterp ${GTSAM_PYTHON_VERSION} EXACT REQUIRED)
4445
else()
4546
find_package(PythonInterp ${GTSAM_PYTHON_VERSION} EXACT)
4647
endif()
48+
endif()
4749

4850
if(NOT PYTHONINTERP_FOUND)
4951
set(NUMPY_FOUND FALSE)

0 commit comments

Comments
 (0)