Skip to content

Commit 3de812a

Browse files
committed
Install and use llvm-19 on unix CI
MSVC supports CXX_MODULES too, give it a try
1 parent 96a0e72 commit 3de812a

File tree

3 files changed

+48
-22
lines changed

3 files changed

+48
-22
lines changed

.github/workflows/cmake.yml

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ jobs:
2424
- name: Install codespell
2525
run: pip3 install codespell
2626

27-
- name: Lint
28-
if: always()
29-
working-directory: asio
30-
run: cmake -D FORMAT_COMMAND=clang-format-18 -P cmake/lint.cmake || echo ignored
27+
# - name: Lint
28+
# if: always()
29+
# working-directory: asio
30+
# run: cmake -D FORMAT_COMMAND=clang-format-18 -P cmake/lint.cmake || echo ignored
3131

3232
- name: Spell check
3333
if: always()
@@ -58,11 +58,11 @@ jobs:
5858

5959
- name: Build
6060
working-directory: asio
61-
run: cmake --build build/coverage -j 2
61+
run: cmake --build build/coverage -j 4
6262

6363
- name: Test
6464
working-directory: asio/build/coverage
65-
run: ctest --output-on-failure --no-tests=error -j 2
65+
run: ctest --output-on-failure --no-tests=error -j 4
6666

6767
- name: Process coverage info
6868
working-directory: asio
@@ -89,7 +89,7 @@ jobs:
8989

9090
- name: Build
9191
working-directory: asio
92-
run: cmake --build build/sanitize -j 2
92+
run: cmake --build build/sanitize -j 4
9393

9494
- name: Test
9595
working-directory: asio/build/sanitize
@@ -100,12 +100,13 @@ jobs:
100100
strict_init_order=1:\
101101
detect_leaks=1"
102102
UBSAN_OPTIONS: print_stacktrace=1
103-
run: ctest --output-on-failure --no-tests=error -j 2
103+
run: ctest --output-on-failure --no-tests=error -j 4
104104

105105
test:
106106
needs: [lint]
107107

108108
strategy:
109+
fail-fast: false
109110
matrix:
110111
os: [macos-15, ubuntu-24.04, windows-2022]
111112

@@ -116,35 +117,58 @@ jobs:
116117

117118
- name: Install static analyzers
118119
if: matrix.os == 'ubuntu-24.04'
119-
run: >-
120-
sudo apt-get install clang-tidy-18 cppcheck -y -q
121-
122-
sudo update-alternatives --install
123-
/usr/bin/clang-tidy clang-tidy
124-
/usr/bin/clang-tidy-18 150
120+
run: |
121+
sudo apt-get install cppcheck ninja-build -y -q
122+
wget https://apt.llvm.org/llvm.sh
123+
chmod +x llvm.sh
124+
sudo ./llvm.sh 19 all
125+
sudo update-alternatives --install \
126+
/usr/bin/clang-tidy clang-tidy \
127+
/usr/bin/clang-tidy-19 150
128+
129+
- name: Install llvm-19
130+
if: startsWith(matrix.os, 'macos')
131+
run: |
132+
brew install llvm@19
133+
echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> /Users/runner/.envrc
134+
echo 'export LDFLAGS="-L/opt/homebrew/opt/llvm/lib"' >> /Users/runner/.envrc
135+
echo 'export CPPFLAGS="-L/opt/homebrew/opt/llvm/include"' >> /Users/runner/.envrc
125136
126-
- name: Setup MultiToolTask
137+
- name: Configure windows
127138
if: matrix.os == 'windows-2022'
139+
working-directory: asio
128140
run: |
129141
Add-Content "$env:GITHUB_ENV" 'UseMultiToolTask=true'
130142
Add-Content "$env:GITHUB_ENV" 'EnforceProcessCountAcrossBuilds=true'
143+
cmake --preset=ci-windows
131144
132-
- name: Configure
133-
shell: pwsh
145+
- name: Configure macos
146+
if: matrix.os == 'macos-15'
147+
working-directory: asio
148+
shell: bash
149+
run: |
150+
source /Users/runner/.envrc
151+
which clang++ && clang++ --version
152+
CXX=$(brew --prefix llvm@19)/bin/clang++ cmake --preset=ci-macos
153+
154+
- name: Configure ubuntu
155+
if: matrix.os == 'ubuntu-24.04'
134156
working-directory: asio
135-
run: cmake "--preset=ci-$("${{ matrix.os }}".split("-")[0])"
157+
env:
158+
CXX: clang++-19
159+
run: cmake --preset=ci-ubuntu
136160

137161
- name: Build
138162
working-directory: asio
139-
run: cmake --build build --config Release -j 2
163+
run: cmake --build build --config Release -j 4
140164

141165
- name: Install
142166
working-directory: asio
143167
run: cmake --install build --config Release --prefix prefix
144168

145169
- name: Test
146170
working-directory: asio/build
147-
run: ctest --output-on-failure --no-tests=error -C Release -j 2
171+
run: ctest --output-on-failure --no-tests=error -C Release -j 4
148172

149173
docs:
150174
# Deploy docs only when builds succeed

asio/CMakePresets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"hidden": true,
6060
"cacheVariables": {
6161
"CMAKE_CXX_FLAGS":
62-
"-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -fcf-protection=full -fstack-clash-protection -Wall -Wextra -Wpedantic -Wno-conversion -Wno-sign-conversion -Wcast-qual -Wformat=2 -Wundef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wimplicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wno-old-style-cast",
62+
"-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -fcf-protection=full -fstack-clash-protection -Wall -Wextra -Wpedantic -Wno-conversion -Wno-sign-conversion -Wcast-qual -Wformat=2 -Wundef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wno-implicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wno-old-style-cast",
6363
"CMAKE_EXE_LINKER_FLAGS":
6464
"-Wl,--allow-shlib-undefined,--as-needed,-z,noexecstack,-z,relro,-z,now",
6565
"CMAKE_SHARED_LINKER_FLAGS":

asio/src/examples/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ if(PROJECT_IS_TOP_LEVEL)
2323
add_link_options(-stdlib=libc++)
2424
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 15.0)
2525
set(USE_MODULES TRUE)
26+
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
27+
set(USE_MODULES TRUE)
2628
endif()
2729
message(STATUS "CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES=${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}")
2830
endif()
@@ -34,7 +36,7 @@ if(PROJECT_IS_TOP_LEVEL)
3436
endif()
3537

3638
# set(ALL_EXAMPLES cpp20/operations/callback_wrapper.cpp)
37-
# set(ALL_EXAMPLES module/tests/main.cpp)
39+
# list(APPEND ALL_EXAMPLES ../../module/tests/main.cpp)
3840
set(ALL_EXAMPLES main)
3941

4042
message(STATUS "Examples to be built: ${ALL_EXAMPLES}")

0 commit comments

Comments
 (0)