JMU JMU - Department of Computer Science
Help Tools
Installing SDL for Xcode


1 Introduction

According to the SDL WWW site "Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware".

This document describes how to install SDL v2 on OS X for use with Xcode. It assumes that you have already installed Xcode (and, perhaps, jGrasp).

2 Getting Started

The first thing you need to do is download the development libraries for the OS X port of SDL v2.

The libraries will be contained in a .dmg file.

3 Putting Files in the Right Place

You need to copy one file to complete the installation.
  1. Copy SDL2.framework to /Library/Frameworks.

4 Using Xcode

In order to use SDL in Xcode you must create an SDL project that uses the appropriate frameworks.

5 Using jGrasp

Some of you may have used jGrasp as your C/C++ IDE under OS X. You can do so with SDL but you will have to change some settings in jGrasp.

In jGrasp, choose Settings on the main menu, pull down to Compiler Settings, and then pull down to either Workspace or Project. Next, click on the Compiler tab and change the "Language" to C.

From here, you can set the "FLAGS or ARGS" for "Make", the "Compiler", etc... At a minimum, you will need to link in SDL2main and SDL2.

6 Testing Your Installation

You can use the following small program (named test.c) to test your installation:
sdlexamples/test.c

Note the need to #include SDL.h.

Copyright 2019