Skip to content

Commit c1b3391

Browse files
committed
Better MSVC support
1 parent cba7e75 commit c1b3391

2 files changed

Lines changed: 170 additions & 77 deletions

File tree

.github/workflows/ci.yml

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,65 @@ jobs:
1111
strategy:
1212
matrix:
1313
os: [ubuntu-latest, macos-latest, windows-latest]
14+
compiler: [gcc]
15+
include:
16+
- os: windows-latest
17+
compiler: msvc
18+
- os: windows-latest
19+
compiler: clang-cl
1420
runs-on: ${{ matrix.os }}
1521

1622
steps:
1723
- uses: actions/checkout@v4
1824

19-
- name: Build library
25+
- name: Set up MSVC
26+
if: matrix.compiler == 'msvc' || matrix.compiler == 'clang-cl'
27+
uses: ilammy/msvc-dev-cmd@v1
28+
29+
- name: Build library (GCC)
30+
if: matrix.compiler == 'gcc'
2031
shell: bash
2132
run: make lib
2233

23-
- name: Build and run tests
34+
- name: Build and run tests (GCC)
35+
if: matrix.compiler == 'gcc'
2436
shell: bash
2537
run: make test
38+
39+
- name: Build library (MSVC)
40+
if: matrix.compiler == 'msvc'
41+
shell: cmd
42+
run: |
43+
if not exist build mkdir build
44+
cl /O2 /DNDEBUG /Isrc src/miniexpr.c /c /Fobuild/miniexpr.obj
45+
46+
- name: Build and run tests (MSVC)
47+
if: matrix.compiler == 'msvc'
48+
shell: cmd
49+
run: |
50+
setlocal enabledelayedexpansion
51+
for %%f in (tests\*.c) do (
52+
cl /O2 /DNDEBUG /Isrc %%f build/miniexpr.obj /Febuild/%%~nf.exe
53+
if !errorlevel! neq 0 exit /b !errorlevel!
54+
build\%%~nf.exe
55+
if !errorlevel! neq 0 exit /b !errorlevel!
56+
)
57+
58+
- name: Build library (clang-cl)
59+
if: matrix.compiler == 'clang-cl'
60+
shell: cmd
61+
run: |
62+
if not exist build mkdir build
63+
clang-cl /O2 /DNDEBUG /Isrc src/miniexpr.c /c /Fobuild/miniexpr.obj
64+
65+
- name: Build and run tests (clang-cl)
66+
if: matrix.compiler == 'clang-cl'
67+
shell: cmd
68+
run: |
69+
setlocal enabledelayedexpansion
70+
for %%f in (tests\*.c) do (
71+
clang-cl /O2 /DNDEBUG /Isrc %%f build/miniexpr.obj /Febuild/%%~nf.exe
72+
if !errorlevel! neq 0 exit /b !errorlevel!
73+
build\%%~nf.exe
74+
if !errorlevel! neq 0 exit /b !errorlevel!
75+
)

0 commit comments

Comments
 (0)