diff --git a/packages/s/sfml/xmake.lua b/packages/s/sfml/xmake.lua index eb2a99b2e..a37e4d230 100644 --- a/packages/s/sfml/xmake.lua +++ b/packages/s/sfml/xmake.lua @@ -11,6 +11,9 @@ package("sfml") if is_arch("x64", "x86_64") then set_urls("https://www.sfml-dev.org/files/SFML-$(version)-macOS-clang.tar.gz") add_versions("2.5.1", "6af0f14fbd41dc038a00d7709f26fb66bb7ccdfe6187657ef0ef8cba578dcf14") + + add_configs("debug", {builtin = true, description = "Enable debug symbols.", default = false, type = "boolean", readonly = true}) + add_configs("shared", {description = "Build shared library.", default = true, type = "boolean", readonly = true}) end elseif is_plat("mingw") then if is_arch("x64", "x86_64") then @@ -26,10 +29,12 @@ package("sfml") add_configs("window", {description = "Use the window module", default = true, type = "boolean"}) add_configs("audio", {description = "Use the audio module", default = true, type = "boolean"}) add_configs("network", {description = "Use the network module", default = true, type = "boolean"}) - add_configs("main", {description = "Link to the sfml-main library", default = true, type = "boolean"}) + if is_plat("windows", "mingw") then + add_configs("main", {description = "Link to the sfml-main library", default = true, type = "boolean"}) + end on_load("windows", "linux", "macosx", "mingw", function (package) - if package:is_plat("windows") then + if package:is_plat("windows", "linux") then package:add("deps", "cmake") end @@ -39,13 +44,11 @@ package("sfml") local e = "" local a = "sfml-" - if package:is_plat("windows", "mingw") then - if not package:config("shared") then - e = "-s" - end - if package:debug() then - e = e .. "-d" - end + if not package:config("shared") then + e = "-s" + end + if package:debug() then + e = e .. "-d" end local main_module = a .. "main" if package:debug() then @@ -53,15 +56,13 @@ package("sfml") end if package:config("graphics") then + package:add("links", a .. "graphics" .. e) if package:is_plat("mingw") then - package:add("links", a .. "graphics" .. e) package:add("links", "freetype") end end if package:config("window") or package:config("graphics") then - if package:is_plat("mingw") then - package:add("links", a .. "window" .. e) - end + package:add("links", a .. "window" .. e) if package:is_plat("windows", "mingw") then package:add("syslinks", "opengl32", "gdi32", "user32", "advapi32") end @@ -71,25 +72,23 @@ package("sfml") end end if package:config("audio") then + package:add("links", a .. "audio" .. e) if package:is_plat("mingw") then - package:add("links", a .. "audio" .. e) package:add("links", "openal32", "flac", "vorbisenc", "vorbisfile", "vorbis", "ogg") elseif package:is_plat("linux") then package:add("deps", "libogg", "libflac", "libvorbis", "openal-soft") end end if package:config("network") then - if package:is_plat("mingw") then - package:add("links", a .. "network" .. e) - end + package:add("links", a .. "network" .. e) if package:is_plat("windows", "mingw") then package:add("syslinks", "ws2_32") end end - if package:is_plat("mingw") then - package:add("links", a .. "system" .. e) + if package:is_plat("windows", "mingw") and package:config("main") then package:add("links", main_module) end + package:add("links", a .. "system" .. e) if package:is_plat("windows", "mingw") then package:add("syslinks", "winmm") end