From 4769772751efb1b5cc120ae73de237ac4332000a Mon Sep 17 00:00:00 2001 From: Ahmed AbouEleyoun Date: Fri, 12 Jul 2024 01:52:51 +0300 Subject: [PATCH] glad: add extra configs to customize the generation (#4617) --- packages/g/glad/xmake.lua | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/g/glad/xmake.lua b/packages/g/glad/xmake.lua index 93def31ed..b66dc15b6 100644 --- a/packages/g/glad/xmake.lua +++ b/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