fix protobuf-c (#260)

* improve protobuf

* Update xmake.lua
pull/262/head
ruki 4 years ago committed by GitHub
parent c744bfe822
commit 2595beac10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 30
      packages/p/protobuf-c/xmake.lua

@ -24,12 +24,38 @@ package("protobuf-c")
on_install("windows", function (package)
os.cd("build-cmake")
import("package.tools.cmake").install(package, {"-Dprotobuf_BUILD_PROTOC_BINARIES=ON"})
local cflags
local shflags
local configs = {}
if package:config("shared") then
table.insert(configs, "-DBUILD_SHARED_LIBS=ON")
cflags = {"-DPROTOBUF_C_USE_SHARED_LIB", "-DPROTOBUF_C_EXPORT"}
shflags = "/export:protobuf_c_empty_string"
else
table.insert(configs, "-DBUILD_SHARED_LIBS=OFF")
end
if package:config("vs_runtime"):startswith("MT") then
table.insert(configs, "-DMSVC_STATIC_BUILD=ON")
else
table.insert(configs, "-DMSVC_STATIC_BUILD=OFF")
end
import("package.tools.cmake").install(package, configs, {cflags = cflags, shflags = shflags})
os.cp("build_*/Release/protoc-gen-c.exe", path.join(package:installdir("bin"), "protoc-c.exe"))
end)
on_install("linux", "macosx", function (package)
import("package.tools.autoconf").install(package, {"--enable-shared=no"})
local configs = {}
if package:config("pic") ~= false then
table.insert(configs, "--with-pic")
end
if package:config("shared") then
table.insert(configs, "--enable-shared=yes")
table.insert(configs, "--enable-static=no")
else
table.insert(configs, "--enable-static=yes")
table.insert(configs, "--enable-shared=no")
end
import("package.tools.autoconf").install(package, configs)
end)
on_test(function (package)

Loading…
Cancel
Save