xmake.lua 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package("openjph")
  2. set_homepage("https://github.com/aous72/OpenJPH")
  3. set_description("Open-source implementation of JPEG2000 Part-15 (or JPH or HTJ2K)")
  4. set_license("BSD-2-Clause")
  5. add_urls("https://github.com/aous72/OpenJPH/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/aous72/OpenJPH.git")
  7. add_versions("0.25.2", "ae5f09562cb811cb2fb881c5eb74583e18db941848cfa3c35787e2580f3defc6")
  8. add_versions("0.24.2", "c99218752b15b5b2afca3b0e4d4f0ddf1ac19f94dbcbe11874fe492d44ed3e2d")
  9. add_versions("0.24.1", "5e44a809c9ee3dad175da839feaf66746cfc114a625ec61c786de8ad3f5ab472")
  10. add_configs("tools", {description = "Build tools", default = false, type = "boolean"})
  11. add_deps("cmake")
  12. if on_check then
  13. on_check("android", function (package)
  14. local ndk = package:toolchain("ndk")
  15. local ndk_sdkver = ndk:config("ndk_sdkver")
  16. assert(ndk_sdkver and tonumber(ndk_sdkver) >= 28, "package(openjph): need ndk api level >= 28")
  17. end)
  18. end
  19. on_install(function (package)
  20. if package:is_plat("windows", "mingw") and package:config("shared") then
  21. io.replace("src/core/common/ojph_arch.h", [[#else
  22. #define OJPH_EXPORT
  23. #endif]], [[#else
  24. #define OJPH_EXPORT __declspec(dllimport)
  25. #endif]], {plain = true})
  26. end
  27. local configs = {}
  28. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  29. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  30. table.insert(configs, "-DOJPH_BUILD_EXECUTABLES=" .. (package:config("tools") and "ON" or "OFF"))
  31. import("package.tools.cmake").install(package, configs)
  32. end)
  33. on_test(function (package)
  34. assert(package:check_cxxsnippets({test = [[
  35. void test() {
  36. ojph::j2c_outfile file;
  37. file.open("file.txt");
  38. }
  39. ]]}, {configs = {languages = "c++11"}, includes = "openjph/ojph_file.h"}))
  40. end)