Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions packages/l/lastools/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"})
Expand All @@ -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"))
Expand Down
Loading