diff options
| author | ruki <[email protected]> | 2020-09-05 00:53:38 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-09-05 00:53:38 +0800 |
| commit | cf9bec1a07d451784df68b2bb55fc041ca1ad33d (patch) | |
| tree | b3f35575d09279b64950f922abba63ae9648452a /xmake/modules/private | |
| parent | 6d94dd1d7ae4b19977fddef3396b454235f6a6f1 (diff) | |
improve trybuild/cmake to support android
Diffstat (limited to 'xmake/modules/private')
| -rw-r--r-- | xmake/modules/private/action/trybuild/cmake.lua | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/xmake/modules/private/action/trybuild/cmake.lua b/xmake/modules/private/action/trybuild/cmake.lua index 684941c39..5ec6a6506 100644 --- a/xmake/modules/private/action/trybuild/cmake.lua +++ b/xmake/modules/private/action/trybuild/cmake.lua @@ -44,6 +44,24 @@ function _get_configs(artifacts_dir) if is_plat("windows") and is_arch("x64") then table.insert(configs, "-A") table.insert(configs, "x64") + elseif is_plat("android") then + -- https://developer.android.google.cn/ndk/guides/cmake + local ndk = config.get("ndk") + if ndk and os.isdir(ndk) then + local arch = config.arch() + local ndk_sdkver = config.get("ndk_sdkver") + local ndk_cxxstl = config.get("ndk_cxxstl") + table.insert(configs, "-DCMAKE_TOOLCHAIN_FILE=" .. path.join(ndk, "build/cmake/android.toolchain.cmake")) + if arch then + table.insert(configs, "-DANDROID_ABI=" .. arch) + end + if ndk_sdkver then + table.insert(configs, "-DANDROID_NATIVE_API_LEVEL=" .. ndk_sdkver) + end + if ndk_cxxstl then + table.insert(configs, "-DANDROID_STL=" .. ndk_cxxstl) + end + end end -- enable verbose? @@ -91,9 +109,6 @@ end -- do build function build() - -- only support the current subsystem host platform now! - assert(is_subhost(config.plat()), "cmake: %s not supported!", config.plat()) - -- get artifacts directory local artifacts_dir = _get_artifacts_dir() if not os.isdir(artifacts_dir) then |
