xmake.lua 3.5 KB

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