xmake.lua 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. package("angelscript")
  2. set_homepage("http://angelcode.com/angelscript/")
  3. set_description("Extremely flexible cross-platform scripting library designed to allow applications to extend their functionality through external scripts")
  4. set_license("zlib")
  5. add_urls("https://github.com/codecat/angelscript-mirror.git")
  6. add_urls("http://angelcode.com/angelscript/sdk/files/angelscript_$(version).zip")
  7. add_versions("2.37.0", "0c52d1688016a0b2484e9ca549471c4e295df060770c57840144c64815f54f10")
  8. add_versions("2.36.0", "33f95f7597bc0d88b097d35e7b1320d15419ffc5779851d9d2a6cccec57811b3")
  9. add_versions("2.35.1", "5c1096b6d6cf50c7e77ae93c736d35b69b07b1e5047161c7816bca25b413a18b")
  10. add_versions("2.35.0", "010dd45e23e734d46f5891d70e268607a12cb9ab12503dda42f842d9db7e8857")
  11. add_versions("2.34.0", "6faa043717522ae0fb2677d907ca5b0e35a79d28e5f83294565e6c6229bfbdf7")
  12. add_patches(">=2.34.0", "patches/msvc-arm64.patch", "1433f474870102e6fd8d0c9978b6d122a098cdecded29be70176b9dab534564f")
  13. add_configs("exceptions", {description = "Enable exception handling in script context", default = true, type = "boolean"})
  14. if is_plat("linux") then
  15. add_syslinks("pthread")
  16. end
  17. if on_check then
  18. on_check("mingw", function (package)
  19. if is_host("macosx") and package:is_arch("i386") and package:version():eq("2.37.0") then
  20. assert(false, "package(angelscript 2.37.0): Unsupported version on mingw|i386")
  21. end
  22. end)
  23. end
  24. on_load("windows|x86", "windows|x64", "linux", "android", "msys", "mingw", function (package)
  25. package:add("deps", "cmake")
  26. end)
  27. on_install("windows|x86", "windows|x64", "linux", "android", "msys", "mingw", function (package)
  28. local configs = {}
  29. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  30. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  31. table.insert(configs, "-DAS_NO_EXCEPTIONS=" .. (package:config("exceptions") and "OFF" or "ON"))
  32. if package:gitref() then
  33. os.cd("sdk")
  34. end
  35. os.cd("angelscript/projects/cmake")
  36. if package:is_plat("android") then
  37. io.gsub("CMakeLists.txt", "set_property", "#set_property")
  38. end
  39. import("package.tools.cmake").install(package, configs)
  40. end)
  41. on_install("windows|arm64", function (package)
  42. local configs = {vers = package:version_str()}
  43. configs.exceptions = package:config("exceptions")
  44. os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
  45. import("package.tools.xmake").install(package, configs)
  46. end)
  47. on_test(function (package)
  48. assert(package:check_cxxsnippets({test = [[
  49. #include <iostream>
  50. #include "angelscript.h"
  51. static void test() {
  52. std::cout << asGetLibraryVersion() << "\n";
  53. }
  54. ]]}, {configs = {languages = "c++11"}, includes = "angelscript.h"}))
  55. end)