Преглед изворни кода

snappy: fix build type (#4200)

* snappy: fix build type

* Update xmake.lua
star9029 пре 1 година
родитељ
комит
32b86097c3
1 измењених фајлова са 6 додато и 4 уклоњено
  1. 6 4
      packages/s/snappy/xmake.lua

+ 6 - 4
packages/s/snappy/xmake.lua

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