try to fix abseil linking

pull/3667/head
Chi Huu Huynh 8 months ago
parent 46a3b46826
commit 03c8ed4215
  1. 17
      packages/p/protobuf-cpp/xmake.lua

@ -21,7 +21,7 @@ package("protobuf-cpp")
add_configs("zlib", {description = "Enable zlib", default = false, type = "boolean"})
add_deps("cmake", "abseil")
add_deps("cmake")
if is_plat("windows") then
add_links("libprotobuf")
@ -38,6 +38,9 @@ package("protobuf-cpp")
if package:config("zlib") then
package:add("deps", "zlib")
end
if package:version():gt("3.19.4") then
package:add("deps", "abseil")
end
end)
on_install("windows", "linux", "macosx", function (package)
@ -45,10 +48,14 @@ package("protobuf-cpp")
os.cd("cmake")
end
io.replace("CMakeLists.txt", "set(protobuf_DEBUG_POSTFIX \"d\"", "set(protobuf_DEBUG_POSTFIX \"\"", {plain = true})
local configs = {"-Dprotobuf_BUILD_TESTS=OFF",
"-Dprotobuf_BUILD_PROTOC_BINARIES=ON",
"-Dprotobuf_ABSL_PROVIDER=package"}
local configs = {"-Dprotobuf_BUILD_TESTS=OFF", "-Dprotobuf_BUILD_PROTOC_BINARIES=ON"}
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
local packagedeps = {}
if package:version():gt("3.19.4") then
table.insert(packagedeps, "abseil")
table.insert(configs, "-Dprotobuf_ABSL_PROVIDER=package")
end
if package:is_plat("windows") then
table.insert(configs, "-Dprotobuf_MSVC_STATIC_RUNTIME=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
if package:config("shared") then
@ -58,7 +65,7 @@ package("protobuf-cpp")
if package:config("zlib") then
table.insert(configs, "-Dprotobuf_WITH_ZLIB=ON")
end
import("package.tools.cmake").install(package, configs, {buildir = "build"})
import("package.tools.cmake").install(package, configs, {buildir = "build", packagedeps = packagedeps})
os.trycp("build/Release/protoc.exe", package:installdir("bin"))
end)

Loading…
Cancel
Save