Skip to content

Instantly share code, notes, and snippets.

@i8degrees
Created September 21, 2014 17:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save i8degrees/74f977f41082c89b33fe to your computer and use it in GitHub Desktop.
Save i8degrees/74f977f41082c89b33fe to your computer and use it in GitHub Desktop.
SDL2 & Friends Build for iOS 7.1
#### SDL2 & Friends Build for iOS 7.1+
* Note that -scheme puts files in ~/Library/Developer/Xcode/DerivedData
* Note that you should set $BUILD_DIR to wherever you want the destination
libraries to end up.
```
cd ~/Projects/third-party/SDL2.hg/Xcode-iOS/SDL
mkdir "${HOME}/Projects/hello-sdl2-ios-cmake.git/third-party/ios/SDL2/libs"
mkdir "${HOME}/Projects/hello-sdl2-ios-cmake.git/third-party/ios/SDL2/include"
xcodebuild -sdk iphoneos7.1 -configuration Debug -scheme libSDL BUILD_DIR="/private/tmp/SDL2"
xcodebuild -sdk iphonesimulator7.1 -configuration Debug -scheme libSDL -arch i386 BUILD_DIR="/private/tmp/SDL2"
# Universal binaries (i386, armv7, armv7s)
lipo -create /private/tmp/SDL2/Debug-iphoneos/libSDL2.a /private/tmp/SDL2/Debug-iphonesimulator/libSDL2.a -output "${HOME}/Projects/hello-sdl2-ios-cmake.git/third-party/ios/SDL2/libs/libSDL2.a"
# Headers
cp -av ../../include/ "${HOME}/Projects/hello-sdl2-ios-cmake.git/third-party/ios/SDL2/include"
```
```
cd ~/Projects/third-party/SDL2_image.hg/Xcode-iOS
mkdir "${HOME}/Projects/hello-sdl2-ios-cmake.git/third-party/ios/SDL2_image/libs"
mkdir "${HOME}/Projects/hello-sdl2-ios-cmake.git/third-party/ios/SDL2_image/include"
xcodebuild -sdk iphoneos7.1 -configuration Debug -scheme libSDL_image BUILD_DIR="/private/tmp/SDL2_image"
xcodebuild -sdk iphonesimulator7.1 -configuration Debug -scheme libSDL_image -arch i386 BUILD_DIR="/private/tmp/SDL2_image"
lipo -create /private/tmp/SDL2_image/Debug-iphoneos/libSDL2_image.a /private/tmp/SDL2_image/Debug-iphonesimulator/libSDL2_image.a -output "${HOME}/Projects/hello-sdl2-ios-cmake.git/third-party/ios/SDL2_image/libs/libSDL2_image.a"
# Headers
cp -av ../SDL_image.h "${HOME}/Projects/hello-sdl2-ios-cmake.git/third-party/ios/SDL2_image/include"
```
```
cd ~/Projects/third-party/SDL2_ttf.hg/Xcode-iOS
mkdir "${HOME}/Projects/hello-sdl2-ios-cmake.git/third-party/ios/SDL2_ttf/libs"
mkdir "${HOME}/Projects/hello-sdl2-ios-cmake.git/third-party/ios/SDL2_ttf/include"
xcodebuild -sdk iphoneos7.1 -configuration Debug BUILD_DIR="/private/tmp/SDL2_ttf"
xcodebuild -sdk iphonesimulator7.1 -configuration Debug -arch i386 BUILD_DIR="/private/tmp/SDL2_ttf"
lipo -create /private/tmp/SDL2_ttf/Debug-iphoneos/libSDL2_ttf.a /private/tmp/SDL2_ttf/Debug-iphonesimulator/libSDL2_ttf.a -output "${HOME}/Projects/hello-sdl2-ios-cmake.git/third-party/ios/SDL2_ttf/libs/libSDL2_ttf.a"
# Headers
cp -av ../SDL_ttf.h "${HOME}/Projects/hello-sdl2-ios-cmake.git/third-party/ios/SDL2_ttf/include"
```
Copy resulting libraries to your third-party dependencies directory.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment