Giter Site home page Giter Site logo

thoughton / hellosdl-tlh Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ricket/hellosdl

2.0 2.0 0.0 118 KB

"Hello world" with SDL in Xcode 4, links with a locally built SDL 1.3 dylib, and copies the dylib into the app bundle (and makes necessary install_name modifications) so the app is distributable and relocatable.

C 1.12% C++ 17.54% Objective-C 81.34%

hellosdl-tlh's Introduction

This is an Xcode 4 project that draws a colourful triangle to the screen with SDL.

Originally by Ricket (https://github.com/Ricket), forked and modified by thoughton (https://github.com/thoughton).

Ricket's original linked to the SDL framework, this fork links to dylibs instead.

The reasons for the change to dylibs, and for this fork's existence in general, are as follows:

  1. To be able to link to SDL libraries that are build using the makefiles on OSX, which in my (limited) experience seems to be the easiest way to build SDL on OSX

  2. To be able to link to SDL libraries that are installed to non-standard locations, eg. within the home directory structure of the user, so admin rights are not needed for building or installing SDL, or for linking to it

  3. To be able to bundle the libraries inside the app's bundle, and to make the necessary modifications to the app's built Mach-O binary, so that the app can be redistributed and relocated without the need to worry about the location of the user's SDL libraries

  4. To experiment with ways of doing #3 in a manner that is easily able to handle any number of additional non-SDL dylibs, in as simple and as painless a way as possible

To be able to build this code after initial git cloning, you should only need to alter the following two settings in the Target's Build Settings within Xcode:

  1. Add to the "Header Search Paths" setting: the directory that contains the "SDL" sub-directory that contains your SDL headers (SDL.h, etc.)

  2. Add to the "Library Search Paths" setting: the directory that contains the "SDL" sub-directory that contains your SDL libraries (libSDL.dylib, etc.)

And that's it. At this point the project should compile without a hitch, and the resulting app should be redistributable and relocatable without a problem.

If you want to add additional dylibs to the project, other than adding another "-lXXX" entry to the "Other Linker Flags" setting so that the linker knows to actually link the library in, all you have to do to also get the dylib bundled in with the built app is just add its name (without version numbers or file extension) to the "DYLIBS_TO_BE_BUNDLED" setting in the User-Defined section of the Target's Build Settings.

hellosdl-tlh's People

Contributors

thoughton avatar ricket avatar

Stargazers

Bo Shi avatar  avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.