summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkaps316 <[email protected]>2026-04-05 10:58:30 +0530
committerAkaps316 <[email protected]>2026-04-05 10:58:30 +0530
commit9b189a6f1098e55c4ea6d1928644bed4acf5a412 (patch)
tree24c57eb099605c9b10e322fdf648f2ba96d4886e
parentd0f83e55778e37afc767cf8fa382e16d6e5dc001 (diff)
parent95e7d1658cb820accdc1bea5c79562331be9baf7 (diff)
fix(xcode.application): resolve merge conflict with upstream dev
-rw-r--r--README.md1
-rw-r--r--README_zh.md1
-rw-r--r--tests/projects/c/filc/safety_test/src/main.c17
-rw-r--r--tests/projects/c/filc/safety_test/test.lua52
-rw-r--r--tests/projects/c/filc/safety_test/xmake.lua9
-rw-r--r--tests/projects/objc/macapp_duplicate_rpath/src/Info.plist18
-rw-r--r--tests/projects/objc/macapp_duplicate_rpath/src/main.m5
-rw-r--r--tests/projects/objc/macapp_duplicate_rpath/test.lua8
-rw-r--r--tests/projects/objc/macapp_duplicate_rpath/xmake.lua9
-rw-r--r--xmake/core/package/package.lua20
-rw-r--r--xmake/modules/core/tools/filcc.lua21
-rw-r--r--xmake/modules/core/tools/filxx.lua21
-rw-r--r--xmake/modules/detect/tools/find_filcc.lua41
-rw-r--r--xmake/modules/detect/tools/find_filxx.lua41
-rw-r--r--xmake/modules/package/tools/xmake.lua10
-rw-r--r--xmake/rules/c++/modules/scanner.lua14
-rw-r--r--xmake/rules/c++/modules/support.lua19
-rw-r--r--xmake/toolchains/filc/xmake.lua100
18 files changed, 395 insertions, 12 deletions
diff --git a/README.md b/README.md
index c262f2761..1d1cb87ac 100644
--- a/README.md
+++ b/README.md
@@ -246,6 +246,7 @@ ti-c2000 TI-CGT C2000 compiler
ti-c6000 TI-CGT C6000 compiler
iararm IAR ARM C/C++ Compiler
kotlin-native Kotlin Native Programming Language Compiler
+filc A memory safe implementation of the C and C++ programming languages (https://fil-c.org/)
```
## Supported languages
diff --git a/README_zh.md b/README_zh.md
index c6618920d..b48c4d630 100644
--- a/README_zh.md
+++ b/README_zh.md
@@ -307,6 +307,7 @@ ti-c2000 TI-CGT C2000 compiler
ti-c6000 TI-CGT C6000 compiler
iararm IAR ARM C/C++ Compiler
kotlin-native Kotlin Native Programming Language Compiler
+filc A memory safe implementation of the C and C++ programming languages (https://fil-c.org/)
```
## 支持语言
diff --git a/tests/projects/c/filc/safety_test/src/main.c b/tests/projects/c/filc/safety_test/src/main.c
new file mode 100644
index 000000000..d23718c3e
--- /dev/null
+++ b/tests/projects/c/filc/safety_test/src/main.c
@@ -0,0 +1,17 @@
+/* Test that filc catches calling a function pointer with a wrong address.
+ *
+ * Expected runtime output (exit non-zero):
+ * filc safety error: cannot access pointer as function with ptr != aux ...
+ * filc panic: thwarted a futile attempt to violate memory safety.
+ */
+#include <stdfil.h>
+#include <stdlib.h>
+
+static void foo(void) {
+}
+
+int main() {
+ void (*my_foo)(void) = (void(*)(void))((char*)foo + 42);
+ my_foo();
+ return 0;
+}
diff --git a/tests/projects/c/filc/safety_test/test.lua b/tests/projects/c/filc/safety_test/test.lua
new file mode 100644
index 000000000..2a372b3cd
--- /dev/null
+++ b/tests/projects/c/filc/safety_test/test.lua
@@ -0,0 +1,52 @@
+import("utils.ci.is_running", {alias = "ci_is_running"})
+
+function main(t)
+ -- filc only supports Linux x86_64
+ if os.host() ~= "linux" or os.arch() ~= "x86_64" then
+ return t:skip("filc is only supported on linux/x86_64")
+ end
+
+ local flags = ci_is_running() and "-vD" or ""
+
+ -- configure and install the filc package; skip if unavailable
+ local configured = try
+ {
+ function ()
+ os.exec("xmake f -c -y " .. flags)
+ return true
+ end,
+ catch { function () end }
+ }
+ if not configured then
+ return t:skip("filc package not available or install failed")
+ end
+
+ os.exec("xmake -r " .. flags)
+
+ -- find the compiled binary
+ local binfile = path.join("build", os.host(), os.arch(), "release", "safety_test")
+ assert(os.isfile(binfile), "binary not found: " .. binfile)
+
+ -- run the binary — it MUST exit non-zero and emit a filc safety error
+ -- os.iorunv raises on non-zero exit in the sandbox, so catch the failure
+ local filc_output = nil
+ try
+ {
+ function ()
+ os.iorunv(binfile, {})
+ end,
+ catch
+ {
+ function (errors)
+ filc_output = tostring(errors)
+ end
+ }
+ }
+ assert(filc_output, "expected safety_test to exit non-zero, but it succeeded")
+ assert(filc_output:find("filc safety error", 1, true),
+ "expected 'filc safety error' in output, got:\n" .. filc_output)
+ assert(filc_output:find("filc panic", 1, true),
+ "expected 'filc panic' in output, got:\n" .. filc_output)
+
+ cprint("${green}filc safety check triggered as expected${reset}")
+end
diff --git a/tests/projects/c/filc/safety_test/xmake.lua b/tests/projects/c/filc/safety_test/xmake.lua
new file mode 100644
index 000000000..4ebbf9792
--- /dev/null
+++ b/tests/projects/c/filc/safety_test/xmake.lua
@@ -0,0 +1,9 @@
+add_rules("mode.debug", "mode.release")
+
+add_requires("filc")
+
+target("safety_test")
+ set_kind("binary")
+ set_toolchains("@filc")
+ add_packages("filc")
+ add_files("src/*.c")
diff --git a/tests/projects/objc/macapp_duplicate_rpath/src/Info.plist b/tests/projects/objc/macapp_duplicate_rpath/src/Info.plist
new file mode 100644
index 000000000..e20952d73
--- /dev/null
+++ b/tests/projects/objc/macapp_duplicate_rpath/src/Info.plist
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleExecutable</key>
+ <string>demo</string>
+ <key>CFBundleIdentifier</key>
+ <string>io.xmake.demo.duprpath</string>
+ <key>CFBundleName</key>
+ <string>demo</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+</dict>
+</plist>
diff --git a/tests/projects/objc/macapp_duplicate_rpath/src/main.m b/tests/projects/objc/macapp_duplicate_rpath/src/main.m
new file mode 100644
index 000000000..f481d2909
--- /dev/null
+++ b/tests/projects/objc/macapp_duplicate_rpath/src/main.m
@@ -0,0 +1,5 @@
+#import <AppKit/AppKit.h>
+
+int main(void) {
+ return 0;
+}
diff --git a/tests/projects/objc/macapp_duplicate_rpath/test.lua b/tests/projects/objc/macapp_duplicate_rpath/test.lua
new file mode 100644
index 000000000..561d206cf
--- /dev/null
+++ b/tests/projects/objc/macapp_duplicate_rpath/test.lua
@@ -0,0 +1,8 @@
+function main(t)
+ if not is_host("macosx") then
+ return t:skip("wrong host platform")
+ end
+
+ os.execv("xmake", {"f", "-p", "macosx", "-a", os.arch(), "-c"})
+ os.execv("xmake", {"-vD"})
+end
diff --git a/tests/projects/objc/macapp_duplicate_rpath/xmake.lua b/tests/projects/objc/macapp_duplicate_rpath/xmake.lua
new file mode 100644
index 000000000..a9428203f
--- /dev/null
+++ b/tests/projects/objc/macapp_duplicate_rpath/xmake.lua
@@ -0,0 +1,9 @@
+add_rules("mode.release", "mode.debug")
+
+set_languages("c11", "objc")
+
+target("demo")
+ add_rules("xcode.application")
+ add_rpathdirs("@executable_path/../Frameworks")
+ add_files("src/main.m")
+ add_files("src/Info.plist")
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua
index 7e20a1cda..395ddbfa3 100644
--- a/xmake/core/package/package.lua
+++ b/xmake/core/package/package.lua
@@ -843,7 +843,7 @@ function _instance:builddir()
if not builddir then
if self:is_local() then
local name = self:name():lower():gsub("::", "_")
- local rootdir = path.join(config.builddir({absolute = true}), ".packages", name:sub(1, 1):lower(), name, self:version_str())
+ local rootdir = path.join(package.installdir({localdir = true}), name:sub(1, 1):lower(), name, self:version_str())
builddir = path.join(rootdir, "cache", "build_" .. hash.rand32())
else
builddir = "build_" .. hash.rand32()
@@ -886,7 +886,7 @@ function _instance:cachedir()
version_str = version_str:gsub("[>=<|%*]", "")
end
if self:is_local() then
- cachedir = path.join(config.builddir({absolute = true}), ".packages", name:sub(1, 1):lower(), name, version_str, "cache")
+ cachedir = path.join(package.installdir({localdir = true}), name:sub(1, 1):lower(), name, version_str, "cache")
else
cachedir = path.join(package.cachedir(), name:sub(1, 1):lower(), name, version_str)
end
@@ -908,7 +908,7 @@ function _instance:installdir(...)
if not installdir then
local name = self:name():lower():gsub("::", "_")
if self:is_local() then
- installdir = path.join(config.builddir({absolute = true}), ".packages", name:sub(1, 1):lower(), name)
+ installdir = path.join(package.installdir({localdir = true}), name:sub(1, 1):lower(), name)
else
installdir = path.join(package.installdir(), name:sub(1, 1):lower(), name)
end
@@ -2939,8 +2939,18 @@ function package.cachedir(opt)
return path.join(cachedir, os.date("%y%m"))
end
--- the install directory
-function package.installdir()
+-- the global/local install directory for packages
+--
+-- @param opt the options, e.g. {localdir = true}
+-- - localdir: return the local project packages directory (build/.packages)
+-- instead of the global directory (~/.xmake/packages)
+--
+-- @return the install directory path
+--
+function package.installdir(opt)
+ if opt and opt.localdir then
+ return path.join(config.builddir({absolute = true}), ".packages")
+ end
local installdir = package._INSTALLDIR
if not installdir then
installdir = os.getenv("XMAKE_PKG_INSTALLDIR") or global.get("pkg_installdir") or path.join(global.directory(), "packages")
diff --git a/xmake/modules/core/tools/filcc.lua b/xmake/modules/core/tools/filcc.lua
new file mode 100644
index 000000000..28aefc34a
--- /dev/null
+++ b/xmake/modules/core/tools/filcc.lua
@@ -0,0 +1,21 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015-present, Xmake Open Source Community.
+--
+-- @file filcc.lua
+--
+
+-- filcc is Fil-C's clang-based C compiler - inherit clang driver behaviour
+inherit("clang")
diff --git a/xmake/modules/core/tools/filxx.lua b/xmake/modules/core/tools/filxx.lua
new file mode 100644
index 000000000..10898fa48
--- /dev/null
+++ b/xmake/modules/core/tools/filxx.lua
@@ -0,0 +1,21 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015-present, Xmake Open Source Community.
+--
+-- @file filxx.lua
+--
+
+-- fil++ is Fil-C's clang-based C++ compiler - inherit clang driver behaviour
+inherit("clang")
diff --git a/xmake/modules/detect/tools/find_filcc.lua b/xmake/modules/detect/tools/find_filcc.lua
new file mode 100644
index 000000000..2f6c96fcc
--- /dev/null
+++ b/xmake/modules/detect/tools/find_filcc.lua
@@ -0,0 +1,41 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015-present, Xmake Open Source Community.
+--
+-- @file find_filcc.lua
+--
+
+import("lib.detect.find_program")
+import("lib.detect.find_programver")
+
+-- find filcc (Fil-C memory-safe C compiler, clang-based)
+--
+-- @param opt the argument options, e.g. {version = true}
+--
+-- @return program, version
+--
+function main(opt)
+ opt = opt or {}
+ opt.check = opt.check or "--version"
+ opt.command = opt.command or "--version"
+
+ local program = find_program(opt.program or "filcc", opt)
+
+ local version = nil
+ if program and opt.version then
+ version = find_programver(program, opt)
+ end
+ return program, version
+end
diff --git a/xmake/modules/detect/tools/find_filxx.lua b/xmake/modules/detect/tools/find_filxx.lua
new file mode 100644
index 000000000..b7aa65cc9
--- /dev/null
+++ b/xmake/modules/detect/tools/find_filxx.lua
@@ -0,0 +1,41 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015-present, Xmake Open Source Community.
+--
+-- @file find_filxx.lua
+--
+
+import("lib.detect.find_program")
+import("lib.detect.find_programver")
+
+-- find fil++ (Fil-C memory-safe C++ compiler, clang-based)
+--
+-- @param opt the argument options, e.g. {version = true}
+--
+-- @return program, version
+--
+function main(opt)
+ opt = opt or {}
+ opt.check = opt.check or "--version"
+ opt.command = opt.command or "--version"
+
+ local program = find_program(opt.program or "fil++", opt)
+
+ local version = nil
+ if program and opt.version then
+ version = find_programver(program, opt)
+ end
+ return program, version
+end
diff --git a/xmake/modules/package/tools/xmake.lua b/xmake/modules/package/tools/xmake.lua
index 133de5f39..ea0ce9d65 100644
--- a/xmake/modules/package/tools/xmake.lua
+++ b/xmake/modules/package/tools/xmake.lua
@@ -23,6 +23,7 @@ import("core.base.option")
import("core.base.global")
import("core.tool.toolchain")
import("core.project.project")
+import("core.package.package", {alias = "package_core"})
import("core.package.repository")
import("private.action.require.impl.package", {alias = "require_package"})
import("private.utils.toolchain", {alias = "toolchain_utils"})
@@ -524,6 +525,15 @@ function install(package, configs, opt)
-- get build environments
local envs = opt.envs or buildenvs(package)
+ -- if the package is installed locally, pass the local packages directory
+ -- to the child xmake process so it can find already-installed deps
+ -- without re-installing them to the global directory
+ -- @see https://github.com/xmake-io/xmake/discussions/7441
+ if package:is_local() and not package:is_source_embed() then
+ envs = table.clone(envs)
+ envs.XMAKE_PKG_INSTALLDIR = package_core.installdir({localdir = true})
+ end
+
-- pass local repositories
for _, repo in ipairs(repository.repositories()) do
local repo_argv = {"repo"}
diff --git a/xmake/rules/c++/modules/scanner.lua b/xmake/rules/c++/modules/scanner.lua
index 2bcee1f12..72adea260 100644
--- a/xmake/rules/c++/modules/scanner.lua
+++ b/xmake/rules/c++/modules/scanner.lua
@@ -385,7 +385,7 @@ function _patch_sourcebatch(target, sourcebatch)
local strict = target:policy("build.c++.modules.reuse.strict") or
target:policy("build.c++.modules.tryreuse.discriminate_on_defines")
local dep = target:dep(fileconfig.from_dep)
- assert(dep, "dep target <%s> for <%s> not found", fileconfig.from_dep, target:fullname())
+ assert(dep, "dep target(%s) for target(%s) not found", fileconfig.from_dep, target:fullname())
local can_reuse = nocheck or _are_flags_compatible(target, dep, sourcefile, {strict = strict})
if can_reuse then
local _reused, from = support.is_reused(dep, sourcefile)
@@ -556,7 +556,7 @@ function _schedule_module_dependencies_scan(target, jobgraph, sourcebatch)
local changed = memcache:get2(target:fullname(), "modules.changed")
if changed then
modules = modules or {}
- local moduleinfo = support.load_moduleinfo(target, sourcefile)
+ local moduleinfo = assert(support.load_moduleinfo(target, sourcefile))
local module, headerunitsinfo = _parse_moduleinfo(target, moduleinfo)
modules[module.sourcefile] = module
for _, headerunitinfo in ipairs(headerunitsinfo) do
@@ -883,7 +883,15 @@ end
function get_modules(target)
local modules = support.localcache():get2(target:fullname(), "c++.modules")
- assert(modules, "no modules! (" .. target:fullname() .. ")")
+ if not modules then
+ local targets = support.memcache():get("targets")
+ assert(targets, "module scanner did not run, maybe a custom `on_prepare()` script overrides the modules one.")
+
+ local target_fullname = target:fullname()
+ assert(targets[target_fullname], "module scanner did not run for target(%s), maybe a custom `on_prepare()` script overrides the modules one.", target_fullname)
+ assert(targets[target_fullname].finished_parsing, "target(%s): tried getting modules before scanner finished parsing.", target_fullname)
+ assert(false, "target(%s): no modules found!", target_fullname)
+ end
return modules
end
diff --git a/xmake/rules/c++/modules/support.lua b/xmake/rules/c++/modules/support.lua
index 0767c88af..1dd7625bb 100644
--- a/xmake/rules/c++/modules/support.lua
+++ b/xmake/rules/c++/modules/support.lua
@@ -281,15 +281,26 @@ end
function load_moduleinfo(target, sourcefile)
local reused, from = is_reused(target, sourcefile)
local dependfile = reused and from:dependfile(sourcefile) or target:dependfile(sourcefile)
- local moduleinfo
- if os.isfile(dependfile) then
+
+ local is_file = os.isfile(dependfile)
+ if is_file then
local data = io.load(dependfile)
if data then
- moduleinfo = json.decode(data.moduleinfo)
+ local moduleinfo = json.decode(data.moduleinfo)
moduleinfo.sourcefile = sourcefile
+ return moduleinfo
end
end
- return moduleinfo
+
+ local targets = memcache():get("targets")
+ local target_fullname = reused and from:fullname() or target:fullname()
+ if not (targets and targets[target_fullname]) then
+ return nil, string.format("module scanner did not run for target(%s), maybe a custom `on_prepare()` script overrides the modules one", target_fullname)
+ end
+ if not is_file then
+ return nil, string.format("target(%s): dependfile for '%s' not found at '%s'", target_fullname, sourcefile, dependfile)
+ end
+ return nil, string.format("target(%s): failed to load moduleinfo for '%s'", target_fullname, sourcefile)
end
function find_quote_header_file(sourcefile, file)
diff --git a/xmake/toolchains/filc/xmake.lua b/xmake/toolchains/filc/xmake.lua
new file mode 100644
index 000000000..326d50022
--- /dev/null
+++ b/xmake/toolchains/filc/xmake.lua
@@ -0,0 +1,100 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015-present, Xmake Open Source Community.
+--
+-- @file xmake.lua
+--
+
+toolchain("filc")
+ set_kind("standalone")
+ set_homepage("https://fil-c.org/")
+ set_description("A memory safe implementation of the C and C++ programming languages.")
+
+ set_toolset("cc", "filcc")
+ set_toolset("cxx", "fil++")
+ set_toolset("ld", "filcc")
+ set_toolset("sh", "filcc")
+ set_toolset("ar", "ar")
+ set_toolset("as", "filcc")
+
+ on_check(function (toolchain)
+ import("lib.detect.find_tool")
+
+ -- look in package installdir/build/bin and bin first, then bindir/sdkdir, then PATH
+ local paths = {}
+ for _, package in ipairs(toolchain:packages()) do
+ local installdir = package:installdir()
+ if installdir then
+ table.insert(paths, path.join(installdir, "build", "bin"))
+ table.insert(paths, path.join(installdir, "bin"))
+ end
+ end
+ local bindir = toolchain:bindir()
+ if bindir then
+ table.insert(paths, bindir)
+ end
+ local sdkdir = toolchain:sdkdir()
+ if sdkdir then
+ table.insert(paths, path.join(sdkdir, "build", "bin"))
+ table.insert(paths, path.join(sdkdir, "bin"))
+ end
+
+ local filcc = find_tool("filcc", {paths = paths, force = true})
+ if filcc then
+ if os.isfile(filcc.program) then
+ toolchain:config_set("bindir", path.directory(filcc.program))
+ -- set sdkdir to the package install root so on_load can find pizfix
+ for _, package in ipairs(toolchain:packages()) do
+ local installdir = package:installdir()
+ if installdir and filcc.program:startswith(installdir) then
+ toolchain:config_set("sdkdir", installdir)
+ break
+ end
+ end
+ end
+ return true
+ end
+ end)
+
+ on_load(function (toolchain)
+ -- expose host system headers (GL, X11, etc.) via -idirafter so they are
+ -- searched AFTER filc's own libc++ headers, preventing stdlib.h conflicts
+ for _, sysdir in ipairs({"/usr/include", "/usr/local/include"}) do
+ if os.isdir(sysdir) then
+ toolchain:add("cflags", "-idirafter " .. sysdir)
+ toolchain:add("cxflags", "-idirafter " .. sysdir)
+ end
+ end
+
+ -- add runtime include/lib dirs from the installed package or sdk
+ local function _add_pizfix(dir)
+ local pizfix = path.join(dir, "pizfix")
+ -- only add stdfil-include for stdfil.h; pizfix/include (musl C headers)
+ -- must NOT be added as -isystem or it breaks libc++'s stdlib.h include order
+ local stdfil_include = path.join(pizfix, "stdfil-include")
+ if os.isdir(stdfil_include) then
+ toolchain:add("sysincludedirs", stdfil_include)
+ end
+ for _, libdir in ipairs({path.join(pizfix, "lib64"), path.join(pizfix, "lib")}) do
+ if os.isdir(libdir) then
+ toolchain:add("linkdirs", libdir)
+ end
+ end
+ end
+ local sdkdir = toolchain:sdkdir()
+ if sdkdir and os.isdir(sdkdir) then
+ _add_pizfix(sdkdir)
+ end
+ end)