From 85f7ac321ec0a5a4af24efac9eb902631153870a Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Fri, 28 Aug 2020 01:07:12 +0100 Subject: [PATCH] Add simdjson wrap file and meson scripts --- .gitignore | 1 + src/meson.build | 6 ++++ subprojects/packagefiles/simdjson/meson.build | 31 +++++++++++++++++++ .../packagefiles/simdjson/meson_options.txt | 6 ++++ .../packagefiles/simdjson/src/meson.build | 13 ++++++++ subprojects/simdjson.wrap | 7 +++++ 6 files changed, 64 insertions(+) create mode 100644 subprojects/packagefiles/simdjson/meson.build create mode 100644 subprojects/packagefiles/simdjson/meson_options.txt create mode 100644 subprojects/packagefiles/simdjson/src/meson.build create mode 100644 subprojects/simdjson.wrap diff --git a/.gitignore b/.gitignore index 6734751..05c42b8 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ links.txt *.bin subprojects/curlcpp/ subprojects/SQLiteCpp/ +subprojects/simdjson diff --git a/src/meson.build b/src/meson.build index 69196e9..41112fe 100644 --- a/src/meson.build +++ b/src/meson.build @@ -13,6 +13,10 @@ curlcpp_dep = dependency('curlcpp', version: '>=1.4', ], ) +simdjson_dep = dependency('simdjson', version: '>=0.5.0', + fallback: ['simdjson', 'simdjson_dep'], +) + if not get_option('with_sqlite').disabled() sqlitecpp_dep = dependency('sqlitecpp', version: '>=3.0.0', fallback: ['SQLiteCpp', 'sqlitecpp_dep'], @@ -73,6 +77,8 @@ lib_deps = [ ev_dep, threads_dep, boost_dep, + curlcpp_dep, + simdjson_dep, ] + backend_libs executable(meson.project_name(), diff --git a/subprojects/packagefiles/simdjson/meson.build b/subprojects/packagefiles/simdjson/meson.build new file mode 100644 index 0000000..68e0270 --- /dev/null +++ b/subprojects/packagefiles/simdjson/meson.build @@ -0,0 +1,31 @@ +project('simdjson', 'cpp', + version: '0.5.0', + meson_version: '>=0.49.2', + default_options: ['buildtype=release', 'cpp_std=c++17', 'b_ndebug=if-release'], + license: 'Apache', +) + +public_incl = include_directories('include') + +compiler_opts = [] +if not get_option('simdjson_implementation_haswell') + compiler_opts += ['-DSIMDJSON_IMPLEMENTATION_HASWELL=0'] +endif +if not get_option('simdjson_implementation_westmere') + compiler_opts += ['-DSIMDJSON_IMPLEMENTATION_WESTMERE=0'] +endif +if not get_option('simdjson_implementation_arm64') + compiler_opts += ['-DSIMDJSON_IMPLEMENTATION_ARM64=0'] +endif +if not get_option('simdjson_implementation_fallback') + compiler_opts += ['-DSIMDJSON_IMPLEMENTATION_FALLBACK=0'] +endif +if not get_option('simdjson_exceptions') + compiler_opts += ['-DSIMDJSON_EXCEPTIONS=0'] +endif +thread_dep = dependency('threads', required: get_option('simdjson_enable_threads')) +if thread_dep.found() + compiler_opts += ['-DSIMDJSON_THREADS_ENABLED=1'] +endif + +subdir('src') diff --git a/subprojects/packagefiles/simdjson/meson_options.txt b/subprojects/packagefiles/simdjson/meson_options.txt new file mode 100644 index 0000000..d50aab8 --- /dev/null +++ b/subprojects/packagefiles/simdjson/meson_options.txt @@ -0,0 +1,6 @@ +option('simdjson_implementation_haswell', type: 'boolean', value: true, description: 'Include the haswell implementation') +option('simdjson_implementation_westmere', type: 'boolean', value: true, description: 'Include the westmere implementation') +option('simdjson_implementation_arm64', type: 'boolean', value: true, description: 'Include the arm64 implementation') +option('simdjson_implementation_fallback', type: 'boolean', value: true, description: 'Include the fallback implementation') +option('simdjson_exceptions', type: 'boolean', value: true, description: 'Enable simdjson\'s exception-throwing interface') +option('simdjson_enable_threads', type: 'feature', value: 'auto', description: 'Link with thread support') diff --git a/subprojects/packagefiles/simdjson/src/meson.build b/subprojects/packagefiles/simdjson/src/meson.build new file mode 100644 index 0000000..9b80553 --- /dev/null +++ b/subprojects/packagefiles/simdjson/src/meson.build @@ -0,0 +1,13 @@ +simdjson = static_library(meson.project_name(), + 'simdjson.cpp', + 'error.cpp', + include_directories: public_incl, + install: true, + cpp_args: compiler_opts, + dependencies: [thread_dep], +) + +simdjson_dep = declare_dependency( + link_with: simdjson, + include_directories: public_incl, +) diff --git a/subprojects/simdjson.wrap b/subprojects/simdjson.wrap new file mode 100644 index 0000000..8fbb193 --- /dev/null +++ b/subprojects/simdjson.wrap @@ -0,0 +1,7 @@ +[wrap-git] +url = https://github.com/simdjson/simdjson.git +revision = 5d355f1a8b584519ed39256c3be949ef7f8b0dbd +patch_directory = simdjson + +[provide] +dependency_names = simdjson-0.5.0