Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add meson build system support #75

Merged
merged 17 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 112 additions & 19 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,29 @@ on:
types: [opened, synchronize, reopened]

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

strategy:
fail-fast: false
matrix:
platform:
platform:
- { name: x86, flags: "-m32" }
- { name: x64, flags: "-m64" }
compiler:
- { name: GNU, CC: gcc }
- { name: LLVM, CC: clang }
flavor:
- { name: GNU, CC: gcc, CXX: g++ }
- { name: LLVM, CC: clang, CXX: clang++ }
flavor:
- Debug
- Release
mode:
- { name: default, args: "" }
mode:
- { name: default, args: "" }
- { name: NO_LIBC, args: -DZYAN_NO_LIBC=ON }

steps:
- name: Checkout
uses: actions/checkout@v3.1.0
uses: actions/checkout@v4

- if: matrix.platform.name == 'x86'
name: Bootstrap
Expand All @@ -47,40 +47,133 @@ jobs:
mkdir build
cd build
cmake -DCMAKE_C_FLAGS=${{ matrix.platform.flags }} -DCMAKE_CXX_FLAGS=${{ matrix.platform.flags }} -DZYAN_DEV_MODE=ON ${{ matrix.mode.args }} ..

- name: Build
run: |
cmake --build build --config ${{ matrix.flavor }}

build-windows:
name: Build ${{ matrix.platform.name }} ${{ matrix.compiler.name }} ${{ matrix.flavor }} (${{ matrix.mode.name }})
build-linux-meson:
name: Meson Build ${{ matrix.platform.name }} ${{ matrix.compiler.name }} ${{ matrix.flavor }} (${{ matrix.mode.name }})
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
platform:
- { name: x86, flags: "-m32" }
- { name: x64, flags: "-m64" }
compiler:
- { name: GNU, CC: gcc, CXX: g++ }
- { name: LLVM, CC: clang, CXX: clang++ }
flavor:
- debug
- release
mode:
- { name: default, args: -Dtests=enabled }
- { name: NO_LIBC, args: -Dnolibc=true }

steps:
- name: Setup meson
run: |
pipx install meson
sudo apt-get install -y ninja-build

- name: Checkout
uses: actions/checkout@v4

- if: matrix.platform.name == 'x86'
name: Bootstrap
run: |
sudo dpkg --add-architecture i386
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
sudo apt-get install -y g++-multilib g++

- name: Configure
env:
CC: ${{ matrix.compiler.CC }}
CXX: ${{ matrix.compiler.CXX }}
run: |
meson setup build-${{ matrix.flavor }} --buildtype=${{ matrix.flavor }} ${{ matrix.mode.args }} -Dc_extra_args="${{ matrix.platform.flags }}" -Dcpp_extra_args="${{ matrix.platform.flags }}"

- name: Build
run: |
meson compile -C build-${{ matrix.flavor }}

- name: Run tests
run: |
meson test -C build-${{ matrix.flavor }}

build-windows-cmake:
name: CMake Build ${{ matrix.platform.name }} ${{ matrix.compiler.name }} ${{ matrix.flavor }} (${{ matrix.mode.name }})
runs-on: windows-latest

strategy:
fail-fast: false
matrix:
platform:
platform:
- { name: x86, flags: "Win32" }
- { name: x64, flags: "x64" }
- { name: x64, flags: "x64" }
compiler:
- { name: MSVC }
flavor:
flavor:
- Debug
- Release
mode:
- { name: default, args: "" }
mode:
- { name: default, args: "" }
- { name: NO_LIBC, args: -DZYAN_NO_LIBC=ON }

steps:
- name: Checkout
uses: actions/checkout@v3.1.0
uses: actions/checkout@v4

- name: Configure
run: |
mkdir build
cd build
cmake -DCMAKE_GENERATOR_PLATFORM=${{ matrix.platform.flags }} -DZYAN_DEV_MODE=ON ${{ matrix.mode.args }} ..

- name: Build
run: |
cmake --build build --config ${{ matrix.flavor }}

build-windows-meson:
name: Meson Build ${{ matrix.platform.name }} ${{ matrix.compiler.name }} ${{ matrix.flavor }} (${{ matrix.mode.name }})
runs-on: windows-latest

strategy:
fail-fast: false
matrix:
platform:
- { name: x86, flags: "amd64_x86" }
- { name: x64, flags: "amd64" }
compiler:
- { name: MSVC }
flavor:
- debug
- release
mode:
- { name: default, args: -Dtests=enabled }
- { name: NO_LIBC, args: -Dnolibc=true }

steps:
- name: Setup meson
run: |
pipx install meson
choco install ninja

- name: Checkout
uses: actions/checkout@v4

- name: Configure
run: |
$VCPATH = vswhere -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath -latest
& $VCPATH\VC\Auxiliary\Build\vcvarsall.bat ${{ matrix.platform.flags }}
meson setup build-${{ matrix.flavor }} --buildtype=${{ matrix.flavor }} ${{ matrix.mode.args }}

- name: Build
run: |
meson compile -C build-${{ matrix.flavor }}

- name: Run tests
run: |
meson test -C build-${{ matrix.flavor }}
31 changes: 31 additions & 0 deletions Doxyfile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
PROJECT_NAME = Zycore
PROJECT_NUMBER = @VERSION@
PROJECT_BRIEF = "Zyan Core Library for C"
OUTPUT_DIRECTORY = "@TOP_BUILDDIR@/doc"
STRIP_FROM_PATH = "@TOP_SRCDIR@"
JAVADOC_AUTOBRIEF = YES
QT_AUTOBRIEF = YES
OPTIMIZE_OUTPUT_FOR_C = YES
TOC_INCLUDE_HEADINGS = 0
EXTRACT_ALL = YES
EXTRACT_LOCAL_CLASSES = NO
HIDE_SCOPE_NAMES = YES
INPUT = "@TOP_SRCDIR@/include" \
"@TOP_SRCDIR@/README.md"
RECURSIVE = YES
EXAMPLE_PATH = "@TOP_SRCDIR@/examples"
USE_MDFILE_AS_MAINPAGE = "@TOP_SRCDIR@/README.md"
GENERATE_TREEVIEW = YES
USE_MATHJAX = YES
MATHJAX_VERSION = MathJax_3
GENERATE_LATEX = NO
MACRO_EXPANSION = YES
PREDEFINED = @PREDEFINED@
DOT_COMMON_ATTR = "fontname=\"sans-serif\",fontsize=10"
DOT_EDGE_ATTR = "labelfontname=\"sans-serif\",labelfontsize=10"
DOT_IMAGE_FORMAT = svg
INTERACTIVE_SVG = YES
HAVE_DOT = @HAVE_DOT@
DOT_MULTI_TARGETS = @HAVE_DOT_1_8_10@
DOT_PATH = "@DOT_PATH@"
HTML_FORMULA_FORMAT = @HTML_FORMULA_FORMAT@
11 changes: 11 additions & 0 deletions examples/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
examples_req = examples.enabled()

if examples_req
executable('String', 'String.c', dependencies: [zycore_dep])
executable('Vector', 'Vector.c', dependencies: [zycore_dep])
endif

summary(
{'examples': examples_req},
section: 'Features',
)
Loading