Skip to content

Commit 5ab6a63

Browse files
committed
Add vcpkg ci
1 parent 36f7736 commit 5ab6a63

File tree

8 files changed

+385
-10
lines changed

8 files changed

+385
-10
lines changed

.github/workflows/linux.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: Linux
2+
on:
3+
pull_request:
4+
branches:
5+
- "*" # Pull request for all branches
6+
schedule:
7+
- cron: '10 12 * * 0'
8+
9+
# Every time you make a push to your PR, it cancel immediately the previous checks,
10+
# and start a new one. The other runner will be available more quickly to your PR.
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
build:
17+
name: vcpkg-ubuntu-${{ matrix.type }}
18+
runs-on: ubuntu-latest
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
include:
23+
- type: x64
24+
BUILD_DIR: gtsam/3rdparty/vcpkg/cache
25+
VCPKG_ROOT: gtsam/3rdparty/vcpkg/cache/vcpkg
26+
VCPKG_LINK: https://github.com/microsoft/vcpkg/
27+
VCPKG_CONFIGS: gtsam/3rdparty/vcpkg
28+
BINARY_CACHE: gtsam/3rdparty/cache/linux
29+
env:
30+
BUILD_DIR: ${{ matrix.BUILD_DIR }}
31+
VCPKG_ROOT: ${{ matrix.VCPKG_ROOT }}
32+
VCPKG_LINK: ${{ matrix.VCPKG_LINK }}
33+
VCPKG_CONFIGS: ${{ matrix.VCPKG_CONFIGS }}
34+
BINARY_CACHE: ${{ matrix.BINARY_CACHE }}
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v3
38+
39+
- name: Cache dependencies
40+
uses: actions/cache/restore@v3
41+
with:
42+
path: |
43+
${{ matrix.BINARY_CACHE }}
44+
key: linux-${{ hashFiles('.github/workflows/linux.yml') }}
45+
restore-keys: linux-${{ hashFiles('.github/workflows/linux.yml') }}
46+
47+
- name: Install ninja
48+
if: success()
49+
run: |
50+
sudo apt install -y ninja-build
51+
ninja --version
52+
whereis ninja
53+
54+
- name: Init vcpkg
55+
if: success()
56+
run: |
57+
mkdir -p $BUILD_DIR
58+
git -C $BUILD_DIR clone $VCPKG_LINK
59+
60+
- name: Vcpkg build & cmake config
61+
if: success()
62+
run: |
63+
export VCPKG_BINARY_SOURCES="clear;files,$PWD/$BINARY_CACHE,readwrite;"
64+
mkdir -p $BINARY_CACHE
65+
export CMAKE_GENERATOR=Ninja
66+
cmake . -B build \
67+
-DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake \
68+
-DVCPKG_MANIFEST_DIR=$VCPKG_CONFIGS/manifest \
69+
-DVCPKG_INSTALLED_DIR=$VCPKG_ROOT/installed \
70+
-DVCPKG_OVERLAY_TRIPLETS=$VCPKG_CONFIGS/triplets \
71+
-DVCPKG_TARGET_TRIPLET=x64-linux-release \
72+
-DVCPKG_INSTALL_OPTIONS=--clean-after-build \
73+
-DGTSAM_BUILD_EXAMPLES_ALWAYS=ON \
74+
-DGTSAM_ROT3_EXPMAP=ON \
75+
-DGTSAM_POSE3_EXPMAP=ON \
76+
-DGTSAM_BUILD_PYTHON=ON \
77+
-DGTSAM_BUILD_TESTS=ON \
78+
-DGTSAM_BUILD_UNSTABLE=ON \
79+
-DGTSAM_USE_SYSTEM_EIGEN=ON \
80+
-DGTSAM_USE_SYSTEM_METIS=ON \
81+
-DGTSAM_SUPPORT_NESTED_DISSECTION=ON
82+
83+
- name: Save cache dependencies
84+
id: cache-save
85+
uses: actions/cache/save@v3
86+
with:
87+
path: |
88+
${{ matrix.BINARY_CACHE }}
89+
key: linux-${{ hashFiles('.github/workflows/linux.yml') }}-${{ hashFiles('gtsam/3rdparty/vcpkg/cache/vcpkg/installed/vcpkg/updates/*') }}
90+
91+
92+
- name: Cmake build
93+
if: success()
94+
run: |
95+
cmake --build build --config Release -j 2
96+
97+
- name: Run tests
98+
if: success()
99+
run: |
100+
# metis test are failing. remove this comment when fix it.
101+
# cmake --build build --target check -j 2

.github/workflows/osx.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: OSX
2+
on:
3+
pull_request:
4+
branches:
5+
- "*" # Pull request for all branches
6+
schedule:
7+
- cron: '10 12 * * 0'
8+
9+
# Every time you make a push to your PR, it cancel immediately the previous checks,
10+
# and start a new one. The other runner will be available more quickly to your PR.
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
build:
17+
name: vcpkg-macos-${{ matrix.type }}
18+
runs-on: macos-latest
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
include:
23+
- type: x64
24+
BUILD_DIR: gtsam/3rdparty/vcpkg/cache
25+
VCPKG_ROOT: gtsam/3rdparty/vcpkg/cache/vcpkg
26+
VCPKG_LINK: https://github.com/microsoft/vcpkg/
27+
VCPKG_CONFIGS: gtsam/3rdparty/vcpkg
28+
BINARY_CACHE: gtsam/3rdparty/cache/osx
29+
env:
30+
BUILD_DIR: ${{ matrix.BUILD_DIR }}
31+
VCPKG_ROOT: ${{ matrix.VCPKG_ROOT }}
32+
VCPKG_LINK: ${{ matrix.VCPKG_LINK }}
33+
VCPKG_CONFIGS: ${{ matrix.VCPKG_CONFIGS }}
34+
BINARY_CACHE: ${{ matrix.BINARY_CACHE }}
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v3
38+
39+
- name: Cache dependencies
40+
uses: actions/cache/restore@v3
41+
with:
42+
path: |
43+
${{ matrix.BINARY_CACHE }}
44+
key: osx-${{ hashFiles('.github/workflows/osx.yml') }}
45+
restore-keys: osx-${{ hashFiles('.github/workflows/osx.yml') }}
46+
47+
- name: Install Dependencies
48+
run: |
49+
sudo xcode-select -switch /Applications/Xcode.app
50+
51+
- name: Install python packages
52+
if: success()
53+
run: |
54+
pip3 install pyparsing
55+
56+
- name: Install ninja
57+
if: success()
58+
run: |
59+
brew install ninja
60+
ninja --version
61+
whereis ninja
62+
63+
- name: Init vcpkg
64+
if: success()
65+
run: |
66+
mkdir -p $BUILD_DIR
67+
git -C $BUILD_DIR clone $VCPKG_LINK
68+
69+
- name: Vcpkg build & cmake config
70+
if: success()
71+
run: |
72+
export VCPKG_BINARY_SOURCES="clear;files,$PWD/$BINARY_CACHE,readwrite;"
73+
mkdir -p $BINARY_CACHE
74+
export CMAKE_GENERATOR=Ninja
75+
cmake . -B build \
76+
-DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake \
77+
-DVCPKG_MANIFEST_DIR=$VCPKG_CONFIGS/manifest \
78+
-DVCPKG_INSTALLED_DIR=$VCPKG_ROOT/installed \
79+
-DVCPKG_OVERLAY_TRIPLETS=$VCPKG_CONFIGS/triplets \
80+
-DVCPKG_TARGET_TRIPLET=x64-osx-release \
81+
-DVCPKG_INSTALL_OPTIONS=--clean-after-build \
82+
-DGTSAM_BUILD_EXAMPLES_ALWAYS=ON \
83+
-DGTSAM_ROT3_EXPMAP=ON \
84+
-DGTSAM_POSE3_EXPMAP=ON \
85+
-DGTSAM_BUILD_PYTHON=ON \
86+
-DGTSAM_BUILD_TESTS=ON \
87+
-DGTSAM_BUILD_UNSTABLE=ON \
88+
-DGTSAM_USE_SYSTEM_EIGEN=ON \
89+
-DGTSAM_USE_SYSTEM_METIS=ON \
90+
-DGTSAM_SUPPORT_NESTED_DISSECTION=ON
91+
92+
- name: Save cache dependencies
93+
id: cache-save
94+
uses: actions/cache/save@v3
95+
with:
96+
path: |
97+
${{ matrix.BINARY_CACHE }}
98+
key: osx-${{ hashFiles('.github/workflows/osx.yml') }}-${{ hashFiles('gtsam/3rdparty/vcpkg/cache/vcpkg/installed/vcpkg/updates/*') }}
99+
100+
- name: Cmake build
101+
if: success()
102+
run: |
103+
cmake --build build --config Release -j 2
104+
105+
- name: Run tests
106+
if: success()
107+
run: |
108+
# metis test are failing. remove this comment when fix it.
109+
# cmake --build build --target check -j 2

.github/workflows/windows.yml

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
name: Windows
2+
on:
3+
pull_request:
4+
branches:
5+
- "*" # Pull request for all branches
6+
schedule:
7+
- cron: '10 12 * * 0'
8+
9+
# Every time you make a push to your PR, it cancel immediately the previous checks,
10+
# and start a new one. The other runner will be available more quickly to your PR.
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
build:
17+
name: vcpkg-windows-${{ matrix.type }}
18+
runs-on: windows-latest
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
include:
23+
- type: x64
24+
BUILD_DIR: gtsam\3rdparty\vcpkg\cache
25+
VCPKG_ROOT: gtsam\3rdparty\vcpkg\cache\vcpkg
26+
VCPKG_LINK: https://github.com/microsoft/vcpkg/
27+
VCPKG_CONFIGS: gtsam\3rdparty\vcpkg
28+
BINARY_CACHE: gtsam\3rdparty\vcpkg\cache\windows
29+
env:
30+
BUILD_DIR: ${{ matrix.BUILD_DIR }}
31+
VCPKG_ROOT: ${{ matrix.VCPKG_ROOT }}
32+
VCPKG_LINK: ${{ matrix.VCPKG_LINK }}
33+
VCPKG_CONFIGS: ${{ matrix.VCPKG_CONFIGS }}
34+
BINARY_CACHE: ${{ matrix.BINARY_CACHE }}
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v3
38+
39+
- name: Restore cache dependencies
40+
uses: actions/cache/restore@v3
41+
with:
42+
path: |
43+
${{ matrix.BINARY_CACHE }}
44+
key: windows-${{ hashFiles('.github/workflows/windows.yml') }}
45+
restore-keys: windows-${{ hashFiles('.github/workflows/windows.yml') }}
46+
47+
- name: Setup msbuild
48+
uses: ilammy/msvc-dev-cmd@v1
49+
with:
50+
arch: x64
51+
52+
- uses: actions/setup-python@v4
53+
with:
54+
python-version: '3.11'
55+
56+
- name: Install python packages
57+
if: success()
58+
shell: cmd
59+
run: |
60+
:: choco install python311
61+
:: where python3.11.exe
62+
:: dir c:\python311
63+
:: C:\ProgramData\Chocolatey\bin\python3.11.exe -m pip --version
64+
:: C:\ProgramData\chocolatey\bin\python3.11.exe -m pip install pyparsing
65+
python --version
66+
python -m pip --version
67+
python -m pip install pyparsing
68+
69+
70+
- name: Install ninja
71+
if: success()
72+
shell: cmd
73+
run: |
74+
choco install ninja
75+
ninja --version
76+
where ninja
77+
78+
- name: Fix vcpkg
79+
run: vcpkg.exe integrate remove
80+
81+
- name: Init vcpkg
82+
if: success()
83+
shell: cmd
84+
run: |
85+
mkdir -p %BUILD_DIR%
86+
git -C %BUILD_DIR% clone %VCPKG_LINK%
87+
88+
- name: Vcpkg build & cmake config
89+
if: success()
90+
shell: cmd
91+
run: |
92+
set VCPKG_ROOT=${{ matrix.VCPKG_ROOT }}
93+
set VCPKG_BINARY_SOURCES=clear;files,%CD%\%BINARY_CACHE%,readwrite;
94+
mkdir %BINARY_CACHE%
95+
set CMAKE_GENERATOR=Ninja
96+
set CL=-openmp:experimental
97+
cmake . -B build ^
98+
-DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%\scripts\buildsystems\vcpkg.cmake ^
99+
-DVCPKG_MANIFEST_DIR=%VCPKG_CONFIGS%\manifest ^
100+
-DVCPKG_INSTALLED_DIR=%VCPKG_ROOT%\installed ^
101+
-DVCPKG_OVERLAY_TRIPLETS=%VCPKG_CONFIGS%\triplets ^
102+
-DVCPKG_TARGET_TRIPLET=x64-windows ^
103+
-DVCPKG_INSTALL_OPTIONS=--clean-after-build ^
104+
-DGTSAM_BUILD_EXAMPLES_ALWAYS=OFF ^
105+
-DGTSAM_ROT3_EXPMAP=ON ^
106+
-DGTSAM_POSE3_EXPMAP=ON ^
107+
-DGTSAM_BUILD_PYTHON=OFF ^
108+
-DGTSAM_BUILD_TESTS=ON ^
109+
-DGTSAM_BUILD_UNSTABLE=OFF ^
110+
-DGTSAM_USE_SYSTEM_EIGEN=ON ^
111+
-DGTSAM_USE_SYSTEM_METIS=ON ^
112+
-DGTSAM_SUPPORT_NESTED_DISSECTION=ON
113+
114+
- name: Save cache dependencies
115+
id: cache-save
116+
uses: actions/cache/save@v3
117+
with:
118+
path: |
119+
${{ matrix.BINARY_CACHE }}
120+
key: windows-${{ hashFiles('.github/workflows/windows.yml') }}-${{ hashFiles('gtsam\3rdparty\vcpkg\cache\vcpkg\installed\vcpkg\updates\*') }}
121+
122+
- name: Cmake build
123+
if: success()
124+
shell: cmd
125+
run: |
126+
cmake --build build --config Release -j 2
127+
128+
- name: Run tests
129+
if: success()
130+
shell: cmd
131+
run: |
132+
:: metis test are failing. remove this comment when fix it.
133+
:: cmake --build build --target check -j 1

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ CMakeLists.txt.user*
1919
xcode/
2020
/Dockerfile
2121
/python/gtsam/notebooks/.ipynb_checkpoints/ellipses-checkpoint.ipynb
22+
gtsam/3rdparty/vcpkg/cache

cmake/HandleMetis.cmake

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ option(GTSAM_USE_SYSTEM_METIS "Find and use system-installed libmetis. If 'off',
1313
if(GTSAM_USE_SYSTEM_METIS)
1414
# Debian package: libmetis-dev
1515

16-
find_path(METIS_INCLUDE_DIR metis.h REQUIRED)
17-
find_library(METIS_LIBRARY metis REQUIRED)
16+
find_package(metis CONFIG REQUIRED)
1817

19-
if(METIS_INCLUDE_DIR AND METIS_LIBRARY)
18+
if(metis_FOUND)
2019
mark_as_advanced(METIS_INCLUDE_DIR)
2120
mark_as_advanced(METIS_LIBRARY)
2221

@@ -27,7 +26,7 @@ if(GTSAM_USE_SYSTEM_METIS)
2726
$<BUILD_INTERFACE:${GTSAM_SOURCE_DIR}/gtsam/3rdparty/metis/libmetis>
2827
$<BUILD_INTERFACE:${GTSAM_SOURCE_DIR}/gtsam/3rdparty/metis/GKlib>
2928
)
30-
target_link_libraries(metis-gtsam-if INTERFACE ${METIS_LIBRARY})
29+
target_link_libraries(metis-gtsam-if INTERFACE ${METIS_LIBRARY} metis)
3130
endif()
3231
else()
3332
# Bundled version:

0 commit comments

Comments
 (0)