nix-super/src/libexpr/meson.build

211 lines
4.4 KiB
Meson
Raw Normal View History

2024-06-27 05:15:33 +03:00
project('nix-expr', 'cpp',
version : files('.version'),
default_options : [
'cpp_std=c++2a',
# TODO(Qyriad): increase the warning level
'warning_level=1',
'debug=true',
'optimization=2',
'errorlogs=true', # Please print logs for tests that fail
],
meson_version : '>= 1.1',
license : 'LGPL-2.1-or-later',
)
cxx = meson.get_compiler('cpp')
2024-06-28 01:28:13 +03:00
subdir('build-utils-meson/deps-lists')
2024-06-27 05:15:33 +03:00
configdata = configuration_data()
2024-06-27 19:34:03 +03:00
deps_private_maybe_subproject = [
]
deps_public_maybe_subproject = [
2024-06-27 05:15:33 +03:00
dependency('nix-util'),
dependency('nix-store'),
dependency('nix-fetchers'),
]
2024-06-28 01:28:13 +03:00
subdir('build-utils-meson/subprojects')
2024-06-27 05:15:33 +03:00
2024-06-28 01:28:13 +03:00
subdir('build-utils-meson/threads')
2024-06-27 05:15:33 +03:00
boost = dependency(
'boost',
modules : ['container', 'context'],
include_type: 'system',
2024-06-27 05:15:33 +03:00
)
# boost is a public dependency, but not a pkg-config dependency unfortunately, so we
# put in `deps_other`.
deps_other += boost
nlohmann_json = dependency('nlohmann_json', version : '>= 3.9')
deps_public += nlohmann_json
bdw_gc = dependency('bdw-gc', required : get_option('gc'))
if bdw_gc.found()
deps_public += bdw_gc
foreach funcspec : [
'pthread_attr_get_np',
'pthread_getattr_np',
]
define_name = 'HAVE_' + funcspec.underscorify().to_upper()
define_value = cxx.has_function(funcspec).to_int()
configdata.set(define_name, define_value)
endforeach
configdata.set('GC_THREADS', 1)
endif
configdata.set('HAVE_BOEHMGC', bdw_gc.found().to_int())
toml11 = dependency(
'toml11',
version : '>=3.7.0',
method : 'cmake',
include_type: 'system',
)
2024-06-28 02:19:32 +03:00
deps_other += toml11
2024-06-27 05:15:33 +03:00
config_h = configure_file(
configuration : configdata,
2024-06-27 17:19:03 +03:00
output : 'config-expr.hh',
2024-06-27 05:15:33 +03:00
)
add_project_arguments(
# TODO(Qyriad): Yes this is how the autoconf+Make system did it.
# It would be nice for our headers to be idempotent instead.
2024-06-27 17:19:03 +03:00
'-include', 'config-util.hh',
'-include', 'config-store.hh',
2024-06-27 05:15:33 +03:00
# '-include', 'config-fetchers.h',
'-include', 'config-expr.hh',
2024-06-27 05:15:33 +03:00
language : 'cpp',
)
2024-06-28 01:28:13 +03:00
subdir('build-utils-meson/diagnostics')
2024-06-27 23:11:52 +03:00
2024-06-27 05:15:33 +03:00
parser_tab = custom_target(
input : 'parser.y',
output : [
'parser-tab.cc',
'parser-tab.hh',
],
command : [
'bison',
'-v',
'-o',
'@OUTPUT0@',
'@INPUT@',
'-d',
],
# NOTE(Qyriad): Meson doesn't support installing only part of a custom target, so we add
# an install script below which removes parser-tab.cc.
install : true,
install_dir : get_option('includedir') / 'nix',
)
lexer_tab = custom_target(
input : [
'lexer.l',
parser_tab,
],
output : [
'lexer-tab.cc',
'lexer-tab.hh',
],
command : [
'flex',
'--outfile',
'@OUTPUT0@',
'--header-file=' + '@OUTPUT1@',
'@INPUT0@',
],
# NOTE(Qyriad): Meson doesn't support installing only part of a custom target, so we add
# an install script below which removes lexer-tab.cc.
install : true,
install_dir : get_option('includedir') / 'nix',
)
subdir('build-utils-meson/generate-header')
2024-06-27 05:15:33 +03:00
generated_headers = []
foreach header : [
'imported-drv-to-derivation.nix',
'fetchurl.nix',
2024-06-28 02:19:32 +03:00
'call-flake.nix',
2024-06-27 05:15:33 +03:00
]
generated_headers += gen_header.process(header)
2024-06-27 05:15:33 +03:00
endforeach
sources = files(
'attr-path.cc',
'attr-set.cc',
'eval-cache.cc',
'eval-error.cc',
'eval-gc.cc',
'eval-settings.cc',
'eval.cc',
'function-trace.cc',
'get-drvs.cc',
'json-to-value.cc',
'lexer-helpers.cc',
2024-06-27 05:15:33 +03:00
'nixexpr.cc',
'paths.cc',
'primops.cc',
'print-ambiguous.cc',
'print.cc',
'search-path.cc',
'value-to-json.cc',
'value-to-xml.cc',
'value/context.cc',
)
2024-06-27 19:17:13 +03:00
include_dirs = [include_directories('.')]
2024-06-27 05:15:33 +03:00
headers = [config_h] + files(
'attr-path.hh',
'attr-set.hh',
'eval-cache.hh',
'eval-error.hh',
'eval-gc.hh',
'eval-inline.hh',
'eval-settings.hh',
'eval.hh',
'function-trace.hh',
'gc-small-vector.hh',
'get-drvs.hh',
'json-to-value.hh',
# internal: 'lexer-helpers.hh',
2024-06-27 05:15:33 +03:00
'nixexpr.hh',
'parser-state.hh',
'pos-idx.hh',
'pos-table.hh',
'primops.hh',
'print-ambiguous.hh',
'print-options.hh',
'print.hh',
'repl-exit-status.hh',
'search-path.hh',
'symbol-table.hh',
'value-to-json.hh',
'value-to-xml.hh',
'value.hh',
'value/context.hh',
)
2024-06-28 02:19:32 +03:00
subdir('primops')
2024-06-27 05:15:33 +03:00
this_library = library(
'nixexpr',
sources,
parser_tab,
lexer_tab,
generated_headers,
dependencies : deps_public + deps_private + deps_other,
prelink : true, # For C++ static initializers
2024-06-27 05:15:33 +03:00
install : true,
)
install_headers(headers, subdir : 'nix', preserve_path : true)
2024-06-27 19:17:13 +03:00
libraries_private = []
2024-06-27 05:15:33 +03:00
2024-06-28 01:28:13 +03:00
subdir('build-utils-meson/export')