iOS project setup

Hey all,

The README-ios.txt says that the project setup instructions are outdated.
I’m new to Xcode and while I’ve managed to make a mess and get a simple
demo running on the simulator, I do wonder how I’m actually supposed to do
this… Can anyone give me an idea of how to properly set up a new SDL
project on iOS via Xcode?

Jonny D

Hi,

My 2 cents advice …

On the first hand, I build the SDL libs with this scripts :
https://bugzilla.libsdl.org/show_bug.cgi?id=2302

Then, I have a CMake file that I use to create the xcode projects for my
apps :
Some example on this website :
http://www.michaelborgmann.com/tutorials/build-sdl2-app-for-ios-using-cmake/

Cheers,

SylvainOn Tue, Apr 22, 2014 at 3:39 PM, Jonathan Dearborn wrote:

Hey all,

The README-ios.txt says that the project setup instructions are outdated.
I’m new to Xcode and while I’ve managed to make a mess and get a simple
demo running on the simulator, I do wonder how I’m actually supposed to do
this… Can anyone give me an idea of how to properly set up a new SDL
project on iOS via Xcode?

Jonny D


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Sylvain Becker

I probably should make a screencast, but I’m knee deep in Android crap
right now. (As bad as this is in iOS, Android is way worse.)

The native iOS, way is to make a new project (we used to have Xcode
project templates but I think they are all broken now).

  • Make a new project (probably an empty one)
  • Delete the .m files
  • Create or add your main.c
  • Copy the SDL source tree into your new project directory
  • In Xcode, use the contextual menu to “Add Files to Project” (I
    usually do it in the Frameworks section). Find the Xcode iOS project
    that builds SDL and select that one. (Alternatively, you can create a
    new “Workspace” add your project and the iOS project to that.)
  • Select your project in the Groups & Panels (click on the topmost
    item in the left-most panel). This will bring up Project Settings in
    your main window.
  • Select your application in “Targets” (left column in main window)
  • Select the Build Phases tab (top center of main window)
  • In Target Dependencies, hit the + button and look for libSDL and add it.
  • In Link Binary With Libraries, hit the + button and look for
    libSDL.a and add it.
  • Now go to the Build Settings tab (one to the left of Build Phases)
  • Find Header Search Paths and add the SDL include path to it.
    Example: “$(SRCROOT)/…/…/SDL2-2.0.3/include” (Tip: You can find it
    in Finder and drag the folder into the box in Xcode and it will fill
    it out for you.)

Assuming I didn’t forget anything, you should now be able to hit the
Run button and it will build and run. This will automatically handle
switching between simulator and device architectures (you don’t need
to lipo the different binaries or do funny setups because there are 2
separate .a files) as well as debug and release.

(P.S. I have no objection to CMake and plan to look at that in the
near future. I use CMake for Windows and Linux and sometimes Mac and
the external NDK side of Android. I just haven’t spent the time
getting familiar with the iOS CMake toolchain because I’ve literally
spent months on the Android one because it is such hell (but it’s
worse without CMake)).

-EricOn 4/22/14, Jonathan Dearborn wrote:

Hey all,

The README-ios.txt says that the project setup instructions are outdated.
I’m new to Xcode and while I’ve managed to make a mess and get a simple
demo running on the simulator, I do wonder how I’m actually supposed to do
this… Can anyone give me an idea of how to properly set up a new SDL
project on iOS via Xcode?

Jonny D


Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/

Some time ago I wrote a post about how to set up a SDL 2 project for OS X
in Xcode 4:

I guess you’re using Xcode 5 now and an iOS project should differ in few
bits anyway, but hopefully this will give you a starting point.On 22 April 2014 14:39, Jonathan Dearborn wrote:

Hey all,

The README-ios.txt says that the project setup instructions are outdated.
I’m new to Xcode and while I’ve managed to make a mess and get a simple
demo running on the simulator, I do wonder how I’m actually supposed to do
this… Can anyone give me an idea of how to properly set up a new SDL
project on iOS via Xcode?

Jonny D


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Davide Coppola

email: @Davide_Coppola
website: http://www.davidecoppola.com

Thanks guys. Now I have a few things to try and a better feeling for how
things should be. :slight_smile:

Jonny D