From 6f781bacba2a63ab1172a00079c0ab65b829145c Mon Sep 17 00:00:00 2001 From: Arthur LAURENT Date: Wed, 6 Mar 2024 20:06:32 +0100 Subject: fix C++ library detection when no runtimes is passed --- xmake/rules/c++/modules/modules_support/clang/compiler_support.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xmake/rules/c++/modules/modules_support/clang/compiler_support.lua b/xmake/rules/c++/modules/modules_support/clang/compiler_support.lua index 49e01db90..5ee8dc591 100644 --- a/xmake/rules/c++/modules/modules_support/clang/compiler_support.lua +++ b/xmake/rules/c++/modules/modules_support/clang/compiler_support.lua @@ -63,11 +63,11 @@ end function _get_cpplibrary_name(target) -- libc++ come first because on windows, if we use libc++ clang will still use msvc crt so MD / MT / MDd / MTd can be set - if target:has_runtime("c++_shared", "c++_static") then + if target:is_plat("macosx") and target:runtimes() == nil or target:has_runtime("c++_shared", "c++_static") then return "c++" - elseif target:has_runtime("stdc++_shared", "stdc++_static") then + elseif target:is_plat("linux") and target:runtimes() == nil or target:has_runtime("stdc++_shared", "stdc++_static") then return "stdc++" - elseif target:is_plat("windows") and target:has_runtime("MD", "MT", "MDd", "MTd") then + elseif target:is_plat("windows") and target:runtimes() == nil or target:has_runtime("MD", "MT", "MDd", "MTd") then return "msstl" end end -- cgit v1.3.1 From 5bca82e0eb88c7c35142cc6adb7d3fbc0d86ad06 Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 7 Mar 2024 09:45:11 +0800 Subject: Update compiler_support.lua --- .../c++/modules/modules_support/clang/compiler_support.lua | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/xmake/rules/c++/modules/modules_support/clang/compiler_support.lua b/xmake/rules/c++/modules/modules_support/clang/compiler_support.lua index 5ee8dc591..4d6e6580a 100644 --- a/xmake/rules/c++/modules/modules_support/clang/compiler_support.lua +++ b/xmake/rules/c++/modules/modules_support/clang/compiler_support.lua @@ -63,11 +63,18 @@ end function _get_cpplibrary_name(target) -- libc++ come first because on windows, if we use libc++ clang will still use msvc crt so MD / MT / MDd / MTd can be set - if target:is_plat("macosx") and target:runtimes() == nil or target:has_runtime("c++_shared", "c++_static") then + if target:has_runtime("c++_shared", "c++_static") then return "c++" - elseif target:is_plat("linux") and target:runtimes() == nil or target:has_runtime("stdc++_shared", "stdc++_static") then + elseif target:has_runtime("stdc++_shared", "stdc++_static") then return "stdc++" - elseif target:is_plat("windows") and target:runtimes() == nil or target:has_runtime("MD", "MT", "MDd", "MTd") then + elseif target:has_runtime("MD", "MT", "MDd", "MTd") then + return "msstl" + end + if target:is_plat("macosx") then + return "c++" + elseif target:is_plat("linux") then + return "stdc++" + elseif target:is_plat("windows") then return "msstl" end end -- cgit v1.3.1