[SDL] CMake gurus...

Gabriele Greco gabriele.greco at darts.it
Mon Mar 25 08:14:48 PDT 2013


 Another plus of CMake is how easy it is to cross-build, for instance for
>> a project I'm working on with two simple toolchain files I can build on
>> the same machine for Linux, OSX and Win32.
>>
>
> Cross compiling for OSX from Linux? Tell me more.


I use a cross compiler I've found in a ubuntu repository (
https://launchpad.net/~flosoft/+archive/cross-apple ) :

dpkg -l | grep apple

ii  apple-uni-framework-sdl                       1.2.14-0flosoft3
                                               MacOSX SDL-framework for
apple cross compiler
ii  apple-uni-sdk-10.5                            20110407-0.flosoft1
                                              MacOSX 10.5 SDK for apple
cross compiler
ii  apple-uni-sdk-10.6                            20110407-0.flosoft1
                                              MacOSX 10.6 SDK for apple
cross compiler
ii  apple-x86-gcc                                 4.2.1~5646.1flosoft2
                                               Apple i686/x86_64
crosscompiler
ii  apple-x86-odcctools                           758.159-0flosoft11
                                               Apple Darwin crosscompiler
i686/x86_64 "binutils".

I've added the libraries I use (SDL, GTK...) in the SYSROOT of  the apple
compiler, and I've added pkg-config files pointing to the right paths.

I use the following toolchain file (the last lines are important to avoid
to "poison" the cross-compiler with linux headers):

# this one is important
SET(CMAKE_SYSTEM_NAME Darwin)

# specify the cross compiler
SET(CMAKE_C_COMPILER   i686-apple-darwin10-gcc)
SET(CMAKE_CXX_COMPILER i686-apple-darwin10-g++)

# where is the target environment
SET(CMAKE_FIND_ROOT_PATH  /usr/lib/apple/SDKs/MacOSX10.5.sdk/usr)

# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(ENV{PKG_CONFIG_PATH} ${CMAKE_FIND_ROOT_PATH}/lib/pkgconfig)

-- 
Bye,
 Gabry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20130325/b3bcdefa/attachment-0009.htm>


More information about the SDL mailing list