Skip to content

build: initialize meson build system #343

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
34 changes: 23 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
name: "AppleClang (MacOS ${{ matrix.macos }}, C++${{ matrix.standard }})"
runs-on: macos-${{ matrix.macos }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- run: c++ -v
- run: make CXX=c++ CXX_STANDARD=2a
if: ${{ matrix.standard == '20' }}
Expand All @@ -19,33 +19,45 @@ jobs:
gcc:
strategy:
matrix:
gcc: [8, 9, 10, 11, 13]
gcc: [9, 10, 11, 13]
standard: [17, 20]
fail-fast: false
name: "GCC ${{ matrix.gcc }} (C++${{ matrix.standard }})"
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: "Install GCC"
uses: egor-tensin/setup-gcc@v1
with:
version: ${{ matrix.gcc }}
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- run: c++ -v
- run: make CXX=c++ CXX_STANDARD=2a
if: ${{ matrix.standard == '20' }}
- run: make CXX=c++ CXX_STANDARD=17
if: ${{ matrix.gcc < '9' && matrix.standard == '17' }}
- run: make CXX=c++ CXX_STANDARD=17 CXXFLAGS=-DCTRE_ENABLE_LITERALS PEDANTIC=""
if: ${{ matrix.gcc >= '9' && matrix.standard == '17' }}
if: ${{ matrix.standard == '17' }}
meson:
name: "Meson package test"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pipx install meson
- run: meson setup build --prefix=/usr
- run: sudo ninja -C build install
- name: Run compilation tests
run: |
# shellcheck disable=SC2046
c++ $(pkg-config --cflags ctre) -fsyntax-only -std=c++20 tests/ci.cpp
# shellcheck disable=SC2046
c++ $(pkg-config --cflags ctre) -fsyntax-only -std=c++20 tests/_unicode.cpp
clang:
strategy:
matrix:
clang: [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]
clang: [11, 12, 13, 14, 15, 16, 17]
stdlib: ["libc++", "libstdc++"]
standard: [17, 20]
fail-fast: false
name: "Clang ${{ matrix.clang }} (C++${{ matrix.standard }}, ${{ matrix.stdlib }})"
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: "Install Clang"
uses: egor-tensin/setup-clang@v1
Expand All @@ -54,7 +66,7 @@ jobs:
- name: "Install libc++"
if: ${{ matrix.stdlib == 'libc++' }}
run: sudo apt-get install libc++abi-${{ matrix.clang }}-dev libc++1-${{ matrix.clang }} libc++-${{ matrix.clang }}-dev
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- run: c++ -v
- run: make CXX=c++ CXX_STANDARD=2a CXXFLAGS=-stdlib=${{ matrix.stdlib }}
if: ${{ matrix.standard == '20' }}
Expand All @@ -74,7 +86,7 @@ jobs:
toolset: ${{ matrix.version }}
- name: "Install Ninja & CMake"
run: choco install ninja cmake
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: "Configure"
run: cmake . -G Ninja -B build -DCTRE_BUILD_TESTS=ON -DCTRE_CXX_STANDARD=20
- name: "Build"
Expand Down
59 changes: 59 additions & 0 deletions include/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
inc = include_directories('.')

hdrs = files(
'ctll.hpp',
'ctll/actions.hpp',
'ctll/fixed_string.hpp',
'ctll/grammars.hpp',
'ctll/list.hpp',
'ctll/parser.hpp',
'ctll/utilities.hpp',
'ctre-unicode.hpp',
'ctre.hpp',
'ctre/actions/asserts.inc.hpp',
'ctre/actions/atomic_group.inc.hpp',
'ctre/actions/backreference.inc.hpp',
'ctre/actions/boundaries.inc.hpp',
'ctre/actions/capture.inc.hpp',
'ctre/actions/characters.inc.hpp',
'ctre/actions/class.inc.hpp',
'ctre/actions/fusion.inc.hpp',
'ctre/actions/hexdec.inc.hpp',
'ctre/actions/look.inc.hpp',
'ctre/actions/mode.inc.hpp',
'ctre/actions/named_class.inc.hpp',
'ctre/actions/options.inc.hpp',
'ctre/actions/properties.inc.hpp',
'ctre/actions/repeat.inc.hpp',
'ctre/actions/sequence.inc.hpp',
'ctre/actions/set.inc.hpp',
'ctre/atoms.hpp',
'ctre/atoms_characters.hpp',
'ctre/atoms_unicode.hpp',
'ctre/evaluation.hpp',
'ctre/find_captures.hpp',
'ctre/first.hpp',
'ctre/flags_and_modes.hpp',
'ctre/functions.hpp',
'ctre/id.hpp',
'ctre/iterators.hpp',
'ctre/literals.hpp',
'ctre/operators.hpp',
'ctre/pcre.hpp',
'ctre/pcre_actions.hpp',
'ctre/range.hpp',
'ctre/return_type.hpp',
'ctre/rotate.hpp',
'ctre/starts_with_anchor.hpp',
'ctre/utf8.hpp',
'ctre/utility.hpp',
'ctre/wrapper.hpp',
'unicode-db.hpp',
'unicode-db/unicode-db.hpp',
'unicode-db/unicode_interface.hpp',
)

install_headers(
hdrs,
preserve_path: true,
)
25 changes: 25 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
project(
'ctre',
'cpp',
version: '3.9.0',
license: 'Apache-2.0',
default_options: [
meson.version().version_compare('>= 1.3.0') ? 'cpp_std=gnu++20,gnu++17,vc++latest,c++20,c++17' : 'cpp_std=c++20',
],
meson_version: '>= 0.63',
)

subdir('include')

ctre_dep = declare_dependency(
include_directories: inc,
sources: hdrs,
)

meson.override_dependency('ctre', ctre_dep)

pkgconf = import('pkgconfig')
pkgconf.generate(
name: 'ctre',
description: 'Fast compile-time regular expressions with support for matching/searching/capturing during compile-time or runtime.',
)