Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS compilation via configure/make [patch] #582

Closed
SDLBugzilla opened this issue Feb 10, 2021 · 0 comments
Closed

iOS compilation via configure/make [patch] #582

SDLBugzilla opened this issue Feb 10, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: HG 2.0
Reported for operating system, platform: iOS (All), All

Comments on the original bug report:

On 2012-05-12 07:03:43 +0000, Gabriel Jacobo wrote:

Created attachment 853
Allows SDL for iOS compilation via configure/make

I've attached a small patch that allows to compile SDL for iOS using configure/make by providing the --host=arm-apple-darwin parameter. It's not a complete solution because you still have to copy SDL_config_iphoneos.h over SDL_config.h, but it may be useful for others anyway as it produces a static library that you can just throw into XCode projects without having to set up anything else.

On 2012-06-01 11:35:16 +0000, Sam Lantinga wrote:

I tried this, but it's not using the right API headers and so forth. Do you have a complete command line that works?

On 2012-06-01 11:42:32 +0000, Gabriel Jacobo wrote:

I set up the adequate environment variables as in any cross compilation using a Python function:

def prepare_ios_env(sdk=None, target='3.0'):
""" Set up the environment variables for iOS compilation"""
env = deepcopy(os.environ)
global XCODE_ROOT, BEST_IOS_SDK

if XCODE_ROOT is None:
    XCODE_ROOT = find_xcode()

if BEST_IOS_SDK is None:
    BEST_IOS_SDK = find_ios_sdk()

if sdk is None:
    sdk = BEST_IOS_SDK

env['DEVROOT'] = join(XCODE_ROOT, 'Platforms/iPhoneOS.platform/Developer')
env['SDKROOT'] = env['DEVROOT'] + '/SDKs/iPhoneOS%s.sdk' % sdk
env['CFLAGS'] = env['CXXFLAGS'] = "-g -O2 -pipe -no-cpp-precomp -isysroot %s -miphoneos-version-min=%s -I%s/usr/include/" % (env['SDKROOT'], target, env['SDKROOT'])
env['CXXCPP'] = env['CPP'] = env['DEVROOT'] + "/usr/bin/llvm-cpp-4.2"
env['CXX'] = env['DEVROOT'] + "/usr/bin/llvm-g++-4.2"
env['CC'] = env['DEVROOT'] + "/usr/bin/llvm-gcc-4.2"
env['LD'] = env['DEVROOT'] + "/usr/bin/ld"
env['AR'] = env['DEVROOT'] + "/usr/bin/ar"
env['AS'] = env['DEVROOT'] + "/usr/bin/ls"
env['NM'] = env['DEVROOT'] + "/usr/bin/nm"
env['RANLIB'] = env['DEVROOT'] + "/usr/bin/ranlib"
env['STRIP'] = env['DEVROOT'] + "/usr/bin/strip"
env['LDFLAGS'] = "-L%s/usr/lib/ -isysroot %s -miphoneos-version-min=%s" % (env['SDKROOT'], env['SDKROOT'], target)
return env

I configure with something like this:

./configure --host=armv6-apple-darwin CFLAGS="-arch armv6" LDFLAGS="-arch armv6 -static-libgcc" --disable-shared --enable-static --prefix="some/path"

After running configure, I overwrite SDL_config.h with SDL_config_iphoneos.h, and run make.

On 2012-06-01 11:45:52 +0000, Gabriel Jacobo wrote:

I actually run the process twice, once with -arch armv6 another with -arch armv7 (and you could do it a third time for simulator support with -arch i386), then lipo all versions together.

The source code for the SDL/iOS compilation code is here: https://bitbucket.org/gabomdq/ignifuga/src/27af5d22dbe8/tools/modules/sdl/ios.py but as I said, it's no different than cross compiling for other platforms really.

On 2012-06-05 14:55:59 +0000, Gabriel Jacobo wrote:

Sam, you merged a few changes from this patch already, is there anything more needed to merge the rest (basically the configure/configure.in changes) ?

On 2012-06-20 13:40:04 +0000, Gabriel Jacobo wrote:

This patch was accepted (see iosbuild.sh)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant