Skip to content

Commit 38d4f02

Browse files
authored
Add meson build system support (#75)
1 parent 419cde9 commit 38d4f02

File tree

8 files changed

+454
-20
lines changed

8 files changed

+454
-20
lines changed

.github/workflows/main.yml

Lines changed: 112 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,29 @@ on:
88
types: [opened, synchronize, reopened]
99

1010
jobs:
11-
build-linux:
12-
name: Build ${{ matrix.platform.name }} ${{ matrix.compiler.name }} ${{ matrix.flavor }} (${{ matrix.mode.name }})
11+
build-linux-cmake:
12+
name: CMake Build ${{ matrix.platform.name }} ${{ matrix.compiler.name }} ${{ matrix.flavor }} (${{ matrix.mode.name }})
1313
runs-on: ubuntu-latest
1414

1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
platform:
18+
platform:
1919
- { name: x86, flags: "-m32" }
2020
- { name: x64, flags: "-m64" }
2121
compiler:
22-
- { name: GNU, CC: gcc }
23-
- { name: LLVM, CC: clang }
24-
flavor:
22+
- { name: GNU, CC: gcc, CXX: g++ }
23+
- { name: LLVM, CC: clang, CXX: clang++ }
24+
flavor:
2525
- Debug
2626
- Release
27-
mode:
28-
- { name: default, args: "" }
27+
mode:
28+
- { name: default, args: "" }
2929
- { name: NO_LIBC, args: -DZYAN_NO_LIBC=ON }
3030

3131
steps:
3232
- name: Checkout
33-
uses: actions/checkout@v3.1.0
33+
uses: actions/checkout@v4
3434

3535
- if: matrix.platform.name == 'x86'
3636
name: Bootstrap
@@ -47,40 +47,133 @@ jobs:
4747
mkdir build
4848
cd build
4949
cmake -DCMAKE_C_FLAGS=${{ matrix.platform.flags }} -DCMAKE_CXX_FLAGS=${{ matrix.platform.flags }} -DZYAN_DEV_MODE=ON ${{ matrix.mode.args }} ..
50-
50+
5151
- name: Build
5252
run: |
5353
cmake --build build --config ${{ matrix.flavor }}
5454
55-
build-windows:
56-
name: Build ${{ matrix.platform.name }} ${{ matrix.compiler.name }} ${{ matrix.flavor }} (${{ matrix.mode.name }})
55+
build-linux-meson:
56+
name: Meson Build ${{ matrix.platform.name }} ${{ matrix.compiler.name }} ${{ matrix.flavor }} (${{ matrix.mode.name }})
57+
runs-on: ubuntu-latest
58+
59+
strategy:
60+
fail-fast: false
61+
matrix:
62+
platform:
63+
- { name: x86, flags: "-m32" }
64+
- { name: x64, flags: "-m64" }
65+
compiler:
66+
- { name: GNU, CC: gcc, CXX: g++ }
67+
- { name: LLVM, CC: clang, CXX: clang++ }
68+
flavor:
69+
- debug
70+
- release
71+
mode:
72+
- { name: default, args: -Dtests=enabled }
73+
- { name: NO_LIBC, args: -Dnolibc=true }
74+
75+
steps:
76+
- name: Setup meson
77+
run: |
78+
pipx install meson
79+
sudo apt-get install -y ninja-build
80+
81+
- name: Checkout
82+
uses: actions/checkout@v4
83+
84+
- if: matrix.platform.name == 'x86'
85+
name: Bootstrap
86+
run: |
87+
sudo dpkg --add-architecture i386
88+
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
89+
sudo apt-get install -y g++-multilib g++
90+
91+
- name: Configure
92+
env:
93+
CC: ${{ matrix.compiler.CC }}
94+
CXX: ${{ matrix.compiler.CXX }}
95+
run: |
96+
meson setup build-${{ matrix.flavor }} --buildtype=${{ matrix.flavor }} ${{ matrix.mode.args }} -Dc_extra_args="${{ matrix.platform.flags }}" -Dcpp_extra_args="${{ matrix.platform.flags }}"
97+
98+
- name: Build
99+
run: |
100+
meson compile -C build-${{ matrix.flavor }}
101+
102+
- name: Run tests
103+
run: |
104+
meson test -C build-${{ matrix.flavor }}
105+
106+
build-windows-cmake:
107+
name: CMake Build ${{ matrix.platform.name }} ${{ matrix.compiler.name }} ${{ matrix.flavor }} (${{ matrix.mode.name }})
57108
runs-on: windows-latest
58109

59110
strategy:
60111
fail-fast: false
61112
matrix:
62-
platform:
113+
platform:
63114
- { name: x86, flags: "Win32" }
64-
- { name: x64, flags: "x64" }
115+
- { name: x64, flags: "x64" }
65116
compiler:
66117
- { name: MSVC }
67-
flavor:
118+
flavor:
68119
- Debug
69120
- Release
70-
mode:
71-
- { name: default, args: "" }
121+
mode:
122+
- { name: default, args: "" }
72123
- { name: NO_LIBC, args: -DZYAN_NO_LIBC=ON }
73124

74125
steps:
75126
- name: Checkout
76-
uses: actions/checkout@v3.1.0
127+
uses: actions/checkout@v4
77128

78129
- name: Configure
79130
run: |
80131
mkdir build
81132
cd build
82133
cmake -DCMAKE_GENERATOR_PLATFORM=${{ matrix.platform.flags }} -DZYAN_DEV_MODE=ON ${{ matrix.mode.args }} ..
83-
134+
84135
- name: Build
85136
run: |
86137
cmake --build build --config ${{ matrix.flavor }}
138+
139+
build-windows-meson:
140+
name: Meson Build ${{ matrix.platform.name }} ${{ matrix.compiler.name }} ${{ matrix.flavor }} (${{ matrix.mode.name }})
141+
runs-on: windows-latest
142+
143+
strategy:
144+
fail-fast: false
145+
matrix:
146+
platform:
147+
- { name: x86, flags: "amd64_x86" }
148+
- { name: x64, flags: "amd64" }
149+
compiler:
150+
- { name: MSVC }
151+
flavor:
152+
- debug
153+
- release
154+
mode:
155+
- { name: default, args: -Dtests=enabled }
156+
- { name: NO_LIBC, args: -Dnolibc=true }
157+
158+
steps:
159+
- name: Setup meson
160+
run: |
161+
pipx install meson
162+
choco install ninja
163+
164+
- name: Checkout
165+
uses: actions/checkout@v4
166+
167+
- name: Configure
168+
run: |
169+
$VCPATH = vswhere -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath -latest
170+
& $VCPATH\VC\Auxiliary\Build\vcvarsall.bat ${{ matrix.platform.flags }}
171+
meson setup build-${{ matrix.flavor }} --buildtype=${{ matrix.flavor }} ${{ matrix.mode.args }}
172+
173+
- name: Build
174+
run: |
175+
meson compile -C build-${{ matrix.flavor }}
176+
177+
- name: Run tests
178+
run: |
179+
meson test -C build-${{ matrix.flavor }}

Doxyfile.in

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
PROJECT_NAME = Zycore
2+
PROJECT_NUMBER = @VERSION@
3+
PROJECT_BRIEF = "Zyan Core Library for C"
4+
OUTPUT_DIRECTORY = "@TOP_BUILDDIR@/doc"
5+
STRIP_FROM_PATH = "@TOP_SRCDIR@"
6+
JAVADOC_AUTOBRIEF = YES
7+
QT_AUTOBRIEF = YES
8+
OPTIMIZE_OUTPUT_FOR_C = YES
9+
TOC_INCLUDE_HEADINGS = 0
10+
EXTRACT_ALL = YES
11+
EXTRACT_LOCAL_CLASSES = NO
12+
HIDE_SCOPE_NAMES = YES
13+
INPUT = "@TOP_SRCDIR@/include" \
14+
"@TOP_SRCDIR@/README.md"
15+
RECURSIVE = YES
16+
EXAMPLE_PATH = "@TOP_SRCDIR@/examples"
17+
USE_MDFILE_AS_MAINPAGE = "@TOP_SRCDIR@/README.md"
18+
GENERATE_TREEVIEW = YES
19+
USE_MATHJAX = YES
20+
MATHJAX_VERSION = MathJax_3
21+
GENERATE_LATEX = NO
22+
MACRO_EXPANSION = YES
23+
PREDEFINED = @PREDEFINED@
24+
DOT_COMMON_ATTR = "fontname=\"sans-serif\",fontsize=10"
25+
DOT_EDGE_ATTR = "labelfontname=\"sans-serif\",labelfontsize=10"
26+
DOT_IMAGE_FORMAT = svg
27+
INTERACTIVE_SVG = YES
28+
HAVE_DOT = @HAVE_DOT@
29+
DOT_MULTI_TARGETS = @HAVE_DOT_1_8_10@
30+
DOT_PATH = "@DOT_PATH@"
31+
HTML_FORMULA_FORMAT = @HTML_FORMULA_FORMAT@

examples/meson.build

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
examples_req = examples.enabled()
2+
3+
if examples_req
4+
executable('String', 'String.c', dependencies: [zycore_dep])
5+
executable('Vector', 'Vector.c', dependencies: [zycore_dep])
6+
endif
7+
8+
summary(
9+
{'examples': examples_req},
10+
section: 'Features',
11+
)

0 commit comments

Comments
 (0)