-
Notifications
You must be signed in to change notification settings - Fork 30
138 lines (120 loc) · 5.2 KB
/
cmake.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
name: CMake
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
name: ${{ matrix.settings.name }} ${{ matrix.configuration }}
runs-on: ${{ matrix.settings.os }}
strategy:
matrix:
configuration: [ "Release", "Debug" ]
settings:
- {
name: "Ubuntu GCC-12",
os: ubuntu-latest,
compiler: { type: GCC, version: 12, conan: "gcc", cc: "gcc-12", cxx: "g++-12", std: 20 },
lib: "libstdc++11"
}
# - {
# name: "Ubuntu Clang-15 + libc++",
# os: ubuntu-latest,
# compiler: { type: CLANG, version: 15, conan: "clang", cc: "clang-15", cxx: "clang++-15", std: 20, toolchain: "clang-libc++.cmake" },
# lib: "libc++",
# }
- {
name: "Visual Studio 2019",
os: windows-latest,
compiler: { type: VISUAL, version: 16, conan: "mscv", cc: "cl", cxx: "cl", std: 20 },
}
steps:
- uses: actions/checkout@v2
- uses: seanmiddleditch/gha-setup-ninja@master
- name: Cache Conan data
uses: actions/cache@v3
env:
cache-name: cache-conan-data
with:
path: ${{github.workspace}}/.conan2/p
key: ${{ hashFiles('**/conanfile.py') }}-build-${{ matrix.settings.os }}-${{ matrix.configuration }}-${{ matrix.settings.compiler.conan }}-${{ matrix.settings.compiler.version }}-${{ matrix.settings.lib }}
restore-keys: |
${{ hashFiles('**/conanfile.py') }}-build-${{ matrix.settings.os }}-${{ matrix.configuration }}-${{ matrix.settings.compiler.conan }}-${{ matrix.settings.compiler.version }}-
${{ hashFiles('**/conanfile.py') }}-build-${{ matrix.settings.os }}-${{ matrix.configuration }}-${{ matrix.settings.compiler.conan }}-
${{ hashFiles('**/conanfile.py') }}-build-${{ matrix.settings.os }}-${{ matrix.configuration }}-
${{ hashFiles('**/conanfile.py') }}-build-${{ matrix.settings.os }}-
- name: Add msbuild to PATH
if: matrix.settings.os == 'windows-latest'
uses: microsoft/[email protected]
with:
vs-version: "16.5"
- name: Install Latest GCC
if: matrix.settings.compiler.type == 'GCC'
uses: egor-tensin/setup-gcc@v1
with:
version: ${{ matrix.settings.compiler.version }}
platform: x64
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11'
- name: Install Conan Package Tools
run: |
pip install -U conan
- name: Configure Conan
shell: bash
run: |
conan profile detect --force
sed -i.backup '/^\[settings\]$/,/^\[/ s/^build_type=.*/build_type=${{ matrix.configuration }}/' .conan2/profiles/default
sed -i.backup '/^\[settings\]$/,/^\[/ s/^compiler.cppstd=.*/compiler.cppstd=${{ matrix.settings.compiler.std }}/' .conan2/profiles/default
if [[ "${{ matrix.settings.compiler.type }}" == "GCC" || "${{ matrix.settings.compiler.type }}" == "CLANG" ]]; then
sed -i.backup '/^\[settings\]$/,/^\[/ s/^compiler=.*/compiler=${{ matrix.settings.compiler.conan }}/' .conan2/profiles/default
sed -i.backup '/^\[settings\]$/,/^\[/ s/^compiler.version=.*/compiler.version=${{ matrix.settings.compiler.version }}/' .conan2/profiles/default
sed -i.backup '/^\[settings\]$/,/^\[/ s/^compiler.libcxx=.*/compiler.libcxx=${{ matrix.settings.lib }}/' .conan2/profiles/default
fi
conan profile show -pr default
- name: Configure Install
shell: bash
run: |
conan install "${{github.workspace}}" --build missing -pr:b default -c tools.cmake.cmaketoolchain:generator="Ninja Multi-Config"
- name: Configure Conan Build
if: matrix.settings.os == 'windows-latest'
shell: cmd
working-directory: ${{github.workspace}}
run: |
call build\generators\conanvcvars.bat
call build\generators\conanbuild.bat
- name: Configure Conan Build
if: matrix.settings.os != 'windows-latest'
shell: bash
working-directory: ${{github.workspace}}
run: |
source build/generators/conanbuild.sh
- name: Configure CMake
if: matrix.settings.os == 'windows-latest'
shell: cmd
run: |
call build\generators\conanbuild.bat
cmake --preset conan-default
- name: Configure CMake
if: matrix.settings.os != 'windows-latest'
shell: bash
run: |
source build/generators/conanbuild.sh
cmake --preset conan-default
- name: Conan Preset
shell: bash
run: echo "CONAN_PRESET=conan-$(echo ${{matrix.configuration}} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Build
if: matrix.settings.os == 'windows-latest'
shell: cmd
run: |
call build\generators\conanbuild.bat
cmake --build --preset ${{ env.CONAN_PRESET }}
- name: Build
if: matrix.settings.os != 'windows-latest'
shell: bash
run: |
source build/generators/conanbuild.sh
cmake --build --preset ${{ env.CONAN_PRESET }}