Skip to main content
GameDev.net gamedev.net
🔒 Locked

Porting to mac using Xcode

Started by pjStyle Sep 23, 2010 at 10:34 AM 1 replies 950+ views
Original Post
pjStyle
pjStyle
Hey guys,

We are working on a mac port of our game but have no experience what so ever with mac development :).

So we have the option Force include set in visual studio to make sure certain header files are always included. Does anybody know if an option like this exists in Xcode??

A workaround would be including the header files where needed, but this will be a gigantic amount of work :).

Also some tips regarding mac development would be greatly appreciated too!

Thanks!

- Ted de Vries
magic_man
magic_man
Well I would ask is there a specific reason you are using the /FI option and not including the files using the CPP.
Quote:

this will be a gigantic amount of work :).

Maybe so but you could also be correcting a bad decision to use the option in the first place :)

Quote:
Also some tips regarding mac development would be greatly appreciated too!

What type of tips are you looking for?
Learn Xcode shortcuts if using Xcode.
Learn how to use Xcode performance and testing tools.
If you are not used to Xcode or MacOsx try compiling use mingw or cygwin then it will compile with xcode using gcc
"You insulted me!" I did not say that in the private message Tom Sloper!
the_edd
the_edd
XCode is a "wrapper" around Apple's port of the GNU tool chain (and LLVM), just like the Visual C++ IDE is a wrapper around cl.exe, link.exe and so on.

At some point, to become effective, you'll need to learn a little about those underlying tools.

In particular the GCC manual will tell you how to inject additional headers in to the compilation unit (see "-include" and "-imacros" options).

"gcc -dumpversion" will give you the version of gcc you're running by default.

The Mac has a roughly equivalent concept to the Windows/Platform SDKs. You will need to make sure your compiler is pointing to the correct platform SDK for the targets you want to support. If you don't specify an SDK, you'll end up targeting the platform on which you're building (and hence lose support for older versions of the OS).

These SDKs typically live under /Developer/SDKs/ and you usually get a bunch of them installed with XCode. More information on these SDKs can be found here.

Another concept it might be worth knowing about is universal binaries. A binary on OS X can contain machine code for multiple architectures (x86, x64, ppc, ppc64 and maybe others). The code that is executed is chosen when the binary is loaded. The architecture(s) you're targeting can be specified on the compiler command line, or you can build for one architecture at a time and then use the "lipo" utility to join the "thin" binaries in to universal binaries later on.

I don't actually use XCode itself, but I know all this is configurable within a project inside the IDE.

Finally, Apple pushes its Objective-C ("Cocoa") APIs quite heavily so if you're using C or C++, the natural way to interface with the platform APIs is to use a smattering of Objective-C here or there. If you don't like doing that, there are older C APIs ("Carbon") which are gradually being phased out. However, they're sometimes easier to use, I find. Finding information on them can be tricky though -- Googling for the API names won't get you anywhere near Apple's official documentation. So start looking here for Carbon stuff.

Good luck.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.