Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Installing on Mac (Xcode)  (Read 20858 times)

0 Members and 2 Guests are viewing this topic.

GroundZero

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
Installing on Mac (Xcode)
« on: October 19, 2011, 04:09:36 pm »
Dear reader,

could someone please provide me (and a lot of other people lol) with a step by step tutorial on how to get SFML working on a mac with xcode. Been trying for 2 months now without success.

It would be much appreciated if you could do it step by step i.e. how to use cmake to unpack everything, then copy the files to the right folders, then what and how to add the links to the .h files in C++ and so on.

You'll be my hero for a life time if someone can do this ;)

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Installing on Mac (Xcode)
« Reply #1 on: October 19, 2011, 08:29:10 pm »
currently there is no such tutorial. but you can get all the required information from this post : http://www.sfml-dev.org/forum/viewtopic.php?p=23608#23608 if you want to use SFML 2.0 (still under development) or refer to http://www.sfml-dev.org/tutorials/1.6/ for SFML 1.6.

however, it's highly recommended to be used to Xcode and C++ programming (Object Oriented Programming and how libraries roughly work) before using SFML on mac.
SFML / OS X developer

GroundZero

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
Installing on Mac (Xcode)
« Reply #2 on: October 19, 2011, 10:10:18 pm »
Thanks for your answer and the links :)

I know how to program in C++ (almost advanced) just cant seem to get SFML working on my Mac. On my PC its working fine, but I want it on my mac ;)

sbroadfoot90

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
Installing on Mac (Xcode)
« Reply #3 on: October 20, 2011, 03:10:16 am »
Hey man, I'm using Xcode4 and I managed to get it working in under 20 minutes with the tutorial here and modifying it a bit for mac.

Are you using Xcode 3 or 4? I'll be happy to help if it's 4 :)[/url]

GroundZero

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
Installing on Mac (Xcode)
« Reply #4 on: October 20, 2011, 02:20:55 pm »
Dear sbroadfoot90,

I am using the newest version of xCode (which is 4 right?) on my Mac which is running OS X Lion.

It would be awesome if you could assist me a little bit. I will first try to follow the tutorial you provided in the link.

Thank you for your reply!

sbroadfoot90

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
Installing on Mac (Xcode)
« Reply #5 on: October 21, 2011, 12:30:10 am »
OK, basically what I did,

1) Clone the git repository.

You can do this two ways:

a) by clicking here and then clicking on Clone in Mac. You will need to download the github app.

Screenshot

Choose to save it in ~/SFML (or any other folder).

b) Alternatively, if you have git installed in your bash terminal, simply type

$ cd ~
$ git clone https://github.com/SFML/SFML.git

2) Download and install C-make. Open it.

- Building release
Where it says "Where is the source code?", type ~/SFML
Where it says "Where to build the binaries", type ~/SFML/build-release
Then click configure, choose Unix makefile and default compiler and OK.... then wait a bit.

There will be a bunch of options in red. Tick all of them (if you don't have doxygen then leave BUILD_DOC unticked), and make sure CMAKE_BUILD_TYPE is Release.

Click configure again, and then click generate.

- Building debug
Do everything the same, but build in  ~/SFML/build-debug, and change CMAKE_BUILD_TYPE to Debug.

3) Compiling and installing

Open up a terminal and type

$ cd ~/SFML/build-release
$ make clean
$ sudo make install

Enter your password

then type

$ cd ../debug
$ make clean
$ sudo make install

Everything should be installed properly now.

4) Making a project with Xcode4!

Open up Xcode4, then click File > New > New Project. The screen should now look like this. Choose either one, and there you go!

If the templates didn't come up, then you probably forgot to tick INSTALL_XCODE4_TEMPLATES in cmake, OR, you didn't click configure the second time.

Any problems with this, just ask :)


EDIT: Made the instructions a bit clearer based on some replies

GroundZero

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
Installing on Mac (Xcode)
« Reply #6 on: October 21, 2011, 11:16:11 am »
awesome thank you so much! I am going to try this out in 2 hours :D

Aranri

  • Newbie
  • *
  • Posts: 6
    • AOL Instant Messenger - Avenue+du+Silo+1
    • View Profile
Installing on Mac (Xcode)
« Reply #7 on: October 29, 2011, 10:43:32 am »
Good Day

I tried to follow all of your instructions (only put the folder inside my home folder -> myname/SFML-source/SFML-make/release

and all seemed to work well, except when i typed sudo make install inside the terminal:

make: *** No rule to make target `install'.  Stop.

What did I do wrong? I have the following files inside the release folder:



If you could help me out I really would appreciate it   :)

Bitbridge

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Manuel Reinfurt - Website
Installing on Mac (Xcode)
« Reply #8 on: October 29, 2011, 01:28:48 pm »
It looks like you used Cmake to create a Xcode-project. You can open that .xcodeproj using Xcode and then run the "install"-target, which will compile and copy the SFML libraries/header files into /usr/local. You probably have to run Xcode using sudo.

If you want to create a makefile, you have to choose "Unix makefile" when configuring Cmake.

Also, since I've already written in this topic: How can I deploy my SFML application via Xcode (using the SFML Xcode 4 Template)? I can build it for archiving, which will build the release .app, however, it doesn't copy the SFML libraries. Do I have to manually add them (Build phases)?

Aranri

  • Newbie
  • *
  • Posts: 6
    • AOL Instant Messenger - Avenue+du+Silo+1
    • View Profile
Installing on Mac (Xcode)
« Reply #9 on: October 29, 2011, 03:00:34 pm »
Thank you for your reply Codevine.
I was actually refering to the post of sbroadfoot90 and the third step:
Quote
3) Compiling and installing

Open up a terminal and type

$ cd ~/SFML-make/release
$ sudo make install

Enter your password

then type

$ cd ../debug
$ sudo make install

Everything should be installed properly now.


and that sudo make install here does not work for me.The libraries etc. are still missing (I also have no templates)

Because if I try to build the install target (and i opened Xcode with sudo open Xcode.app) I have 105 issues.

They sound like the following:
in allocator.h:
In file included from /Users/myName/SFML-source/SFML/src/SFML/System/Err.cpp
in cstddef
/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/cstddef:53: error: expected constructor, destructor, or type conversion before '(' token
'_GLIBCXX_END_NAMESPACE' does not name a type
Bits/time_members.h: No such file or directory

etc...
So i think something is still missing, but I really don't know what it is.

Bitbridge

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Manuel Reinfurt - Website
Installing on Mac (Xcode)
« Reply #10 on: October 29, 2011, 03:17:34 pm »
When clicking on Configure in CMake the first time it asks for the generator. What did you choose there? If you want to use 'sudo make install', you will have to choose "Unix makefile". However, on your screenshot it looks like you chose the Xcode generator, which is why it created a Xcode project (so there is no rule to make target 'install').

Anyways, it also should work using Xcode (it does for me, using 10.7), so I'm not sure about the error(s). If you have the same error(s) using the unix makefile, you probably have to wait for Hiura.

Aranri

  • Newbie
  • *
  • Posts: 6
    • AOL Instant Messenger - Avenue+du+Silo+1
    • View Profile
Installing on Mac (Xcode)
« Reply #11 on: October 29, 2011, 07:52:41 pm »
Thank you so much, that was exactly the problem!

Now it could install it perfectly on my Laptop, unfortunatley it didn't work on my iMac.
After I typed sudo make install I many errors similar to those:

Quote

[  8%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Err.cpp.o

/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/iosfwd:44:28: error: bits/c++config.h: No such file or directory
/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/iosfwd:45:29: error: bits/c++locale.h: No such file or directory
/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/iosfwd:46:25: error: bits/c++io.h: No such file or directory

or
Quote

/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/bits/allocator.h:53:31: error: bits/c++allocator.h: No such file or directory
In file included from /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/bits/basic_ios.h:44,
                 from /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/ios:50,
                 from /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/ostream:45,
                 from /Users/rogerkueng/SFML-source/SFML/include/SFML/System/Err.hpp:32,
                 from /Users/rogerkueng/SFML-source/SFML/src/SFML/System/Err.cpp:28:


In theory i did everything the same way on both machines, but somehow on one it doesn't want to work.

Am I missing some other library or did I not install something?

Thank you again so much for your help!

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Installing on Mac (Xcode)
« Reply #12 on: October 30, 2011, 10:28:23 am »
Looks like Xcode & co aren't correctly installed, since you're missing some standard headers.
Want to play movies in your SFML application? Check out sfeMovie!

Aranri

  • Newbie
  • *
  • Posts: 6
    • AOL Instant Messenger - Avenue+du+Silo+1
    • View Profile
Installing on Mac (Xcode)
« Reply #13 on: October 30, 2011, 12:05:59 pm »
Thank you Ceylo!

It was exactly that, I reinstalled Xcode and afterward everything worked!

Now I can finally start coding :D

thecruuk

  • Newbie
  • *
  • Posts: 6
    • View Profile
Installing on Mac (Xcode)
« Reply #14 on: November 05, 2011, 07:44:17 pm »
i followed the tutorial but i´m getting this error:

can someone help me?