diff options
| author | ruki <[email protected]> | 2023-05-03 00:39:38 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-05-03 00:39:38 +0800 |
| commit | a3b4b157db9eab2a98929429952e9ec4b05a9ebf (patch) | |
| tree | a6385aab5a9313406251bde630f915155ac5758e | |
| parent | 006ba41d2e4d78ef59bcf109c71320682e743832 (diff) | |
improve conan2 for macos/clang
| -rw-r--r-- | xmake/modules/package/manager/conan/v2/install_package.lua | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/xmake/modules/package/manager/conan/v2/install_package.lua b/xmake/modules/package/manager/conan/v2/install_package.lua index 82e53aad3..399665136 100644 --- a/xmake/modules/package/manager/conan/v2/install_package.lua +++ b/xmake/modules/package/manager/conan/v2/install_package.lua @@ -187,10 +187,27 @@ function _conan_generate_compiler_profile(profile, configs, opt) profile:print("os.api_level=" .. ndk_sdkver) end else - profile:print("compiler=gcc") - profile:print("compiler.cppstd=gnu17") - profile:print("compiler.libcxx=libstdc++11") - profile:print("compiler.version=11") + local program, toolname = platform.tool("cc", plat, arch) + if toolname == "gcc" or toolname == "clang" then + local version + local gcc = find_tool(toolname, {program = program, version = true}) + if gcc and gcc.version then + local v = semver.try_parse(gcc.version) + if v then + version = v:major() + end + end + profile:print("compiler=" .. toolname) + profile:print("compiler.cppstd=gnu17") + if toolname == "clang" then + profile:print("compiler.libcxx=libc++") + else + profile:print("compiler.libcxx=libstdc++11") + end + if version then + profile:print("compiler.version=" .. version) + end + end end end |
