summaryrefslogtreecommitdiff
path: root/tests/projects/package/components/xmake.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-10-17 22:43:28 +0800
committerruki <[email protected]>2022-10-17 22:43:28 +0800
commit0bc0bf1e0d114d1050eefde177cc3fca23777010 (patch)
tree6baeb821b21ec1846ade247838f704bcd66a8c88 /tests/projects/package/components/xmake.lua
parent5692805fd0bb1aa70cd6965de83068db60743b34 (diff)
improve sfml tests
Diffstat (limited to 'tests/projects/package/components/xmake.lua')
-rw-r--r--tests/projects/package/components/xmake.lua92
1 files changed, 53 insertions, 39 deletions
diff --git a/tests/projects/package/components/xmake.lua b/tests/projects/package/components/xmake.lua
index 17b8b4d04..85ff819c8 100644
--- a/tests/projects/package/components/xmake.lua
+++ b/tests/projects/package/components/xmake.lua
@@ -56,65 +56,79 @@ package("sfml")
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", "linux") then
- package:add("deps", "cmake")
+ add_components("graphics", function (package, component)
+ local e = package:config("shared") and "" or "-s"
+ component:add("links", "sfml-graphics" .. e)
+ if package:is_plat("windows", "mingw") and not package:config("shared") then
+ component:add("links", "freetype")
+ component:add("syslinks", "opengl32", "gdi32", "user32", "advapi32")
end
+ end)
- if not package:config("shared") then
- package:add("defines", "SFML_STATIC")
+ add_components("window", function (package, component)
+ local e = package:config("shared") and "" or "-s"
+ component:add("links", "sfml-window" .. e)
+ if package:is_plat("windows", "mingw") and not package:config("shared") then
+ component:add("syslinks", "opengl32", "gdi32", "user32", "advapi32")
end
+ end)
- local e = ""
- local a = "sfml-"
- if not package:config("shared") then
- e = "-s"
+ add_components("audio", function (package, component)
+ local e = package:config("shared") and "" or "-s"
+ component:add("links", "sfml-audio" .. e)
+ if package:is_plat("windows", "mingw") and not package:config("shared") then
+ component:add("links", "openal32", "flac", "vorbisenc", "vorbisfile", "vorbis", "ogg")
end
- if package:debug() then
- e = e .. "-d"
+ end)
+
+ add_components("network", function (package, component)
+ local e = package:config("shared") and "" or "-s"
+ component:add("links", "sfml-network" .. e)
+ if package:is_plat("windows", "mingw") and not package:config("shared") then
+ component:add("syslinks", "ws2_32")
end
- local main_module = a .. "main"
- if package:debug() then
- main_module = main_module .. "-d"
+ end)
+
+ add_components("system", function (package, component)
+ local e = package:config("shared") and "" or "-s"
+ component:add("links", "sfml-system" .. e)
+ if package:is_plat("windows", "mingw") then
+ component:add("syslinks", "winmm")
end
+ end)
- if package:config("graphics") then
- package:add("links", a .. "graphics" .. e)
- if package:is_plat("windows", "mingw") and not package:config("shared") then
- package:add("links", "freetype")
+ if is_plat("windows", "mingw") then
+ add_components("main", function (package, component)
+ if package:is_plat("windows", "mingw") then
+ local main_module = "sfml-main"
+ if package:debug() then
+ main_module = main_module .. "-d"
+ end
+ component:add("links", main_module)
end
+ end)
+ end
+
+ on_load("windows", "linux", "macosx", "mingw", function (package)
+ if package:is_plat("windows", "linux") then
+ package:add("deps", "cmake")
end
+
+ if not package:config("shared") then
+ package:add("defines", "SFML_STATIC")
+ end
+
if package:config("window") or package:config("graphics") then
- package:add("links", a .. "window" .. e)
- if package:is_plat("windows", "mingw") and not package:config("shared") then
- package:add("syslinks", "opengl32", "gdi32", "user32", "advapi32")
- end
if package:is_plat("linux") then
package:add("deps", "libx11", "libxext", "libxrandr", "libxrender", "freetype", "eudev")
package:add("deps", "opengl", "glx", {optional = true})
end
end
if package:config("audio") then
- package:add("links", a .. "audio" .. e)
- if package:is_plat("windows", "mingw") and not package:config("shared") then
- package:add("links", "openal32", "flac", "vorbisenc", "vorbisfile", "vorbis", "ogg")
- elseif package:is_plat("linux") then
+ if package:is_plat("linux") then
package:add("deps", "libogg", "libflac", "libvorbis", "openal-soft")
end
end
- if package:config("network") then
- package:add("links", a .. "network" .. e)
- if package:is_plat("windows", "mingw") and not package:config("shared") then
- package:add("syslinks", "ws2_32")
- end
- end
- 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
end)
on_install("windows", "linux", function (package)