glad: add extra configs to customize the generation (#4617)

pull/4628/head
Ahmed AbouEleyoun 5 months ago committed by GitHub
parent b324b50764
commit 4769772751
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 15
      packages/g/glad/xmake.lua

@ -21,10 +21,23 @@ package("glad")
end
end)
add_configs("reproducible", {description = "Disable fetching the latest specification from Khronos", default = true, type = "boolean"})
add_configs("profile", {description = "OpenGL profile", default = "compatibility", type = "string", values = {"core", "compatibility"}})
add_configs("api", {description = "OpenGL API", default = "", type = "string"})
add_configs("extensions", {description = "OpenGL extensions", default = "", type = "string"})
add_configs("generator", {description = "Generator", default = "c", type = "string", values = {"c", "c-debug", "d", "nim", "pascal", "volt"}})
add_configs("spec", {description = "OpenGL spec", default = "gl", type = "string"})
on_install("windows", "linux", "macosx", "mingw", function (package)
local configs = {"-DGLAD_INSTALL=ON", "-DGLAD_REPRODUCIBLE=ON"}
local configs = {"-DGLAD_INSTALL=ON"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
table.insert(configs, "-DGLAD_REPRODUCIBLE=" .. (package:config("reproducible") and "ON" or "OFF"))
table.insert(configs, "-DGLAD_PROFILE=" .. package:config("profile"))
table.insert(configs, "-DGLAD_API=" .. package:config("api"))
table.insert(configs, "-DGLAD_EXTENSIONS=" .. package:config("extensions"))
table.insert(configs, "-DGLAD_GENERATOR=" .. package:config("generator"))
table.insert(configs, "-DGLAD_SPEC=" .. package:config("spec"))
if package:is_plat("windows") then
table.insert(configs, "-DUSE_MSVC_RUNTIME_LIBRARY_DLL=" .. (package:config("vs_runtime"):startswith("MT") and "OFF" or "ON"))
end

Loading…
Cancel
Save