Forráskód Böngészése

Auto-update lastools to v2.0.4 (#8478)

* Update lastools to v2.0.4

* Fix installation for MinGW and update CMakeLists

---------

Co-authored-by: star9029 <[email protected]>
ruki 1 hónapja
szülő
commit
2d44f055c2
1 módosított fájl, 15 hozzáadás és 3 törlés
  1. 15 3
      packages/l/lastools/xmake.lua

+ 15 - 3
packages/l/lastools/xmake.lua

@@ -6,6 +6,7 @@ package("lastools")
     add_urls("https://github.com/LAStools/LAStools/archive/refs/tags/$(version).tar.gz",
              "https://github.com/LAStools/LAStools.git")
 
+    add_versions("v2.0.4", "40009d74dd7e782e2f245f4e35d063db06e74b2948a47157ee41f1cf63057090")
     add_versions("v2.0.3", "b6c6ac33835ead2c69d05e282febc266048ba071a71dae6fdad321d532dfcf78")
 
     add_configs("cmake", {description = "Use cmake buildsystem", default = false, type = "boolean"})
@@ -21,18 +22,29 @@ package("lastools")
     end)
 
     on_install(function (package)
+        if package:is_plat("mingw") then
+            if package:version() and package:version():ge("2.0.4") then
+                io.replace("LASzip/src/mydefs.cpp", "#ifdef _MSC_VER\n#include <windows.h>", "#ifdef _WIN32\n#include <windows.h>", {plain = true})
+                io.replace("LASzip/src/mydefs.cpp", "#ifdef _MSC_VER\n  GetCurrentDirectory", "#ifdef _WIN32\n  GetCurrentDirectory", {plain = true})
+            end
+        end
+
         local enable_tools = package:config("tools")
         if package:config("cmake") then
+            io.replace("LASlib/src/CMakeLists.txt", "RUNTIME DESTINATION lib/LASlib", "RUNTIME DESTINATION bin", {plain = true})
+            io.replace("LASlib/src/CMakeLists.txt", "DESTINATION lib/LASlib", "DESTINATION lib", {plain = true})
             if not enable_tools then
                 io.replace("CMakeLists.txt", "add_subdirectory(src)", "", {plain = true})
             end
-    
+
             local configs = {}
             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"))
-    
+
             local opt = {}
-            opt.cxflags = "/utf-8"
+            if package:has_tool("cxx", "cl") then
+                opt.cxflags = "/utf-8"
+            end
             import("package.tools.cmake").install(package, configs, opt)
 
             os.cp("LASlib/lib/*.lib", package:installdir("lib"))