summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorPhilip Chimento <philip.chimento@gmail.com>2020-01-13 22:35:56 -0800
committerPhilip Chimento <philip.chimento@gmail.com>2020-01-21 22:35:27 -0800
commitaad47f9b07dc6105c3ce10059a83efea4a36bcfc (patch)
treee4cda4c4c732fe524cdfdab3632bbe5ce10ba739 /meson.build
parent9e9dea45678c01b95bc85bf4915e42c2094fdde2 (diff)
build: Meson build system
Removes the existing Autotools build system and adds a new Meson one. Also replaces the shell script test driver with a Python one, since Meson already brings in a Python dependency. Common operations: - ./configure -> meson _build - make -> ninja -C _build - make install -> ninja -C _build install - make check -> meson test -C _build - make Tartan.pot-update -> ninja -C _build tartan-pot - make update-po -> ninja -C _build tartan-update-po To run the tests with coverage enabled and make a coverage report: - meson _build -Db_coverage=true - meson test -C _build - ninja -C _build coverage-html
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build48
1 files changed, 48 insertions, 0 deletions
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..51b44f7
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,48 @@
+project('tartan', 'cpp', version: '0.4.0', license: 'GPL3',
+ meson_version: '>= 0.52',
+ default_options: ['cpp_std=c++11', 'warning_level=3'])
+
+cxx = meson.get_compiler('cpp')
+
+### Check for required libraries ###############################################
+
+llvm_requirement = '>= 7.0'
+glib_requirement = '>= 2.38'
+gir_requirement = '>= 1.38.0'
+
+glib = dependency('glib-2.0', version: glib_requirement,
+ fallback: ['glib', 'libglib_dep'])
+gobject = dependency('gobject-2.0', version: glib_requirement,
+ fallback: ['glib', 'libgobject_dep'])
+gio = dependency('gio-2.0', version: glib_requirement,
+ fallback: ['glib', 'libgio_dep'])
+gi = dependency('gobject-introspection-1.0', version: gir_requirement,
+ fallback: ['gobject-introspection', 'girepo_dep'])
+
+llvm_with_link = dependency('llvm', version: llvm_requirement,
+ include_type: 'system')
+# Don't link against the LLVM libs because they're huge. All the symbols
+# will be available when the plugin is loaded anyway.
+llvm = llvm_with_link.partial_dependency(compile_args: true)
+
+cxx.check_header('clang/AST/Expr.h', dependencies: llvm, required: true)
+
+### Generate config.h ##########################################################
+
+header_conf = configuration_data()
+
+header_conf.set_quoted('VERSION', meson.project_version())
+header_conf.set_quoted('LLVM_CONFIG_VERSION', llvm.version())
+header_conf.set('HAVE_LLVM_8_0', llvm.version().version_compare('>= 8.0'))
+header_conf.set('HAVE_LLVM_9_0', llvm.version().version_compare('>= 9.0'))
+header_conf.set('GETTEXT_PACKAGE', meson.project_name())
+
+configure_file(output: 'config.h', configuration: header_conf)
+config_h_include = include_directories('.')
+
+### Build ######################################################################
+
+subdir('po')
+subdir('clang-plugin')
+subdir('scripts')
+subdir('tests')