project(
'nix-plugin-pijul',
'cpp',
license: 'LGPL-3.0',
license_files: ['LICENSE'],
version: configure_file(input: 'VERSION', output: 'VERSION', copy: true),
default_options: {
'cpp_std': 'c++20',
}
)
nix_impl = get_option('nix_impl')
nix_main_dep_names = {
'cppnix': 'nix-main',
'lix': 'lix-main',
}
if nix_impl != ''
nix_main_dep = dependency(nix_main_dep_names.get(nix_impl))
else
nix_main_dep = dependency('', required: false)
foreach impl, dep_name : nix_main_dep_names
d = dependency(dep_name, required: false)
if d.found() and nix_main_dep.found()
error('Both cppnix and lix are installed, choose one with -Dnix_impl=')
endif
nix_main_dep = d
nix_impl = impl
endforeach
if not d.found()
error('No Nix implementation found')
endif
endif
nix_store_dep_names = {
'cppnix': 'nix-store',
'lix': 'lix-store',
}
nix_store_dep = dependency(nix_store_dep_names.get(nix_impl))
nix_fetchers_dep_names = {
'cppnix': 'nix-fetchers',
'lix': 'lix-fetchers',
}
nix_fetchers_dep = dependency(nix_fetchers_dep_names.get(nix_impl))
nix_version_components = nix_main_dep.version().split('.')
nix_major_version = nix_version_components[0]
nix_minor_version = nix_version_components[1]
nix_patch_version = nix_version_components[2]
if nix_patch_version.contains('_')
nix_patch_version = '99'
endif
subdir('src')
subdir('autotests')