Skip to content

Commit 76bffbc

Browse files
author
Conor
committed
squash multi configuration ci
tmp add nm tmp --remove if no work Revert "tmp --remove if no work" This reverts commit d643bf3. dev flow move to dev presets dont ignore rm ci workflows spell add required add required more flags for debug
1 parent 3d69798 commit 76bffbc

File tree

8 files changed

+188
-83
lines changed

8 files changed

+188
-83
lines changed

.clangd

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
CompileFlags:
2-
CompilationDatabase: build/llvm-brew
3-
2+
CompilationDatabase: build/dev

.github/workflows/linux.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ on:
1010
jobs:
1111
build-and-test:
1212
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
preset: [ci-debug-hardened, ci-release, ci-no-except-rtti]
1317

1418
steps:
1519
- uses: actions/checkout@v6
@@ -20,5 +24,11 @@ jobs:
2024
- name: Install Dependencies
2125
run: brew install cmake ninja gcc catch2
2226

23-
- name: Configure, Build, and Test
24-
run: cmake --workflow --preset gcc-brew
27+
- name: Configure
28+
run: cmake --preset ${{ matrix.preset }} -DCMAKE_TOOLCHAIN_FILE=cmake/gcc-brew-toolchain.cmake
29+
30+
- name: Build
31+
run: cmake --build --preset ${{ matrix.preset }}
32+
33+
- name: Test
34+
run: ctest --preset ${{ matrix.preset }}

.github/workflows/macos.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ on:
1010
jobs:
1111
build-and-test:
1212
runs-on: macos-latest
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
preset: [ci-debug-hardened, ci-release, ci-no-except-rtti]
1317

1418
steps:
1519
- uses: actions/checkout@v6
@@ -20,5 +24,11 @@ jobs:
2024
- name: Install Dependencies
2125
run: brew install cmake ninja llvm catch2
2226

23-
- name: Configure, Build, and Test
24-
run: cmake --workflow --preset llvm-brew
27+
- name: Configure
28+
run: cmake --preset ${{ matrix.preset }} -DCMAKE_TOOLCHAIN_FILE=cmake/llvm-brew-toolchain.cmake
29+
30+
- name: Build
31+
run: cmake --build --preset ${{ matrix.preset }}
32+
33+
- name: Test
34+
run: ctest --preset ${{ matrix.preset }}

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,3 @@ output.png
2626
**/.DS_Store
2727

2828
compile_commands.json
29-
CMakeLists.txt.user
30-
CMakeUserPresets.json

CMakePresets.json

Lines changed: 48 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,62 @@
22
"version": 10,
33
"configurePresets": [
44
{
5-
"name": "llvm-brew",
6-
"displayName": "LLVM (Homebrew)",
7-
"description": "Use Homebrew LLVM compilers",
8-
"binaryDir": "${sourceDir}/build/llvm-brew",
5+
"name": "ci-base",
6+
"hidden": true,
7+
"displayName": "CI Base",
8+
"description": "Base configuration for CI",
99
"generator": "Ninja",
10-
"toolchainFile": "${sourceDir}/cmake/llvm-brew-toolchain.cmake",
10+
"binaryDir": "${sourceDir}/build/${presetName}",
1111
"cacheVariables": {
1212
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
1313
}
1414
},
1515
{
16-
"name": "gcc-brew",
17-
"displayName": "GCC (Homebrew)",
18-
"description": "Use Homebrew GCC compilers",
19-
"binaryDir": "${sourceDir}/build/gcc-brew",
20-
"generator": "Ninja",
21-
"toolchainFile": "${sourceDir}/cmake/gcc-brew-toolchain.cmake",
16+
"name": "ci-debug-hardened",
17+
"inherits": "ci-base",
18+
"displayName": "CI Debug Hardened",
2219
"cacheVariables": {
23-
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
20+
"CMAKE_BUILD_TYPE": "Debug",
21+
"CMAKE_CXX_FLAGS": "-Wall -Wextra -Wpedantic -Wformat -Wformat=2 -Wconversion -Wimplicit-fallthrough -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS -fstrict-flex-arrays=3 -fstack-protector-strong"
22+
}
23+
},
24+
{
25+
"name": "ci-release",
26+
"inherits": "ci-base",
27+
"displayName": "CI Release",
28+
"cacheVariables": {
29+
"CMAKE_BUILD_TYPE": "Release",
30+
"CMAKE_CXX_FLAGS": "-O3 -DNDEBUG -flto"
31+
}
32+
},
33+
{
34+
"name": "ci-no-except-rtti",
35+
"inherits": "ci-base",
36+
"displayName": "CI No Exceptions/RTTI",
37+
"cacheVariables": {
38+
"CMAKE_BUILD_TYPE": "Release",
39+
"CMAKE_CXX_FLAGS": "-O3 -DNDEBUG -fno-exceptions -fno-rtti"
2440
}
2541
}
2642
],
2743
"buildPresets": [
2844
{
29-
"name": "llvm-brew",
30-
"configurePreset": "llvm-brew"
45+
"name": "ci-debug-hardened",
46+
"configurePreset": "ci-debug-hardened"
3147
},
3248
{
33-
"name": "gcc-brew",
34-
"configurePreset": "gcc-brew"
49+
"name": "ci-release",
50+
"configurePreset": "ci-release"
51+
},
52+
{
53+
"name": "ci-no-except-rtti",
54+
"configurePreset": "ci-no-except-rtti"
3555
}
3656
],
3757
"testPresets": [
3858
{
39-
"name": "llvm-brew",
40-
"configurePreset": "llvm-brew",
59+
"name": "ci-debug-hardened",
60+
"configurePreset": "ci-debug-hardened",
4161
"output": {
4262
"outputOnFailure": true
4363
},
@@ -46,54 +66,24 @@
4666
}
4767
},
4868
{
49-
"name": "gcc-brew",
50-
"configurePreset": "gcc-brew",
69+
"name": "ci-release",
70+
"configurePreset": "ci-release",
5171
"output": {
5272
"outputOnFailure": true
5373
},
5474
"execution": {
5575
"stopOnFailure": true
5676
}
57-
}
58-
],
59-
"workflowPresets": [
60-
{
61-
"name": "llvm-brew",
62-
"displayName": "LLVM (Homebrew) Workflow",
63-
"description": "Configure and build using Homebrew LLVM",
64-
"steps": [
65-
{
66-
"type": "configure",
67-
"name": "llvm-brew"
68-
},
69-
{
70-
"type": "build",
71-
"name": "llvm-brew"
72-
},
73-
{
74-
"type": "test",
75-
"name": "llvm-brew"
76-
}
77-
]
7877
},
7978
{
80-
"name": "gcc-brew",
81-
"displayName": "GCC (Homebrew) Workflow",
82-
"description": "Configure and build using Homebrew GCC",
83-
"steps": [
84-
{
85-
"type": "configure",
86-
"name": "gcc-brew"
87-
},
88-
{
89-
"type": "build",
90-
"name": "gcc-brew"
91-
},
92-
{
93-
"type": "test",
94-
"name": "gcc-brew"
95-
}
96-
]
79+
"name": "ci-no-except-rtti",
80+
"configurePreset": "ci-no-except-rtti",
81+
"output": {
82+
"outputOnFailure": true
83+
},
84+
"execution": {
85+
"stopOnFailure": true
86+
}
9787
}
9888
]
9989
}

CMakeUserPresets.json

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"version": 10,
3+
"configurePresets": [
4+
{
5+
"name": "dev",
6+
"inherits": "ci-debug-hardened",
7+
"displayName": "Development",
8+
"toolchainFile": "${sourceDir}/cmake/llvm-brew-toolchain.cmake"
9+
}
10+
],
11+
"buildPresets": [
12+
{
13+
"name": "dev",
14+
"configurePreset": "dev"
15+
}
16+
],
17+
"testPresets": [
18+
{
19+
"name": "dev",
20+
"configurePreset": "dev",
21+
"output": {
22+
"outputOnFailure": true
23+
},
24+
"execution": {
25+
"stopOnFailure": true
26+
}
27+
}
28+
],
29+
"workflowPresets": [
30+
{
31+
"name": "dev",
32+
"displayName": "Development Debug Hardened Workflow",
33+
"steps": [
34+
{
35+
"type": "configure",
36+
"name": "dev"
37+
},
38+
{
39+
"type": "build",
40+
"name": "dev"
41+
},
42+
{
43+
"type": "test",
44+
"name": "dev"
45+
}
46+
]
47+
}
48+
]
49+
}

cmake/gcc-brew-toolchain.cmake

Lines changed: 40 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
cmake_minimum_required(VERSION 4.2.1)
22

3-
# Set up Homebrew GCC@15 toolchain for CMake
3+
# Set up Homebrew GCC@15 & Ninja toolchain for CMake
44

55
find_program(BREW_EXE brew)
66

77
if(NOT BREW_EXE)
88
message(FATAL_ERROR "Could not find 'brew' executable. Please install Homebrew.")
99
endif()
1010

11-
# Get Ninja prefix
11+
# --- Ninja
12+
1213
execute_process(
1314
COMMAND ${BREW_EXE} --prefix ninja
1415
OUTPUT_VARIABLE NINJA_PREFIX
@@ -20,9 +21,11 @@ find_program(CMAKE_MAKE_PROGRAM
2021
NAMES ninja
2122
HINTS "${NINJA_PREFIX}/bin"
2223
NO_DEFAULT_PATH
24+
REQUIRED
2325
)
2426

25-
# Get GCC prefix
27+
# --- GCC
28+
2629
execute_process(
2730
COMMAND ${BREW_EXE} --prefix gcc
2831
OUTPUT_VARIABLE GCC_PREFIX
@@ -34,21 +37,49 @@ find_program(CMAKE_C_COMPILER
3437
NAMES gcc-15
3538
HINTS "${GCC_PREFIX}/bin"
3639
NO_DEFAULT_PATH
40+
REQUIRED
3741
)
3842

3943
find_program(CMAKE_CXX_COMPILER
4044
NAMES g++-15
4145
HINTS "${GCC_PREFIX}/bin"
4246
NO_DEFAULT_PATH
47+
REQUIRED
4348
)
4449

45-
if(NOT CMAKE_C_COMPILER)
46-
message(FATAL_ERROR "Could not find gcc executable in ${GCC_PREFIX}/bin")
47-
endif()
50+
find_program(CMAKE_AR
51+
NAMES gcc-ar-15
52+
HINTS "${GCC_PREFIX}/bin"
53+
NO_DEFAULT_PATH
54+
REQUIRED
55+
)
56+
57+
find_program(CMAKE_RANLIB
58+
NAMES gcc-ranlib-15
59+
HINTS "${GCC_PREFIX}/bin"
60+
NO_DEFAULT_PATH
61+
REQUIRED
62+
)
63+
64+
find_program(CMAKE_NM
65+
NAMES gcc-nm-15
66+
HINTS "${GCC_PREFIX}/bin"
67+
NO_DEFAULT_PATH
68+
REQUIRED
69+
)
70+
71+
# --- Binutils
72+
73+
execute_process(
74+
COMMAND ${BREW_EXE} --prefix binutils
75+
OUTPUT_VARIABLE BINUTILS_PREFIX
76+
OUTPUT_STRIP_TRAILING_WHITESPACE
77+
COMMAND_ERROR_IS_FATAL ANY
78+
)
79+
80+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -B${BINUTILS_PREFIX}/bin/" CACHE STRING "" FORCE)
81+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -B${BINUTILS_PREFIX}/bin/" CACHE STRING "" FORCE)
4882

49-
if(NOT CMAKE_CXX_COMPILER)
50-
message(FATAL_ERROR "Could not find g++ executable in ${GCC_PREFIX}/bin")
51-
endif()
5283

5384
# Get macOS SDK path (only on macOS)
5485
if(APPLE)

0 commit comments

Comments
 (0)