|
@@ -1,5 +1,4 @@
|
|
|
package("snappy")
|
|
|
-
|
|
|
set_homepage("https://github.com/google/snappy")
|
|
|
set_description("A fast compressor/decompressor")
|
|
|
|
|
@@ -19,17 +18,20 @@ package("snappy")
|
|
|
add_configs("avx2", {description = "Use the AVX2 instruction set", default = false, type = "boolean"})
|
|
|
add_configs("bmi2", {description = "Use the BMI2 instruction set", default = false, type = "boolean"})
|
|
|
|
|
|
- on_install("windows", "linux", "macosx", "mingw", "android", function (package)
|
|
|
+ on_install(function (package)
|
|
|
+ io.replace("CMakeLists.txt", "-Werror", "", {plain = true})
|
|
|
+
|
|
|
if package:version():eq("1.1.10") then
|
|
|
io.replace("snappy.cc", "(op + deferred_length) < op_limit_min_slop);", "static_cast<ptrdiff_t>(op + deferred_length) < op_limit_min_slop);", {plain = true})
|
|
|
end
|
|
|
local configs = {"-DSNAPPY_BUILD_TESTS=OFF", "-DSNAPPY_BUILD_BENCHMARKS=OFF"}
|
|
|
+ table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
|
|
|
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
|
|
|
table.insert(configs, "-DSNAPPY_REQUIRE_AVX=" .. (package:config("avx") and "ON" or "OFF"))
|
|
|
table.insert(configs, "-DSNAPPY_REQUIRE_AVX2=" .. (package:config("avx2") and "ON" or "OFF"))
|
|
|
table.insert(configs, "-DSNAPPY_HAVE_BMI2=" .. (package:config("bmi2") and "ON" or "OFF"))
|
|
|
- if package:config("pic") ~= false then
|
|
|
- table.insert(configs, "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
|
|
|
+ if package:is_plat("windows") then
|
|
|
+ table.insert(configs, "-DCMAKE_COMPILE_PDB_OUTPUT_DIRECTORY=''")
|
|
|
end
|
|
|
import("package.tools.cmake").install(package, configs)
|
|
|
end)
|