Convert project to meson

This commit is contained in:
King_DuckZ 2021-03-26 21:05:11 +01:00
parent 7adb4748f5
commit 2a9780bf15
9 changed files with 77 additions and 21 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
compile_commands.json
tags
subprojects/simdjson

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "lib/simdjson"]
path = lib/simdjson
url = https://github.com/simdjson/simdjson.git

View File

@ -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"
)

@ -1 +0,0 @@
Subproject commit 95b4870e20be5f97d9dcf63b23b1c6f520c366c1

19
meson.build Normal file
View File

@ -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,
)

View File

@ -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')

View File

@ -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')

View File

@ -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,
)

View File

@ -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