From 645fdafcafb73493963dbbd81141d959a45f8005 Mon Sep 17 00:00:00 2001 From: Michal Siedlaczek Date: Sun, 28 Jul 2024 15:07:29 -0400 Subject: [PATCH] Add meson build file --- meson.build | 37 +++++++++++++++++++++++++++++++++++++ meson.options | 1 + 2 files changed, 38 insertions(+) create mode 100644 meson.build create mode 100644 meson.options diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..ddc0469 --- /dev/null +++ b/meson.build @@ -0,0 +1,37 @@ +project( + 'wapopp', + 'cpp', + version : '1.0', + default_options : ['warning_level=3', 'cpp_std=c++17', 'default_library=static'], + subproject_dir: 'external', +) + +cmake = import('cmake') +json = cmake.subproject('json').dependency('nlohmann_json') + +wapopp = library( + 'wapopp', + 'src/wapopp.cpp', + include_directories: 'include', + dependencies: json, + install: true, +) +wapopp_dep = declare_dependency( + include_directories : 'include', + link_with : wapopp +) + +build_tests = get_option('build_tests') +if build_tests + catch2 = subproject('Catch2').get_variable('catch2_with_main_dep') + + tests = executable( + 'test_wapopp', + # 'test/test_detail.cpp', + 'test/test_wapopp.cpp', + include_directories: 'include', + dependencies: [catch2, json], + link_with: wapopp, + ) + test('unit tests', 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')