77 # TODO(Qyriad): increase the warning level
88 ' warning_level=1' ,
99 ' errorlogs=true' , # Please print logs for tests that fail
10+ ' unity=on' ,
11+ ' unity_size=1024' ,
1012 ],
1113 meson_version : ' >= 1.1' ,
1214 license : ' LGPL-2.1-or-later' ,
7779# Used in public header. Affects ABI!
7880configdata_pub.set(' NIX_USE_BOEHMGC' , bdw_gc.found().to_int())
7981
82+ link_args = []
83+
84+ wasmtime_required = get_option (' wasm' ).disable_if(
85+ get_option (' default_library' ) == ' static' ,
86+ error_message : ' Building with wasmtime and static linking is not supported' ,
87+ )
88+
89+ if wasmtime_required.enabled()
90+ link_args += ' -lwasmtime'
91+ endif
92+
8093toml11 = dependency (
8194 ' toml11' ,
8295 version : ' >=3.7.0' ,
@@ -156,14 +169,12 @@ sources = files(
156169 ' eval-cache.cc' ,
157170 ' eval-error.cc' ,
158171 ' eval-gc.cc' ,
159- ' eval-profiler-settings.cc' ,
160172 ' eval-profiler.cc' ,
161173 ' eval-settings.cc' ,
162174 ' eval.cc' ,
163175 ' function-trace.cc' ,
164176 ' get-drvs.cc' ,
165177 ' json-to-value.cc' ,
166- ' lexer-helpers.cc' ,
167178 ' nixexpr.cc' ,
168179 ' parallel-eval.cc' ,
169180 ' paths.cc' ,
@@ -216,6 +227,8 @@ parser_library = static_library(
216227 ' nixexpr-parser' ,
217228 parser_tab,
218229 lexer_tab,
230+ # Putting eval-profiler-settings.cc here to work around an inscrutable gcc compiler error when doing a unity build.
231+ files (' eval-profiler-settings.cc' , ' lexer-helpers.cc' ),
219232 cpp_args : parser_library_cpp_args,
220233 dependencies : deps_public + deps_private + deps_other,
221234 include_directories : include_dirs,
@@ -226,6 +239,7 @@ parser_library = static_library(
226239 override_options : [
227240 ' b_ndebug=@0@' .format(not get_option (' debug' )),
228241 ' b_lto=@0@' .format(get_option (' b_lto' ) and cxx.get_id() != ' gcc' ),
242+ ' unity=off' ,
229243 ],
230244)
231245
@@ -239,9 +253,9 @@ this_library = library(
239253 soversion : nix_soversion,
240254 dependencies : deps_public + deps_private + deps_other,
241255 include_directories : include_dirs,
242- link_args : linker_export_flags + [ ' -lwasmtime ' ] ,
256+ link_args : linker_export_flags + link_args ,
243257 link_whole : [ parser_library ],
244- prelink : true , # For C++ static initializers
258+ prelink : prelink , # For C++ static initializers
245259 install : true ,
246260 cpp_pch : do_pch ? [ ' pch/precompiled-headers.hh' ] : [],
247261)
0 commit comments