|
@@ -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)
|