|
| 1 | +project('nix-main-c', 'cpp', |
| 2 | + version : files('.version'), |
| 3 | + default_options : [ |
| 4 | + 'cpp_std=c++2a', |
| 5 | + # TODO(Qyriad): increase the warning level |
| 6 | + 'warning_level=1', |
| 7 | + 'debug=true', |
| 8 | + 'optimization=2', |
| 9 | + 'errorlogs=true', # Please print logs for tests that fail |
| 10 | + ], |
| 11 | + meson_version : '>= 1.1', |
| 12 | + license : 'LGPL-2.1-or-later', |
| 13 | +) |
| 14 | + |
| 15 | +cxx = meson.get_compiler('cpp') |
| 16 | + |
| 17 | +subdir('build-utils-meson/deps-lists') |
| 18 | + |
| 19 | +configdata = configuration_data() |
| 20 | + |
| 21 | +deps_private_maybe_subproject = [ |
| 22 | + dependency('nix-util'), |
| 23 | + dependency('nix-store'), |
| 24 | + dependency('nix-main'), |
| 25 | +] |
| 26 | +deps_public_maybe_subproject = [ |
| 27 | + dependency('nix-util-c'), |
| 28 | + dependency('nix-store-c'), |
| 29 | +] |
| 30 | +subdir('build-utils-meson/subprojects') |
| 31 | + |
| 32 | +# TODO rename, because it will conflict with downstream projects |
| 33 | +configdata.set_quoted('PACKAGE_VERSION', meson.project_version()) |
| 34 | + |
| 35 | +config_h = configure_file( |
| 36 | + configuration : configdata, |
| 37 | + output : 'config-main.h', |
| 38 | +) |
| 39 | + |
| 40 | +add_project_arguments( |
| 41 | + # TODO(Qyriad): Yes this is how the autoconf+Make system did it. |
| 42 | + # It would be nice for our headers to be idempotent instead. |
| 43 | + |
| 44 | + # From C++ libraries, only for internals |
| 45 | + '-include', 'config-util.hh', |
| 46 | + '-include', 'config-store.hh', |
| 47 | + '-include', 'config-main.hh', |
| 48 | + |
| 49 | + # From C libraries, for our public, installed headers too |
| 50 | + '-include', 'config-util.h', |
| 51 | + '-include', 'config-store.h', |
| 52 | + '-include', 'config-main.h', |
| 53 | + language : 'cpp', |
| 54 | +) |
| 55 | + |
| 56 | +subdir('build-utils-meson/diagnostics') |
| 57 | + |
| 58 | +sources = files( |
| 59 | + 'nix_api_main.cc', |
| 60 | +) |
| 61 | + |
| 62 | +include_dirs = [include_directories('.')] |
| 63 | + |
| 64 | +headers = [config_h] + files( |
| 65 | + 'nix_api_main.h', |
| 66 | +) |
| 67 | + |
| 68 | +subdir('build-utils-meson/export-all-symbols') |
| 69 | + |
| 70 | +this_library = library( |
| 71 | + 'nixmainc', |
| 72 | + sources, |
| 73 | + dependencies : deps_public + deps_private + deps_other, |
| 74 | + include_directories : include_dirs, |
| 75 | + link_args: linker_export_flags, |
| 76 | + prelink : true, # For C++ static initializers |
| 77 | + install : true, |
| 78 | +) |
| 79 | + |
| 80 | +install_headers(headers, subdir : 'nix', preserve_path : true) |
| 81 | + |
| 82 | +libraries_private = [] |
| 83 | + |
| 84 | +subdir('build-utils-meson/export') |
0 commit comments