Bladeren bron

Test sfgui (#6671)

* Test sfgui

* Limit plats

* Fixup MinGW shared build

* Enforce shared SFML for both lib types on MinGW,

* Try to get rid of ```defines = not package:config("shared") and "SFGUI_STATIC" or nil```

* Update xmake.lua
Saikari 4 maanden geleden
bovenliggende
commit
e528c70745
2 gewijzigde bestanden met toevoegingen van 94 en 0 verwijderingen
  1. 52 0
      packages/s/sfgui/port/xmake.lua
  2. 42 0
      packages/s/sfgui/xmake.lua

+ 52 - 0
packages/s/sfgui/port/xmake.lua

@@ -0,0 +1,52 @@
+add_rules("mode.debug", "mode.release")
+set_languages("c++17")
+
+if is_plat("mingw") then
+    add_requires("sfml", {configs = {graphics = true, shared = true}})
+else
+    add_requires("sfml", {configs = {graphics = true}})
+end
+
+add_requires("opengl")
+
+if is_plat("linux", "bsd", "cross") then
+    add_requires("libx11")
+end
+
+option("font", {default = true})
+
+target("sfgui")
+    set_kind("$(kind)")
+
+    if is_plat("windows") then
+        add_defines("WIN32_LEAN_AND_MEAN", "NOMINMAX")
+    end
+
+    if is_plat("windows", "mingw") and is_kind("shared") then
+        add_defines("SFGUI_EXPORTS")
+    end
+
+    if is_kind("static") then
+        add_defines("SFGUI_STATIC")
+    end
+
+    add_packages("sfml", "opengl")
+
+    if is_plat("linux", "bsd", "cross") then
+        add_packages("libx11")
+    end
+
+    if is_plat("macosx", "iphoneos") then
+        add_frameworks("CoreFoundation", "Foundation")
+    end
+
+    add_files("src/**.cpp")
+
+    if not has_config("font") then
+        remove_files("src/SFGUI/DejaVuSansFont.cpp")
+    else
+        add_defines("SFGUI_INCLUDE_FONT")
+    end
+
+    add_includedirs("src", "include", "extlibs/libELL/include")
+    add_headerfiles("include/(SFGUI/**.hpp)", "include/(SFGUI/**.inl)")

+ 42 - 0
packages/s/sfgui/xmake.lua

@@ -0,0 +1,42 @@
+package("sfgui")
+    set_homepage("https://github.com/TankOs/SFGUI")
+    set_description("Simple and Fast Graphical User Interface")
+    set_license("zlib")
+
+    add_urls("https://github.com/TankOs/SFGUI/archive/refs/tags/$(version).tar.gz",
+             "https://github.com/TankOs/SFGUI.git")
+
+    add_versions("1.0.0", "280993756cfa8ca82574a5c505f4ce65f192037d523d38572552e96ca18aa3a0")
+
+    add_configs("font", {description = "Include default font in library (DejaVuSans)", default = true, type = "boolean"})
+
+    if is_plat("mingw") then
+        add_deps("sfml", {configs = {graphics = true, shared = true}})
+    else
+        add_deps("sfml", {configs = {graphics = true}})
+    end
+
+    add_deps("opengl")
+
+    if is_plat("linux", "bsd", "cross") then
+        add_deps("libx11")
+    end
+
+    if is_plat("macosx", "iphoneos") then
+        add_frameworks("CoreFoundation", "Foundation")
+    end
+
+    on_install("windows", "linux", "macosx", "mingw", function (package)
+        io.replace("include/SFGUI/Config.hpp", "!defined( SFGUI_STATIC )", not package:config("shared") and "0" or "1", {plain = true})
+        os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
+        import("package.tools.xmake").install(package)
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            void test() {
+                sfg::Window::Ptr window = sfg::Window::Create();
+	            window->SetTitle( "Title" );
+            }
+        ]]}, {configs = {languages = "c++17"}, includes = { "SFGUI/SFGUI.hpp", "SFGUI/Widgets.hpp" } }))
+    end)