xmake.lua 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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") then
  9. add_syslinks("advapi32")
  10. end
  11. add_deps("openjdk")
  12. on_install("windows|x64", "linux|x86_64", "macosx|x86_64", "macosx|arm64", "mingw|x86_64", function (package)
  13. io.writefile("xmake.lua", [[
  14. add_rules("mode.debug", "mode.release")
  15. add_requires("openjdk")
  16. set_languages("c++14")
  17. target("jnipp")
  18. set_kind("$(kind)")
  19. add_files("jnipp.cpp")
  20. add_headerfiles("jnipp.h")
  21. add_packages("openjdk")
  22. if is_plat("windows") then
  23. add_syslinks("advapi32")
  24. if is_kind("shared") then
  25. add_rules("utils.symbols.export_all", {export_classes = true})
  26. end
  27. end
  28. ]])
  29. import("package.tools.xmake").install(package)
  30. end)
  31. on_test(function (package)
  32. assert(package:check_cxxsnippets({test = [[
  33. #include <jnipp.h>
  34. void test() {
  35. jni::Vm vm;
  36. jni::Class Integer = jni::Class("java/lang/Integer");
  37. jni::Object i = Integer.newInstance("1000");
  38. }
  39. ]]}, {configs = {languages = "c++14"}}))
  40. end)