-
Notifications
You must be signed in to change notification settings - Fork 115
142 lines (124 loc) · 4.63 KB
/
windows.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: Windows
on:
push:
branches:
- main
pull_request:
types: [ assigned, opened, synchronize, reopened ]
release:
types: [ published, edited ]
jobs:
build:
name: ${{ matrix.config.os }} ${{ matrix.config.cmakeBuildType }} ${{ matrix.config.cudaEnabled && 'CUDA' || '' }}
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
config: [
{
os: windows-2019,
cmakeBuildType: Release,
cudaEnabled: false,
testsEnabled: true,
exportPackage: false,
},
{
os: windows-2022,
cmakeBuildType: Release,
cudaEnabled: false,
testsEnabled: true,
exportPackage: true,
},
]
env:
COMPILER_CACHE_VERSION: 1
COMPILER_CACHE_DIR: ${{ github.workspace }}/compiler-cache
CCACHE_DIR: ${{ github.workspace }}/compiler-cache/ccache
CCACHE_BASEDIR: ${{ github.workspace }}
VCPKG_COMMIT_ID: e01906b2ba7e645a76ee021a19de616edc98d29f
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
steps:
- uses: actions/checkout@v4
- name: Export GitHub Actions cache env
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Compiler cache
uses: actions/cache@v4
id: cache-builds
with:
key: v${{ env.COMPILER_CACHE_VERSION }}-${{ matrix.config.os }}-${{ matrix.config.cmakeBuildType }}-${{ matrix.config.asanEnabled }}--${{ matrix.config.cudaEnabled }}-${{ github.run_id }}-${{ github.run_number }}
restore-keys: v${{ env.COMPILER_CACHE_VERSION }}-${{ matrix.config.os }}-${{ matrix.config.cmakeBuildType }}-${{ matrix.config.asanEnabled }}--${{ matrix.config.cudaEnabled }}
path: ${{ env.COMPILER_CACHE_DIR }}
- name: Install ccache
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path "${{ env.CCACHE_DIR }}"
echo "${{ env.COMPILER_CACHE_DIR }}/bin" | Out-File -Encoding utf8 -Append -FilePath $env:GITHUB_PATH
if (Test-Path -PathType Leaf "${{ env.COMPILER_CACHE_DIR }}/bin/ccache.exe") {
exit
}
.github/workflows/install-ccache.ps1 -Destination "${{ env.COMPILER_CACHE_DIR }}/bin"
- name: Install CMake and Ninja
uses: lukka/get-cmake@latest
- name: Setup vcpkg
shell: pwsh
run: |
./scripts/shell/enter_vs_dev_shell.ps1
cd ${{ github.workspace }}
git clone https://github.com/microsoft/vcpkg
cd vcpkg
git reset --hard ${{ env.VCPKG_COMMIT_ID }}
./bootstrap-vcpkg.bat
- name: Configure and build
shell: pwsh
run: |
./scripts/shell/enter_vs_dev_shell.ps1
cd ${{ github.workspace }}
./vcpkg/vcpkg.exe integrate install
mkdir build
cd build
cmake .. `
-GNinja `
-DCMAKE_MAKE_PROGRAM=ninja `
-DCMAKE_BUILD_TYPE=Release `
-DTESTS_ENABLED=ON `
-DCUDA_ENABLED=OFF `
-DGUI_ENABLED=OFF `
-DCGAL_ENABLED=OFF `
-DCMAKE_CUDA_ARCHITECTURES=all-major `
-DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" `
-DVCPKG_TARGET_TRIPLET=x64-windows-release `
-DCMAKE_INSTALL_PREFIX=install
ninja
- name: Run tests
shell: pwsh
run: |
./vcpkg/vcpkg.exe integrate install
cd build
ctest -E .+colmap_.* --output-on-failure
- name: Export package
if: matrix.config.exportPackage
shell: pwsh
run: |
./vcpkg/vcpkg.exe integrate install
cd build
ninja install
../vcpkg/vcpkg.exe install `
--triplet=x64-windows-release
../vcpkg/vcpkg.exe export --raw --output-dir vcpkg_export --output glomap
cp vcpkg_export/glomap/installed/x64-windows/bin/*.dll install/bin
cp vcpkg_export/glomap/installed/x64-windows-release/bin/*.dll install/bin
- name: Upload package
uses: actions/upload-artifact@v4
if: ${{ matrix.config.exportPackage }}
with:
name: glomap-x64-windows
path: build/install
- name: Cleanup compiler cache
shell: pwsh
run: |
ccache --show-stats --verbose
ccache --evict-older-than 1d
ccache --show-stats --verbose