xmake.lua 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package("jerryscript")
  2. set_homepage("https://jerryscript.net")
  3. set_description("Ultra-lightweight JavaScript engine for the Internet of Things.")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/jerryscript-project/jerryscript.git")
  6. add_versions("2024.12.03", "c509a06669bd39301fdf0d36305a69689f51919e")
  7. add_patches("2024.12.03", "patches/2024.12.03/enum.patch", "91a69eacb49d9c7cc0302060787fe514fa53790858579bc32e326d991436bbaa")
  8. add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
  9. add_configs("cli", {description = "Build jerry command line tool", default = false, type = "boolean"})
  10. add_deps("cmake")
  11. if on_check then
  12. on_check("linux", function (package)
  13. assert(not package:has_tool("cxx", "clang", "clangxx"), "package(jerryscript): Linux Clang is not supported.")
  14. end)
  15. end
  16. on_install("!mingw and !macosx", function (package)
  17. local configs = {
  18. "-DJERRY_CMDLINE=" .. (package:config("cli") and "ON" or "OFF"),
  19. "-DCMAKE_POLICY_DEFAULT_CMP0057=NEW",
  20. }
  21. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  22. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  23. if package:is_plat("windows") then
  24. table.insert(configs, "-DENABLE_STATIC_CRT=" .. (package:has_runtime("MT", "MTd") and "ON" or "OFF"))
  25. if package:config("shared") then
  26. table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON")
  27. end
  28. end
  29. import("package.tools.cmake").install(package, configs)
  30. end)
  31. on_test(function (package)
  32. assert(package:check_cxxsnippets({test = [[
  33. #include <jerryscript.h>
  34. void test() {
  35. jerry_init(JERRY_INIT_EMPTY);
  36. }
  37. ]]}, {configs = {languages = "c99"}}))
  38. end)