Skip to content

Commit

Permalink
tgui: use sfml
Browse files Browse the repository at this point in the history
  • Loading branch information
cho-m authored and daeho-ro committed Jan 12, 2025
1 parent 2b6cd27 commit 2958148
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions Formula/t/tgui.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Tgui < Formula
end

depends_on "cmake" => :build
depends_on "sfml@2" # sfml 3.0 build issue report, https://github.com/texus/TGUI/issues/249
depends_on "sfml"

def install
args = %W[
Expand All @@ -45,17 +45,25 @@ def install
#include <TGUI/Backend/SFML-Graphics.hpp>
int main()
{
sf::Text text;
text.setString("Hello World");
sf::RenderWindow window{sf::VideoMode{{800, 600}}, "TGUI example (SFML-Graphics)"};
tgui::Gui gui{window};
if (!window.isOpen())
return 1;
const auto event = window.pollEvent();
window.close();
return 0;
}
CPP

ENV.append_path "LD_LIBRARY_PATH", Formula["sfml@2"].opt_lib if OS.linux?
system ENV.cxx, "test.cpp", "-std=c++17", "-I#{include}", "-I#{Formula["sfml@2"].opt_include}",
"-L#{lib}", "-L#{Formula["sfml@2"].opt_lib}",
system ENV.cxx, "test.cpp", "-std=c++17", "-I#{include}", "-I#{Formula["sfml"].opt_include}",
"-L#{lib}", "-L#{Formula["sfml"].opt_lib}",
"-ltgui", "-lsfml-graphics", "-lsfml-system", "-lsfml-window",
"-o", "test"
system "./test"

if OS.linux? && ENV["HOMEBREW_GITHUB_ACTIONS"]
assert_match "Failed to open X11 display", shell_output("./test 2>&1", 134)
else
system "./test"
end
end
end

0 comments on commit 2958148

Please sign in to comment.