xmake.lua 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package("jnipp")
  2. set_homepage("https://github.com/mitchdowd/jnipp")
  3. set_description("C++ wrapper for the Java Native Interface")
  4. set_license("MIT")
  5. add_urls("https://github.com/mitchdowd/jnipp/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/mitchdowd/jnipp.git")
  7. add_versions("v1.0.0", "e5ff425e1af81d6c0a80420f5b3a46986cdb5f2a1c34449e2fb262eb2edf885b")
  8. if is_plat("windows", "mingw") then
  9. add_syslinks("advapi32")
  10. end
  11. add_deps("openjdk", {kind = "library"})
  12. if on_check then
  13. on_check(function (package)
  14. if not package:is_arch64() then
  15. raise("package(jnipp) unsupported 32-bit arch")
  16. end
  17. if package:is_cross() then
  18. raise("package(jnipp) only support native build")
  19. end
  20. end)
  21. end
  22. on_install("windows", "linux", "macosx", function (package)
  23. io.writefile("xmake.lua", [[
  24. add_rules("mode.debug", "mode.release")
  25. add_requires("openjdk", {kind = "library"})
  26. set_languages("c++14")
  27. target("jnipp")
  28. set_kind("$(kind)")
  29. add_files("jnipp.cpp")
  30. add_headerfiles("jnipp.h")
  31. add_packages("openjdk")
  32. if is_plat("windows", "mingw") then
  33. add_syslinks("advapi32")
  34. if is_kind("shared") then
  35. add_rules("utils.symbols.export_all", {export_classes = true})
  36. end
  37. end
  38. ]])
  39. import("package.tools.xmake").install(package)
  40. end)
  41. on_test(function (package)
  42. assert(package:check_cxxsnippets({test = [[
  43. #include <jnipp.h>
  44. void test() {
  45. jni::Vm vm;
  46. jni::Class Integer = jni::Class("java/lang/Integer");
  47. jni::Object i = Integer.newInstance("1000");
  48. }
  49. ]]}, {configs = {languages = "c++14"}}))
  50. end)