summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstar9029 <[email protected]>2024-12-11 19:00:13 +0800
committerstar9029 <[email protected]>2024-12-11 19:00:13 +0800
commit4fdfe591a19e81d9390a5c310b81f95d50ccf5f0 (patch)
tree7b4f5984be87fcd486ce6c7b9c803c71be3a287f
parentf2c9a6c2669c90e275753e1c1628dad7fca595da (diff)
Improve protobuf test
-rw-r--r--tests/projects/c++/protobuf/xmake.lua12
-rw-r--r--xmake/modules/package/tools/cmake.lua2
2 files changed, 11 insertions, 3 deletions
diff --git a/tests/projects/c++/protobuf/xmake.lua b/tests/projects/c++/protobuf/xmake.lua
index 1468cc5e3..593397b82 100644
--- a/tests/projects/c++/protobuf/xmake.lua
+++ b/tests/projects/c++/protobuf/xmake.lua
@@ -1,11 +1,19 @@
add_rules("mode.debug", "mode.release")
+
add_requires("protobuf-cpp")
+if is_cross() then
+ add_requires("protoc")
+end
target("test")
set_kind("binary")
- set_languages("c++11")
- add_packages("protobuf-cpp")
+ set_languages("c++17")
add_rules("protobuf.cpp")
add_files("src/*.cpp")
add_files("src/**.proto", {proto_rootdir = "src"})
+ add_packages("protobuf-cpp")
+ if is_cross() then
+ add_packages("protoc")
+ end
+
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua
index 6d7f15dce..e83f254d8 100644
--- a/xmake/modules/package/tools/cmake.lua
+++ b/xmake/modules/package/tools/cmake.lua
@@ -652,7 +652,7 @@ function _get_configs_for_cross(package, configs, opt)
envs.CMAKE_CXX_COMPILER = _translate_bin_path(package:build_getenv("cxx"))
envs.CMAKE_ASM_COMPILER = _translate_bin_path(package:build_getenv("as"))
envs.CMAKE_AR = _translate_bin_path(package:build_getenv("ar"))
- if package:is_plat("windows") and is_host("linux") then
+ if package:is_plat("windows") then
envs.CMAKE_AR = path.join(path.directory(envs.CMAKE_CXX_COMPILER), "lib.exe")
end
_fix_cxx_compiler_cmake(package, envs)