summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md2
-rw-r--r--README.md1
-rw-r--r--README_zh.md1
-rw-r--r--xmake/platforms/linux/xmake.lua2
-rw-r--r--xmake/platforms/windows/xmake.lua2
-rw-r--r--xmake/toolchains/swift/xmake.lua37
6 files changed, 43 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 58bfe9b8f..4dc1c9b8f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,7 @@
* [#2011](https://github.com/xmake-io/xmake/issues/2011): Support to inherit base package
* Support to build and run xmake on sparc, alpha, powerpc, s390x and sh4
* Add on_download for package()
+* [#2021](https://github.com/xmake-io/xmake/issues/2021): Support Swift for linux and windows
### Bugs fixed
@@ -1208,6 +1209,7 @@
* [#2011](https://github.com/xmake-io/xmake/issues/2011): 支持继承和局部修改官方包,例如对现有的包更换 urls 和 versions
* 支持在 sparc, alpha, powerpc, s390x 和 sh4 上编译运行 xmake
* 为 package() 添加 on_download 自定义下载
+* [#2021](https://github.com/xmake-io/xmake/issues/2021): 支持 Linux/Windows 下构建 Swift 程序
### Bugs 修复
diff --git a/README.md b/README.md
index 6d738805c..c50a7f11a 100644
--- a/README.md
+++ b/README.md
@@ -230,6 +230,7 @@ sdcc Small Device C Compiler
cuda CUDA Toolkit
ndk Android NDK
rust Rust Programming Language Compiler
+swift Swift Programming Language Compiler
llvm A collection of modular and reusable compiler and toolchain technologies
cross Common cross compilation toolchain
nasm NASM Assembler
diff --git a/README_zh.md b/README_zh.md
index d6d878f8d..16fa11d69 100644
--- a/README_zh.md
+++ b/README_zh.md
@@ -239,6 +239,7 @@ sdcc Small Device C Compiler
cuda CUDA Toolkit
ndk Android NDK
rust Rust Programming Language Compiler
+swift Swift Programming Language Compiler
llvm A collection of modular and reusable compiler and toolchain technologies
cross Common cross compilation toolchain
nasm NASM Assembler
diff --git a/xmake/platforms/linux/xmake.lua b/xmake/platforms/linux/xmake.lua
index ab7c71f75..ea70ed8e2 100644
--- a/xmake/platforms/linux/xmake.lua
+++ b/xmake/platforms/linux/xmake.lua
@@ -40,7 +40,7 @@ platform("linux")
set_installdir("/usr/local")
-- set toolchains
- set_toolchains("envs", "cross", "gcc", "clang", "yasm", "nasm", "fasm", "cuda", "dlang", "go", "rust", "gfortran", "zig", "fpc", "nim")
+ set_toolchains("envs", "cross", "gcc", "clang", "yasm", "nasm", "fasm", "cuda", "dlang", "go", "rust", "swift", "gfortran", "zig", "fpc", "nim")
-- set menu
set_menu {
diff --git a/xmake/platforms/windows/xmake.lua b/xmake/platforms/windows/xmake.lua
index f7687f44b..6f25ef914 100644
--- a/xmake/platforms/windows/xmake.lua
+++ b/xmake/platforms/windows/xmake.lua
@@ -38,7 +38,7 @@ platform("windows")
set_formats("symbol", "$(name).pdb")
-- set toolchains
- set_toolchains("msvc", "clang", "yasm", "nasm", "cuda", "dlang", "rust", "go", "gfortran", "zig", "fpc", "nim")
+ set_toolchains("msvc", "clang", "yasm", "nasm", "cuda", "dlang", "rust", "swift", "go", "gfortran", "zig", "fpc", "nim")
-- set menu
set_menu {
diff --git a/xmake/toolchains/swift/xmake.lua b/xmake/toolchains/swift/xmake.lua
new file mode 100644
index 000000000..1d9d1279b
--- /dev/null
+++ b/xmake/toolchains/swift/xmake.lua
@@ -0,0 +1,37 @@
+--!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, TBOOX Open Sousce Group.
+--
+-- @author ruki
+-- @file xmake.lua
+--
+
+-- define toolchain
+toolchain("swift")
+
+ -- set homepage
+ set_homepage("https://swift.org/")
+ set_description("Swift Programming Language Compiler")
+
+ -- set toolset
+ set_toolset("sc", "$(env SC)", "swiftc")
+ set_toolset("scld", "$(env SC)", "swiftc")
+ set_toolset("scsh", "$(env SC)", "swiftc")
+
+ -- on load
+ on_load(function (toolchain)
+ toolchain:set("scshflags", "")
+ toolchain:set("scldflags", "")
+ end)