Ver Fonte

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

Ahmed AbouEleyoun há 1 ano atrás
pai
commit
4769772751
1 ficheiros alterados com 14 adições e 1 exclusões
  1. 14 1
      packages/g/glad/xmake.lua

+ 14 - 1
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