OSX GCC how to specify sfml library source?

前端 未结 2 2129
清酒与你
清酒与你 2021-02-10 21:03

I\'m trying to compile a project that uses sfml I installed sfml 2.1 through homebrew like below

unknown542696d2a12b:keepe         


        
2条回答
  •  执笔经年
    2021-02-10 21:20

    Why doesn't SFML formula work out of the box?

    SFML was built to use freetype and libsndfile frameworks from /Library/Frameworks or from the Frameworks folder in your application bundle.

    You can find more technical details here and there.

    How can I use SFML on Mac easily?

    It's really easy: follow 1:1 the official guide: SFML and Xcode (Mac OS X) (And yes, you can use SFML outside Xcode!)

    I really want to use brew formula. How can I fix it?

    First, take a good look at this issue. That would give you an overview of the problems with the current naïve formula.

    Specifically to you current issue, you will need to use install_name_tool to fix your binaries.

    Here is how you can do it for freetype. It's similar for libsndfile.

    install_name_tool -change @executable_path/../Frameworks/freetype.framework/Versions/A/freetype /usr/local/lib/libfreetype.dylib /usr/local/Cellar/sfml/2.1/lib/libsfml-graphics.2.1.dylib
    

    However, this means your app will look for freetype in /usr/local/lib. Hence, you would have to install freetype there on your clients' computers too. This is not the case if you use the official installation procedure and use Xcode templates to create a SFML app.

提交回复
热议问题