Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lexy: new wrap #1423

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions releases.json
Original file line number Diff line number Diff line change
Expand Up @@ -1381,6 +1381,14 @@
"1.83.1-1"
]
},
"lexy": {
"dependency_names": [
"lexy"
],
"versions": [
"2022.12.1-1"
]
},
"libarchive": {
"dependency_names": [
"libarchive"
Expand Down
9 changes: 9 additions & 0 deletions subprojects/lexy.wrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[wrap-file]
directory = lexy-2022.12.1
source_url = https://github.com/foonathan/lexy/archive/refs/tags/v2022.12.1.tar.gz
source_filename = lexy-2022.12.1.tar.gz
source_hash = 97de4324254ad235296a9161d6332200387981671411a6443aadd2b3265122f9
patch_directory = lexy

[provide]
lexy = lexy_dep
2 changes: 2 additions & 0 deletions subprojects/packagefiles/lexy/benchmarks/file/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
file_benchmark = executable('file', files('main.cpp'), dependencies: benchmarks_deps)
benchmark('file_benchmark', file_benchmark)
74 changes: 74 additions & 0 deletions subprojects/packagefiles/lexy/benchmarks/json/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@



fetch_targets = []

data = [
['canada.json', 'https://github.com/miloyip/nativejson-benchmark/raw/master/data/canada.json'],
[
'citm_catalog.json',
'https://github.com/miloyip/nativejson-benchmark/raw/master/data/citm_catalog.json',
],
[
'twitter.json',
'https://raw.githubusercontent.com/miloyip/nativejson-benchmark/master/data/twitter.json',
],
]

foreach d : data

name = d[0]
url = d[1]

curl = find_program('curl', required: false)

if curl.found()

fetch_targets += custom_target(
'fetch_' + name,
output: name,
command: [curl, url, '-o', '@OUTPUT@'],
)

else
wget = find_program('wget')

fetch_targets += custom_target(
'fetch_' + name,
output: name,
command: [wget, url, '-O', '@OUTPUT@'],
)

endif


endforeach



benchmark_files = files('baseline.cpp', 'lexy.cpp', 'main.cpp')

pegtl_dep = dependency('PEGTL', required: false)
if pegtl_dep.found()
benchmark_files += files('pegtl.cpp')
endif

json_dep = dependency('nlohmann_json', required: false)
if json_dep.found()
benchmark_files += files('nlohmann.cpp')
endif

rapidjson_dep = dependency('rapidjson', required: false)
if rapidjson_dep.found()
benchmark_files += files('rapidjson.cpp')
endif

# in the original also Boost.JSON is downloaded an used to compare it, that isn't done here

json_benchmark = executable(
'json',
benchmark_files,
dependencies: [benchmarks_deps, fetch_targets],
cpp_args: ['-DLEXY_BENCHMARK_DATA=' + meson.current_build_dir()],
)
benchmark('json_benchmark', json_benchmark)
8 changes: 8 additions & 0 deletions subprojects/packagefiles/lexy/benchmarks/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

benchmarks_deps = [lexy_dep]
benchmarks_deps += dependency('nanobench')


subdir('file')
subdir('json')
subdir('swar')
15 changes: 15 additions & 0 deletions subprojects/packagefiles/lexy/benchmarks/swar/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
swar_benchmark = executable(
'swar',
files(
'any.cpp',
'delimited.cpp',
'digits.cpp',
'identifier.cpp',
'literal.cpp',
'main.cpp',
'swar.hpp',
'until.cpp',
),
dependencies: benchmarks_deps,
)
benchmark('swar_benchmark', swar_benchmark)
113 changes: 113 additions & 0 deletions subprojects/packagefiles/lexy/include/lexy/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@

header_files += files(
'_detail/any_ref.hpp',
'_detail/assert.hpp',
'_detail/buffer_builder.hpp',
'_detail/code_point.hpp',
'_detail/config.hpp',
'_detail/detect.hpp',
'_detail/integer_sequence.hpp',
'_detail/invoke.hpp',
'_detail/iterator.hpp',
'_detail/lazy_init.hpp',
'_detail/memory_resource.hpp',
'_detail/nttp_string.hpp',
'_detail/stateless_lambda.hpp',
'_detail/std.hpp',
'_detail/string_view.hpp',
'_detail/swar.hpp',
'_detail/tuple.hpp',
'_detail/type_name.hpp',
'action/base.hpp',
'action/match.hpp',
'action/parse.hpp',
'action/parse_as_tree.hpp',
'action/scan.hpp',
'action/validate.hpp',
'callback/adapter.hpp',
'callback/aggregate.hpp',
'callback/base.hpp',
'callback/bind.hpp',
'callback/bit_cast.hpp',
'callback/composition.hpp',
'callback/constant.hpp',
'callback/container.hpp',
'callback/fold.hpp',
'callback/forward.hpp',
'callback/integer.hpp',
'callback/noop.hpp',
'callback/object.hpp',
'callback/string.hpp',
'dsl/any.hpp',
'dsl/ascii.hpp',
'dsl/base.hpp',
'dsl/bits.hpp',
'dsl/bom.hpp',
'dsl/brackets.hpp',
'dsl/branch.hpp',
'dsl/byte.hpp',
'dsl/capture.hpp',
'dsl/case_folding.hpp',
'dsl/char_class.hpp',
'dsl/choice.hpp',
'dsl/code_point.hpp',
'dsl/combination.hpp',
'dsl/context_counter.hpp',
'dsl/context_flag.hpp',
'dsl/context_identifier.hpp',
'dsl/delimited.hpp',
'dsl/digit.hpp',
'dsl/effect.hpp',
'dsl/eof.hpp',
'dsl/error.hpp',
'dsl/expression.hpp',
'dsl/flags.hpp',
'dsl/follow.hpp',
'dsl/identifier.hpp',
'dsl/if.hpp',
'dsl/integer.hpp',
'dsl/lookahead.hpp',
'dsl/loop.hpp',
'dsl/member.hpp',
'dsl/newline.hpp',
'dsl/operator.hpp',
'dsl/option.hpp',
'dsl/parse_as.hpp',
'dsl/peek.hpp',
'dsl/position.hpp',
'dsl/production.hpp',
'dsl/punctuator.hpp',
'dsl/recover.hpp',
'dsl/repeat.hpp',
'dsl/return.hpp',
'dsl/scan.hpp',
'dsl/separator.hpp',
'dsl/sequence.hpp',
'dsl/sign.hpp',
'dsl/subgrammar.hpp',
'dsl/symbol.hpp',
'dsl/terminator.hpp',
'dsl/times.hpp',
'dsl/token.hpp',
'dsl/unicode.hpp',
'dsl/until.hpp',
'dsl/whitespace.hpp',
'input/argv_input.hpp',
'input/base.hpp',
'input/buffer.hpp',
'input/file.hpp',
'input/lexeme_input.hpp',
'input/range_input.hpp',
'input/string_input.hpp',
'callback.hpp',
'code_point.hpp',
'dsl.hpp',
'encoding.hpp',
'error.hpp',
'grammar.hpp',
'input_location.hpp',
'lexeme.hpp',
'parse_tree.hpp',
'token.hpp',
'visualize.hpp',
)
7 changes: 7 additions & 0 deletions subprojects/packagefiles/lexy/include/lexy_ext/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ext_header_files += files(
'compiler_explorer.hpp',
'parse_tree_algorithm.hpp',
'parse_tree_doctest.hpp',
'report_error.hpp',
'shell.hpp',
)
21 changes: 21 additions & 0 deletions subprojects/packagefiles/lexy/include/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
inc_dirs += include_directories('.')


header_files = []
subdir('lexy')

ext_header_files = []
subdir('lexy_ext')

if install
install_headers(
header_files,
subdir: 'lexy',
preserve_path: true,
)
install_headers(
ext_header_files,
subdir: 'lexy_ext',
preserve_path: true,
)
endif
81 changes: 81 additions & 0 deletions subprojects/packagefiles/lexy/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
project(
'lexy',
'cpp',
default_options: {'default_library': 'static'},
version: '2022.12.1',
license: 'BSL-1.0',
meson_version: '>=1.2.0',
)

inc_dirs = []
compile_args = []
override_options = []

install = get_option('install')

cpp = meson.get_compiler('cpp')
is_in_cpp20_mode = cpp.compiles(
'''
#if defined(__cplusplus) && (__cplusplus >= 202002L || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L))
#else
#error is not in cpp 20 mode
#endif
''',
)
is_in_cpp17_mode = cpp.compiles(
'''
#if defined(__cplusplus) && (__cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L))
#else
#error is not in cpp 17 mode
#endif
''',
)

if not is_in_cpp17_mode
error('at least c++17 is required to build this package')
endif

if get_option('use_cpp17').enabled()

override_options += 'cpp_std=c++17'

elif get_option('use_cpp17').disabled()

if not is_in_cpp20_mode
error(
'at least c++20 is required to build this package, you explicitely disabled c++17 support',
)
endif

override_options += 'cpp_std=c++20'

else
if not is_in_cpp20_mode
override_options += 'cpp_std=c++17'
else
override_options += 'cpp_std=c++20'
endif
endif

subdir('include')
subdir('src')


lexy_dep = declare_dependency(
include_directories: inc_dirs,
version: meson.project_version(),
link_with: lexy_lib,
compile_args: compile_args,
)

if get_option('build_examples')
subdir('examples')
endif

if get_option('build_benchmarks')
subdir('benchmarks')
endif

if get_option('tests')
subdir('tests')
endif
37 changes: 37 additions & 0 deletions subprojects/packagefiles/lexy/meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

option(
'build_examples',
type: 'boolean',
value: false,
description: 'whether or not examples should be built',
)
option(
'build_benchmarks',
type: 'boolean',
value: false,
description: 'whether or not benchmarks should be built',
)
option(
'tests',
type: 'boolean',
value: true,
description: 'whether or not tests should be built',
)
option(
'user_config_header',
type: 'string',
value: '',
description: 'set the name of the user config header',
)
option(
'use_cpp17',
type: 'feature',
value: 'auto',
description: 'use c++17 standard instead of c++20',
)
option(
'install',
type: 'boolean',
value: false,
description: 'Create installation target',
)
Loading
Loading