diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index eca2e52..7a43474 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -7,9 +7,8 @@ on:
branches: [ "main" ]
jobs:
- test:
+ test-cmake:
runs-on: ubuntu-latest
-
steps:
- uses: actions/checkout@v3
@@ -20,4 +19,21 @@ jobs:
run: cmake --build build --config Release
- name: Run tests
- run: ctest --test-dir build -C Release --output-on-failure
\ No newline at end of file
+ run: ctest --test-dir build -C Release --output-on-failure
+
+ test-meson:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Install Meson and Ninja
+ run: pip install meson ninja
+
+ - name: Configure Meson
+ run: meson setup build -Dbuild_tests=true
+
+ - name: Build
+ run: meson compile -C build
+
+ - name: Run tests
+ run: meson test -C build --verbose
diff --git a/.gitignore b/.gitignore
index bc42fe3..67120a4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,10 @@
build/
+# Meson subproject downloads
+subprojects/*/
+subprojects/packagecache/
+
# User-specific files
*.rsuser
*.suo
@@ -399,4 +403,4 @@ FodyWeavers.xsd
*.msp
# JetBrains Rider
-*.sln.iml
\ No newline at end of file
+*.sln.iml
diff --git a/README.md b/README.md
index cf04d5b..ab157f3 100644
--- a/README.md
+++ b/README.md
@@ -24,15 +24,15 @@ This makes it perfect for learning, experimentation, but not a drop-in replaceme
`pi`, `radians()`, `degrees()`
- **Starlet** Project Constants
-
-
-
-
## Prerequisites
- C++20 or later
-- CMake 3.20+
+- One of the following Build Systems,
+ - CMake 3.20+
+ - Meson 1.1+
## Using as a Dependency
+
+### CMake
```cmake
include(FetchContent)
@@ -45,25 +45,32 @@ FetchContent_MakeAvailable(starlet_math)
target_link_libraries(app_name PRIVATE starlet_math)
```
-
+### Meson
+```python
+starlet_math = subproject('starlet_math')
+starlet_math_dep = starlet_math.get_variable('starlet_math_dep')
+```
## Building and Testing
```bash
# 1. Clone starlet-math
git clone https://github.com/masonlet/starlet-math.git
cd starlet-math
+```
-# 2. Create a Build Directory and Generate Build Files
-mkdir build
-cd build
-cmake -DBUILD_TESTS=ON ..
-
-# 3. Build and run tests
-cmake --build .
-ctest
+### CMake
+```bash
+cmake -B build -DBUILD_TESTS=ON
+cmake --build build
+ctest --test-dir build
```
-
+### Meson
+```bash
+meson setup build -Dbuild_tests=true
+meson compile -C build
+meson test -C build
+```
## License
MIT License — see [LICENSE](./LICENSE) for details.
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..2f2dfab
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,18 @@
+project('starlet-math', 'cpp',
+ version : '1.0.0',
+ meson_version : '>=1.1',
+ default_options : ['cpp_std=c++20']
+)
+
+inc = include_directories('inc')
+
+starlet_math_dep = declare_dependency(
+ include_directories : inc
+)
+
+if get_option('build_tests')
+ gtest_dep = dependency('gtest_main',
+ fallback : ['gtest', 'gtest_main_dep']
+ )
+ subdir('tests')
+endif
diff --git a/meson.options b/meson.options
new file mode 100644
index 0000000..332f699
--- /dev/null
+++ b/meson.options
@@ -0,0 +1 @@
+option('build_tests', type : 'boolean', value : false, description : 'Build unit tests')
diff --git a/subprojects/.wraplock b/subprojects/.wraplock
new file mode 100644
index 0000000..e69de29
diff --git a/subprojects/gtest.wrap b/subprojects/gtest.wrap
new file mode 100644
index 0000000..9902a4f
--- /dev/null
+++ b/subprojects/gtest.wrap
@@ -0,0 +1,16 @@
+[wrap-file]
+directory = googletest-1.17.0
+source_url = https://github.com/google/googletest/archive/refs/tags/v1.17.0.tar.gz
+source_filename = googletest-1.17.0.tar.gz
+source_hash = 65fab701d9829d38cb77c14acdc431d2108bfdbf8979e40eb8ae567edf10b27c
+patch_filename = gtest_1.17.0-4_patch.zip
+patch_url = https://wrapdb.mesonbuild.com/v2/gtest_1.17.0-4/get_patch
+patch_hash = 3abf7662d09db706453a5b064a1e914678c74b9d9b0b19382747ca561d0d8750
+source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/gtest_1.17.0-4/googletest-1.17.0.tar.gz
+wrapdb_version = 1.17.0-4
+
+[provide]
+gtest = gtest_dep
+gtest_main = gtest_main_dep
+gmock = gmock_dep
+gmock_main = gmock_main_dep
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 0000000..eb1f899
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,10 @@
+test_exe = executable('starlet_math_tests',
+ files(
+ 'vec2_test.cpp',
+ 'vec3_test.cpp',
+ 'vec4_test.cpp',
+ ),
+ dependencies : [starlet_math_dep, gtest_dep]
+)
+
+test('starlet-math tests', test_exe)