From a8401ba377c8f3c659428ceb30c2ab9e5fb41706 Mon Sep 17 00:00:00 2001 From: Frederik Aalund Date: Fri, 14 Mar 2014 14:17:34 +0100 Subject: [PATCH 01/11] Added support for heterogenous metadata on the aiNodes. --- code/FBXConverter.cpp | 41 +++------ code/IFCLoader.cpp | 14 ++- include/assimp/metadata.h | 174 ++++++++++++++++++++++++++++++++++---- 3 files changed, 174 insertions(+), 55 deletions(-) diff --git a/code/FBXConverter.cpp b/code/FBXConverter.cpp index 1ac05aa17..b0f4bf823 100644 --- a/code/FBXConverter.cpp +++ b/code/FBXConverter.cpp @@ -760,48 +760,33 @@ private: aiMetadata* data = new aiMetadata(); data->mNumProperties = unparsedProperties.size() + numStaticMetaData; data->mKeys = new aiString[data->mNumProperties](); - data->mValues = new aiString[data->mNumProperties](); + data->mValues = new aiMetaDataEntry[data->mNumProperties](); nd.mMetaData = data; int index = 0; // find user defined properties (3ds Max) - data->mKeys[index].Set("UserProperties"); - data->mValues[index].Set(PropertyGet(props, "UDP3DSMAX", "")); - ++index; - + data->Set(index++, "UserProperties", aiString(PropertyGet(props, "UDP3DSMAX", ""))); // preserve the info that a node was marked as Null node in the original file. - data->mKeys[index].Set("IsNull"); - data->mValues[index].Set(model.IsNull() ? "true" : "false"); - ++index; + data->Set(index++, "IsNull", model.IsNull() ? true : false); // add unparsed properties to the node's metadata BOOST_FOREACH(const DirectPropertyMap::value_type& prop, unparsedProperties) { - // all values are converted to strings using the following stringstream - std::stringstream ss; - bool parse_succeeded = false; - // Interpret the property as a concrete type - if (const TypedProperty* interpreted = prop.second->As >()) - ss << interpreted->Value(); - else if (const TypedProperty* interpreted = prop.second->As >()) - ss << interpreted->Value(); + if (const TypedProperty* interpreted = prop.second->As >()) + data->Set(index++, prop.first, interpreted->Value()); else if (const TypedProperty* interpreted = prop.second->As >()) - ss << interpreted->Value(); + data->Set(index++, prop.first, interpreted->Value()); else if (const TypedProperty* interpreted = prop.second->As >()) - ss << interpreted->Value(); + data->Set(index++, prop.first, interpreted->Value()); else if (const TypedProperty* interpreted = prop.second->As >()) - ss << interpreted->Value(); + data->Set(index++, prop.first, interpreted->Value()); + else if (const TypedProperty* interpreted = prop.second->As >()) + data->Set(index++, prop.first, interpreted->Value()); else if (const TypedProperty* interpreted = prop.second->As >()) - { - aiVector3D v = interpreted->Value(); - ss << v.x << ";" << v.y << ";" << v.z; - } - - // add property to meta data - data->mKeys[index].Set(prop.first); - data->mValues[index].Set(ss.str()); - ++index; + data->Set(index++, prop.first, interpreted->Value()); + else + assert(false); } } diff --git a/code/IFCLoader.cpp b/code/IFCLoader.cpp index 4c8feeab1..a00f2c9e7 100644 --- a/code/IFCLoader.cpp +++ b/code/IFCLoader.cpp @@ -726,16 +726,12 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion aiMetadata* data = new aiMetadata(); data->mNumProperties = properties.size(); data->mKeys = new aiString[data->mNumProperties](); - data->mValues = new aiString[data->mNumProperties](); + data->mValues = new aiMetaDataEntry[data->mNumProperties](); + + unsigned int index = 0; + BOOST_FOREACH(const Metadata::value_type& kv, properties) + data->Set(index++, kv.first, aiString(kv.second)); - unsigned int i = 0; - BOOST_FOREACH(const Metadata::value_type& kv, properties) { - data->mKeys[i].Set(kv.first); - if (kv.second.length() > 0) { - data->mValues[i].Set(kv.second); - } - ++i; - } nd->mMetaData = data; } } diff --git a/include/assimp/metadata.h b/include/assimp/metadata.h index 942029ae6..6d52f59dd 100644 --- a/include/assimp/metadata.h +++ b/include/assimp/metadata.h @@ -45,10 +45,116 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef __AI_METADATA_H_INC__ #define __AI_METADATA_H_INC__ +#include + + + +// ------------------------------------------------------------------------------- +/** + * Enum used to distinguish data types + */ + // ------------------------------------------------------------------------------- +enum aiType +{ + AI_BOOL = 0, + AI_INT = 1, + AI_UINT64 = 2, + AI_FLOAT = 3, + AI_AISTRING = 4, + AI_AIVECTOR3D = 5, + + FORCE_32BIT = INT_MAX +}; + + + +// ------------------------------------------------------------------------------- +/** + * Metadata entry + * + * The type field uniquely identifies the underlying type of the data field + */ + // ------------------------------------------------------------------------------- +struct aiMetaDataEntry +{ + aiType type; + void* data; +}; + + + #ifdef __cplusplus -extern "C" { + +// ------------------------------------------------------------------------------- +/** + * Helper functions to get the aiType enum entry for a type + */ + // ------------------------------------------------------------------------------- +inline aiType GetAiType( bool ) { return aiType::AI_BOOL; } +inline aiType GetAiType( int ) { return aiType::AI_INT; } +inline aiType GetAiType( uint64_t ) { return aiType::AI_UINT64; } +inline aiType GetAiType( float ) { return aiType::AI_FLOAT; } +inline aiType GetAiType( aiString ) { return aiType::AI_AISTRING; } +inline aiType GetAiType( aiVector3D ) { return aiType::AI_AIVECTOR3D; } + + + +// ------------------------------------------------------------------------------- +/** + * Transform + * + * Applies the callable, c, to the given data of the given type. + * The callable, c, is expected to have the following interface + * + * c( T* data ) + * + * where T can be any type with a corresponding entry in the aiType enum. + */ + // ------------------------------------------------------------------------------- +template +inline void transform( aiType type, void* data, callable c ) +{ + switch (type) + { + case aiType::AI_BOOL: + callable(static_cast(data)); + break; + case aiType::AI_INT: + callable(static_cast(data)); + break; + case aiType::AI_UINT64: + callable(static_cast(data)); + break; + case aiType::AI_FLOAT: + callable(static_cast(data)); + break; + case aiType::AI_AISTRING: + callable(static_cast(data)); + break; + case aiType::AI_AIVECTOR3D: + callable(static_cast(data)); + break; + default: + assert(false); + break; + } +} + +// ------------------------------------------------------------------------------- +/** + * Transform. + * + * This is a convenience overload for aiMetaDataEntry's. + */ + // ------------------------------------------------------------------------------- +template +inline void transform( aiMetaDataEntry entry, callable c ) +{ transform(entry.type, entry.data, c); } + #endif + + // ------------------------------------------------------------------------------- /** * Container for holding metadata. @@ -66,18 +172,17 @@ struct aiMetadata /** Arrays of values, may not be NULL. Entries in this array may be NULL if the * corresponding property key has no assigned value. */ - C_STRUCT aiString* mValues; + C_STRUCT aiMetaDataEntry* mValues; #ifdef __cplusplus /** Constructor */ aiMetadata() - { // set all members to zero by default - mKeys = NULL; - mValues = NULL; - mNumProperties = 0; - } + : mKeys(NULL) + , mValues(NULL) + , mNumProperties(0) + {} /** Destructor */ @@ -86,27 +191,60 @@ struct aiMetadata if (mKeys) delete [] mKeys; if (mValues) + { + // Delete each metadata entry + for (unsigned i=0; i + inline void Set( unsigned index, const std::string& key, const T& value ) { - for (unsigned i=0; i + inline bool Get( unsigned index, T& value ) + { + // Return false if the output data type does + // not match the found value's data type + if (GetAiType(value) != mValues[index].type) + return false; + + // Otherwise, output the found value and + // return true + value = *static_cast(mValues[index].data); + return true; + } + + template + inline bool Get( const aiString& key, T& value ) + { + // Search for the given key + for (unsigned i=0; i Date: Fri, 14 Mar 2014 15:01:36 +0100 Subject: [PATCH 02/11] Fixed a compile error involving unnecessary enum resolution qualification. --- include/assimp/metadata.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/include/assimp/metadata.h b/include/assimp/metadata.h index 6d52f59dd..d14a987dc 100644 --- a/include/assimp/metadata.h +++ b/include/assimp/metadata.h @@ -90,12 +90,12 @@ struct aiMetaDataEntry * Helper functions to get the aiType enum entry for a type */ // ------------------------------------------------------------------------------- -inline aiType GetAiType( bool ) { return aiType::AI_BOOL; } -inline aiType GetAiType( int ) { return aiType::AI_INT; } -inline aiType GetAiType( uint64_t ) { return aiType::AI_UINT64; } -inline aiType GetAiType( float ) { return aiType::AI_FLOAT; } -inline aiType GetAiType( aiString ) { return aiType::AI_AISTRING; } -inline aiType GetAiType( aiVector3D ) { return aiType::AI_AIVECTOR3D; } +inline aiType GetAiType( bool ) { return AI_BOOL; } +inline aiType GetAiType( int ) { return AI_INT; } +inline aiType GetAiType( uint64_t ) { return AI_UINT64; } +inline aiType GetAiType( float ) { return AI_FLOAT; } +inline aiType GetAiType( aiString ) { return AI_AISTRING; } +inline aiType GetAiType( aiVector3D ) { return AI_AIVECTOR3D; } @@ -116,22 +116,22 @@ inline void transform( aiType type, void* data, callable c ) { switch (type) { - case aiType::AI_BOOL: + case AI_BOOL: callable(static_cast(data)); break; - case aiType::AI_INT: + case AI_INT: callable(static_cast(data)); break; - case aiType::AI_UINT64: + case AI_UINT64: callable(static_cast(data)); break; - case aiType::AI_FLOAT: + case AI_FLOAT: callable(static_cast(data)); break; - case aiType::AI_AISTRING: + case AI_AISTRING: callable(static_cast(data)); break; - case aiType::AI_AIVECTOR3D: + case AI_AIVECTOR3D: callable(static_cast(data)); break; default: From 56f37a04650df80d4633bbf8f5f3374277524fd2 Mon Sep 17 00:00:00 2001 From: Frederik Aalund Date: Fri, 14 Mar 2014 15:36:12 +0100 Subject: [PATCH 03/11] Deprecated some abstraction and fixed a memory leak. --- include/assimp/metadata.h | 86 ++++++++++++++------------------------- 1 file changed, 31 insertions(+), 55 deletions(-) diff --git a/include/assimp/metadata.h b/include/assimp/metadata.h index d14a987dc..69d0b8067 100644 --- a/include/assimp/metadata.h +++ b/include/assimp/metadata.h @@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef __AI_METADATA_H_INC__ #define __AI_METADATA_H_INC__ +#include #include @@ -99,58 +100,6 @@ inline aiType GetAiType( aiVector3D ) { return AI_AIVECTOR3D; } -// ------------------------------------------------------------------------------- -/** - * Transform - * - * Applies the callable, c, to the given data of the given type. - * The callable, c, is expected to have the following interface - * - * c( T* data ) - * - * where T can be any type with a corresponding entry in the aiType enum. - */ - // ------------------------------------------------------------------------------- -template -inline void transform( aiType type, void* data, callable c ) -{ - switch (type) - { - case AI_BOOL: - callable(static_cast(data)); - break; - case AI_INT: - callable(static_cast(data)); - break; - case AI_UINT64: - callable(static_cast(data)); - break; - case AI_FLOAT: - callable(static_cast(data)); - break; - case AI_AISTRING: - callable(static_cast(data)); - break; - case AI_AIVECTOR3D: - callable(static_cast(data)); - break; - default: - assert(false); - break; - } -} - -// ------------------------------------------------------------------------------- -/** - * Transform. - * - * This is a convenience overload for aiMetaDataEntry's. - */ - // ------------------------------------------------------------------------------- -template -inline void transform( aiMetaDataEntry entry, callable c ) -{ transform(entry.type, entry.data, c); } - #endif @@ -179,9 +128,9 @@ struct aiMetadata /** Constructor */ aiMetadata() // set all members to zero by default - : mKeys(NULL) + : mNumProperties(0) + , mKeys(NULL) , mValues(NULL) - , mNumProperties(0) {} @@ -194,7 +143,34 @@ struct aiMetadata { // Delete each metadata entry for (unsigned i=0; i(data); + break; + case AI_INT: + delete static_cast(data); + break; + case AI_UINT64: + delete static_cast(data); + break; + case AI_FLOAT: + delete static_cast(data); + break; + case AI_AISTRING: + delete static_cast(data); + break; + case AI_AIVECTOR3D: + delete static_cast(data); + break; + default: + assert(false); + break; + } + } + // Delete the metadata array delete [] mValues; } From 9b78a180d9632e4bbb189e099fc1be402004c570 Mon Sep 17 00:00:00 2001 From: Frederik Aalund Date: Fri, 14 Mar 2014 17:12:22 +0100 Subject: [PATCH 04/11] Added a convenience overload for aiMetadata::Get using std::string as key. --- include/assimp/metadata.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/assimp/metadata.h b/include/assimp/metadata.h index 69d0b8067..5bbc38bd4 100644 --- a/include/assimp/metadata.h +++ b/include/assimp/metadata.h @@ -86,6 +86,10 @@ struct aiMetaDataEntry #ifdef __cplusplus +#include + + + // ------------------------------------------------------------------------------- /** * Helper functions to get the aiType enum entry for a type @@ -218,6 +222,10 @@ struct aiMetadata return false; } + template + inline bool Get( const std::string& key, T& value ) + { return Get(aiString(key), value); } + #endif // __cplusplus }; From 595529ef8bc6fe20e7b708f2e09e4b81d1f6d31e Mon Sep 17 00:00:00 2001 From: Frederik Aalund Date: Sat, 15 Mar 2014 08:37:45 +0100 Subject: [PATCH 05/11] Refactored the metadata for inner consistency. --- code/FBXConverter.cpp | 2 +- code/IFCLoader.cpp | 2 +- include/assimp/metadata.h | 37 ++++++++++++++++++++----------------- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/code/FBXConverter.cpp b/code/FBXConverter.cpp index b0f4bf823..d08dc3dce 100644 --- a/code/FBXConverter.cpp +++ b/code/FBXConverter.cpp @@ -760,7 +760,7 @@ private: aiMetadata* data = new aiMetadata(); data->mNumProperties = unparsedProperties.size() + numStaticMetaData; data->mKeys = new aiString[data->mNumProperties](); - data->mValues = new aiMetaDataEntry[data->mNumProperties](); + data->mValues = new aiMetadataEntry[data->mNumProperties](); nd.mMetaData = data; int index = 0; diff --git a/code/IFCLoader.cpp b/code/IFCLoader.cpp index a00f2c9e7..9a5f79a5a 100644 --- a/code/IFCLoader.cpp +++ b/code/IFCLoader.cpp @@ -726,7 +726,7 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion aiMetadata* data = new aiMetadata(); data->mNumProperties = properties.size(); data->mKeys = new aiString[data->mNumProperties](); - data->mValues = new aiMetaDataEntry[data->mNumProperties](); + data->mValues = new aiMetadataEntry[data->mNumProperties](); unsigned int index = 0; BOOST_FOREACH(const Metadata::value_type& kv, properties) diff --git a/include/assimp/metadata.h b/include/assimp/metadata.h index 5bbc38bd4..f69f73ae2 100644 --- a/include/assimp/metadata.h +++ b/include/assimp/metadata.h @@ -55,7 +55,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * Enum used to distinguish data types */ // ------------------------------------------------------------------------------- -enum aiType +enum aiMetadataType { AI_BOOL = 0, AI_INT = 1, @@ -76,10 +76,10 @@ enum aiType * The type field uniquely identifies the underlying type of the data field */ // ------------------------------------------------------------------------------- -struct aiMetaDataEntry +struct aiMetadataEntry { - aiType type; - void* data; + aiMetadataType mType; + void* mData; }; @@ -95,12 +95,12 @@ struct aiMetaDataEntry * Helper functions to get the aiType enum entry for a type */ // ------------------------------------------------------------------------------- -inline aiType GetAiType( bool ) { return AI_BOOL; } -inline aiType GetAiType( int ) { return AI_INT; } -inline aiType GetAiType( uint64_t ) { return AI_UINT64; } -inline aiType GetAiType( float ) { return AI_FLOAT; } -inline aiType GetAiType( aiString ) { return AI_AISTRING; } -inline aiType GetAiType( aiVector3D ) { return AI_AIVECTOR3D; } +inline aiMetadataType GetAiType( bool ) { return AI_BOOL; } +inline aiMetadataType GetAiType( int ) { return AI_INT; } +inline aiMetadataType GetAiType( uint64_t ) { return AI_UINT64; } +inline aiMetadataType GetAiType( float ) { return AI_FLOAT; } +inline aiMetadataType GetAiType( aiString ) { return AI_AISTRING; } +inline aiMetadataType GetAiType( aiVector3D ) { return AI_AIVECTOR3D; } @@ -125,7 +125,7 @@ struct aiMetadata /** Arrays of values, may not be NULL. Entries in this array may be NULL if the * corresponding property key has no assigned value. */ - C_STRUCT aiMetaDataEntry* mValues; + C_STRUCT aiMetadataEntry* mValues; #ifdef __cplusplus @@ -148,8 +148,8 @@ struct aiMetadata // Delete each metadata entry for (unsigned i=0; i(data); @@ -193,22 +193,25 @@ struct aiMetadata mKeys[index] = key; // Set metadata type - mValues[index].type = GetAiType(value); + mValues[index].mType = GetAiType(value); // Copy the given value to the dynamic storage - mValues[index].data = new T(value); + mValues[index].mData = new T(value); } template inline bool Get( unsigned index, T& value ) { + // In range assertion + assert(index < mNumProperties); + // Return false if the output data type does // not match the found value's data type - if (GetAiType(value) != mValues[index].type) + if (GetAiType(value) != mValues[index].mType) return false; // Otherwise, output the found value and // return true - value = *static_cast(mValues[index].data); + value = *static_cast(mValues[index].mData); return true; } From 9f4623bec74727bf51ae23dd783008ee6777edc4 Mon Sep 17 00:00:00 2001 From: shaded enmity Date: Thu, 20 Mar 2014 16:21:28 -0700 Subject: [PATCH 06/11] iOS Toolchain Update Signed-off-by: shaded enmity --- port/iOS/IPHONEOS_ARM64_TOOLCHAIN.cmake | 19 ++++ port/iOS/IPHONEOS_ARMV6_TOOLCHAIN.cmake | 19 ++++ port/iOS/IPHONEOS_ARMV7S_TOOLCHAIN.cmake | 19 ++++ port/iOS/IPHONEOS_ARMV7_TOOLCHAIN.cmake | 19 ++++ port/iOS/IPHONEOS_X86_64_TOOLCHAIN.cmake | 20 ++++ port/iOS/build.sh | 123 +++++++++++++++++++++++ 6 files changed, 219 insertions(+) create mode 100644 port/iOS/IPHONEOS_ARM64_TOOLCHAIN.cmake create mode 100644 port/iOS/IPHONEOS_ARMV6_TOOLCHAIN.cmake create mode 100644 port/iOS/IPHONEOS_ARMV7S_TOOLCHAIN.cmake create mode 100644 port/iOS/IPHONEOS_ARMV7_TOOLCHAIN.cmake create mode 100644 port/iOS/IPHONEOS_X86_64_TOOLCHAIN.cmake create mode 100755 port/iOS/build.sh diff --git a/port/iOS/IPHONEOS_ARM64_TOOLCHAIN.cmake b/port/iOS/IPHONEOS_ARM64_TOOLCHAIN.cmake new file mode 100644 index 000000000..3cefaf9be --- /dev/null +++ b/port/iOS/IPHONEOS_ARM64_TOOLCHAIN.cmake @@ -0,0 +1,19 @@ +INCLUDE(CMakeForceCompiler) + +SET (CMAKE_CROSSCOMPILING TRUE) +SET (CMAKE_SYSTEM_NAME "Darwin") +SET (CMAKE_SYSTEM_PROCESSOR "arm64”) + +SET (SDKVER “7.1”) +SET (DEVROOT "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain") +SET (SDKROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDKVER}.sdk") +SET (CC "${DEVROOT}/usr/bin/llvm-gcc") +SET (CXX "${DEVROOT}/usr/bin/llvm-g++") + +CMAKE_FORCE_C_COMPILER (${CC} LLVM) +CMAKE_FORCE_CXX_COMPILER (${CXX} LLVM) + +SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}") +SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) \ No newline at end of file diff --git a/port/iOS/IPHONEOS_ARMV6_TOOLCHAIN.cmake b/port/iOS/IPHONEOS_ARMV6_TOOLCHAIN.cmake new file mode 100644 index 000000000..f72569f94 --- /dev/null +++ b/port/iOS/IPHONEOS_ARMV6_TOOLCHAIN.cmake @@ -0,0 +1,19 @@ +INCLUDE(CMakeForceCompiler) + +SET (CMAKE_CROSSCOMPILING TRUE) +SET (CMAKE_SYSTEM_NAME "Darwin") +SET (CMAKE_SYSTEM_PROCESSOR "armv6") + +SET (SDKVER “7.1”) +SET (DEVROOT "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain") +SET (SDKROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDKVER}.sdk") +SET (CC "${DEVROOT}/usr/bin/clang”) +SET (CXX "${DEVROOT}/usr/bin/clang++") + +CMAKE_FORCE_C_COMPILER (${CC} LLVM) +CMAKE_FORCE_CXX_COMPILER (${CXX} LLVM) + +SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}") +SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) \ No newline at end of file diff --git a/port/iOS/IPHONEOS_ARMV7S_TOOLCHAIN.cmake b/port/iOS/IPHONEOS_ARMV7S_TOOLCHAIN.cmake new file mode 100644 index 000000000..dcf39e644 --- /dev/null +++ b/port/iOS/IPHONEOS_ARMV7S_TOOLCHAIN.cmake @@ -0,0 +1,19 @@ +INCLUDE(CMakeForceCompiler) + +SET (CMAKE_CROSSCOMPILING TRUE) +SET (CMAKE_SYSTEM_NAME "Darwin") +SET (CMAKE_SYSTEM_PROCESSOR "armv7s”) + +SET (SDKVER “7.1”) +SET (DEVROOT "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain") +SET (SDKROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDKVER}.sdk") +SET (CC "${DEVROOT}/usr/bin/clang”) +SET (CXX "${DEVROOT}/usr/bin/clang++") + +CMAKE_FORCE_C_COMPILER (${CC} LLVM) +CMAKE_FORCE_CXX_COMPILER (${CXX} LLVM) + +SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}") +SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) \ No newline at end of file diff --git a/port/iOS/IPHONEOS_ARMV7_TOOLCHAIN.cmake b/port/iOS/IPHONEOS_ARMV7_TOOLCHAIN.cmake new file mode 100644 index 000000000..06aa24a00 --- /dev/null +++ b/port/iOS/IPHONEOS_ARMV7_TOOLCHAIN.cmake @@ -0,0 +1,19 @@ +INCLUDE(CMakeForceCompiler) + +SET (CMAKE_CROSSCOMPILING TRUE) +SET (CMAKE_SYSTEM_NAME "Darwin") +SET (CMAKE_SYSTEM_PROCESSOR "armv7") + +SET (SDKVER “7.1”) +SET (DEVROOT "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain") +SET (SDKROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDKVER}.sdk") +SET (CC "${DEVROOT}/usr/bin/clang”) +SET (CXX "${DEVROOT}/usr/bin/clang++") + +CMAKE_FORCE_C_COMPILER (${CC} LLVM) +CMAKE_FORCE_CXX_COMPILER (${CXX} LLVM) + +SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}") +SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) \ No newline at end of file diff --git a/port/iOS/IPHONEOS_X86_64_TOOLCHAIN.cmake b/port/iOS/IPHONEOS_X86_64_TOOLCHAIN.cmake new file mode 100644 index 000000000..7e82d4db6 --- /dev/null +++ b/port/iOS/IPHONEOS_X86_64_TOOLCHAIN.cmake @@ -0,0 +1,20 @@ +INCLUDE(CMakeForceCompiler) + +SET (CMAKE_CROSSCOMPILING TRUE) +SET (CMAKE_SYSTEM_NAME "Darwin") +SET (CMAKE_SYSTEM_PROCESSOR “x86_64”) + +SET (SDKVER “7.1”) + +SET (DEVROOT "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain") +SET (SDKROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneSimulator ${SDKVER}.sdk") +SET (CC "${DEVROOT}/usr/bin/clang”) +SET (CXX "${DEVROOT}/usr/bin/clang++") + +CMAKE_FORCE_C_COMPILER (${CC} LLVM) +CMAKE_FORCE_CXX_COMPILER (${CXX} LLVM) + +SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}") +SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) \ No newline at end of file diff --git a/port/iOS/build.sh b/port/iOS/build.sh new file mode 100755 index 000000000..39e77c4f2 --- /dev/null +++ b/port/iOS/build.sh @@ -0,0 +1,123 @@ +#!/bin/bash + +####################### +# BUILD ASSIMP for iOS and iOS Simulator +####################### + +BUILD_DIR="./lib/iOS" + +IOS_SDK_VERSION=7.1 +IOS_SDK_TARGET=6.0 +#(iPhoneOS iPhoneSimulator) -- determined from arch +IOS_SDK_DEVICE= + +XCODE_ROOT_DIR=/Applications/Xcode.app/Contents + +BUILD_ARCHS_DEVICE="armv7 armv7s arm64" +BUILD_ARCHS_SIMULATOR="i386 x86_64" +BUILD_ARCHS_ALL=(armv7 armv7s arm64 i386 x86_64) + +CPP_DEV_TARGET_LIST=(miphoneos-version-min mios-simulator-version-min) +CPP_DEV_TARGET= +CPP_STD_LIB_LIST=(libc++ libstdc++) +CPP_STD_LIB= + +function join { local IFS="$1"; shift; echo "$*"; } + +build_arch() +{ + IOS_SDK_DEVICE=iPhoneOS + CPP_DEV_TARGET=${CPP_DEV_TARGET_LIST[0]} + + if [[ "$BUILD_ARCHS_SIMULATOR" =~ "$1" ]] + then + echo '[!] Target SDK set to SIMULATOR.' + IOS_SDK_DEVICE=iPhoneSimulator + CPP_DEV_TARGET=${CPP_DEV_TARGET_LIST[1]} + else + echo '[!] Target SDK set to DEVICE.' + fi + + unset DEVROOT SDKROOT CFLAGS CC LD CPP CXX AR AS NM CXXCPP RANLIB LDFLAGS CPPFLAGS CXXFLAGS + + export TOOLCHAIN=$XCODE_ROOT_DIR//Developer/Toolchains/XcodeDefault.xctoolchain + export DEVROOT=$XCODE_ROOT_DIR/Developer/Platforms/$IOS_SDK_DEVICE.platform/Developer + export SDKROOT=$DEVROOT/SDKs/$IOS_SDK_DEVICE$IOS_SDK_VERSION.sdk + export CFLAGS="-arch $1 -pipe -no-cpp-precomp -stdlib=$CPP_STD_LIB -isysroot $SDKROOT -$CPP_DEV_TARGET=$IOS_SDK_TARGET -I$SDKROOT/usr/include/" + export CPP="$TOOLCHAIN/usr/bin/clang++" + export CXX="$TOOLCHAIN/usr/bin/clang++" + export CXXCPP="$TOOLCHAIN/usr/bin/clang++" + export CC="$TOOLCHAIN/usr/bin/clang" + export LD=$TOOLCHAIN/usr/bin/ld + export AR=$TOOLCHAIN/usr/bin/ar + export AS=$TOOLCHAIN/usr/bin/as + export NM=$TOOLCHAIN/usr/bin/nm + export RANLIB=$TOOLCHAIN/usr/bin/ranlib + export LDFLAGS="-L$SDKROOT/usr/lib/" + export CPPFLAGS=$CFLAGS + export CXXFLAGS=$CFLAGS + + rm CMakeCache.txt + + cmake -G 'Unix Makefiles' -DCMAKE_TOOLCHAIN_FILE=./port/iOS/IPHONEOS_$(echo $1 | tr '[:lower:]' '[:upper:]')_TOOLCHAIN.cmake -DENABLE_BOOST_WORKAROUND=ON -DASSIMP_BUILD_STATIC_LIB=ON + + echo "[!] Building $1 library" + + $XCODE_ROOT_DIR/Developer/usr/bin/make clean + $XCODE_ROOT_DIR/Developer/usr/bin/make assimp -j 8 -l + + echo "[!] Moving built library into: $BUILD_DIR/$1/" + + mv ./lib/libassimp.a $BUILD_DIR/$1/ +} + +echo "[!] $0 - assimp iOS build script" + +CPP_STD_LIB=${CPP_STD_LIB_LIST[0]} +DEPLOY_ARCHS=${BUILD_ARCHS_ALL[*]} +DEPLOY_FAT=1 + +for i in "$@"; do + case $i in + -l=*|--stdlib=*) + CPP_STD_LIB=`echo $i | sed 's/[-a-zA-Z0-9]*=//'` + echo "[!] Selecting c++ std lib: $DEPLOY_STD" + ;; + -a=*|--archs=*) + DEPLOY_ARCHS=`echo $i | sed 's/[-a-zA-Z0-9]*=//'` + echo "[!] Selecting architectures: $DEPLOY_ARCHS" + ;; + -n|--no-fat) + DEPLOY_FAT=0 + echo "[!] Fat binary will not be created." + ;; + -h|--help) + echo " - supported architectures: $(echo $(join , ${BUILD_ARCHS_ALL[*]}) | sed 's/,/, /g')" + echo " - supported C++ STD libs.: $(echo $(join , ${CPP_STD_LIB_LIST[*]}) | sed 's/,/, /g')" + exit + ;; + *) + ;; + esac +done + +cd ../../ +rm -rf $BUILD_DIR + +for ARCH_TARGET in $DEPLOY_ARCHS; do + mkdir -p $BUILD_DIR/$ARCH_TARGET + build_arch $ARCH_TARGET + #rm ./lib/libassimp.a +done + +if [[ "$DEPLOY_FAT" -eq 1 ]]; then + echo ' creating fat binary ...' + for ARCH_TARGET in $DEPLOY_ARCHS; do + LIPO_ARGS="$LIPO_ARGS-arch $ARCH_TARGET $BUILD_DIR/$ARCH_TARGET/libassimp.a " + done + LIPO_ARGS="$LIPO_ARGS-create -output $BUILD_DIR/libassimp-fat.a" + lipo $LIPO_ARGS + echo "Done! You will find the libaries and fat binary library in $BUILD_DIR" +fi + + From 2dc5a46e996f9f8953951fea11a42fca83fce05d Mon Sep 17 00:00:00 2001 From: shaded enmity Date: Thu, 20 Mar 2014 16:25:07 -0700 Subject: [PATCH 07/11] Zombie Removal Signed-off-by: shaded enmity --- port/iOS/IPHONEOS_ARM6_TOOLCHAIN.cmake | 19 ----- port/iOS/IPHONEOS_ARM7_TOOLCHAIN.cmake | 19 ----- port/iOS/IPHONEOS_i386_TOOLCHAIN.cmake | 19 ----- port/iOS/README.txt | 13 ---- port/iOS/build_ios.sh | 104 ------------------------- 5 files changed, 174 deletions(-) delete mode 100644 port/iOS/IPHONEOS_ARM6_TOOLCHAIN.cmake delete mode 100644 port/iOS/IPHONEOS_ARM7_TOOLCHAIN.cmake delete mode 100644 port/iOS/IPHONEOS_i386_TOOLCHAIN.cmake delete mode 100644 port/iOS/README.txt delete mode 100755 port/iOS/build_ios.sh diff --git a/port/iOS/IPHONEOS_ARM6_TOOLCHAIN.cmake b/port/iOS/IPHONEOS_ARM6_TOOLCHAIN.cmake deleted file mode 100644 index 0d443b798..000000000 --- a/port/iOS/IPHONEOS_ARM6_TOOLCHAIN.cmake +++ /dev/null @@ -1,19 +0,0 @@ -INCLUDE(CMakeForceCompiler) - -SET (CMAKE_CROSSCOMPILING TRUE) -SET (CMAKE_SYSTEM_NAME "Darwin") -SET (CMAKE_SYSTEM_PROCESSOR "armv6") - -SET (SDKVER "5.0") -SET (DEVROOT "/Developer/Platforms/iPhoneOS.platform/Developer") -SET (SDKROOT "/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDKVER}.sdk") -SET (CC "${DEVROOT}/usr/bin/llvm-gcc") -SET (CXX "${DEVROOT}/usr/bin/llvm-g++") - -CMAKE_FORCE_C_COMPILER (${CC} LLVM) -CMAKE_FORCE_CXX_COMPILER (${CXX} LLVM) - -SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}") -SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) \ No newline at end of file diff --git a/port/iOS/IPHONEOS_ARM7_TOOLCHAIN.cmake b/port/iOS/IPHONEOS_ARM7_TOOLCHAIN.cmake deleted file mode 100644 index 211ee71d4..000000000 --- a/port/iOS/IPHONEOS_ARM7_TOOLCHAIN.cmake +++ /dev/null @@ -1,19 +0,0 @@ -INCLUDE(CMakeForceCompiler) - -SET (CMAKE_CROSSCOMPILING TRUE) -SET (CMAKE_SYSTEM_NAME "Darwin") -SET (CMAKE_SYSTEM_PROCESSOR "armv7") - -SET (SDKVER "5.0") -SET (DEVROOT "/Developer/Platforms/iPhoneOS.platform/Developer") -SET (SDKROOT "/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDKVER}.sdk") -SET (CC "${DEVROOT}/usr/bin/llvm-gcc") -SET (CXX "${DEVROOT}/usr/bin/llvm-g++") - -CMAKE_FORCE_C_COMPILER (${CC} LLVM) -CMAKE_FORCE_CXX_COMPILER (${CXX} LLVM) - -SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}") -SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) \ No newline at end of file diff --git a/port/iOS/IPHONEOS_i386_TOOLCHAIN.cmake b/port/iOS/IPHONEOS_i386_TOOLCHAIN.cmake deleted file mode 100644 index 375d64074..000000000 --- a/port/iOS/IPHONEOS_i386_TOOLCHAIN.cmake +++ /dev/null @@ -1,19 +0,0 @@ -INCLUDE(CMakeForceCompiler) - -SET (CMAKE_CROSSCOMPILING TRUE) -SET (CMAKE_SYSTEM_NAME "Darwin") -SET (CMAKE_SYSTEM_PROCESSOR "i386") - -SET (SDKVER "5.0") -SET (DEVROOT "/Developer/Platforms/iPhoneOS.platform/Developer") -SET (SDKROOT "/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDKVER}.sdk") -SET (CC "${DEVROOT}/usr/bin/llvm-gcc") -SET (CXX "${DEVROOT}/usr/bin/llvm-g++") - -CMAKE_FORCE_C_COMPILER (${CC} LLVM) -CMAKE_FORCE_CXX_COMPILER (${CXX} LLVM) - -SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}") -SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) \ No newline at end of file diff --git a/port/iOS/README.txt b/port/iOS/README.txt deleted file mode 100644 index ce13faa05..000000000 --- a/port/iOS/README.txt +++ /dev/null @@ -1,13 +0,0 @@ -To build for iOS simply execute "./build_ios.sh" from this folder. Currently this script requires the latest SDK (5.0) from Apple in order to build properly. In the future I will add support for specifying the SDK version on the command line. - -Once the build is completed you will see a "ios" folder under /lib. This folder has sub folders for each of the following architectures: - -* armv6 (Older Devices) -* armv7 (New Devices) -* i386 (Simulator) - -Each of these folders contains a single static library for that architecture. In addition the libassimp.a file in the root of this folder is a combined archive (fat binary) library for all of the above architectures. - -This port is being maintained by Matt Mathias please contact him with any questions or comments. - - diff --git a/port/iOS/build_ios.sh b/port/iOS/build_ios.sh deleted file mode 100755 index 9c8cc363a..000000000 --- a/port/iOS/build_ios.sh +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/sh -# build.sh - -####################### -# BUILD ASSIMP for iOS and iOS Simulator -####################### - -BUILD_DIR="./lib/ios" - -IOS_BASE_SDK="5.0" -IOS_DEPLOY_TGT="3.2" - -setenv_all() -{ - # Add internal libs - export CFLAGS="$CFLAGS" - export CPP="$DEVROOT/usr/bin/llvm-cpp-4.2" - export CXX="$DEVROOT/usr/bin/llvm-g++-4.2" - export CXXCPP="$DEVROOT/usr/bin/llvm-cpp-4.2" - export CC="$DEVROOT/usr/bin/llvm-gcc-4.2" - export LD=$DEVROOT/usr/bin/ld - export AR=$DEVROOT/usr/bin/ar - export AS=$DEVROOT/usr/bin/as - export NM=$DEVROOT/usr/bin/nm - export RANLIB=$DEVROOT/usr/bin/ranlib - export LDFLAGS="-L$SDKROOT/usr/lib/" - - export CPPFLAGS=$CFLAGS - export CXXFLAGS=$CFLAGS -} - -setenv_arm6() -{ - unset DEVROOT SDKROOT CFLAGS CC LD CPP CXX AR AS NM CXXCPP RANLIB LDFLAGS CPPFLAGS CXXFLAGS - export DEVROOT=/Developer/Platforms/iPhoneOS.platform/Developer - export SDKROOT=$DEVROOT/SDKs/iPhoneOS$IOS_BASE_SDK.sdk - export CFLAGS="-arch armv6 -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min=$IOS_DEPLOY_TGT -I$SDKROOT/usr/include/" - setenv_all - rm CMakeCache.txt - cmake -G 'Unix Makefiles' -DCMAKE_TOOLCHAIN_FILE=./port/iOS/IPHONEOS_ARM6_TOOLCHAIN.cmake -DENABLE_BOOST_WORKAROUND=ON -DBUILD_STATIC_LIB=ON -} - -setenv_arm7() -{ - unset DEVROOT SDKROOT CFLAGS CC LD CPP CXX AR AS NM CXXCPP RANLIB LDFLAGS CPPFLAGS CXXFLAGS - export DEVROOT=/Developer/Platforms/iPhoneOS.platform/Developer - export SDKROOT=$DEVROOT/SDKs/iPhoneOS$IOS_BASE_SDK.sdk - export CFLAGS="-arch armv7 -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min=$IOS_DEPLOY_TGT -I$SDKROOT/usr/include/" - setenv_all - rm CMakeCache.txt - cmake -G 'Unix Makefiles' -DCMAKE_TOOLCHAIN_FILE=./port/iOS/IPHONEOS_ARM7_TOOLCHAIN.cmake -DENABLE_BOOST_WORKAROUND=ON -DBUILD_STATIC_LIB=ON -} - -setenv_i386() -{ - unset DEVROOT SDKROOT CFLAGS CC LD CPP CXX AR AS NM CXXCPP RANLIB LDFLAGS CPPFLAGS CXXFLAGS - export DEVROOT=/Developer/Platforms/iPhoneSimulator.platform/Developer - export SDKROOT=$DEVROOT/SDKs/iPhoneSimulator$IOS_BASE_SDK.sdk - export CFLAGS="-arch i386 -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min=$IOS_DEPLOY_TGT" - setenv_all - rm CMakeCache.txt - cmake -G 'Unix Makefiles' -DCMAKE_TOOLCHAIN_FILE=./port/iOS/IPHONEOS_i386_TOOLCHAIN.cmake -DENABLE_BOOST_WORKAROUND=ON -DBUILD_STATIC_LIB=ON -} - -create_outdir() -{ - for lib_i386 in `find $BUILD_DIR/i386 -name "lib*\.a"`; do - lib_arm6=`echo $lib_i386 | sed "s/i386/arm6/g"` - lib_arm7=`echo $lib_i386 | sed "s/i386/arm7/g"` - lib=`echo $lib_i386 | sed "s/i386\///g"` - echo 'Creating fat binary...' - lipo -arch armv6 $lib_arm6 -arch armv7 $lib_arm7 -arch i386 $lib_i386 -create -output $lib - done - echo 'Done! You will find the libaries and fat binary library in /lib/ios' -} -cd ../../ - -rm -rf $BUILD_DIR -mkdir -p $BUILD_DIR/arm6 $BUILD_DIR/arm7 $BUILD_DIR/i386 - -setenv_arm6 -echo 'Building armv6 library' -make clean -make assimp -j 8 -l -cp ./lib/libassimp.a $BUILD_DIR/arm6/ - -setenv_arm7 -echo 'Building armv7 library' -make clean -make assimp -j 8 -l -cp ./lib/libassimp.a $BUILD_DIR/arm7/ - - -setenv_i386 -echo 'Building i386 library' -make clean -make assimp -j 8 -l -cp ./lib/libassimp.a $BUILD_DIR/i386/ - -rm ./lib/libassimp.a - -create_outdir - - From dd6a624f151ede428731d710f113a800425486c3 Mon Sep 17 00:00:00 2001 From: shaded enmity Date: Thu, 20 Mar 2014 16:27:49 -0700 Subject: [PATCH 08/11] iOS Toolchain Readme Signed-off-by: shaded enmity --- port/iOS/README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 port/iOS/README.md diff --git a/port/iOS/README.md b/port/iOS/README.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/port/iOS/README.md @@ -0,0 +1 @@ +TODO From 81cc2c5de3f967bc723cbdcbd6655fba843aedbe Mon Sep 17 00:00:00 2001 From: Seed-Of-Hate Date: Thu, 20 Mar 2014 17:11:46 -0700 Subject: [PATCH 09/11] Update README.md --- port/iOS/README.md | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/port/iOS/README.md b/port/iOS/README.md index 1333ed77b..56fae2602 100644 --- a/port/iOS/README.md +++ b/port/iOS/README.md @@ -1 +1,30 @@ -TODO +# assimp for iOS-SDK 7.1 +(deployment target 6.0+) + +Builds assimp libraries for several iOS CPU architectures at once, and outputs a fat binary from the result. + +Run the **build.sh** script from the ```./port/iOS/``` directory. See **./build.sh --help** for information about command line options. + +```bash +shadeds-Mac:iOS arul$ ./build.sh --help +[!] ./build.sh - assimp iOS build script + - don't build fat library (--no-fat) + - supported architectures(--archs): armv7, armv7s, arm64, i386, x86_64 + - supported C++ STD libs.(--stdlib): libc++, libstdc++ +``` +Example: +```bash +cd ./port/iOS/ +./build.sh --stdlib=libc++ --archs="armv7 arm64 i386" +``` +Supported architectures/devices: + +### Simulator +- i386 +- x86_64 + +### Device +- ~~ARMv6 (dropped after iOS 6.0)~~ +- ARMv7 +- ARMv7-s +- ARM64 From 73c482a2930983506df74672c72459d664169f8c Mon Sep 17 00:00:00 2001 From: shaded enmity Date: Thu, 20 Mar 2014 17:15:09 -0700 Subject: [PATCH 10/11] iOS Path Update Signed-off-by: shaded enmity --- port/iOS/IPHONEOS_I386_TOOLCHAIN.cmake | 20 +++++++++++++++++ port/iOS/IPHONEOS_X86_64_TOOLCHAIN.cmake | 2 +- port/iOS/build.sh | 28 +++++++++--------------- 3 files changed, 31 insertions(+), 19 deletions(-) create mode 100644 port/iOS/IPHONEOS_I386_TOOLCHAIN.cmake diff --git a/port/iOS/IPHONEOS_I386_TOOLCHAIN.cmake b/port/iOS/IPHONEOS_I386_TOOLCHAIN.cmake new file mode 100644 index 000000000..22d564c95 --- /dev/null +++ b/port/iOS/IPHONEOS_I386_TOOLCHAIN.cmake @@ -0,0 +1,20 @@ +INCLUDE(CMakeForceCompiler) + +SET (CMAKE_CROSSCOMPILING TRUE) +SET (CMAKE_SYSTEM_NAME "Darwin") +SET (CMAKE_SYSTEM_PROCESSOR “i386”) + +SET (SDKVER “7.1”) + +SET (DEVROOT "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain") +SET (SDKROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator${SDKVER}.sdk") +SET (CC "${DEVROOT}/usr/bin/clang”) +SET (CXX "${DEVROOT}/usr/bin/clang++") + +CMAKE_FORCE_C_COMPILER (${CC} LLVM) +CMAKE_FORCE_CXX_COMPILER (${CXX} LLVM) + +SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}") +SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) \ No newline at end of file diff --git a/port/iOS/IPHONEOS_X86_64_TOOLCHAIN.cmake b/port/iOS/IPHONEOS_X86_64_TOOLCHAIN.cmake index 7e82d4db6..80ef8e003 100644 --- a/port/iOS/IPHONEOS_X86_64_TOOLCHAIN.cmake +++ b/port/iOS/IPHONEOS_X86_64_TOOLCHAIN.cmake @@ -7,7 +7,7 @@ SET (CMAKE_SYSTEM_PROCESSOR “x86_64”) SET (SDKVER “7.1”) SET (DEVROOT "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain") -SET (SDKROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneSimulator ${SDKVER}.sdk") +SET (SDKROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator${SDKVER}.sdk") SET (CC "${DEVROOT}/usr/bin/clang”) SET (CXX "${DEVROOT}/usr/bin/clang++") diff --git a/port/iOS/build.sh b/port/iOS/build.sh index 39e77c4f2..f7c23e58f 100755 --- a/port/iOS/build.sh +++ b/port/iOS/build.sh @@ -1,8 +1,8 @@ #!/bin/bash -####################### -# BUILD ASSIMP for iOS and iOS Simulator -####################### +# +# Written and maintained by the.arul@gmail.com (2014) +# BUILD_DIR="./lib/iOS" @@ -12,6 +12,7 @@ IOS_SDK_TARGET=6.0 IOS_SDK_DEVICE= XCODE_ROOT_DIR=/Applications/Xcode.app/Contents +TOOLCHAIN=$XCODE_ROOT_DIR//Developer/Toolchains/XcodeDefault.xctoolchain BUILD_ARCHS_DEVICE="armv7 armv7s arm64" BUILD_ARCHS_SIMULATOR="i386 x86_64" @@ -38,21 +39,11 @@ build_arch() echo '[!] Target SDK set to DEVICE.' fi - unset DEVROOT SDKROOT CFLAGS CC LD CPP CXX AR AS NM CXXCPP RANLIB LDFLAGS CPPFLAGS CXXFLAGS + unset DEVROOT SDKROOT CFLAGS LDFLAGS CPPFLAGS CXXFLAGS - export TOOLCHAIN=$XCODE_ROOT_DIR//Developer/Toolchains/XcodeDefault.xctoolchain export DEVROOT=$XCODE_ROOT_DIR/Developer/Platforms/$IOS_SDK_DEVICE.platform/Developer export SDKROOT=$DEVROOT/SDKs/$IOS_SDK_DEVICE$IOS_SDK_VERSION.sdk export CFLAGS="-arch $1 -pipe -no-cpp-precomp -stdlib=$CPP_STD_LIB -isysroot $SDKROOT -$CPP_DEV_TARGET=$IOS_SDK_TARGET -I$SDKROOT/usr/include/" - export CPP="$TOOLCHAIN/usr/bin/clang++" - export CXX="$TOOLCHAIN/usr/bin/clang++" - export CXXCPP="$TOOLCHAIN/usr/bin/clang++" - export CC="$TOOLCHAIN/usr/bin/clang" - export LD=$TOOLCHAIN/usr/bin/ld - export AR=$TOOLCHAIN/usr/bin/ar - export AS=$TOOLCHAIN/usr/bin/as - export NM=$TOOLCHAIN/usr/bin/nm - export RANLIB=$TOOLCHAIN/usr/bin/ranlib export LDFLAGS="-L$SDKROOT/usr/lib/" export CPPFLAGS=$CFLAGS export CXXFLAGS=$CFLAGS @@ -92,8 +83,9 @@ for i in "$@"; do echo "[!] Fat binary will not be created." ;; -h|--help) - echo " - supported architectures: $(echo $(join , ${BUILD_ARCHS_ALL[*]}) | sed 's/,/, /g')" - echo " - supported C++ STD libs.: $(echo $(join , ${CPP_STD_LIB_LIST[*]}) | sed 's/,/, /g')" + echo " - don't build fat library (--no-fat)." + echo " - supported architectures (--archs): $(echo $(join , ${BUILD_ARCHS_ALL[*]}) | sed 's/,/, /g')" + echo " - supported C++ STD libs. (--stdlib): $(echo $(join , ${CPP_STD_LIB_LIST[*]}) | sed 's/,/, /g')" exit ;; *) @@ -111,13 +103,13 @@ for ARCH_TARGET in $DEPLOY_ARCHS; do done if [[ "$DEPLOY_FAT" -eq 1 ]]; then - echo ' creating fat binary ...' + echo '[+] Creating fat binary ...' for ARCH_TARGET in $DEPLOY_ARCHS; do LIPO_ARGS="$LIPO_ARGS-arch $ARCH_TARGET $BUILD_DIR/$ARCH_TARGET/libassimp.a " done LIPO_ARGS="$LIPO_ARGS-create -output $BUILD_DIR/libassimp-fat.a" lipo $LIPO_ARGS - echo "Done! You will find the libaries and fat binary library in $BUILD_DIR" + echo "[!] Done! The fat binary can be found at $BUILD_DIR" fi From 050b38a69f7c9b5dc9b231da704f0b45eb274248 Mon Sep 17 00:00:00 2001 From: shaded enmity Date: Thu, 20 Mar 2014 17:25:35 -0700 Subject: [PATCH 11/11] Readme and cosmetics Signed-off-by: shaded enmity --- port/iOS/README.md | 2 +- port/iOS/build.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/port/iOS/README.md b/port/iOS/README.md index 56fae2602..836c40d16 100644 --- a/port/iOS/README.md +++ b/port/iOS/README.md @@ -1,5 +1,5 @@ # assimp for iOS-SDK 7.1 -(deployment target 6.0+) +(deployment target 6.0+, 32/64bit) Builds assimp libraries for several iOS CPU architectures at once, and outputs a fat binary from the result. diff --git a/port/iOS/build.sh b/port/iOS/build.sh index f7c23e58f..96ee5c4ae 100755 --- a/port/iOS/build.sh +++ b/port/iOS/build.sh @@ -72,7 +72,7 @@ for i in "$@"; do case $i in -l=*|--stdlib=*) CPP_STD_LIB=`echo $i | sed 's/[-a-zA-Z0-9]*=//'` - echo "[!] Selecting c++ std lib: $DEPLOY_STD" + echo "[!] Selecting c++ std lib: $CPP_STD_LIB" ;; -a=*|--archs=*) DEPLOY_ARCHS=`echo $i | sed 's/[-a-zA-Z0-9]*=//'`