From 4fdfe591a19e81d9390a5c310b81f95d50ccf5f0 Mon Sep 17 00:00:00 2001 From: star9029 Date: Wed, 11 Dec 2024 19:00:13 +0800 Subject: Improve protobuf test --- tests/projects/c++/protobuf/xmake.lua | 12 ++++++++++-- xmake/modules/package/tools/cmake.lua | 2 +- 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) -- cgit v1.3.1 From 6896aad2e8f997ceca4a76dbe8180514ca1ffab8 Mon Sep 17 00:00:00 2001 From: star9029 Date: Wed, 11 Dec 2024 19:34:58 +0800 Subject: Remove is_cross --- tests/projects/c++/protobuf/xmake.lua | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/tests/projects/c++/protobuf/xmake.lua b/tests/projects/c++/protobuf/xmake.lua index 593397b82..f3c544291 100644 --- a/tests/projects/c++/protobuf/xmake.lua +++ b/tests/projects/c++/protobuf/xmake.lua @@ -1,9 +1,7 @@ add_rules("mode.debug", "mode.release") -add_requires("protobuf-cpp") -if is_cross() then - add_requires("protoc") -end +add_requires("protoc", "protobuf-cpp") +-- add_requireconfs("protoc.protobuf-cpp", {version = "1.0.0"}) target("test") set_kind("binary") @@ -12,8 +10,5 @@ target("test") add_files("src/*.cpp") add_files("src/**.proto", {proto_rootdir = "src"}) - add_packages("protobuf-cpp") - if is_cross() then - add_packages("protoc") - end + add_packages("protoc", "protobuf-cpp") -- cgit v1.3.1