summaryrefslogtreecommitdiff
path: root/xmake/toolchains
diff options
context:
space:
mode:
authorruki <[email protected]>2025-02-13 23:23:19 +0800
committerruki <[email protected]>2025-02-13 23:23:19 +0800
commit5073a4a7a6a80fef383d22f503c76e2dbadc80ac (patch)
tree66b5ab6c4f6c99ee44e8baf44281fda205164cc0 /xmake/toolchains
parent452cfe7f8803f4c9fd110a80058b03e975b09e30 (diff)
add kotlin-native test
Diffstat (limited to 'xmake/toolchains')
-rw-r--r--xmake/toolchains/kotlin-native/xmake.lua61
1 files changed, 61 insertions, 0 deletions
diff --git a/xmake/toolchains/kotlin-native/xmake.lua b/xmake/toolchains/kotlin-native/xmake.lua
new file mode 100644
index 000000000..9787fc204
--- /dev/null
+++ b/xmake/toolchains/kotlin-native/xmake.lua
@@ -0,0 +1,61 @@
+--!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 Source Group.
+--
+-- @author ruki
+-- @file xmake.lua
+--
+
+toolchain("kotlin-native")
+ set_kind("standalone")
+ set_homepage("https://kotlinlang.org")
+ set_description("The Kotlin Programming Language Compiler. ")
+
+ set_toolset("kc", "$(env KC)", "kotlinc-native")
+ set_toolset("kcld", "$(env KC)", "kotlinc-native")
+ set_toolset("kcsh", "$(env KC)", "kotlinc-native")
+ set_toolset("kcar", "$(env KC)", "kotlinc-native")
+
+ on_check(function (toolchain)
+ import("lib.detect.find_tool")
+
+ local paths = {}
+ for _, package in ipairs(toolchain:packages()) do
+ local envs = package:envs()
+ if envs then
+ table.join2(paths, envs.PATH)
+ end
+ end
+ if toolchain:bindir() then
+ table.insert(paths, toolchain:bindir())
+ end
+ local kotlinc_native = find_tool("kotlinc-native", {paths = paths})
+ if kotlinc_native and kotlinc_native.program then
+ kotlinc_native = kotlinc_native.program
+ end
+ if kotlinc_native then
+ if path.is_absolute(kotlinc_native) then
+ local bindir = path.directory(kotlinc_native)
+ toolchain:config_set("bindir", bindir)
+ toolchain:config_set("sdkdir", path.directory(bindir))
+ end
+ toolchain:configs_save()
+ return true
+ end
+ end)
+
+ on_load(function (toolchain)
+ -- TODO
+ end)