Skip to content

Commit a561a26

Browse files
committed
CI: Add build-tests for various compilers on Windows and Ubuntu
The build setup for this repository is incredibly simple, but unfortunately even recent changes to the CMake have made various platforms and compiler combinations unbuildable. Add a basic CI that at the very least _builds_ the project to demonstrate all these problems, which should all go away when other PRs are merged.
1 parent 6e79513 commit a561a26

File tree

3 files changed

+50
-54
lines changed

3 files changed

+50
-54
lines changed

.github/workflows/ci.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
on:
2+
- push
3+
4+
jobs:
5+
build-linux:
6+
name: Use clang and gcc via "Unix Makefiles"
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
compiler: [clang, gcc]
11+
steps:
12+
- uses: actions/checkout@v4
13+
- run: |
14+
cmake -Bbuild -DCMAKE_C_COMPILER=${{ matrix.compiler }}
15+
cmake --build build
16+
17+
build-windows-ninja:
18+
name: Use clang and clang-cl via Ninja
19+
runs-on: windows-latest
20+
strategy:
21+
matrix:
22+
# On Windows, clang only enables the WIN32 flag in CMake whereas
23+
# clang-cl also enables MSVC, because it has a cl.exe-like interface.
24+
compiler: [clang, clang-cl]
25+
steps:
26+
- uses: actions/checkout@v4
27+
- name: clang
28+
run: |
29+
# Use Ninja because the MSBuild toolchain can only configure
30+
# alternative compilers via "toolsets", where only ClangCL is
31+
# supported.
32+
cmake -Bbuild -GNinja -DCMAKE_C_COMPILER=${{ matrix.compiler }}
33+
cmake --build build
34+
35+
build-windows-msbuild:
36+
name: Use MSVC and clang-cl via MSBuild
37+
runs-on: windows-latest
38+
strategy:
39+
matrix:
40+
toolset:
41+
# The default toolset should be the latest 'v143' when nothing is specified
42+
-
43+
- -TClangCL
44+
steps:
45+
- uses: actions/checkout@v4
46+
- run: |
47+
cmake -Bbuild ${{ matrix.toolset }}
48+
cmake --build build

Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,11 @@ ifneq ($(shared), not-set)
7272
endif
7373

7474
define run-config
75-
mkdir -p $(BUILDDIR)
76-
cd $(BUILDDIR) && cmake $(CURDIR) $(CONFIG_FLAGS)
75+
cmake $(CURDIR) -B"$(BUILDDIR)" $(CONFIG_FLAGS)
7776
endef
7877

7978
all clean install: $(BUILDDIR)
80-
make -C $(BUILDDIR) $@
79+
cmake --build $(BUILDDIR) $@
8180

8281
uninstall:
8382
xargs rm < $(BUILDDIR)/install_manifest.txt

cmake/GKlibSystem.cmake

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)