package An official xmake package repository
https://xrepo.xmake.io/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
2.6 KiB
59 lines
2.6 KiB
package("glfw") |
|
|
|
set_homepage("https://www.glfw.org/") |
|
set_description("GLFW is an Open Source, multi-platform library for OpenGL, OpenGL ES and Vulkan application development.") |
|
set_license("zlib") |
|
|
|
add_urls("https://github.com/glfw/glfw/archive/$(version).tar.gz", |
|
"https://github.com/glfw/glfw.git") |
|
add_versions("3.3.2", "98768e12e615fbe9f3386f5bbfeb91b5a3b45a8c4c77159cef06b1f6ff749537") |
|
add_versions("3.3.4", "cc8ac1d024a0de5fd6f68c4133af77e1918261396319c24fd697775a6bc93b63") |
|
add_versions("3.3.5", "32fdb8705784adfe3082f97e0d41e7c515963e977b5a14c467a887cf0da827b5") |
|
|
|
add_configs("glfw_include", {description = "Choose submodules enabled in glfw", default = "none", type = "string", values = {"none", "vulkan", "glu", "glext", "es2", "es3"}}) |
|
|
|
if is_plat("linux") then |
|
add_extsources("apt::libglfw3-dev") |
|
end |
|
|
|
add_deps("cmake") |
|
add_deps("opengl", {optional = true}) |
|
if is_plat("macosx") then |
|
add_frameworks("Cocoa", "IOKit") |
|
elseif is_plat("windows") then |
|
add_syslinks("user32", "shell32", "gdi32") |
|
elseif is_plat("mingw") then |
|
add_syslinks("gdi32") |
|
elseif is_plat("linux") then |
|
-- TODO: add wayland support |
|
add_deps("libx11", "libxrandr", "libxrender", "libxinerama", "libxfixes", "libxcursor", "libxi", "libxext") |
|
add_syslinks("dl", "pthread") |
|
add_defines("_GLFW_X11") |
|
end |
|
|
|
on_load(function (package) |
|
package:add("defines", "GLFW_INCLUDE_" .. package:config("glfw_include"):upper()) |
|
end) |
|
|
|
on_install("macosx", "windows", "linux", "mingw", function (package) |
|
local configs = {"-DGLFW_BUILD_DOCS=OFF", "-DGLFW_BUILD_TESTS=OFF", "-DGLFW_BUILD_EXAMPLES=OFF"} |
|
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")) |
|
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 |
|
if package:is_plat("linux") then |
|
import("package.tools.cmake").install(package, configs, {packagedeps = {"libxrender", "libxfixes", "libxext", "libx11"}}) |
|
else |
|
import("package.tools.cmake").install(package, configs) |
|
end |
|
end) |
|
|
|
on_test(function (package) |
|
assert(package:check_csnippets({test = [[ |
|
void test() { |
|
glfwInit(); |
|
glfwTerminate(); |
|
} |
|
]]}, {configs = {languages = "c11"}, includes = "GLFW/glfw3.h"})) |
|
end)
|
|
|