xmake.lua 3.9 KB

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