summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur LAURENT <[email protected]>2025-10-26 16:40:28 +0100
committerArthur LAURENT <[email protected]>2025-10-26 17:23:16 +0100
commit49effcb3896dbef158e375ef0524ab1f09ce6b15 (patch)
tree812a6fa447062ea8676f5fcb54a244fa66e24e81
parent716bc9fe22b091f57765d894429a7f630e69420e (diff)
feat(swift) support add_includedirs / add_sysincludedirs for swiftc and swift-frontend
-rw-r--r--tests/projects/swift/bidirectional_cxx_interop_lib/xmake.lua2
-rw-r--r--xmake/languages/swift/load.lua6
-rw-r--r--xmake/modules/core/tools/swift_frontend.lua10
-rw-r--r--xmake/modules/core/tools/swiftc.lua10
4 files changed, 26 insertions, 2 deletions
diff --git a/tests/projects/swift/bidirectional_cxx_interop_lib/xmake.lua b/tests/projects/swift/bidirectional_cxx_interop_lib/xmake.lua
index aca6d4235..b2840f1fd 100644
--- a/tests/projects/swift/bidirectional_cxx_interop_lib/xmake.lua
+++ b/tests/projects/swift/bidirectional_cxx_interop_lib/xmake.lua
@@ -6,7 +6,7 @@ target("fibonacci")
set_values("swift.modulename", "SwiftFibonacci")
set_values("swift.interop", "cxx")
-- for automatic clang modulemap
- add_scflags("-Iinclude/fibonacci", {public = true})
+ add_includedirs("include/fibonacci", {public = true})
add_includedirs("include")
add_headerfiles("include/**.h")
diff --git a/xmake/languages/swift/load.lua b/xmake/languages/swift/load.lua
index 90277ed90..08e7efde8 100644
--- a/xmake/languages/swift/load.lua
+++ b/xmake/languages/swift/load.lua
@@ -51,9 +51,13 @@ function _get_apis()
}
apis.paths = {
-- target.add_xxx
- "target.add_linkdirs"
+ "target.add_includedirs"
+ , "target.add_sysincludedirs"
+ , "target.add_linkdirs"
, "target.add_frameworkdirs"
-- option.add_xxx
+ , "option.add_includedirs"
+ , "option.add_sysincludedirs"
, "option.add_linkdirs"
, "option.add_frameworkdirs"
}
diff --git a/xmake/modules/core/tools/swift_frontend.lua b/xmake/modules/core/tools/swift_frontend.lua
index 002e323d7..66a0c488b 100644
--- a/xmake/modules/core/tools/swift_frontend.lua
+++ b/xmake/modules/core/tools/swift_frontend.lua
@@ -110,6 +110,16 @@ function nf_vectorext(self, extension)
return maps[extension]
end
+-- make the includedir flag
+function nf_includedir(self, includedir)
+ return "-I" .. includedir
+end
+
+-- make the sysincludedir flag
+function nf_sysincludedir(self, dir)
+ return nf_includedir(self, dir)
+end
+
-- make the define flag
function nf_define(self, macro)
return {"-Xcc", "-D" .. macro}
diff --git a/xmake/modules/core/tools/swiftc.lua b/xmake/modules/core/tools/swiftc.lua
index c19072fd7..109d461d2 100644
--- a/xmake/modules/core/tools/swiftc.lua
+++ b/xmake/modules/core/tools/swiftc.lua
@@ -120,6 +120,16 @@ function nf_vectorext(self, extension)
return maps[extension]
end
+-- make the includedir flag
+function nf_includedir(self, includedir)
+ return "-I" .. includedir
+end
+
+-- make the sysincludedir flag
+function nf_sysincludedir(self, dir)
+ return nf_includedir(self, dir)
+end
+
-- make the define flag
function nf_define(self, macro)
return {"-Xcc", "-D" .. macro}