From 2a9780bf15f22d311d411a1e3968c763d5db0e87 Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Fri, 26 Mar 2021 21:05:11 +0100 Subject: [PATCH] Convert project to meson --- .gitignore | 1 + .gitmodules | 3 -- CMakeLists.txt | 17 ---------- lib/simdjson | 1 - meson.build | 19 ++++++++++++ subprojects/packagefiles/simdjson/meson.build | 31 +++++++++++++++++++ .../packagefiles/simdjson/meson_options.txt | 6 ++++ .../packagefiles/simdjson/src/meson.build | 13 ++++++++ subprojects/simdjson.wrap | 7 +++++ 9 files changed, 77 insertions(+), 21 deletions(-) delete mode 100644 CMakeLists.txt delete mode 160000 lib/simdjson create mode 100644 meson.build 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 d91d243..b4fe38a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ compile_commands.json tags +subprojects/simdjson diff --git a/.gitmodules b/.gitmodules index 130d783..e69de29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "lib/simdjson"] - path = lib/simdjson - url = https://github.com/simdjson/simdjson.git diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 7039211..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 3.10 FATAL_ERROR) -project(remarkable_tool LANGUAGES CXX VERSION 1.0.0) - -add_subdirectory("lib/simdjson") - -add_executable(${PROJECT_NAME} - main.cpp -) - -target_link_libraries(${PROJECT_NAME} - PRIVATE simdjson -) - -set_target_properties(${PROJECT_NAME} PROPERTIES - CXX_STANDARD_REQUIRED ON - CXX_STANDARD "20" -) diff --git a/lib/simdjson b/lib/simdjson deleted file mode 160000 index 95b4870..0000000 --- a/lib/simdjson +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 95b4870e20be5f97d9dcf63b23b1c6f520c366c1 diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..5084cc7 --- /dev/null +++ b/meson.build @@ -0,0 +1,19 @@ +project('remarkable_tool', 'cpp', + version: '0.1.0', + meson_version: '>=0.56.0', + default_options: [ + 'buildtype=release', + 'cpp_std=c++20', + 'b_ndebug=if-release', + ], +) + +simdjson_dep = dependency('simdjson', version: '>=0.5.0', + fallback: ['simdjson', 'simdjson_dep'], +) + +executable(meson.project_name(), + 'main.cpp', + dependencies: simdjson_dep, + install: true, +) 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..316f6ec --- /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: not meson.is_subproject(), + 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..6f682c9 --- /dev/null +++ b/subprojects/simdjson.wrap @@ -0,0 +1,7 @@ +[wrap-git] +url = https://github.com/simdjson/simdjson.git +revision = 8a3b2f20e47b2eb28b7085d388422de94bdae634 +patch_directory = simdjson + +[provide] +dependency_names = simdjson-0.9.1