@@ -12,6 +12,7 @@ option("ci", { default = false })
1212
1313if has_config (" dev" ) then
1414 set_policy (" build.ccache" , true )
15+ set_policy (" package.install_only" , true ) -- Don't fetch system package
1516 if is_plat (" windows" ) then
1617 set_runtimes (" MD" )
1718 if is_mode (" debug" ) then
@@ -31,32 +32,37 @@ local libuv_require = "libuv"
3132if has_config (" release" ) then
3233 set_policy (" build.optimization.lto" , true )
3334 set_policy (" package.cmake_generator.ninja" , true )
35+ set_policy (" package.install_only" , true ) -- Don't fetch system package
3436
3537 if is_plat (" windows" ) then
36- set_runtimes (" MT " )
38+ set_runtimes (" MD " )
3739 -- workaround cmake
3840 libuv_require = " libuv[toolchains=clang-cl]"
3941 end
4042
4143 includes (" @builtin/xpack" )
4244end
4345
44- if is_plat (" macosx" ) then
45- -- https://conda-forge.org/docs/maintainer/knowledge_base/#newer-c-features-with-old-sdk
46- add_defines (" _LIBCPP_DISABLE_AVAILABILITY=1" )
47- add_ldflags (" -fuse-ld=lld" )
48- add_shflags (" -fuse-ld=lld" )
46+ if is_plat (" macosx" , " linux" ) then
47+ local cxflags
48+ if is_plat (" macosx" ) then
49+ -- https://conda-forge.org/docs/maintainer/knowledge_base/#newer-c-features-with-old-sdk
50+ cxflags = " -D_LIBCPP_DISABLE_AVAILABILITY=1"
51+ end
52+ local ldflags = " -fuse-ld=lld"
53+ local shflags = " -fuse-ld=lld"
54+
55+ add_cxflags (cxflags )
56+ add_ldflags (ldflags )
57+ add_shflags (shflags )
4958
5059 add_requireconfs (" **|cmake" , {
5160 configs = {
52- ldflags = " -fuse-ld=lld " ,
53- shflags = " -fuse-ld=lld " ,
54- cxflags = " -D_LIBCPP_DISABLE_AVAILABILITY=1 " ,
61+ cxflags = cxflags ,
62+ ldflags = ldflags ,
63+ shflags = shflags ,
5564 },
5665 })
57- elseif is_plat (" linux" ) then
58- -- don't fetch system package
59- set_policy (" package.install_only" , true )
6066end
6167
6268add_defines (" TOML_EXCEPTIONS=0" )
@@ -247,12 +253,17 @@ rule("clice_build_config", function()
247253 target :add (" ldflags" , " -fuse-ld=lld" , " -static-libstdc++" , " -Wl,--gc-sections" )
248254 elseif target :is_plat (" macosx" ) then
249255 target :add (" ldflags" , " -fuse-ld=lld" , " -Wl,-dead_strip,-object_path_lto,clice.lto.o" , { force = true })
250- -- dsymutil so slow, disable it in daily ci
256+ -- dsymutil so slow, disable it in dev ci
251257 if not has_config (" release" ) and is_mode (" releasedbg" ) and has_config (" ci" ) then
252258 target :rule_enable (" utils.symbols.extract" , false )
253259 end
254260 end
255261
262+ if has_config (" release" ) then
263+ -- pixi clang failed to add lto flags because it need `-fuse-ld=lld`
264+ target :add (" ldflags" , " -flto=thin" , { force = true })
265+ end
266+
256267 if has_config (" ci" ) then
257268 target :add (" cxxflags" , " -DCLICE_CI_ENVIRONMENT=1" )
258269 end
0 commit comments