xmake.lua 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. package("orc")
  2. set_homepage("https://arrow.apache.org/")
  3. set_description("ORC is a self-describing type-aware columnar file format designed for Hadoop workloads.")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/apache/orc/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/apache/orc.git")
  7. add_versions("v2.1.2", "277638a1e408ed405f29f1cdc254ff28b69b7c152cbf6c9f40418765dfe4bd24")
  8. add_versions("v2.1.1", "1f8eef537814fdcd003de13e49c6edb35427b45eb40bafd3355f775d99a0ff99")
  9. add_versions("v2.1.0", "c7f1b36e28a468fe7e3f92e581fb499825b7c342b7952c593f004defb50777d0")
  10. add_versions("v2.0.3", "7920c7c7644f31c5519befa18f8f949cdf53420603b621bd85d214b516e25ff3")
  11. add_configs("tools", {description = "build command line tools", default = false, type = "boolean"})
  12. add_configs("avx512", {description = "build the C++ library with AVX512 enabled if possible", default = false, type = "boolean"})
  13. if is_plat("linux") then
  14. add_extsources("pacman::apache-orc")
  15. end
  16. if is_plat("linux", "bsd") then
  17. add_syslinks("pthread", "m")
  18. end
  19. add_deps("cmake")
  20. add_deps("protobuf-cpp", "lz4", "snappy", "zlib", "zstd")
  21. on_check(function (package)
  22. if package:is_arch("arm.*") then
  23. raise("package(orc) unsupported arm architectures")
  24. end
  25. if package:is_cross() then
  26. raise("package(orc) unsupported cross-compilation")
  27. end
  28. end)
  29. on_install("windows", "linux", "macosx", "bsd", function (package)
  30. io.replace("c++/src/CMakeLists.txt", [[(orc STATIC ${SOURCE_FILES})]], [[(orc ${SOURCE_FILES})]], {plain = true})
  31. local configs = {
  32. "-DBUILD_JAVA=OFF",
  33. "-DBUILD_CPP_TESTS=OFF",
  34. "-DBUILD_LIBHDFSPP=OFF",
  35. "-DINSTALL_VENDORED_LIBS=OFF",
  36. "-DSTOP_BUILD_ON_WARNING=OFF",
  37. "-DPROTOBUF_HOME=" .. package:dep("protobuf-cpp"):installdir(),
  38. "-DLZ4_HOME=" .. package:dep("lz4"):installdir(),
  39. "-DSNAPPY_HOME=" .. package:dep("snappy"):installdir(),
  40. "-DZLIB_HOME=" .. package:dep("zlib"):installdir(),
  41. "-DZSTD_HOME=" .. package:dep("zstd"):installdir()
  42. }
  43. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  44. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  45. table.insert(configs, "-DBUILD_POSITION_INDEPENDENT_LIB=" .. (package:config("pic") and "ON" or "OFF"))
  46. if package:config("shared") and package:is_plat("windows") then
  47. table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON")
  48. end
  49. if package:dep("cmake"):version():lt("1.9.0") then
  50. table.insert(configs, "-DCMAKE_POLICY_DEFAULT_CMP0077=NEW")
  51. end
  52. table.insert(configs, "-DHAS_PRE_1970=" .. (package:is_plat("windows") and "ON" or "OFF"))
  53. table.insert(configs, "-DHAS_PRE_2038=" .. (package:is_plat("windows") and "ON" or "OFF"))
  54. table.insert(configs, "-DBUILD_TOOLS=" .. (package:config("tools") and "ON" or "OFF"))
  55. table.insert(configs, "-DBUILD_ENABLE_AVX512=" .. (package:config("avx512") and "ON" or "OFF"))
  56. import("package.tools.cmake").install(package, configs)
  57. end)
  58. on_test(function (package)
  59. assert(package:check_cxxsnippets({test = [[
  60. using namespace orc;
  61. void test(){
  62. std::unique_ptr<OutputStream> outStream =writeLocalFile("my-file.orc");
  63. std::unique_ptr<Type> schema(Type::buildTypeFromString("struct<x:int,y:int>"));
  64. WriterOptions options;
  65. std::unique_ptr<Writer> writer =createWriter(*schema, outStream.get(), options);
  66. }
  67. ]]}, {configs = {languages = "c++17"}, includes = "orc/OrcFile.hh"}))
  68. end)