xmake.lua 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. package("raylib")
  2. set_homepage("http://www.raylib.com")
  3. set_description("A simple and easy-to-use library to enjoy videogames programming.")
  4. if is_plat("macosx") and is_arch("x86_64") then
  5. add_urls("https://github.com/raysan5/raylib/releases/download/$(version).tar.gz", {version = function (version)
  6. if version:ge("3.5.0") then
  7. return version .. "/raylib-" .. version .. "_macos"
  8. else
  9. return version .. "/raylib-" .. version .. "-macOS"
  10. end
  11. end})
  12. add_versions("2.5.0", "e9ebdf70ad4912dc9f3c7965dc702d5c61f2841aeae521e8dd3b0a96a9d82d58")
  13. add_versions("3.0.0", "8244898b09887f29baa9325b5ae47c30ec0f45dc15b4f740178c65af068b3141")
  14. add_versions("3.5.0", "9b9be75fe1b231225c91a6fcf5ed9c24cbf03c6193f917e40e4655ef27f281e2")
  15. add_versions("3.7.0", "439dc1851dd1b7f385f4caf4f5c7191dda90add9d8d531e5e74702315e432003")
  16. add_versions("4.0.0", "be73734815a7ef4eb3130f4a2ecaabb2059602745ae6ce1173201a74034c2ec9")
  17. add_versions("4.2.0", "5f79c103b82c577698b01c7b2c166d0c2b51615886b7fabdc671199f0aaf4b38")
  18. add_versions("4.5.0", "63deb87ffc32e5eb2023ba763aaea2cb5f41bd37bbc07760651efe251bd76f3d")
  19. add_versions("5.0", "48e477d3dde2e20220572c9f93a332c48cf378fc1e1f205454b975180085565c")
  20. else
  21. add_urls("https://github.com/raysan5/raylib/archive/$(version).tar.gz",
  22. "https://github.com/raysan5/raylib.git")
  23. add_versions("2.5.0", "fa947329975bdc9ea284019f0edc30ca929535dc78dcf8c19676900d67a845ac")
  24. add_versions("3.0.0", "164d1cc1710bb8e711a495e84cc585681b30098948d67d482e11dc37d2054eab")
  25. add_versions("3.5.0", "761985876092fa98a99cbf1fef7ca80c3ee0365fb6a107ab901a272178ba69f5")
  26. add_versions("3.7.0", "7bfdf2e22f067f16dec62b9d1530186ddba63ec49dbd0ae6a8461b0367c23951")
  27. add_versions("4.0.0", "11f6087dc7bedf9efb3f69c0c872f637e421d914e5ecea99bbe7781f173dc38c")
  28. add_versions("4.2.0", "676217604a5830cb4aa31e0ede0e4233c942e2fc5c206691bded58ebcd82a590")
  29. add_versions("4.5.0", "163378604f2293ea5ebf3238f50c8926addde72d1a6bc8998ac2e96074ba8af8")
  30. add_versions("5.0", "98f049b9ea2a9c40a14e4e543eeea1a7ec3090ebdcd329c4ca2cf98bc9793482")
  31. end
  32. if not (is_plat("macosx") and is_arch("x86_64")) then
  33. add_deps("cmake >=3.11")
  34. end
  35. if is_plat("macosx") then
  36. add_frameworks("CoreVideo", "CoreGraphics", "AppKit", "IOKit", "CoreFoundation", "Foundation")
  37. elseif is_plat("windows", "mingw") then
  38. add_syslinks("gdi32", "user32", "winmm", "shell32")
  39. elseif is_plat("linux") then
  40. add_syslinks("pthread", "dl", "m")
  41. add_deps("libx11", "libxrandr", "libxrender", "libxinerama", "libxcursor", "libxi", "libxfixes", "libxext")
  42. end
  43. add_deps("opengl", {optional = true})
  44. on_install("macosx|x86_64", function (package)
  45. os.cp("include/*.h", package:installdir("include"))
  46. os.cp("lib/libraylib.a", package:installdir("lib"))
  47. end)
  48. on_install("windows", "linux", "macosx|arm64", "mingw", function (package)
  49. local configs = {"-DBUILD_EXAMPLES=OFF"}
  50. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  51. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  52. import("package.tools.cmake").install(package, configs, {packagedeps = {"libx11", "libxrender", "libxrandr", "libxinerama", "libxcursor", "libxi", "libxfixes", "libxext"}})
  53. end)
  54. on_test(function (package)
  55. assert(package:check_cxxsnippets({test = [[
  56. void test() {
  57. InitWindow(100, 100, "hello world!");
  58. }
  59. ]]}, {includes = {"raylib.h"}, configs = {languages = "cxx11"}}))
  60. end)