From 5f6089742293d1182ec082c80841bf3047182ae3 Mon Sep 17 00:00:00 2001 From: Zephyr Lykos Date: Wed, 30 Apr 2025 22:14:19 +0800 Subject: [PATCH 1/5] build: initialize meson build system --- include/meson.build | 59 +++++++++++++++++++++++++++++++++++++++++++++ meson.build | 22 +++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 include/meson.build create mode 100644 meson.build diff --git a/include/meson.build b/include/meson.build new file mode 100644 index 00000000..854715c2 --- /dev/null +++ b/include/meson.build @@ -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, +) diff --git a/meson.build b/meson.build new file mode 100644 index 00000000..6177c037 --- /dev/null +++ b/meson.build @@ -0,0 +1,22 @@ +project( + 'ctre', + 'cpp', + version: '3.9.0', + license: 'Apache-2.0', + default_options: ['cpp_std=gnu++20,gnu++17,vc++latest,c++20,c++17'], +) + +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.', +) From ace762fe3d95538bbebd5d7fd38698ad0b9a29c2 Mon Sep 17 00:00:00 2001 From: Zephyr Lykos Date: Thu, 1 May 2025 08:53:31 +0800 Subject: [PATCH 2/5] build: require meson >= 0.63 --- meson.build | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 6177c037..ee2c4942 100644 --- a/meson.build +++ b/meson.build @@ -3,7 +3,10 @@ project( 'cpp', version: '3.9.0', license: 'Apache-2.0', - default_options: ['cpp_std=gnu++20,gnu++17,vc++latest,c++20,c++17'], + 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') From 75b3f9af4f35fa283229478a09d1b6af66c6e55e Mon Sep 17 00:00:00 2001 From: Zephyr Lykos Date: Thu, 1 May 2025 10:09:52 +0800 Subject: [PATCH 3/5] ci: add meson packaging tests --- .github/workflows/tests.yml | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 37226652..5b3a3e97 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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' }} @@ -29,7 +29,7 @@ jobs: 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' }} @@ -37,6 +37,20 @@ jobs: 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' }} + 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: @@ -54,7 +68,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' }} @@ -74,7 +88,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" From d2db0424df60faa4992e4168693b1e553491bbe8 Mon Sep 17 00:00:00 2001 From: Zephyr Lykos Date: Thu, 1 May 2025 10:13:14 +0800 Subject: [PATCH 4/5] ci: use ubuntu-22.04 --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5b3a3e97..1e23ea15 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -23,7 +23,7 @@ jobs: 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 @@ -59,7 +59,7 @@ jobs: 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 From 5455dd28326f390ebe55d27ce9473f62b91f4e54 Mon Sep 17 00:00:00 2001 From: Zephyr Lykos Date: Thu, 1 May 2025 10:22:59 +0800 Subject: [PATCH 5/5] ci: remove outdated gcc/clang version --- .github/workflows/tests.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1e23ea15..4272a6c2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -19,7 +19,7 @@ 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 }})" @@ -33,10 +33,8 @@ jobs: - 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 @@ -54,7 +52,7 @@ jobs: 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