diff options
| author | ruki <[email protected]> | 2026-03-14 00:04:01 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-03-14 00:11:43 +0800 |
| commit | a86bde866d5f65d5fbd31f1474190dcc40aa2876 (patch) | |
| tree | a043c2be4830b300a59543f8d10bcfddced70f4f /xmake/toolchains/dotnet/xmake.lua | |
| parent | 4b56123d797578f1abec0c3d507282d9e5bc8f3b (diff) | |
improve csharp support
Diffstat (limited to 'xmake/toolchains/dotnet/xmake.lua')
| -rw-r--r-- | xmake/toolchains/dotnet/xmake.lua | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/xmake/toolchains/dotnet/xmake.lua b/xmake/toolchains/dotnet/xmake.lua new file mode 100644 index 000000000..9c1fe40c3 --- /dev/null +++ b/xmake/toolchains/dotnet/xmake.lua @@ -0,0 +1,60 @@ +--!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. +-- +-- @author ruki +-- @file xmake.lua +-- + +toolchain("dotnet") + set_kind("standalone") + set_homepage("https://dotnet.microsoft.com/") + set_description(".NET SDK Toolchain") + + set_toolset("cs", "dotnet") + set_toolset("csld", "dotnet") + set_toolset("cssh", "dotnet") + + on_check(function (toolchain) + import("lib.detect.find_tool") + import("detect.sdks.find_dotnet") + + -- find dotnet program + local dotnet = find_tool("dotnet", {version = true}) + if not dotnet then + return false + end + toolchain:config_set("dotnet", dotnet.program) + toolchain:config_set("dotnet_version", dotnet.version) + + -- find dotnet sdk info + local sdkinfo = find_dotnet() + if sdkinfo then + toolchain:config_set("sdkinfo", sdkinfo) + end + return true + end) + + on_load(function (toolchain) + local dotnet = toolchain:config("dotnet") or "dotnet" + toolchain:set("toolset", "cs", dotnet) + toolchain:set("toolset", "csld", dotnet) + toolchain:set("toolset", "cssh", dotnet) + + -- set default environment variables + toolchain:add("runenvs", "DOTNET_NOLOGO", "1") + toolchain:add("runenvs", "DOTNET_CLI_TELEMETRY_OPTOUT", "1") + toolchain:add("runenvs", "DOTNET_SKIP_FIRST_TIME_EXPERIENCE", "1") + end) |
