xmake.lua 3.4 KB

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