xmake.lua 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package("quickjs-ng")
  2. set_homepage("https://github.com/quickjs-ng/quickjs")
  3. set_description("QuickJS, the Next Generation: a mighty JavaScript engine")
  4. set_license("MIT")
  5. add_urls("https://github.com/quickjs-ng/quickjs/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/quickjs-ng/quickjs.git")
  7. add_versions("v0.5.0", "41212a6fb84bfe07d61772c02513734b7a06465843ba8f76f1ce1e5df866f489")
  8. if is_plat("linux", "bsd") then
  9. add_syslinks("m", "pthread")
  10. end
  11. add_deps("cmake")
  12. if on_check then
  13. on_check("windows", function (package)
  14. local msvc = package:toolchain("msvc")
  15. if msvc then
  16. local vs = msvc:config("vs")
  17. assert(vs and tonumber(vs) >= 2022, "package(quickjs-ng): need vs >= 2022")
  18. end
  19. end)
  20. end
  21. on_install("!iphoneos and windows|!x86", function (package)
  22. local configs = {}
  23. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  24. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  25. table.insert(configs, "-DCONFIG_ASAN=" .. (package:config("asan") and "ON" or "OFF"))
  26. if package:config("shared") and package:is_plat("windows") then
  27. table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON")
  28. end
  29. import("package.tools.cmake").install(package, configs)
  30. end)
  31. on_test(function (package)
  32. assert(package:has_cfuncs("JS_NewRuntime", {includes = "quickjs.h"}))
  33. end)