Giter Club home page Giter Club logo

Comments (4)

SpartanJ avatar SpartanJ commented on July 27, 2024

Original comment by Martín Lucas Golini (Bitbucket: SpartanJ, GitHub: SpartanJ).


Hi!
If i remember correctly the SDL2 header file in the SDL2 Framework is not located in the SDL2 sub-folder. That seems to be the problem. But i need to make some changes in the premake4.lua file to detect if you're using xcode and the framework. I'll look into that as soon as i can.

from soil2.

SpartanJ avatar SpartanJ commented on July 27, 2024

Original comment by Johannes P. (Bitbucket: [Johannes P.](https://bitbucket.org/Johannes P.), ).


Hi Martín, thanks for the fast reply!

As far as I can tell, the framework is laid out correctly, according to Apple's framework guidelines: https://developer.apple.com/library/prerelease/mac/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/FrameworkAnatomy.html - See Listing 3 under 'Additional Directories', and note that it matches the layout found in SDL2.framework:

screenshot_2015-08-03_20.11.50.png

I am Not using Xcode. This is entirely with gmake. I may be mistaken, but as far as I understand, when using a non-system framework in a program being compiled under g++ or clang you need two flags when compiling and linking:

  1. -framework (What framework)
  2. -F <PATH TO FRAMEWORK(S)> (Where to find it)

If that is done correctly than headers in the framework such as SDL.h are found automatically, or at least that seems to be what line 22 and 32 of my snippet above suggest. This is further supported when you consider the fact that without the -F flag the linking step does not work (line 28), and you don't even need the header file when linking. It simply has to do with providing the compiler with the location of the framework, and it does the rest.


To quote the man page - http://linux.die.net/man/1/g++ :

#!

-Fdir
Add the framework directory dir to the head of the list of directories to be searched for header files.
These directories are interleaved with those specified by -I options and are scanned in a left-to-right order.

So effectively, during the compilation step, you can use -I and manually provide the path to the framework's header directory, ie:

#!shell

-I /Library/Frameworks/SDL2.framework/Headers

And for that single framework would accomplish the same thing as:

#!shell

-F /Library/Frameworks

But that kind of defeats the point of using frameworks in the first place, not to mention you need to do -I /path/to/framework/header for every single framework, instead of just one -F /path/where/all/frameworks/are


TL;DR: the SDL2 framework is laid out correctly, but when compiling with g++ or clang you need to use -F /Path/To/Framework to ensure the compiler can traverse the standardized framework file structure and locate the header file.

from soil2.

SpartanJ avatar SpartanJ commented on July 27, 2024

Original comment by Johannes P. (Bitbucket: [Johannes P.](https://bitbucket.org/Johannes P.), ).


A minor update:

When creating a separate premake5 project I'm able to fix this issue by manually adding the -F flag to my build and link options:
https://gist.github.com/JohannesMP/9a9b5263c127103f1861#file-premake5-lua-L24-L26 (see highlighted lines) - doing so appends the correct -F ... flag to the make variables ALL_CFLAGS and ALL_LDFLAGS

However when I attempt to add that with premake4 it seems that the resulting make file fails to include the flags in All_CFLAGS as well as ALL_LDFLAGS (as can be seen when using make verbose=1). I'm not quite sure why.

I'll play around with it a bit more. I can manually get the make files to compile if I append -F /Library/Frameworks to each instance of ALL_CFLAGS and ALL_LDFLAGS in the resulting .make files

On a semi-related note, here is an issue regarding frameworks in premake that I opened on the premake repo: premake/premake-core#196

from soil2.

SpartanJ avatar SpartanJ commented on July 27, 2024

Original comment by Martín Lucas Golini (Bitbucket: SpartanJ, GitHub: SpartanJ).


This should improve the tests on OS X.

Thanks for your help,

Regards

from soil2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.