xmake.lua 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package("liblas")
  2. set_homepage("https://liblas.org/index.html")
  3. set_description("libLAS - LAS 1.0/1.1/1.2 ASPRS LiDAR data translation toolset")
  4. set_license("BSD-3-Clause")
  5. add_urls("http://download.osgeo.org/liblas/libLAS-$(version).tar.bz2")
  6. add_versions("1.8.1", "9adb4a98c63b461ed2bc82e214ae522cbd809cff578f28511122efe6c7ea4e76")
  7. add_patches("1.8.1", path.join(os.scriptdir(), "patches", "1.8.1", "header.patch"), "fde1c186e78472f4eb8902f28b51b18a8b40166379c710b43f89323aac7c3afd")
  8. add_deps("cmake", "libgeotiff")
  9. add_deps("boost", {configs = {program_options = true,
  10. thread = true,
  11. system = true,
  12. iostreams = true,
  13. filesystem = true}})
  14. on_install("windows", "macosx", "linux", function (package)
  15. io.replace("CMakeLists.txt", "JPEG", "PROJ", {plain = true})
  16. io.replace("src/CMakeLists.txt", "${GDAL_LIBRARY}", "${PROJ_LIBRARIES}", {plain = true})
  17. local configs = {"-DWITH_TESTS=OFF", "-DWITH_LASZIP=OFF", "-DWITH_GDAL=OFF", "-DBUILD_OSGEO4W=OFF", "-DBoost_USE_STATIC_LIBS=ON"}
  18. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  19. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  20. if package:is_plat("windows") then
  21. table.insert(configs, "-DBoost_USE_STATIC_RUNTIME=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
  22. end
  23. import("package.tools.cmake").install(package, configs)
  24. end)
  25. on_test(function (package)
  26. assert(package:check_cxxsnippets({test = [[
  27. #include <liblas/liblas.hpp>
  28. #include <fstream>
  29. void test() {
  30. std::ifstream ifs;
  31. ifs.open("file.las", std::ios::in | std::ios::binary);
  32. liblas::ReaderFactory f;
  33. liblas::Reader reader = f.CreateWithStream(ifs);
  34. }
  35. ]]}, {configs = {languages = "c++11"}}))
  36. end)