|
@@ -16,9 +16,9 @@ package("protobuf-cpp")
|
|
|
add_patches("3.17.3", path.join(os.scriptdir(), "patches", "3.17.3", "field_access_listener.patch"), "ac9bdf49611b01e563fe74b2aaf1398214129454c3e18f1198245549eb281e85")
|
|
|
add_patches("3.19.4", path.join(os.scriptdir(), "patches", "3.19.4", "vs_runtime.patch"), "8e73e585d29f3b9dca3c279df0b11b3ee7651728c07f51381a69e5899b93c367")
|
|
|
|
|
|
- if is_plat("windows") then
|
|
|
- add_deps("cmake")
|
|
|
- end
|
|
|
+ add_configs("zlib", {description = "Enable zlib", default = false, type = "boolean"})
|
|
|
+
|
|
|
+ add_deps("cmake")
|
|
|
|
|
|
if is_plat("windows") then
|
|
|
add_links("libprotobuf")
|
|
@@ -32,33 +32,26 @@ package("protobuf-cpp")
|
|
|
|
|
|
on_load(function (package)
|
|
|
package:addenv("PATH", "bin")
|
|
|
+ if package:config("zlib") then
|
|
|
+ package:add("deps", "zlib")
|
|
|
+ end
|
|
|
end)
|
|
|
|
|
|
- on_install("windows", function (package)
|
|
|
+ on_install("windows", "linux", "macosx", function (package)
|
|
|
os.cd("cmake")
|
|
|
local configs = {"-Dprotobuf_BUILD_TESTS=OFF", "-Dprotobuf_BUILD_PROTOC_BINARIES=ON"}
|
|
|
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
|
|
|
- table.insert(configs, "-Dprotobuf_MSVC_STATIC_RUNTIME=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
|
|
|
- if package:config("shared") then
|
|
|
- package:add("defines", "PROTOBUF_USE_DLLS")
|
|
|
- end
|
|
|
- import("package.tools.cmake").install(package, configs)
|
|
|
- os.cp("build_*/Release/protoc.exe", package:installdir("bin"))
|
|
|
- end)
|
|
|
-
|
|
|
- on_install("linux", "macosx", function (package)
|
|
|
- local configs = {}
|
|
|
- if package:config("pic") ~= false then
|
|
|
- table.insert(configs, "--with-pic")
|
|
|
+ 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
|
|
|
+ package:add("defines", "PROTOBUF_USE_DLLS")
|
|
|
+ end
|
|
|
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")
|
|
|
+ if package:config("zlib") then
|
|
|
+ table.insert(configs, "-Dprotobuf_WITH_ZLIB=ON")
|
|
|
end
|
|
|
- import("package.tools.autoconf").install(package, configs)
|
|
|
+ import("package.tools.cmake").install(package, configs, {buildir = "build"})
|
|
|
+ os.trycp("build/Release/protoc.exe", package:installdir("bin"))
|
|
|
end)
|
|
|
|
|
|
on_test(function (package)
|