xmake.lua 1.5 KB

12345678910111213141516171819202122232425262728293031323334
  1. package("glad")
  2. set_homepage("https://glad.dav1d.de/")
  3. set_description("Multi-Language Vulkan/GL/GLES/EGL/GLX/WGL Loader-Generator based on the official specs.")
  4. set_license("MIT")
  5. add_urls("https://github.com/Dav1dde/glad/archive/$(version).tar.gz",
  6. "https://github.com/Dav1dde/glad.git")
  7. add_versions("v0.1.34", "4be2900ff76ac71a2aab7a8be301eb4c0338491c7e205693435b09aad4969ecd")
  8. add_versions("v0.1.36", "8470ed1b0e9fbe88e10c34770505c8a1dc8ccb78cadcf673331aaf5224f963d2")
  9. if is_plat("linux") then
  10. add_syslinks("dl")
  11. end
  12. on_load("windows", "linux", "macosx", "mingw", function (package)
  13. if not package.is_built or package:is_built() then
  14. package:add("deps", "cmake")
  15. package:add("deps", "python 3.x", {kind = "binary"})
  16. end
  17. end)
  18. on_install("windows", "linux", "macosx", "mingw", function (package)
  19. local configs = {"-DGLAD_INSTALL=ON", "-DGLAD_REPRODUCIBLE=ON"}
  20. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  21. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  22. if package:is_plat("windows") then
  23. table.insert(configs, "-DUSE_MSVC_RUNTIME_LIBRARY_DLL=" .. (package:config("vs_runtime"):startswith("MT") and "OFF" or "ON"))
  24. end
  25. import("package.tools.cmake").install(package, configs)
  26. end)
  27. on_test(function (package)
  28. assert(package:has_cfuncs("gladLoadGL", {includes = "glad/glad.h"}))
  29. end)