|
@@ -11,7 +11,7 @@ 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
|
|
@@ -61,23 +61,23 @@ package("sfml")
|
|
|
|
|
|
if package:config("graphics") then
|
|
|
package:add("links", a .. "graphics" .. e)
|
|
|
- if package:is_plat("mingw") then
|
|
|
+ if package:is_plat("windows", "mingw") and not package:config("shared") then
|
|
|
package:add("links", "freetype")
|
|
|
end
|
|
|
end
|
|
|
if package:config("window") or package:config("graphics") then
|
|
|
package:add("links", a .. "window" .. e)
|
|
|
- if package:is_plat("windows", "mingw") then
|
|
|
+ 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", "libxrandr", "freetype", "eudev")
|
|
|
+ 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("mingw") then
|
|
|
+ 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
|
|
|
package:add("deps", "libogg", "libflac", "libvorbis", "openal-soft")
|
|
@@ -85,7 +85,7 @@ package("sfml")
|
|
|
end
|
|
|
if package:config("network") then
|
|
|
package:add("links", a .. "network" .. e)
|
|
|
- if package:is_plat("windows", "mingw") then
|
|
|
+ if package:is_plat("windows", "mingw") and not package:config("shared") then
|
|
|
package:add("syslinks", "ws2_32")
|
|
|
end
|
|
|
end
|
|
@@ -109,11 +109,17 @@ package("sfml")
|
|
|
table.insert(configs, "-DSFML_USE_STATIC_STD_LIBS=ON")
|
|
|
end
|
|
|
end
|
|
|
+ local packagedeps
|
|
|
+ if package:is_plat("linux") and package:config("shared") then
|
|
|
+ io.replace("src/SFML/Graphics/CMakeLists.txt", "target_link_libraries(sfml-graphics PRIVATE X11)",
|
|
|
+ "target_link_libraries(sfml-graphics PRIVATE X11 Xext Xrender)", {plain = true})
|
|
|
+ packagedeps = {"libxext", "libxrender"}
|
|
|
+ end
|
|
|
table.insert(configs, "-DSFML_BUILD_AUDIO=" .. (package:config("audio") and "ON" or "OFF"))
|
|
|
table.insert(configs, "-DSFML_BUILD_GRAPHICS=" .. (package:config("graphics") and "ON" or "OFF"))
|
|
|
table.insert(configs, "-DSFML_BUILD_WINDOW=" .. (package:config("window") and "ON" or "OFF"))
|
|
|
table.insert(configs, "-DSFML_BUILD_NETWORK=" .. (package:config("network") and "ON" or "OFF"))
|
|
|
- import("package.tools.cmake").install(package, configs)
|
|
|
+ import("package.tools.cmake").install(package, configs, {packagedeps = packagedeps})
|
|
|
end)
|
|
|
|
|
|
on_install("macosx", "mingw", function (package)
|
|
@@ -131,4 +137,45 @@ package("sfml")
|
|
|
c.restart();
|
|
|
}
|
|
|
]]}, {includes = "SFML/System.hpp"}))
|
|
|
+ if package:config("graphics") then
|
|
|
+ assert(package:check_cxxsnippets({test = [[
|
|
|
+ void test(int args, char** argv) {
|
|
|
+ sf::Text text;
|
|
|
+ text.setString("Hello world");
|
|
|
+ }
|
|
|
+ ]]}, {includes = "SFML/Graphics.hpp"}))
|
|
|
+ end
|
|
|
+ if package:config("window") or package:config("graphics") then
|
|
|
+ assert(package:check_cxxsnippets({test = [[
|
|
|
+ void test(int args, char** argv) {
|
|
|
+ sf::Window window(sf::VideoMode(1280, 720), "Title");
|
|
|
+
|
|
|
+ sf::Event event;
|
|
|
+ window.pollEvent(event);
|
|
|
+ }
|
|
|
+ ]]}, {includes = "SFML/Window.hpp"}))
|
|
|
+ end
|
|
|
+ if package:config("audio") then
|
|
|
+ assert(package:check_cxxsnippets({test = [[
|
|
|
+ void test(int args, char** argv) {
|
|
|
+ sf::Music music;
|
|
|
+ music.openFromFile("music.ogg");
|
|
|
+ music.play();
|
|
|
+ }
|
|
|
+ ]]}, {includes = "SFML/Audio.hpp"}))
|
|
|
+ end
|
|
|
+ if package:config("network") then
|
|
|
+ assert(package:check_cxxsnippets({test = [[
|
|
|
+ void test(int args, char** argv) {
|
|
|
+ sf::UdpSocket socket;
|
|
|
+ socket.bind(54000);
|
|
|
+
|
|
|
+ char data[100];
|
|
|
+ std::size_t received;
|
|
|
+ sf::IpAddress sender;
|
|
|
+ unsigned short port;
|
|
|
+ socket.receive(data, 100, received, sender, port);
|
|
|
+ }
|
|
|
+ ]]}, {includes = "SFML/Network.hpp"}))
|
|
|
+ end
|
|
|
end)
|