From 34d4244a8067b57bec8f4023a552f00868aa4602 Mon Sep 17 00:00:00 2001 From: PucklaMotzer09 Date: Wed, 7 Oct 2020 10:16:20 +0200 Subject: [PATCH 1/2] Fix links and add test to glfw --- packages/g/glfw/xmake.lua | 48 ++++++++++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/packages/g/glfw/xmake.lua b/packages/g/glfw/xmake.lua index edd55bf65..fddfd3233 100644 --- a/packages/g/glfw/xmake.lua +++ b/packages/g/glfw/xmake.lua @@ -20,17 +20,40 @@ package("glfw") add_deps("cmake") end - if is_plat("windows", "mingw") then - add_syslinks("opengl32", "gdi32", "user32", "shell32") - elseif is_plat("macosx") then - add_frameworks("Cocoa", "IOKit", "CoreFoundation") + add_configs("include_none", {description = "Adds the GLFW_INCLUDE_NONE Preprocessor Macro to disable all OpenGL includes inside GLFW", default = true, type = "boolean"}) + + if is_plat("macosx") then + add_frameworks("Cocoa", "IOKit") elseif is_plat("linux") then add_defines("_GLFW_X11") - add_syslinks("xrandr", "x11", "xinerama", "xcursor", "xi", "xext") end - on_load("windows", function (package) - package:add("links", "glfw3") + on_load(function (package) + if package:config("shared") then + if package:is_plat("windows", "mingw") then + package:add("defines", "GLFW_DLL") + package:add("links", "glfw3dll") + elseif package:is_plat("macosx") then + package:add("links", "glfw") + end + else + if package:is_plat("windows", "mingw") then + package:add("links", "glfw3") + if package:is_plat("windows") then + package:add("syslinks", "user32", "shell32") + package:add("cxflags", "/MD") + end + package:add("syslinks", "gdi32") + elseif package:is_plat("macosx") then + package:add("links", "glfw3") + elseif package:is_plat("linux") then + package:add("syslinks", "Xrandr", "X11", "Xinerama", "Xcursor", "Xi", "Xext", "dl", "pthread") + end + end + + if package:config("include_none") then + package:add("defines", "GLFW_INCLUDE_NONE") + end end) on_install("windows", function (package) @@ -59,5 +82,14 @@ package("glfw") end) on_install("linux", function (package) - import("package.tools.cmake").install(package) + local config = {} + table.insert(config, "-DGLFW_BUILD_DOCS=OFF") + table.insert(config, "-DGLFW_BUILD_TESTS=OFF") + table.insert(config, "-DGLFW_BUILD_EXAMPLES=OFF") + table.insert(config, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) + import("package.tools.cmake").install(package, config) + end) + + on_test(function (package) + assert(package:has_cfuncs("glfwInit", {includes = "GLFW/glfw3.h"})) end) \ No newline at end of file From a3c61d8d8db1bc61d6340290b4144d797ebbcd41 Mon Sep 17 00:00:00 2001 From: PucklaMotzer09 Date: Thu, 8 Oct 2020 11:17:03 +0200 Subject: [PATCH 2/2] Add Installation step to linux --- .github/workflows/linux.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 8aa550692..b321f511a 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -19,6 +19,10 @@ jobs: with: xmake-version: branch@dev + - name: Installation + run: | + sudo apt-get install -y libxrandr-dev libxinerama-dev libx11-dev libxcursor-dev libxi-dev libxext-dev + - name: Tests run: | xmake l ./scripts/test.lua -D -k ${{ matrix.kind }}