1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-24 22:11:15 +02:00

Meson build for libexpr and libflake

This commit is contained in:
John Ericson 2024-06-26 22:15:33 -04:00
parent fbdc554908
commit 31257009e1
16 changed files with 731 additions and 122 deletions

View file

@ -18,18 +18,57 @@ cxx = meson.get_compiler('cpp')
deps_private = [ ]
# See note in ../nix-util/meson.build
deps_public = [ ]
deps_private_subproject = [ ]
# See note in ../nix-util/meson.build
deps_other = [ ]
configdata = configuration_data()
# TODO rename, because it will conflict with downstream projects
configdata.set_quoted('PACKAGE_VERSION', meson.project_version())
foreach nix_dep : [
dependency('nix-util'),
dependency('nix-util-c'),
dependency('nix-util-test-support'),
]
if nix_dep.type_name() == 'internal'
deps_private_subproject += nix_dep
# subproject sadly no good for pkg-config module
deps_other += nix_dep
else
deps_private += nix_dep
endif
endforeach
if host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
# Windows DLLs are stricter about symbol visibility than Unix shared
# objects --- see https://gcc.gnu.org/wiki/Visibility for details.
# This is a temporary sledgehammer to export everything like on Unix,
# and not detail with this yet.
#
# TODO do not do this, and instead do fine-grained export annotations.
linker_export_flags = ['-Wl,--export-all-symbols']
else
linker_export_flags = []
endif
rapidcheck = dependency('rapidcheck')
deps_private += rapidcheck
gtest = dependency('gtest', main : true)
deps_private += gtest
config_h = configure_file(
configuration : configdata,
output : 'config-util-test.h',
)
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.
'-include', 'config-util-test.h',
# '-include', 'config-store.h',
'-Wno-deprecated-declarations',
'-Wimplicit-fallthrough',
'-Werror=switch',
@ -46,14 +85,6 @@ add_project_arguments(
language : 'cpp',
)
# TODO rename, because it will conflict with downstream projects
configdata.set_quoted('PACKAGE_VERSION', meson.project_version())
config_h = configure_file(
configuration : configdata,
output : 'config-util-test.h',
)
sources = files(
'args.cc',
'canon-path.cc',
@ -80,52 +111,11 @@ sources = files(
include_dirs = [include_directories('.')]
if host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
# Windows DLLs are stricter about symbol visibility than Unix shared
# objects --- see https://gcc.gnu.org/wiki/Visibility for details.
# This is a temporary sledgehammer to export everything like on Unix,
# and not detail with this yet.
#
# TODO do not do this, and instead do fine-grained export annotations.
linker_export_flags = ['-Wl,--export-all-symbols']
else
linker_export_flags = []
endif
nix_util = dependency('nix-util')
if nix_util.type_name() == 'internal'
# subproject sadly no good for pkg-config module
deps_other += nix_util
else
deps_public += nix_util
endif
nix_util_c = dependency('nix-util-c')
if nix_util_c.type_name() == 'internal'
# subproject sadly no good for pkg-config module
deps_other += nix_util_c
else
deps_public += nix_util_c
endif
nix_util_test_support = dependency('nix-util-test-support')
if nix_util_test_support.type_name() == 'internal'
# subproject sadly no good for pkg-config module
deps_other += nix_util_test_support
else
deps_public += nix_util_test_support
endif
rapidcheck = dependency('rapidcheck')
deps_public += rapidcheck
gtest = dependency('gtest', main : true)
deps_public += gtest
this_exe = executable(
'nix-util-test',
sources,
dependencies : deps_public + deps_private + deps_other,
dependencies : deps_private_subproject + deps_private + deps_other,
include_directories : include_dirs,
# TODO: -lrapidcheck, see ../libutil-support/build.meson
link_args: linker_export_flags + ['-lrapidcheck'],
@ -139,5 +129,4 @@ meson.override_dependency(meson.project_name(), declare_dependency(
include_directories : include_dirs,
link_with : this_exe,
compile_args : ['-std=c++2a'],
dependencies : [],
))