Skip to content

Commit ea01742

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 ea01742

File tree

3 files changed

+49
-54
lines changed

3 files changed

+49
-54
lines changed

.github/workflows/ci.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
- run: |
28+
# Use Ninja because the MSBuild toolchain can only configure
29+
# alternative compilers via "toolsets", where only ClangCL is
30+
# supported.
31+
cmake -Bbuild -GNinja -DCMAKE_C_COMPILER=${{ matrix.compiler }}
32+
cmake --build build
33+
34+
build-windows-msbuild:
35+
name: Use MSVC and clang-cl via MSBuild
36+
runs-on: windows-latest
37+
strategy:
38+
matrix:
39+
toolset:
40+
# The default toolset should be the latest 'v143' when nothing is specified
41+
-
42+
- -TClangCL
43+
steps:
44+
- uses: actions/checkout@v4
45+
- run: |
46+
cmake -Bbuild ${{ matrix.toolset }}
47+
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)