diff options
| author | ruki <[email protected]> | 2026-03-20 22:33:30 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-03-20 22:33:30 +0800 |
| commit | 2b0964deaf94355eea91dff12d017525b49c3737 (patch) | |
| tree | 8fc1d3decacbf9d2371ef58f96ebbad13316627e /xmake/rules | |
| parent | faac0865a79ef38c47bb81d7fa3b42f05ace5538 (diff) | |
remove native_aot
Diffstat (limited to 'xmake/rules')
| -rw-r--r-- | xmake/rules/csharp/config.lua | 10 | ||||
| -rw-r--r-- | xmake/rules/csharp/generator/properties.lua | 28 | ||||
| -rw-r--r-- | xmake/rules/csharp/xmake.lua | 8 |
3 files changed, 3 insertions, 43 deletions
diff --git a/xmake/rules/csharp/config.lua b/xmake/rules/csharp/config.lua index 452e0e39c..e9dbc71e0 100644 --- a/xmake/rules/csharp/config.lua +++ b/xmake/rules/csharp/config.lua @@ -45,16 +45,6 @@ function main(target) target:data_set("csharp.csproj", csprojfile) - -- for NativeAOT shared library, export targetfile directly for C/C++ consumers - -- dotnet outputs without lib prefix, so we use ldflags with full path - local publish_aot = target:values("csharp.publish_aot") - if publish_aot and target:is_shared() then - target:data_set("inherit.links.deplink", false) - -- on Windows, MSVC linker needs import library (.lib), not .dll - local linkfile = target:artifactfile("implib") or target:targetfile() - target:add("ldflags", linkfile, {interface = true, force = true}) - end - -- add native shared library search paths for P/Invoke for _, dep in ipairs(target:orderdeps()) do if dep:is_shared() and not dep:rule("csharp.build") then diff --git a/xmake/rules/csharp/generator/properties.lua b/xmake/rules/csharp/generator/properties.lua index 844c6c0d3..a931b1db3 100644 --- a/xmake/rules/csharp/generator/properties.lua +++ b/xmake/rules/csharp/generator/properties.lua @@ -69,25 +69,6 @@ end -- resolve runtime identifier from user config or auto-detect from target plat/arch -- e.g. "osx-x64", "osx-arm64", "linux-x64", "win-x64" -function _resolve_runtime_identifier(context) - local rid = _get_target_value(context.target, "csharp.runtime_identifier") - if rid then - return rid - end - -- auto-detect RID when publish_aot is enabled - local publish_aot = _get_target_value(context.target, "csharp.publish_aot") - if not publish_aot then - return nil - end - local target = context.target - local plat = target:plat() - local arch = target:arch() - local rid_arch = ({x86_64 = "x64", i386 = "x86", x64 = "x64", x86 = "x86", - arm64 = "arm64", ["arm64-v8a"] = "arm64", armv7 = "arm"})[arch] or arch - local rid_os = ({macosx = "osx", linux = "linux", windows = "win", mingw = "win"})[plat] or plat - return rid_os .. "-" .. rid_arch -end - -- register a single-value csharp.* property entry function _register_property(register, suffix, xml, default, extra) local entry = table.join({ @@ -149,7 +130,7 @@ function main() _register_property(register, "generate_documentation_file", "GenerateDocumentationFile") _register_property(register, "documentation_file", "DocumentationFile") - register({kind = "property", xml = "RuntimeIdentifier", resolve = _resolve_runtime_identifier}) + _register_property(register, "runtime_identifier", "RuntimeIdentifier") _register_list_property(register, "runtime_identifiers", "RuntimeIdentifiers") _register_property(register, "self_contained", "SelfContained") _register_property(register, "use_app_host", "UseAppHost") @@ -162,13 +143,6 @@ function main() _register_property(register, "include_native_libraries_for_self_extract", "IncludeNativeLibrariesForSelfExtract") _register_property(register, "enable_compression_in_single_file", "EnableCompressionInSingleFile") _register_property(register, "publish_aot", "PublishAot") - -- auto-set NativeLib=Shared when PublishAot is enabled for shared library - register({kind = "property", xml = "NativeLib", resolve = function (context) - local publish_aot = _get_target_value(context.target, "csharp.publish_aot") - if publish_aot and context.target:is_shared() then - return "Shared" - end - end}) _register_property(register, "strip_symbols", "StripSymbols") _register_property(register, "enable_trim_analyzer", "EnableTrimAnalyzer") _register_property(register, "json_serializer_is_reflection_enabled_by_default", "JsonSerializerIsReflectionEnabledByDefault") diff --git a/xmake/rules/csharp/xmake.lua b/xmake/rules/csharp/xmake.lua index 603af08c3..9a0a6e43b 100644 --- a/xmake/rules/csharp/xmake.lua +++ b/xmake/rules/csharp/xmake.lua @@ -115,14 +115,10 @@ rule("csharp.build") set_sourcekinds("cs") on_load(function (target) + -- dotnet always outputs .dll for libraries, and no prefix if target:is_shared() or target:is_static() then - -- dotnet always outputs without lib prefix target:set("prefixname", "") - -- managed libraries use .dll, NativeAOT uses native format (.dylib/.so/.dll) - local publish_aot = target:values("csharp.publish_aot") - if not publish_aot then - target:set("extension", ".dll") - end + target:set("extension", ".dll") end end) on_config("config") |
