summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaikari <[email protected]>2026-04-03 00:33:20 +0300
committerSaikari <[email protected]>2026-04-03 00:33:20 +0300
commit6146edfaeb30011c571884987b9ee761d8abae2b (patch)
tree688da6d277cfd8893e2f675ba862a34a4d4ca661
parent75e1604e1fd44459a6169b1fcb8c1fd06599feef (diff)
add filxx toolchain and find_filxx detection script for Fil-C C++ compiler
-rw-r--r--xmake/modules/core/tools/filxx.lua21
-rw-r--r--xmake/modules/detect/tools/find_filxx.lua41
-rw-r--r--xmake/toolchains/filc/xmake.lua27
3 files changed, 79 insertions, 10 deletions
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_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/toolchains/filc/xmake.lua b/xmake/toolchains/filc/xmake.lua
index 465183b56..8e13f6e04 100644
--- a/xmake/toolchains/filc/xmake.lua
+++ b/xmake/toolchains/filc/xmake.lua
@@ -67,16 +67,25 @@ toolchain("filc")
toolchain:set("toolset", "ar", "ar")
toolchain:set("toolset", "as", filcc)
+ -- 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
for _, package in ipairs(toolchain:packages()) do
local installdir = package:installdir()
if installdir then
local pizfix = path.join(installdir, "pizfix")
- for _, d in ipairs({"stdfil-include", "include"}) do
- local includedir = path.join(pizfix, d)
- if os.isdir(includedir) then
- toolchain:add("sysincludedirs", includedir)
- end
+ -- 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
@@ -88,11 +97,9 @@ toolchain("filc")
local sdkdir = toolchain:sdkdir()
if sdkdir and os.isdir(sdkdir) then
local pizfix = path.join(sdkdir, "pizfix")
- for _, d in ipairs({"stdfil-include", "include"}) do
- local includedir = path.join(pizfix, d)
- if os.isdir(includedir) then
- toolchain:add("sysincludedirs", includedir)
- end
+ 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