Permalink
Browse files

First crack at a build system using toolchains to build iPhone archit…

…ecture versions
  • Loading branch information...
1 parent 113c363 commit 42057b8ee2761a5b1650cbc5523a3e47a488a464 @batterseapower committed Oct 31, 2010
View
@@ -6,10 +6,10 @@ INCLUDE_DIRECTORIES(. nspr-emu mozilla/extensions/universalchardet/src/base/)
FILE(GLOB charsetdetect_lib_src mozilla/extensions/universalchardet/src/base/*.cpp)
SET(charsetdetect_lib_src ${charsetdetect_lib_src} charsetdetect.cpp)
-ADD_LIBRARY(charsetdetect SHARED ${charsetdetect_lib_src})
+ADD_LIBRARY(charsetdetect ${charsetdetect_lib_src})
# Do not output the shared library into the root
-SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
+SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/build)
INSTALL (TARGETS charsetdetect DESTINATION lib)
INSTALL (FILES charsetdetect.h DESTINATION include)
@@ -0,0 +1,50 @@
+# Michael Aaron Safyan (michaelsafyan@gmail.com). Copyright (C) 2009-2010. Simplified BSD License.
+SET (CMAKE_SYSTEM_NAME Generic)
+SET (CMAKE_SYSTEM_VERSION 1)
+SET (CMAKE_SYSTEM_PROCESSOR i686)
+SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)
+
+SET (DEVROOT "/Developer/Platforms/iPhoneSimulator.platform/Developer")
+SET (SDKROOT "${DEVROOT}/SDKs/iPhoneSimulator${SDKVER}.sdk")
+SET (CMAKE_OSX_SYSROOT "${SDKROOT}")
+SET (CMAKE_OSX_ARCHITECTURES "i386" "x86_64")
+
+SET (CMAKE_C_COMPILER "${DEVROOT}/usr/bin/gcc-4.2")
+SET (CMAKE_CXX_COMPILER "${DEVROOT}/usr/bin/g++-4.2")
+
+SET (CMAKE_C_FLAGS "-std=c99" "-x objective-c")
+SET (CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS} "-DDEBUG=1" "-ggdb")
+SET (CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS} "-DNDEBUG=1")
+SET (CMAKE_C_FLAGS_RELWITHDEBINFO ${CMAKE_C_FLAGS} "-DNDEBUG=1" "-ggdb")
+
+SET (CMAKE_CXX_FLAGS "-x objective-c++")
+SET (CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS} "-DDEBUG=1" "-ggdb")
+SET (CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS} "-DNDEBUG=1")
+SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS} "-DNDEBUG=1" "-ggdb")
+
+ADD_DEFINITIONS("-arch i386")
+ADD_DEFINITIONS("-arch x86_64")
+ADD_DEFINITIONS("-pipe")
+ADD_DEFINITIONS("-no-cpp-precomp")
+ADD_DEFINITIONS("--sysroot=${SDKROOT}")
+ADD_DEFINITIONS("-miphoneos-version-min=${SDKVER}")
+
+INCLUDE_DIRECTORIES(SYSTEM "${SDKROOT}/usr/include")
+INCLUDE_DIRECTORIES(SYSTEM "${SDKROOT}/opt/iphone-simulator-${SDKVER}/include")
+INCLUDE_DIRECTORIES(SYSTEM "${SDKROOT}/usr/local/iphone-simulator-${SDKVER}/include")
+
+LINK_DIRECTORIES("${SDKROOT}/usr/lib")
+LINK_DIRECTORIES("${SDKROOT}/opt/iphone-simulator-${SDKVER}/lib")
+LINK_DIRECTORIES("${SDKROOT}/usr/local/iphone-simulator-${SDKVER}/lib")
+
+SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${SDKROOT}/opt/iphone-simulator-${SDKVER}/" "${SDKROOT}/usr/local/iphone-simulator-${SDKVER}/")
+SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
+SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+
+SET (iPhone 1)
+SET (iPhoneSimulator 1)
+SET (iPhoneSimulator_VERSION ${SDKVER})
+
+# The iPhone does not support shared libraries
+SET (BUILD_SHARED_LIBS OFF)
@@ -0,0 +1,53 @@
+# Michael Aaron Safyan (michaelsafyan@gmail.com). Copyright (C) 2009-2010. Simplified BSD License.
+SET (CMAKE_SYSTEM_NAME Generic)
+SET (CMAKE_SYSTEM_VERSION 1)
+SET (CMAKE_SYSTEM_PROCESSOR arm)
+SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)
+
+SET (DEVROOT "/Developer/Platforms/iPhoneOS.platform/Developer")
+SET (SDKROOT "${DEVROOT}/SDKs/iPhoneOS${SDKVER}.sdk")
+SET (CMAKE_OSX_SYSROOT "${SDKROOT}")
+SET (CMAKE_OSX_ARCHITECTURES "armv6" "armv7")
+
+SET (CMAKE_C_COMPILER "${DEVROOT}/usr/bin/gcc-4.2")
+SET (CMAKE_CXX_COMPILER "${DEVROOT}/usr/bin/g++-4.2")
+
+SET (CMAKE_C_COMPILER "${DEVROOT}/usr/bin/gcc-4.2")
+SET (CMAKE_CXX_COMPILER "${DEVROOT}/usr/bin/g++-4.2")
+
+SET (CMAKE_C_FLAGS "-std=c99" "-x objective-c")
+SET (CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS} "-DDEBUG=1" "-ggdb")
+SET (CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS} "-DNDEBUG=1")
+SET (CMAKE_C_FLAGS_RELWITHDEBINFO ${CMAKE_C_FLAGS} "-DNDEBUG=1" "-ggdb")
+
+SET (CMAKE_CXX_FLAGS "-x objective-c++")
+SET (CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS} "-DDEBUG=1" "-ggdb")
+SET (CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS} "-DNDEBUG=1")
+SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS} "-DNDEBUG=1" "-ggdb")
+
+ADD_DEFINITIONS("-arch armv6")
+ADD_DEFINITIONS("-arch armv7")
+ADD_DEFINITIONS("-pipe")
+ADD_DEFINITIONS("-no-cpp-precomp")
+ADD_DEFINITIONS("--sysroot=${SDKROOT}")
+ADD_DEFINITIONS("-miphoneos-version-min=${SDKVER}")
+
+INCLUDE_DIRECTORIES(SYSTEM "${SDKROOT}/usr/include")
+INCLUDE_DIRECTORIES(SYSTEM "${SDKROOT}/opt/iphone-${SDKVER}/include")
+INCLUDE_DIRECTORIES(SYSTEM "${SDKROOT}/usr/local/iphone-${SDKVER}/include")
+
+LINK_DIRECTORIES("${SDKROOT}/usr/lib")
+LINK_DIRECTORIES("${SDKROOT}/opt/iphone-${SDKVER}/lib")
+LINK_DIRECTORIES("${SDKROOT}/usr/local/iphone-${SDKVER}/lib")
+
+SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${SDKROOT}/opt/iphone-${SDKVER}/" "${SDKROOT}/usr/local/iphone-${SDKVER}/")
+SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
+SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+
+SET (iPhone 1)
+SET (iPhoneOS 1)
+SET (iPhoneOS_VERSION ${SDKVER})
+
+# The iPhone does not support shared libraries
+SET (BUILD_SHARED_LIBS OFF)
View
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+cmake . -DBUILD_SHARED_LIBS=YES "$@"
View
@@ -0,0 +1,23 @@
+#! /bin/bash
+unset CPATH
+unset C_INCLUDE_PATH
+unset CPLUS_INCLUDE_PATH
+unset OBJC_INCLUDE_PATH
+unset LIBS
+unset DYLD_FALLBACK_LIBRARY_PATH
+unset DYLD_FALLBACK_FRAMEWORK_PATH
+
+if [ $# -lt 1 ]; then
+ echo "Usage: $0 sdk_version"
+ exit 1
+fi
+
+export SDKVER=$1
+shift
+
+export DEVROOT="/Developer/Platforms/iPhoneOS.platform/Developer"
+export SDKROOT="$DEVROOT/SDKs/iPhoneOS$SDKVER.sdk"
+export PKG_CONFIG_PATH="$SDKROOT/usr/lib/pkgconfig":"$SDKROOT/opt/iphone-$SDKVER/lib/pkgconfig":"$SDKROOT/usr/local/iphone-$SDKVER/lib/pkgconfig"
+export PKG_CONFIG_LIBDIR="$PKG_CONFIG_PATH"
+
+cmake . -DSDKVER=$SDKVER -DCMAKE_TOOLCHAIN_FILE="cmake-toolchains/iphone.toolchain" -DCMAKE_INSTALL_PREFIX="/opt/iphone-$SDKVER" "$@"
View
@@ -0,0 +1,24 @@
+#! /bin/bash
+unset CPATH
+unset C_INCLUDE_PATH
+unset CPLUS_INCLUDE_PATH
+unset OBJC_INCLUDE_PATH
+unset LIBS
+unset DYLD_FALLBACK_LIBRARY_PATH
+unset DYLD_FALLBACK_FRAMEWORK_PATH
+
+if [ $# -lt 1 ]; then
+ echo "Usage: $0 sdk_version"
+ exit 1
+fi
+
+export SDKVER=$1
+shift
+
+export DEVROOT="/Developer/Platforms/iPhoneSimulator.platform/Developer"
+export SDKROOT="$DEVROOT/SDKs/iPhoneSimulator$SDKVER.sdk"
+export PKG_CONFIG_PATH="$SDKROOT/usr/lib/pkgconfig":"$SDKROOT/opt/iphone-simulator-$SDKVER/lib/pkgconfig":"$SDKROOT/usr/local/iphone-simulator-$SDKVER/lib/pkgconfig"
+export PKG_CONFIG_LIBDIR="$PKG_CONFIG_PATH"
+
+cmake . -DSDKVER=$SDKVER -DCMAKE_TOOLCHAIN_FILE="cmake-toolchains/iphone-simulator.toolchain" -DCMAKE_INSTALL_PREFIX="/opt/iphone-simulator-$SDKVER" "$@"
+
Oops, something went wrong.

0 comments on commit 42057b8

Please sign in to comment.