From 3ca6b1081080355724cf02ceb31fcace1838fbb0 Mon Sep 17 00:00:00 2001 From: Doron Adler Date: Mon, 19 Mar 2018 13:17:18 +0200 Subject: [PATCH 01/19] Norod: Set IOS_SDK_VERSION to the latest based on xcodebuild sdk version Norod:Set XCODE_ROOT_DIR based on xcode-select's --print-path --- port/iOS/build.sh | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/port/iOS/build.sh b/port/iOS/build.sh index 44683f0c7..1a4778850 100755 --- a/port/iOS/build.sh +++ b/port/iOS/build.sh @@ -6,17 +6,24 @@ BUILD_DIR="./lib/iOS" -IOS_SDK_VERSION= -IOS_SDK_TARGET=6.0 -#(iPhoneOS iPhoneSimulator) -- determined from arch -IOS_SDK_DEVICE= +################################### +# SDK Version +################################### +IOS_SDK_VERSION=$(xcodebuild -version -sdk iphoneos | grep SDKVersion | cut -f2 -d ':' | tr -d '[[:space:]]') +################################### -XCODE_ROOT_DIR=/Applications/Xcode.app/Contents -TOOLCHAIN=$XCODE_ROOT_DIR//Developer/Toolchains/XcodeDefault.xctoolchain +################################################ +# Minimum iOS deployment target version +################################################ +MIN_IOS_VERSION="8.0" -BUILD_ARCHS_DEVICE="armv7 armv7s arm64" -BUILD_ARCHS_SIMULATOR="i386 x86_64" -BUILD_ARCHS_ALL=(armv7 armv7s arm64 i386 x86_64) +IOS_SDK_TARGET=$MIN_IOS_VERSION +XCODE_ROOT_DIR=$(xcode-select --print-path) +TOOLCHAIN=$XCODE_ROOT_DIR/Toolchains/XcodeDefault.xctoolchain + +BUILD_ARCHS_DEVICE="armv7s arm64" +BUILD_ARCHS_SIMULATOR="x86_64" +BUILD_ARCHS_ALL=(armv7s arm64 x86_64) CPP_DEV_TARGET_LIST=(miphoneos-version-min mios-simulator-version-min) CPP_DEV_TARGET= @@ -43,7 +50,7 @@ build_arch() unset DEVROOT SDKROOT CFLAGS LDFLAGS CPPFLAGS CXXFLAGS - export DEVROOT=$XCODE_ROOT_DIR/Developer/Platforms/$IOS_SDK_DEVICE.platform/Developer + export DEVROOT=$XCODE_ROOT_DIR/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 LDFLAGS="-L$SDKROOT/usr/lib/" @@ -56,8 +63,8 @@ build_arch() echo "[!] Building $1 library" - $XCODE_ROOT_DIR/Developer/usr/bin/make clean - $XCODE_ROOT_DIR/Developer/usr/bin/make assimp -j 8 -l + $XCODE_ROOT_DIR/usr/bin/make clean + $XCODE_ROOT_DIR/usr/bin/make assimp -j 8 -l echo "[!] Moving built library into: $BUILD_DIR/$1/" From 14a1b9980ea444c82530a98780ccbe936b988a41 Mon Sep 17 00:00:00 2001 From: Doron Adler Date: Mon, 19 Mar 2018 15:49:16 +0200 Subject: [PATCH 02/19] Norod: Do not attempt to look for Qt5Widgets when building for iOS Norod: Toolchain files get their SDKVER, DEVROOT and SDKROOT values from build.sh Norod: Removed deprecated CMAKE_FORCE_ Norod: Build shared libs is now set-able from a flag, so to be more extendable later Norod: .gitignore updated --- .gitignore | 6 ++++++ CMakeLists.txt | 6 ++++-- port/iOS/IPHONEOS_ARM64_TOOLCHAIN.cmake | 12 ++---------- port/iOS/IPHONEOS_ARMV6_TOOLCHAIN.cmake | 12 ++---------- port/iOS/IPHONEOS_ARMV7S_TOOLCHAIN.cmake | 12 ++---------- port/iOS/IPHONEOS_ARMV7_TOOLCHAIN.cmake | 12 ++---------- port/iOS/IPHONEOS_I386_TOOLCHAIN.cmake | 13 ++----------- port/iOS/IPHONEOS_X86_64_TOOLCHAIN.cmake | 13 ++----------- port/iOS/build.sh | 6 ++++-- 9 files changed, 26 insertions(+), 66 deletions(-) diff --git a/.gitignore b/.gitignore index 2a3b68a50..89d21df6d 100644 --- a/.gitignore +++ b/.gitignore @@ -84,3 +84,9 @@ lib64/assimp-vc120-mt.exp xcuserdata cmake-build-debug +install_manifest.txt +tools/assimp_qt_viewer/moc_glview.cpp +tools/assimp_qt_viewer/moc_glview.cpp_parameters +tools/assimp_qt_viewer/moc_mainwindow.cpp +tools/assimp_qt_viewer/moc_mainwindow.cpp_parameters +tools/assimp_qt_viewer/ui_mainwindow.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 15374a3fb..93558a76f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -425,9 +425,11 @@ IF ( ASSIMP_BUILD_ASSIMP_TOOLS ) # Why here? Maybe user do not want Qt viewer and have no Qt. # Why assimp_qt_viewer/CMakeLists.txt still contain similar check? # Because viewer can be build independently of Assimp. - FIND_PACKAGE(Qt5Widgets QUIET) - FIND_PACKAGE(DevIL QUIET) FIND_PACKAGE(OpenGL QUIET) + IF (NOT IOS) + FIND_PACKAGE(Qt5Widgets QUIET) + ENDIF (NOT IOS) + FIND_PACKAGE(DevIL QUIET) IF ( Qt5Widgets_FOUND AND IL_FOUND AND OPENGL_FOUND) ADD_SUBDIRECTORY( tools/assimp_qt_viewer/ ) ELSE() diff --git a/port/iOS/IPHONEOS_ARM64_TOOLCHAIN.cmake b/port/iOS/IPHONEOS_ARM64_TOOLCHAIN.cmake index 3aea8342e..15c1cc172 100644 --- a/port/iOS/IPHONEOS_ARM64_TOOLCHAIN.cmake +++ b/port/iOS/IPHONEOS_ARM64_TOOLCHAIN.cmake @@ -3,17 +3,9 @@ INCLUDE(CMakeForceCompiler) SET (CMAKE_CROSSCOMPILING TRUE) SET (CMAKE_SYSTEM_NAME "Darwin") SET (CMAKE_SYSTEM_PROCESSOR "arm64") +SET (IOS TRUE) -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 "${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 index 5ec416322..692fa2b55 100644 --- a/port/iOS/IPHONEOS_ARMV6_TOOLCHAIN.cmake +++ b/port/iOS/IPHONEOS_ARMV6_TOOLCHAIN.cmake @@ -3,17 +3,9 @@ INCLUDE(CMakeForceCompiler) SET (CMAKE_CROSSCOMPILING TRUE) SET (CMAKE_SYSTEM_NAME "Darwin") SET (CMAKE_SYSTEM_PROCESSOR "armv6") +SET (IOS TRUE) -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 "${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 index f11519aa4..0a708d963 100644 --- a/port/iOS/IPHONEOS_ARMV7S_TOOLCHAIN.cmake +++ b/port/iOS/IPHONEOS_ARMV7S_TOOLCHAIN.cmake @@ -3,17 +3,9 @@ INCLUDE(CMakeForceCompiler) SET (CMAKE_CROSSCOMPILING TRUE) SET (CMAKE_SYSTEM_NAME "Darwin") SET (CMAKE_SYSTEM_PROCESSOR "armv7s") +SET (IOS TRUE) -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 "${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 index b7f196c0f..22fdde115 100644 --- a/port/iOS/IPHONEOS_ARMV7_TOOLCHAIN.cmake +++ b/port/iOS/IPHONEOS_ARMV7_TOOLCHAIN.cmake @@ -3,17 +3,9 @@ INCLUDE(CMakeForceCompiler) SET (CMAKE_CROSSCOMPILING TRUE) SET (CMAKE_SYSTEM_NAME "Darwin") SET (CMAKE_SYSTEM_PROCESSOR "armv7") +SET (IOS TRUE) -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 "${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 index 22178bb87..217b4ed51 100644 --- a/port/iOS/IPHONEOS_I386_TOOLCHAIN.cmake +++ b/port/iOS/IPHONEOS_I386_TOOLCHAIN.cmake @@ -3,18 +3,9 @@ INCLUDE(CMakeForceCompiler) SET (CMAKE_CROSSCOMPILING TRUE) SET (CMAKE_SYSTEM_NAME "Darwin") SET (CMAKE_SYSTEM_PROCESSOR "i386") +SET (IOS TRUE) -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 "${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 3c69ecdb3..e4b27fba4 100644 --- a/port/iOS/IPHONEOS_X86_64_TOOLCHAIN.cmake +++ b/port/iOS/IPHONEOS_X86_64_TOOLCHAIN.cmake @@ -3,18 +3,9 @@ INCLUDE(CMakeForceCompiler) SET (CMAKE_CROSSCOMPILING TRUE) SET (CMAKE_SYSTEM_NAME "Darwin") SET (CMAKE_SYSTEM_PROCESSOR "x86_64") +SET (IOS TRUE) -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 "${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 index 1a4778850..8b423e473 100755 --- a/port/iOS/build.sh +++ b/port/iOS/build.sh @@ -12,6 +12,8 @@ BUILD_DIR="./lib/iOS" IOS_SDK_VERSION=$(xcodebuild -version -sdk iphoneos | grep SDKVersion | cut -f2 -d ':' | tr -d '[[:space:]]') ################################### +BUILD_SHARED_LIBS="OFF" + ################################################ # Minimum iOS deployment target version ################################################ @@ -59,7 +61,7 @@ build_arch() rm CMakeCache.txt - cmake -G 'Unix Makefiles' -DCMAKE_TOOLCHAIN_FILE=./port/iOS/IPHONEOS_$(echo $1 | tr '[:lower:]' '[:upper:]')_TOOLCHAIN.cmake -DENABLE_BOOST_WORKAROUND=ON -DBUILD_SHARED_LIBS=OFF + cmake -G 'Unix Makefiles' -DCMAKE_TOOLCHAIN_FILE=./port/iOS/IPHONEOS_$(echo $1 | tr '[:lower:]' '[:upper:]')_TOOLCHAIN.cmake -DENABLE_BOOST_WORKAROUND=ON -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS echo "[!] Building $1 library" @@ -95,7 +97,7 @@ for i in "$@"; do -n|--no-fat) DEPLOY_FAT=0 echo "[!] Fat binary will not be created." - ;; + ;; -h|--help) echo " - don't build fat library (--no-fat)." echo " - supported architectures (--archs): $(echo $(join , ${BUILD_ARCHS_ALL[*]}) | sed 's/,/, /g')" From e2e09ba2fa83d25fb5a1767e07e6c12b111212e7 Mon Sep 17 00:00:00 2001 From: Doron Adler Date: Mon, 19 Mar 2018 22:51:52 +0200 Subject: [PATCH 03/19] Norod: Support building assimp as dylib for iOS (set as default) --- CMakeLists.txt | 4 +++- port/iOS/build.sh | 55 ++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 48 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 93558a76f..e48507e43 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -337,7 +337,9 @@ ENDIF(NOT ZLIB_FOUND) INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) # Search for unzip -use_pkgconfig(UNZIP minizip) +IF (NOT IOS) + use_pkgconfig(UNZIP minizip) +ENDIF (NOT IOS) IF ( ASSIMP_NO_EXPORT ) ADD_DEFINITIONS( -DASSIMP_BUILD_NO_EXPORT) diff --git a/port/iOS/build.sh b/port/iOS/build.sh index 8b423e473..199418e17 100755 --- a/port/iOS/build.sh +++ b/port/iOS/build.sh @@ -12,7 +12,8 @@ BUILD_DIR="./lib/iOS" IOS_SDK_VERSION=$(xcodebuild -version -sdk iphoneos | grep SDKVersion | cut -f2 -d ':' | tr -d '[[:space:]]') ################################### -BUILD_SHARED_LIBS="OFF" +BUILD_SHARED_LIBS=ON +BUILD_TYPE=MinSizeRel ################################################ # Minimum iOS deployment target version @@ -23,9 +24,9 @@ IOS_SDK_TARGET=$MIN_IOS_VERSION XCODE_ROOT_DIR=$(xcode-select --print-path) TOOLCHAIN=$XCODE_ROOT_DIR/Toolchains/XcodeDefault.xctoolchain -BUILD_ARCHS_DEVICE="armv7s arm64" -BUILD_ARCHS_SIMULATOR="x86_64" -BUILD_ARCHS_ALL=(armv7s arm64 x86_64) +BUILD_ARCHS_DEVICE="armv7 arm64" +BUILD_ARCHS_SIMULATOR="x86_64 i386" +BUILD_ARCHS_ALL=(armv7 arm64 x86_64 i386) CPP_DEV_TARGET_LIST=(miphoneos-version-min mios-simulator-version-min) CPP_DEV_TARGET= @@ -61,16 +62,23 @@ build_arch() rm CMakeCache.txt - cmake -G 'Unix Makefiles' -DCMAKE_TOOLCHAIN_FILE=./port/iOS/IPHONEOS_$(echo $1 | tr '[:lower:]' '[:upper:]')_TOOLCHAIN.cmake -DENABLE_BOOST_WORKAROUND=ON -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS + cmake -G 'Unix Makefiles' -DCMAKE_TOOLCHAIN_FILE=./port/iOS/IPHONEOS_$(echo $1 | tr '[:lower:]' '[:upper:]')_TOOLCHAIN.cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DENABLE_BOOST_WORKAROUND=ON -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS echo "[!] Building $1 library" $XCODE_ROOT_DIR/usr/bin/make clean $XCODE_ROOT_DIR/usr/bin/make assimp -j 8 -l - echo "[!] Moving built library into: $BUILD_DIR/$1/" + echo "[!] Moving built libraries into: $BUILD_DIR/$1/" - mv ./lib/libassimp.a $BUILD_DIR/$1/ + if [[ "$BUILD_SHARED_LIBS" =~ "ON" ]]; then + mv ./lib/libassimp*.dylib $BUILD_DIR/$1/ + else + mv ./lib/libassimp.a $BUILD_DIR/$1/ + fi + + mv ./lib/libIrrXML.a $BUILD_DIR/$1/ + mv ./lib/libzlibstatic.a $BUILD_DIR/$1/ } echo "[!] $0 - assimp iOS build script" @@ -120,13 +128,40 @@ for ARCH_TARGET in $DEPLOY_ARCHS; do done if [[ "$DEPLOY_FAT" -eq 1 ]]; then - echo '[+] Creating fat binary ...' + echo '[+] Creating fat libassimp binary ...' for ARCH_TARGET in $DEPLOY_ARCHS; do - LIPO_ARGS="$LIPO_ARGS-arch $ARCH_TARGET $BUILD_DIR/$ARCH_TARGET/libassimp.a " + if [[ "$BUILD_SHARED_LIBS" =~ "ON" ]]; then + LIPO_ARGS="$LIPO_ARGS-arch $ARCH_TARGET $BUILD_DIR/$ARCH_TARGET/libassimp.dylib " + else + LIPO_ARGS="$LIPO_ARGS-arch $ARCH_TARGET $BUILD_DIR/$ARCH_TARGET/libassimp.a " + fi done - LIPO_ARGS="$LIPO_ARGS-create -output $BUILD_DIR/libassimp-fat.a" + if [[ "$BUILD_SHARED_LIBS" =~ "ON" ]]; then + LIPO_ARGS="$LIPO_ARGS-create -output $BUILD_DIR/libassimp-fat.dylib" + else + LIPO_ARGS="$LIPO_ARGS-create -output $BUILD_DIR/libassimp-fat.a" + fi lipo $LIPO_ARGS echo "[!] Done! The fat binary can be found at $BUILD_DIR" + LIPO_ARGS="" + + echo '[+] Creating fat libIrrXML binary ...' + for ARCH_TARGET in $DEPLOY_ARCHS; do + LIPO_ARGS="$LIPO_ARGS-arch $ARCH_TARGET $BUILD_DIR/$ARCH_TARGET/libIrrXML.a " + done + LIPO_ARGS="$LIPO_ARGS-create -output $BUILD_DIR/libIrrXML-fat.a" + lipo $LIPO_ARGS + echo "[!] Done! The fat binary can be found at $BUILD_DIR" + LIPO_ARGS="" + + echo '[+] Creating fat libzlibstatic binary ...' + for ARCH_TARGET in $DEPLOY_ARCHS; do + LIPO_ARGS="$LIPO_ARGS-arch $ARCH_TARGET $BUILD_DIR/$ARCH_TARGET/libzlibstatic.a " + done + LIPO_ARGS="$LIPO_ARGS-create -output $BUILD_DIR/libzlibstatic-fat.a" + lipo $LIPO_ARGS + echo "[!] Done! The fat binary can be found at $BUILD_DIR" + LIPO_ARGS="" fi From c2f22be99abac1a10715ca92980dd352f4a2b237 Mon Sep 17 00:00:00 2001 From: Doron Adler Date: Tue, 20 Mar 2018 13:46:03 +0200 Subject: [PATCH 04/19] Norod: Default build type is set as Release, no shared libraries --- CMakeLists.txt | 8 +++++++- port/iOS/IPHONEOS_ARM64_TOOLCHAIN.cmake | 8 ++++++++ port/iOS/IPHONEOS_ARMV6_TOOLCHAIN.cmake | 8 ++++++++ port/iOS/IPHONEOS_ARMV7S_TOOLCHAIN.cmake | 8 ++++++++ port/iOS/IPHONEOS_ARMV7_TOOLCHAIN.cmake | 8 ++++++++ port/iOS/IPHONEOS_I386_TOOLCHAIN.cmake | 8 ++++++++ port/iOS/IPHONEOS_X86_64_TOOLCHAIN.cmake | 8 ++++++++ port/iOS/build.sh | 6 +++--- 8 files changed, 58 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e48507e43..57f9e892f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,10 +39,16 @@ CMAKE_MINIMUM_REQUIRED( VERSION 2.8 ) PROJECT( Assimp ) # All supported options ############################################### + +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release") +endif() + OPTION( BUILD_SHARED_LIBS "Build package with shared libraries." - ON + OFF ) + OPTION( BUILD_FRAMEWORK "Build package as Mac OS X Framework bundle." OFF diff --git a/port/iOS/IPHONEOS_ARM64_TOOLCHAIN.cmake b/port/iOS/IPHONEOS_ARM64_TOOLCHAIN.cmake index 15c1cc172..4abcac764 100644 --- a/port/iOS/IPHONEOS_ARM64_TOOLCHAIN.cmake +++ b/port/iOS/IPHONEOS_ARM64_TOOLCHAIN.cmake @@ -5,6 +5,14 @@ SET (CMAKE_SYSTEM_NAME "Darwin") SET (CMAKE_SYSTEM_PROCESSOR "arm64") SET (IOS TRUE) +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release") +endif() + +set(CMAKE_CXX_FLAGS "-Wall -Wextra") +set(CMAKE_CXX_FLAGS_DEBUG "-g") +set(CMAKE_CXX_FLAGS_RELEASE "-O3") + SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}") SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) diff --git a/port/iOS/IPHONEOS_ARMV6_TOOLCHAIN.cmake b/port/iOS/IPHONEOS_ARMV6_TOOLCHAIN.cmake index 692fa2b55..5aa7f90f1 100644 --- a/port/iOS/IPHONEOS_ARMV6_TOOLCHAIN.cmake +++ b/port/iOS/IPHONEOS_ARMV6_TOOLCHAIN.cmake @@ -5,6 +5,14 @@ SET (CMAKE_SYSTEM_NAME "Darwin") SET (CMAKE_SYSTEM_PROCESSOR "armv6") SET (IOS TRUE) +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release") +endif() + +set(CMAKE_CXX_FLAGS "-Wall -Wextra") +set(CMAKE_CXX_FLAGS_DEBUG "-g") +set(CMAKE_CXX_FLAGS_RELEASE "-O3") + SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}") SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) diff --git a/port/iOS/IPHONEOS_ARMV7S_TOOLCHAIN.cmake b/port/iOS/IPHONEOS_ARMV7S_TOOLCHAIN.cmake index 0a708d963..d35bfce03 100644 --- a/port/iOS/IPHONEOS_ARMV7S_TOOLCHAIN.cmake +++ b/port/iOS/IPHONEOS_ARMV7S_TOOLCHAIN.cmake @@ -5,6 +5,14 @@ SET (CMAKE_SYSTEM_NAME "Darwin") SET (CMAKE_SYSTEM_PROCESSOR "armv7s") SET (IOS TRUE) +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release") +endif() + +set(CMAKE_CXX_FLAGS "-Wall -Wextra") +set(CMAKE_CXX_FLAGS_DEBUG "-g") +set(CMAKE_CXX_FLAGS_RELEASE "-O3") + SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}") SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) diff --git a/port/iOS/IPHONEOS_ARMV7_TOOLCHAIN.cmake b/port/iOS/IPHONEOS_ARMV7_TOOLCHAIN.cmake index 22fdde115..d563bb078 100644 --- a/port/iOS/IPHONEOS_ARMV7_TOOLCHAIN.cmake +++ b/port/iOS/IPHONEOS_ARMV7_TOOLCHAIN.cmake @@ -5,6 +5,14 @@ SET (CMAKE_SYSTEM_NAME "Darwin") SET (CMAKE_SYSTEM_PROCESSOR "armv7") SET (IOS TRUE) +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release") +endif() + +set(CMAKE_CXX_FLAGS "-Wall -Wextra") +set(CMAKE_CXX_FLAGS_DEBUG "-g") +set(CMAKE_CXX_FLAGS_RELEASE "-O3") + SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}") SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) diff --git a/port/iOS/IPHONEOS_I386_TOOLCHAIN.cmake b/port/iOS/IPHONEOS_I386_TOOLCHAIN.cmake index 217b4ed51..6d077567e 100644 --- a/port/iOS/IPHONEOS_I386_TOOLCHAIN.cmake +++ b/port/iOS/IPHONEOS_I386_TOOLCHAIN.cmake @@ -5,6 +5,14 @@ SET (CMAKE_SYSTEM_NAME "Darwin") SET (CMAKE_SYSTEM_PROCESSOR "i386") SET (IOS TRUE) +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release") +endif() + +set(CMAKE_CXX_FLAGS "-Wall -Wextra") +set(CMAKE_CXX_FLAGS_DEBUG "-g") +set(CMAKE_CXX_FLAGS_RELEASE "-O3") + SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}") SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) diff --git a/port/iOS/IPHONEOS_X86_64_TOOLCHAIN.cmake b/port/iOS/IPHONEOS_X86_64_TOOLCHAIN.cmake index e4b27fba4..354487ce0 100644 --- a/port/iOS/IPHONEOS_X86_64_TOOLCHAIN.cmake +++ b/port/iOS/IPHONEOS_X86_64_TOOLCHAIN.cmake @@ -5,6 +5,14 @@ SET (CMAKE_SYSTEM_NAME "Darwin") SET (CMAKE_SYSTEM_PROCESSOR "x86_64") SET (IOS TRUE) +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release") +endif() + +set(CMAKE_CXX_FLAGS "-Wall -Wextra") +set(CMAKE_CXX_FLAGS_DEBUG "-g") +set(CMAKE_CXX_FLAGS_RELEASE "-O3") + SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}") SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) diff --git a/port/iOS/build.sh b/port/iOS/build.sh index 199418e17..7e454fae2 100755 --- a/port/iOS/build.sh +++ b/port/iOS/build.sh @@ -12,8 +12,8 @@ BUILD_DIR="./lib/iOS" IOS_SDK_VERSION=$(xcodebuild -version -sdk iphoneos | grep SDKVersion | cut -f2 -d ':' | tr -d '[[:space:]]') ################################### -BUILD_SHARED_LIBS=ON -BUILD_TYPE=MinSizeRel +BUILD_SHARED_LIBS=OFF +BUILD_TYPE=Release ################################################ # Minimum iOS deployment target version @@ -62,7 +62,7 @@ build_arch() rm CMakeCache.txt - cmake -G 'Unix Makefiles' -DCMAKE_TOOLCHAIN_FILE=./port/iOS/IPHONEOS_$(echo $1 | tr '[:lower:]' '[:upper:]')_TOOLCHAIN.cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DENABLE_BOOST_WORKAROUND=ON -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS + cmake -G 'Unix Makefiles' -DCMAKE_TOOLCHAIN_FILE=./port/iOS/IPHONEOS_$(echo $1 | tr '[:lower:]' '[:upper:]')_TOOLCHAIN.cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS echo "[!] Building $1 library" From c1f6683b2017905d2c86ab4934f730ab5ffa0187 Mon Sep 17 00:00:00 2001 From: Doron Adler Date: Tue, 20 Mar 2018 14:45:54 +0200 Subject: [PATCH 05/19] Partial revert, build only 64bit targets --- CMakeLists.txt | 4 ++-- port/iOS/IPHONEOS_ARM64_TOOLCHAIN.cmake | 6 ++++++ port/iOS/IPHONEOS_ARMV6_TOOLCHAIN.cmake | 6 ++++++ port/iOS/IPHONEOS_ARMV7S_TOOLCHAIN.cmake | 6 ++++++ port/iOS/IPHONEOS_ARMV7_TOOLCHAIN.cmake | 6 ++++++ port/iOS/IPHONEOS_I386_TOOLCHAIN.cmake | 6 ++++++ port/iOS/IPHONEOS_X86_64_TOOLCHAIN.cmake | 6 ++++++ port/iOS/build.sh | 7 ++++--- 8 files changed, 42 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 57f9e892f..0579aefed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,7 +46,7 @@ endif() OPTION( BUILD_SHARED_LIBS "Build package with shared libraries." - OFF + ON ) OPTION( BUILD_FRAMEWORK @@ -433,11 +433,11 @@ IF ( ASSIMP_BUILD_ASSIMP_TOOLS ) # Why here? Maybe user do not want Qt viewer and have no Qt. # Why assimp_qt_viewer/CMakeLists.txt still contain similar check? # Because viewer can be build independently of Assimp. - FIND_PACKAGE(OpenGL QUIET) IF (NOT IOS) FIND_PACKAGE(Qt5Widgets QUIET) ENDIF (NOT IOS) FIND_PACKAGE(DevIL QUIET) + FIND_PACKAGE(OpenGL QUIET) IF ( Qt5Widgets_FOUND AND IL_FOUND AND OPENGL_FOUND) ADD_SUBDIRECTORY( tools/assimp_qt_viewer/ ) ELSE() diff --git a/port/iOS/IPHONEOS_ARM64_TOOLCHAIN.cmake b/port/iOS/IPHONEOS_ARM64_TOOLCHAIN.cmake index 4abcac764..89da24f09 100644 --- a/port/iOS/IPHONEOS_ARM64_TOOLCHAIN.cmake +++ b/port/iOS/IPHONEOS_ARM64_TOOLCHAIN.cmake @@ -9,6 +9,12 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release") endif() +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_CXX_FLAGS "-Wall -Wextra") set(CMAKE_CXX_FLAGS_DEBUG "-g") set(CMAKE_CXX_FLAGS_RELEASE "-O3") diff --git a/port/iOS/IPHONEOS_ARMV6_TOOLCHAIN.cmake b/port/iOS/IPHONEOS_ARMV6_TOOLCHAIN.cmake index 5aa7f90f1..686b2faab 100644 --- a/port/iOS/IPHONEOS_ARMV6_TOOLCHAIN.cmake +++ b/port/iOS/IPHONEOS_ARMV6_TOOLCHAIN.cmake @@ -9,6 +9,12 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release") endif() +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_CXX_FLAGS "-Wall -Wextra") set(CMAKE_CXX_FLAGS_DEBUG "-g") set(CMAKE_CXX_FLAGS_RELEASE "-O3") diff --git a/port/iOS/IPHONEOS_ARMV7S_TOOLCHAIN.cmake b/port/iOS/IPHONEOS_ARMV7S_TOOLCHAIN.cmake index d35bfce03..f34aad1fe 100644 --- a/port/iOS/IPHONEOS_ARMV7S_TOOLCHAIN.cmake +++ b/port/iOS/IPHONEOS_ARMV7S_TOOLCHAIN.cmake @@ -9,6 +9,12 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release") endif() +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_CXX_FLAGS "-Wall -Wextra") set(CMAKE_CXX_FLAGS_DEBUG "-g") set(CMAKE_CXX_FLAGS_RELEASE "-O3") diff --git a/port/iOS/IPHONEOS_ARMV7_TOOLCHAIN.cmake b/port/iOS/IPHONEOS_ARMV7_TOOLCHAIN.cmake index d563bb078..46a0afbea 100644 --- a/port/iOS/IPHONEOS_ARMV7_TOOLCHAIN.cmake +++ b/port/iOS/IPHONEOS_ARMV7_TOOLCHAIN.cmake @@ -9,6 +9,12 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release") endif() +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_CXX_FLAGS "-Wall -Wextra") set(CMAKE_CXX_FLAGS_DEBUG "-g") set(CMAKE_CXX_FLAGS_RELEASE "-O3") diff --git a/port/iOS/IPHONEOS_I386_TOOLCHAIN.cmake b/port/iOS/IPHONEOS_I386_TOOLCHAIN.cmake index 6d077567e..919817851 100644 --- a/port/iOS/IPHONEOS_I386_TOOLCHAIN.cmake +++ b/port/iOS/IPHONEOS_I386_TOOLCHAIN.cmake @@ -9,6 +9,12 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release") endif() +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_CXX_FLAGS "-Wall -Wextra") set(CMAKE_CXX_FLAGS_DEBUG "-g") set(CMAKE_CXX_FLAGS_RELEASE "-O3") diff --git a/port/iOS/IPHONEOS_X86_64_TOOLCHAIN.cmake b/port/iOS/IPHONEOS_X86_64_TOOLCHAIN.cmake index 354487ce0..a9514ddaa 100644 --- a/port/iOS/IPHONEOS_X86_64_TOOLCHAIN.cmake +++ b/port/iOS/IPHONEOS_X86_64_TOOLCHAIN.cmake @@ -9,6 +9,12 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release") endif() +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_CXX_FLAGS "-Wall -Wextra") set(CMAKE_CXX_FLAGS_DEBUG "-g") set(CMAKE_CXX_FLAGS_RELEASE "-O3") diff --git a/port/iOS/build.sh b/port/iOS/build.sh index 7e454fae2..9d4338889 100755 --- a/port/iOS/build.sh +++ b/port/iOS/build.sh @@ -24,9 +24,10 @@ IOS_SDK_TARGET=$MIN_IOS_VERSION XCODE_ROOT_DIR=$(xcode-select --print-path) TOOLCHAIN=$XCODE_ROOT_DIR/Toolchains/XcodeDefault.xctoolchain -BUILD_ARCHS_DEVICE="armv7 arm64" -BUILD_ARCHS_SIMULATOR="x86_64 i386" -BUILD_ARCHS_ALL=(armv7 arm64 x86_64 i386) +BUILD_ARCHS_DEVICE="arm64" +BUILD_ARCHS_SIMULATOR="x86_64" +BUILD_ARCHS_ALL=(arm64 x86_64) +#BUILD_ARCHS_ALL=(armv7 arm64 x86_64 i386) CPP_DEV_TARGET_LIST=(miphoneos-version-min mios-simulator-version-min) CPP_DEV_TARGET= From 643cf9bea2005343f90f19fb7acf3d3c402649b4 Mon Sep 17 00:00:00 2001 From: Doron Adler Date: Tue, 20 Mar 2018 17:09:50 +0200 Subject: [PATCH 06/19] Norod: Brought back 32bit archs --- port/iOS/build.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/port/iOS/build.sh b/port/iOS/build.sh index 9d4338889..b56b36c43 100755 --- a/port/iOS/build.sh +++ b/port/iOS/build.sh @@ -24,10 +24,9 @@ IOS_SDK_TARGET=$MIN_IOS_VERSION XCODE_ROOT_DIR=$(xcode-select --print-path) TOOLCHAIN=$XCODE_ROOT_DIR/Toolchains/XcodeDefault.xctoolchain -BUILD_ARCHS_DEVICE="arm64" -BUILD_ARCHS_SIMULATOR="x86_64" -BUILD_ARCHS_ALL=(arm64 x86_64) -#BUILD_ARCHS_ALL=(armv7 arm64 x86_64 i386) +BUILD_ARCHS_DEVICE="arm64 armv7" +BUILD_ARCHS_SIMULATOR="x86_64 i386" +BUILD_ARCHS_ALL=(armv7 arm64 x86_64 i386) CPP_DEV_TARGET_LIST=(miphoneos-version-min mios-simulator-version-min) CPP_DEV_TARGET= From 323d59c7aafe4ef2a4492dc98306ee56d5b1fc46 Mon Sep 17 00:00:00 2001 From: Doron Adler Date: Mon, 28 May 2018 16:12:54 +0300 Subject: [PATCH 07/19] Check for null --- code/TriangulateProcess.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/code/TriangulateProcess.cpp b/code/TriangulateProcess.cpp index 25d92c470..ba4c96c40 100644 --- a/code/TriangulateProcess.cpp +++ b/code/TriangulateProcess.cpp @@ -105,8 +105,10 @@ void TriangulateProcess::Execute( aiScene* pScene) bool bHas = false; for( unsigned int a = 0; a < pScene->mNumMeshes; a++) { - if ( TriangulateMesh( pScene->mMeshes[ a ] ) ) { - bHas = true; + if (pScene->mMeshes[ a ]) { + if ( TriangulateMesh( pScene->mMeshes[ a ] ) ) { + bHas = true; + } } } if ( bHas ) { @@ -286,7 +288,7 @@ bool TriangulateProcess::TriangulateMesh( aiMesh* pMesh) // We project it onto a plane to get a 2d triangle. // Collect all vertices of of the polygon. - for (tmp = 0; tmp < max; ++tmp) { + for (tmp = 0; tmp < MIN(max,max_out+2); ++tmp) { temp_verts3d[tmp] = verts[idx[tmp]]; } From 3023df8f7ed1185e838351cc0c6dc95e222efae6 Mon Sep 17 00:00:00 2001 From: Doron Adler Date: Mon, 28 May 2018 17:36:43 +0300 Subject: [PATCH 08/19] Norod: Configurable from script parameters: dynamic libraries and debug/release build type --- port/iOS/IPHONEOS_ARM64_TOOLCHAIN.cmake | 7 ------- port/iOS/IPHONEOS_ARMV6_TOOLCHAIN.cmake | 7 ------- port/iOS/IPHONEOS_ARMV7S_TOOLCHAIN.cmake | 7 ------- port/iOS/IPHONEOS_ARMV7_TOOLCHAIN.cmake | 7 ------- port/iOS/IPHONEOS_I386_TOOLCHAIN.cmake | 7 ------- port/iOS/IPHONEOS_X86_64_TOOLCHAIN.cmake | 7 ------- port/iOS/build.sh | 24 +++++++++++++++++++----- 7 files changed, 19 insertions(+), 47 deletions(-) diff --git a/port/iOS/IPHONEOS_ARM64_TOOLCHAIN.cmake b/port/iOS/IPHONEOS_ARM64_TOOLCHAIN.cmake index 89da24f09..e37045cf4 100644 --- a/port/iOS/IPHONEOS_ARM64_TOOLCHAIN.cmake +++ b/port/iOS/IPHONEOS_ARM64_TOOLCHAIN.cmake @@ -5,16 +5,9 @@ SET (CMAKE_SYSTEM_NAME "Darwin") SET (CMAKE_SYSTEM_PROCESSOR "arm64") SET (IOS TRUE) -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE "Release") -endif() - 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_CXX_FLAGS "-Wall -Wextra") set(CMAKE_CXX_FLAGS_DEBUG "-g") set(CMAKE_CXX_FLAGS_RELEASE "-O3") diff --git a/port/iOS/IPHONEOS_ARMV6_TOOLCHAIN.cmake b/port/iOS/IPHONEOS_ARMV6_TOOLCHAIN.cmake index 686b2faab..47ac79481 100644 --- a/port/iOS/IPHONEOS_ARMV6_TOOLCHAIN.cmake +++ b/port/iOS/IPHONEOS_ARMV6_TOOLCHAIN.cmake @@ -5,16 +5,9 @@ SET (CMAKE_SYSTEM_NAME "Darwin") SET (CMAKE_SYSTEM_PROCESSOR "armv6") SET (IOS TRUE) -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE "Release") -endif() - 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_CXX_FLAGS "-Wall -Wextra") set(CMAKE_CXX_FLAGS_DEBUG "-g") set(CMAKE_CXX_FLAGS_RELEASE "-O3") diff --git a/port/iOS/IPHONEOS_ARMV7S_TOOLCHAIN.cmake b/port/iOS/IPHONEOS_ARMV7S_TOOLCHAIN.cmake index f34aad1fe..44f58e091 100644 --- a/port/iOS/IPHONEOS_ARMV7S_TOOLCHAIN.cmake +++ b/port/iOS/IPHONEOS_ARMV7S_TOOLCHAIN.cmake @@ -5,16 +5,9 @@ SET (CMAKE_SYSTEM_NAME "Darwin") SET (CMAKE_SYSTEM_PROCESSOR "armv7s") SET (IOS TRUE) -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE "Release") -endif() - 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_CXX_FLAGS "-Wall -Wextra") set(CMAKE_CXX_FLAGS_DEBUG "-g") set(CMAKE_CXX_FLAGS_RELEASE "-O3") diff --git a/port/iOS/IPHONEOS_ARMV7_TOOLCHAIN.cmake b/port/iOS/IPHONEOS_ARMV7_TOOLCHAIN.cmake index 46a0afbea..f8e5e8657 100644 --- a/port/iOS/IPHONEOS_ARMV7_TOOLCHAIN.cmake +++ b/port/iOS/IPHONEOS_ARMV7_TOOLCHAIN.cmake @@ -5,16 +5,9 @@ SET (CMAKE_SYSTEM_NAME "Darwin") SET (CMAKE_SYSTEM_PROCESSOR "armv7") SET (IOS TRUE) -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE "Release") -endif() - 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_CXX_FLAGS "-Wall -Wextra") set(CMAKE_CXX_FLAGS_DEBUG "-g") set(CMAKE_CXX_FLAGS_RELEASE "-O3") diff --git a/port/iOS/IPHONEOS_I386_TOOLCHAIN.cmake b/port/iOS/IPHONEOS_I386_TOOLCHAIN.cmake index 919817851..4b161f33a 100644 --- a/port/iOS/IPHONEOS_I386_TOOLCHAIN.cmake +++ b/port/iOS/IPHONEOS_I386_TOOLCHAIN.cmake @@ -5,16 +5,9 @@ SET (CMAKE_SYSTEM_NAME "Darwin") SET (CMAKE_SYSTEM_PROCESSOR "i386") SET (IOS TRUE) -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE "Release") -endif() - 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_CXX_FLAGS "-Wall -Wextra") set(CMAKE_CXX_FLAGS_DEBUG "-g") set(CMAKE_CXX_FLAGS_RELEASE "-O3") diff --git a/port/iOS/IPHONEOS_X86_64_TOOLCHAIN.cmake b/port/iOS/IPHONEOS_X86_64_TOOLCHAIN.cmake index a9514ddaa..07c103174 100644 --- a/port/iOS/IPHONEOS_X86_64_TOOLCHAIN.cmake +++ b/port/iOS/IPHONEOS_X86_64_TOOLCHAIN.cmake @@ -5,16 +5,9 @@ SET (CMAKE_SYSTEM_NAME "Darwin") SET (CMAKE_SYSTEM_PROCESSOR "x86_64") SET (IOS TRUE) -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE "Release") -endif() - 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_CXX_FLAGS "-Wall -Wextra") set(CMAKE_CXX_FLAGS_DEBUG "-g") set(CMAKE_CXX_FLAGS_RELEASE "-O3") diff --git a/port/iOS/build.sh b/port/iOS/build.sh index 338526632..2bb88014b 100755 --- a/port/iOS/build.sh +++ b/port/iOS/build.sh @@ -12,21 +12,25 @@ BUILD_DIR="./lib/iOS" IOS_SDK_VERSION=$(xcodebuild -version -sdk iphoneos | grep SDKVersion | cut -f2 -d ':' | tr -d '[[:space:]]') ################################### +################################### +# BUILD Configuration +################################### + BUILD_SHARED_LIBS=OFF -BUILD_TYPE=Release +BUILD_TYPE=Debug ################################################ # Minimum iOS deployment target version ################################################ -MIN_IOS_VERSION="8.0" +MIN_IOS_VERSION="6.0" IOS_SDK_TARGET=$MIN_IOS_VERSION XCODE_ROOT_DIR=$(xcode-select --print-path) TOOLCHAIN=$XCODE_ROOT_DIR/Toolchains/XcodeDefault.xctoolchain -BUILD_ARCHS_DEVICE="arm64 armv7" +BUILD_ARCHS_DEVICE="arm64 armv7s armv7" BUILD_ARCHS_SIMULATOR="x86_64 i386" -BUILD_ARCHS_ALL=(armv7 arm64 x86_64 i386) +BUILD_ARCHS_ALL=(armv7 armv7s arm64 x86_64 i386) CPP_DEV_TARGET_LIST=(miphoneos-version-min mios-simulator-version-min) CPP_DEV_TARGET= @@ -62,7 +66,7 @@ build_arch() rm CMakeCache.txt - cmake -G 'Unix Makefiles' -DCMAKE_TOOLCHAIN_FILE=./port/iOS/IPHONEOS_$(echo $1 | tr '[:lower:]' '[:upper:]')_TOOLCHAIN.cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS + cmake -G 'Unix Makefiles' -DCMAKE_TOOLCHAIN_FILE=./port/iOS/IPHONEOS_$(echo $1 | tr '[:lower:]' '[:upper:]')_TOOLCHAIN.cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DENABLE_BOOST_WORKAROUND=ON -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS echo "[!] Building $1 library" @@ -102,12 +106,22 @@ for i in "$@"; do DEPLOY_ARCHS=`echo $i | sed 's/[-a-zA-Z0-9]*=//'` echo "[!] Selecting architectures: $DEPLOY_ARCHS" ;; + -r=*|--release=*) + BUILD_TYPE=Release + echo "[!] Selecting build type: Release" + ;; + -s=*|--shared-lib=*) + BUILD_SHARED_LIBS=ON + echo "[!] Will generate dynamic libraries" + ;; -n|--no-fat) DEPLOY_FAT=0 echo "[!] Fat binary will not be created." ;; -h|--help) echo " - don't build fat library (--no-fat)." + echo " - don't include debug information and apply compiler optimizations (--release)." + echo " - generate dynamic libraries rather than static ones (--shared-lib)." 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')" echo " - supported C++ standards (--std): $(echo $(join , ${CPP_STD_LIST[*]}) | sed 's/,/, /g')" From 1ee92002772b8fd68697ff658dba4f5c52fd64f6 Mon Sep 17 00:00:00 2001 From: Doron Adler Date: Wed, 30 May 2018 08:49:11 +0300 Subject: [PATCH 09/19] smallerMax --- code/TriangulateProcess.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/TriangulateProcess.cpp b/code/TriangulateProcess.cpp index 31b087acb..134d1ed41 100644 --- a/code/TriangulateProcess.cpp +++ b/code/TriangulateProcess.cpp @@ -287,7 +287,8 @@ bool TriangulateProcess::TriangulateMesh( aiMesh* pMesh) // We project it onto a plane to get a 2d triangle. // Collect all vertices of of the polygon. - for (tmp = 0; tmp < MIN(max,max_out+2); ++tmp) { + int smallerMax = (max<=((int)max_out+2))?(max):((int)max_out+2); + for (tmp = 0; tmp < smallerMax; ++tmp) { temp_verts3d[tmp] = verts[idx[tmp]]; } From e3847b7996e7f3f96a0bc45abf85b09e1aeffbf4 Mon Sep 17 00:00:00 2001 From: Doron Adler Date: Wed, 30 May 2018 09:21:28 +0300 Subject: [PATCH 10/19] Default to release builds, update CC/LD/etc flags --- port/iOS/build.sh | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/port/iOS/build.sh b/port/iOS/build.sh index 2bb88014b..9ce8edf6b 100755 --- a/port/iOS/build.sh +++ b/port/iOS/build.sh @@ -17,7 +17,7 @@ IOS_SDK_VERSION=$(xcodebuild -version -sdk iphoneos | grep SDKVersion | cut -f2 ################################### BUILD_SHARED_LIBS=OFF -BUILD_TYPE=Debug +BUILD_TYPE=Release ################################################ # Minimum iOS deployment target version @@ -28,9 +28,9 @@ IOS_SDK_TARGET=$MIN_IOS_VERSION XCODE_ROOT_DIR=$(xcode-select --print-path) TOOLCHAIN=$XCODE_ROOT_DIR/Toolchains/XcodeDefault.xctoolchain -BUILD_ARCHS_DEVICE="arm64 armv7s armv7" +BUILD_ARCHS_DEVICE="arm64 armv7" BUILD_ARCHS_SIMULATOR="x86_64 i386" -BUILD_ARCHS_ALL=(armv7 armv7s arm64 x86_64 i386) +BUILD_ARCHS_ALL=(armv7 arm64 x86_64 i386) CPP_DEV_TARGET_LIST=(miphoneos-version-min mios-simulator-version-min) CPP_DEV_TARGET= @@ -55,12 +55,14 @@ build_arch() echo '[!] Target SDK set to DEVICE.' fi - unset DEVROOT SDKROOT CFLAGS LDFLAGS CPPFLAGS CXXFLAGS - + unset CC CPP DEVROOT SDKROOT CFLAGS LDFLAGS CPPFLAGS CXXFLAGS + + export CC="$(xcrun -sdk iphoneos -find clang)" + export CPP="$CC -E" export DEVROOT=$XCODE_ROOT_DIR/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 LDFLAGS="-L$SDKROOT/usr/lib/" + export CFLAGS="-arch $1 -pipe -no-cpp-precomp -stdlib=$CPP_STD_LIB -isysroot $SDKROOT -I$SDKROOT/usr/include/ -miphoneos-version-min=$IOS_SDK_TARGET" + export LDFLAGS="-arch $1 -isysroot $SDKROOT -L$SDKROOT/usr/lib/" export CPPFLAGS=$CFLAGS export CXXFLAGS="$CFLAGS -std=$CPP_STD" @@ -74,15 +76,9 @@ build_arch() $XCODE_ROOT_DIR/usr/bin/make assimp -j 8 -l echo "[!] Moving built libraries into: $BUILD_DIR/$1/" - - if [[ "$BUILD_SHARED_LIBS" =~ "ON" ]]; then - mv ./lib/libassimp*.dylib $BUILD_DIR/$1/ - else - mv ./lib/libassimp.a $BUILD_DIR/$1/ - fi - - mv ./lib/libIrrXML.a $BUILD_DIR/$1/ - mv ./lib/libzlibstatic.a $BUILD_DIR/$1/ + + mv ./lib/*.dylib $BUILD_DIR/$1/ + mv ./lib/*.a $BUILD_DIR/$1/ } echo "[!] $0 - assimp iOS build script" @@ -106,9 +102,9 @@ for i in "$@"; do DEPLOY_ARCHS=`echo $i | sed 's/[-a-zA-Z0-9]*=//'` echo "[!] Selecting architectures: $DEPLOY_ARCHS" ;; - -r=*|--release=*) - BUILD_TYPE=Release - echo "[!] Selecting build type: Release" + -d=*|--debug=*) + BUILD_TYPE=Debug + echo "[!] Selecting build type: Debug" ;; -s=*|--shared-lib=*) BUILD_SHARED_LIBS=ON @@ -120,7 +116,7 @@ for i in "$@"; do ;; -h|--help) echo " - don't build fat library (--no-fat)." - echo " - don't include debug information and apply compiler optimizations (--release)." + echo " - Include debug information and symbols, no compiler optimizations (--debug)." echo " - generate dynamic libraries rather than static ones (--shared-lib)." 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')" From 6e49d288c3798ec62bde337035d96d48438425f8 Mon Sep 17 00:00:00 2001 From: Doron Adler Date: Wed, 30 May 2018 09:40:18 +0300 Subject: [PATCH 11/19] now only x86_64 builds :( --- port/iOS/build.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/port/iOS/build.sh b/port/iOS/build.sh index 9ce8edf6b..d56d4bcf3 100755 --- a/port/iOS/build.sh +++ b/port/iOS/build.sh @@ -28,9 +28,9 @@ IOS_SDK_TARGET=$MIN_IOS_VERSION XCODE_ROOT_DIR=$(xcode-select --print-path) TOOLCHAIN=$XCODE_ROOT_DIR/Toolchains/XcodeDefault.xctoolchain -BUILD_ARCHS_DEVICE="arm64 armv7" +BUILD_ARCHS_DEVICE="arm64 armv7s armv7" BUILD_ARCHS_SIMULATOR="x86_64 i386" -BUILD_ARCHS_ALL=(armv7 arm64 x86_64 i386) +BUILD_ARCHS_ALL=($BUILD_ARCHS_DEVICE $BUILD_ARCHS_SIMULATOR) CPP_DEV_TARGET_LIST=(miphoneos-version-min mios-simulator-version-min) CPP_DEV_TARGET= @@ -55,10 +55,10 @@ build_arch() echo '[!] Target SDK set to DEVICE.' fi - unset CC CPP DEVROOT SDKROOT CFLAGS LDFLAGS CPPFLAGS CXXFLAGS + unset DEVROOT SDKROOT CFLAGS LDFLAGS CPPFLAGS CXXFLAGS - export CC="$(xcrun -sdk iphoneos -find clang)" - export CPP="$CC -E" + #export CC="$(xcrun -sdk iphoneos -find clang)" + #export CPP="$CC -E" export DEVROOT=$XCODE_ROOT_DIR/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 -I$SDKROOT/usr/include/ -miphoneos-version-min=$IOS_SDK_TARGET" @@ -132,7 +132,9 @@ cd ../../ rm -rf $BUILD_DIR for ARCH_TARGET in $DEPLOY_ARCHS; do + echo "Creating folder: $BUILD_DIR/$ARCH_TARGET" mkdir -p $BUILD_DIR/$ARCH_TARGET + echo "Building for arc: $ARCH_TARGET" build_arch $ARCH_TARGET #rm ./lib/libassimp.a done From 5428fa6dd5f5daf018934265078d20ef4b0349a3 Mon Sep 17 00:00:00 2001 From: Doron Adler Date: Wed, 27 Jun 2018 11:39:14 +0300 Subject: [PATCH 12/19] Norod: Managed to get it past the make file creation phase --- CMakeLists.txt | 2 ++ port/iOS/IPHONEOS_ARM64_TOOLCHAIN.cmake | 9 ++++----- port/iOS/IPHONEOS_ARMV6_TOOLCHAIN.cmake | 9 ++++----- port/iOS/IPHONEOS_ARMV7S_TOOLCHAIN.cmake | 9 ++++----- port/iOS/IPHONEOS_ARMV7_TOOLCHAIN.cmake | 9 ++++----- port/iOS/IPHONEOS_I386_TOOLCHAIN.cmake | 9 ++++----- port/iOS/IPHONEOS_X86_64_TOOLCHAIN.cmake | 9 ++++----- port/iOS/build.sh | 11 +++++++---- 8 files changed, 33 insertions(+), 34 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b9f42eaf1..8367e2bc5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -420,7 +420,9 @@ IF ( ASSIMP_BUILD_ASSIMP_TOOLS ) ENDIF ( WIN32 AND DirectX_D3DX9_LIBRARY ) ADD_SUBDIRECTORY( tools/assimp_cmd/ ) +IF (NOT IOS) ADD_SUBDIRECTORY( tools/assimp_qt_viewer/ ) +ENDIF (NOT IOS) ENDIF ( ASSIMP_BUILD_ASSIMP_TOOLS ) IF ( ASSIMP_BUILD_SAMPLES) diff --git a/port/iOS/IPHONEOS_ARM64_TOOLCHAIN.cmake b/port/iOS/IPHONEOS_ARM64_TOOLCHAIN.cmake index e37045cf4..0f476f11f 100644 --- a/port/iOS/IPHONEOS_ARM64_TOOLCHAIN.cmake +++ b/port/iOS/IPHONEOS_ARM64_TOOLCHAIN.cmake @@ -5,12 +5,11 @@ SET (CMAKE_SYSTEM_NAME "Darwin") SET (CMAKE_SYSTEM_PROCESSOR "arm64") SET (IOS TRUE) -SET (CC "${DEVROOT}/usr/bin/clang") -SET (CXX "${DEVROOT}/usr/bin/clang++") +SET (IOS_SDK_DEVICE iPhoneOS) + +SET (SDKVER "${IOS_SDK_VERSION}") +SET (DEVROOT "${XCODE_ROOT_DIR}/Platforms/${IOS_SDK_DEVICE}.platform/Developer") -set(CMAKE_CXX_FLAGS "-Wall -Wextra") -set(CMAKE_CXX_FLAGS_DEBUG "-g") -set(CMAKE_CXX_FLAGS_RELEASE "-O3") SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}") SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) diff --git a/port/iOS/IPHONEOS_ARMV6_TOOLCHAIN.cmake b/port/iOS/IPHONEOS_ARMV6_TOOLCHAIN.cmake index 47ac79481..2f5d96929 100644 --- a/port/iOS/IPHONEOS_ARMV6_TOOLCHAIN.cmake +++ b/port/iOS/IPHONEOS_ARMV6_TOOLCHAIN.cmake @@ -5,12 +5,11 @@ SET (CMAKE_SYSTEM_NAME "Darwin") SET (CMAKE_SYSTEM_PROCESSOR "armv6") SET (IOS TRUE) -SET (CC "${DEVROOT}/usr/bin/clang") -SET (CXX "${DEVROOT}/usr/bin/clang++") +SET (IOS_SDK_DEVICE iPhoneOS) + +SET (SDKVER "${IOS_SDK_VERSION}") +SET (DEVROOT "${XCODE_ROOT_DIR}/Platforms/${IOS_SDK_DEVICE}.platform/Developer") -set(CMAKE_CXX_FLAGS "-Wall -Wextra") -set(CMAKE_CXX_FLAGS_DEBUG "-g") -set(CMAKE_CXX_FLAGS_RELEASE "-O3") SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}") SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) diff --git a/port/iOS/IPHONEOS_ARMV7S_TOOLCHAIN.cmake b/port/iOS/IPHONEOS_ARMV7S_TOOLCHAIN.cmake index 44f58e091..325d48315 100644 --- a/port/iOS/IPHONEOS_ARMV7S_TOOLCHAIN.cmake +++ b/port/iOS/IPHONEOS_ARMV7S_TOOLCHAIN.cmake @@ -5,12 +5,11 @@ SET (CMAKE_SYSTEM_NAME "Darwin") SET (CMAKE_SYSTEM_PROCESSOR "armv7s") SET (IOS TRUE) -SET (CC "${DEVROOT}/usr/bin/clang") -SET (CXX "${DEVROOT}/usr/bin/clang++") +SET (IOS_SDK_DEVICE iPhoneOS) + +SET (SDKVER "${IOS_SDK_VERSION}") +SET (DEVROOT "${XCODE_ROOT_DIR}/Platforms/${IOS_SDK_DEVICE}.platform/Developer") -set(CMAKE_CXX_FLAGS "-Wall -Wextra") -set(CMAKE_CXX_FLAGS_DEBUG "-g") -set(CMAKE_CXX_FLAGS_RELEASE "-O3") SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}") SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) diff --git a/port/iOS/IPHONEOS_ARMV7_TOOLCHAIN.cmake b/port/iOS/IPHONEOS_ARMV7_TOOLCHAIN.cmake index f8e5e8657..73087e06c 100644 --- a/port/iOS/IPHONEOS_ARMV7_TOOLCHAIN.cmake +++ b/port/iOS/IPHONEOS_ARMV7_TOOLCHAIN.cmake @@ -5,12 +5,11 @@ SET (CMAKE_SYSTEM_NAME "Darwin") SET (CMAKE_SYSTEM_PROCESSOR "armv7") SET (IOS TRUE) -SET (CC "${DEVROOT}/usr/bin/clang") -SET (CXX "${DEVROOT}/usr/bin/clang++") +SET (IOS_SDK_DEVICE iPhoneOS) + +SET (SDKVER "${IOS_SDK_VERSION}") +SET (DEVROOT "${XCODE_ROOT_DIR}/Platforms/${IOS_SDK_DEVICE}.platform/Developer") -set(CMAKE_CXX_FLAGS "-Wall -Wextra") -set(CMAKE_CXX_FLAGS_DEBUG "-g") -set(CMAKE_CXX_FLAGS_RELEASE "-O3") SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}") SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) diff --git a/port/iOS/IPHONEOS_I386_TOOLCHAIN.cmake b/port/iOS/IPHONEOS_I386_TOOLCHAIN.cmake index 4b161f33a..dc35d3760 100644 --- a/port/iOS/IPHONEOS_I386_TOOLCHAIN.cmake +++ b/port/iOS/IPHONEOS_I386_TOOLCHAIN.cmake @@ -5,12 +5,11 @@ SET (CMAKE_SYSTEM_NAME "Darwin") SET (CMAKE_SYSTEM_PROCESSOR "i386") SET (IOS TRUE) -SET (CC "${DEVROOT}/usr/bin/clang") -SET (CXX "${DEVROOT}/usr/bin/clang++") +SET (IOS_SDK_DEVICE iPhoneSimulator) + +SET (SDKVER "${IOS_SDK_VERSION}") +SET (DEVROOT "${XCODE_ROOT_DIR}/Platforms/${IOS_SDK_DEVICE}.platform/Developer") -set(CMAKE_CXX_FLAGS "-Wall -Wextra") -set(CMAKE_CXX_FLAGS_DEBUG "-g") -set(CMAKE_CXX_FLAGS_RELEASE "-O3") SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}") SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) diff --git a/port/iOS/IPHONEOS_X86_64_TOOLCHAIN.cmake b/port/iOS/IPHONEOS_X86_64_TOOLCHAIN.cmake index 07c103174..a9ed2b898 100644 --- a/port/iOS/IPHONEOS_X86_64_TOOLCHAIN.cmake +++ b/port/iOS/IPHONEOS_X86_64_TOOLCHAIN.cmake @@ -5,12 +5,11 @@ SET (CMAKE_SYSTEM_NAME "Darwin") SET (CMAKE_SYSTEM_PROCESSOR "x86_64") SET (IOS TRUE) -SET (CC "${DEVROOT}/usr/bin/clang") -SET (CXX "${DEVROOT}/usr/bin/clang++") +SET (IOS_SDK_DEVICE iPhoneSimulator) + +SET (SDKVER "${IOS_SDK_VERSION}") +SET (DEVROOT "${XCODE_ROOT_DIR}/Platforms/${IOS_SDK_DEVICE}.platform/Developer") -set(CMAKE_CXX_FLAGS "-Wall -Wextra") -set(CMAKE_CXX_FLAGS_DEBUG "-g") -set(CMAKE_CXX_FLAGS_RELEASE "-O3") SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}") SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) diff --git a/port/iOS/build.sh b/port/iOS/build.sh index d56d4bcf3..a4e8bb052 100755 --- a/port/iOS/build.sh +++ b/port/iOS/build.sh @@ -28,6 +28,9 @@ IOS_SDK_TARGET=$MIN_IOS_VERSION XCODE_ROOT_DIR=$(xcode-select --print-path) TOOLCHAIN=$XCODE_ROOT_DIR/Toolchains/XcodeDefault.xctoolchain +CMAKE_C_COMPILER=$(xcrun -find cc) +CMAKE_CXX_COMPILER=$(xcrun -find c++) + BUILD_ARCHS_DEVICE="arm64 armv7s armv7" BUILD_ARCHS_SIMULATOR="x86_64 i386" BUILD_ARCHS_ALL=($BUILD_ARCHS_DEVICE $BUILD_ARCHS_SIMULATOR) @@ -37,7 +40,7 @@ CPP_DEV_TARGET= CPP_STD_LIB_LIST=(libc++ libstdc++) CPP_STD_LIB= CPP_STD_LIST=(c++11 c++14) -CPP_STD= +CPP_STD=c++11 function join { local IFS="$1"; shift; echo "$*"; } @@ -68,12 +71,12 @@ build_arch() rm CMakeCache.txt - cmake -G 'Unix Makefiles' -DCMAKE_TOOLCHAIN_FILE=./port/iOS/IPHONEOS_$(echo $1 | tr '[:lower:]' '[:upper:]')_TOOLCHAIN.cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DENABLE_BOOST_WORKAROUND=ON -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS + cmake -G 'Unix Makefiles' -DCMAKE_C_COMPILER=$CMAKE_C_COMPILER -DCMAKE_CXX_COMPILER=$CMAKE_CXX_COMPILER -DCMAKE_TOOLCHAIN_FILE=./port/iOS/IPHONEOS_$(echo $1 | tr '[:lower:]' '[:upper:]')_TOOLCHAIN.cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DENABLE_BOOST_WORKAROUND=ON -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS echo "[!] Building $1 library" - $XCODE_ROOT_DIR/usr/bin/make clean - $XCODE_ROOT_DIR/usr/bin/make assimp -j 8 -l + xcrun -run make clean + xcrun -run make assimp -j 8 -l echo "[!] Moving built libraries into: $BUILD_DIR/$1/" From 35871b6c37743d2d6482b1a605b6d71978a21214 Mon Sep 17 00:00:00 2001 From: Doron Adler Date: Wed, 27 Jun 2018 13:04:49 +0300 Subject: [PATCH 13/19] Use -g or -O3 based on debug/release --- CMakeLists.txt | 11 +++++++++-- port/iOS/build.sh | 12 ++++++++---- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8367e2bc5..e277441fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -226,11 +226,18 @@ ELSEIF( CMAKE_COMPILER_IS_MINGW ) ADD_DEFINITIONS( -U__STRICT_ANSI__ ) ENDIF() -IF (IOS) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fembed-bitcode -O3") +IF ( IOS ) + +IF (CMAKE_BUILD_TYPE STREQUAL "Debug") + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fembed-bitcode -g") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fembed-bitcode -g") +ELSE() + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fembed-bitcode -O3") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fembed-bitcode -O3") ENDIF() +ENDIF( IOS ) + IF (ASSIMP_COVERALLS) MESSAGE(STATUS "Coveralls enabled") INCLUDE(Coveralls) diff --git a/port/iOS/build.sh b/port/iOS/build.sh index a4e8bb052..e717c836a 100755 --- a/port/iOS/build.sh +++ b/port/iOS/build.sh @@ -58,7 +58,7 @@ build_arch() echo '[!] Target SDK set to DEVICE.' fi - unset DEVROOT SDKROOT CFLAGS LDFLAGS CPPFLAGS CXXFLAGS + unset DEVROOT SDKROOT CFLAGS LDFLAGS CPPFLAGS CXXFLAGS CMAKE_CLI_INPUT #export CC="$(xcrun -sdk iphoneos -find clang)" #export CPP="$CC -E" @@ -66,12 +66,16 @@ build_arch() 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 -I$SDKROOT/usr/include/ -miphoneos-version-min=$IOS_SDK_TARGET" export LDFLAGS="-arch $1 -isysroot $SDKROOT -L$SDKROOT/usr/lib/" - export CPPFLAGS=$CFLAGS + export CPPFLAGS="$CFLAGS" export CXXFLAGS="$CFLAGS -std=$CPP_STD" rm CMakeCache.txt - - cmake -G 'Unix Makefiles' -DCMAKE_C_COMPILER=$CMAKE_C_COMPILER -DCMAKE_CXX_COMPILER=$CMAKE_CXX_COMPILER -DCMAKE_TOOLCHAIN_FILE=./port/iOS/IPHONEOS_$(echo $1 | tr '[:lower:]' '[:upper:]')_TOOLCHAIN.cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DENABLE_BOOST_WORKAROUND=ON -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS + + CMAKE_CLI_INPUT="-DCMAKE_C_COMPILER=$CMAKE_C_COMPILER -DCMAKE_CXX_COMPILER=$CMAKE_CXX_COMPILER -DCMAKE_TOOLCHAIN_FILE=./port/iOS/IPHONEOS_$(echo $1 | tr '[:lower:]' '[:upper:]')_TOOLCHAIN.cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DENABLE_BOOST_WORKAROUND=ON -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS" + + echo "[!] Running CMake with -G 'Unix Makefiles' $CMAKE_CLI_INPUT" + + cmake -G 'Unix Makefiles' ${CMAKE_CLI_INPUT} echo "[!] Building $1 library" From d79a82faa23947298f3a9ce66cd946c0fe834830 Mon Sep 17 00:00:00 2001 From: Doron Adler Date: Wed, 27 Jun 2018 13:10:41 +0300 Subject: [PATCH 14/19] -Og for debug --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e277441fa..f4c59c042 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -229,8 +229,8 @@ ENDIF() IF ( IOS ) IF (CMAKE_BUILD_TYPE STREQUAL "Debug") - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fembed-bitcode -g") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fembed-bitcode -g") + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fembed-bitcode -Og") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fembed-bitcode -Og") ELSE() SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fembed-bitcode -O3") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fembed-bitcode -O3") From 1b7f3de6360bee065e1405e8c9a5b454753fbb62 Mon Sep 17 00:00:00 2001 From: Doron Adler Date: Wed, 27 Jun 2018 13:26:01 +0300 Subject: [PATCH 15/19] assimp will now be correctly built with -O3 or -Og based on build type --- port/iOS/build.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/port/iOS/build.sh b/port/iOS/build.sh index e717c836a..8167c1e0c 100755 --- a/port/iOS/build.sh +++ b/port/iOS/build.sh @@ -65,6 +65,11 @@ build_arch() export DEVROOT=$XCODE_ROOT_DIR/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 -I$SDKROOT/usr/include/ -miphoneos-version-min=$IOS_SDK_TARGET" + if [[ "$BUILD_TYPE" =~ "Debug" ]]; then + export CFLAGS="$CFLAGS -Og" + else + export CFLAGS="$CFLAGS -O3" + fi export LDFLAGS="-arch $1 -isysroot $SDKROOT -L$SDKROOT/usr/lib/" export CPPFLAGS="$CFLAGS" export CXXFLAGS="$CFLAGS -std=$CPP_STD" @@ -80,12 +85,15 @@ build_arch() echo "[!] Building $1 library" xcrun -run make clean - xcrun -run make assimp -j 8 -l - - echo "[!] Moving built libraries into: $BUILD_DIR/$1/" + xcrun -run make assimp -j 8 -l - mv ./lib/*.dylib $BUILD_DIR/$1/ - mv ./lib/*.a $BUILD_DIR/$1/ + if [[ "$BUILD_SHARED_LIBS" =~ "ON" ]]; then + echo "[!] Moving built dynamic libraries into: $BUILD_DIR/$1/" + mv ./lib/*.dylib $BUILD_DIR/$1/ + else + echo "[!] Moving built static libraries into: $BUILD_DIR/$1/" + mv ./lib/*.a $BUILD_DIR/$1/ + fi } echo "[!] $0 - assimp iOS build script" From 6e346a5504aed0938a3eb723643f43b635f16617 Mon Sep 17 00:00:00 2001 From: Doron Adler Date: Sun, 1 Jul 2018 11:35:56 +0300 Subject: [PATCH 16/19] Added comment --- code/TriangulateProcess.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/TriangulateProcess.cpp b/code/TriangulateProcess.cpp index 134d1ed41..a0bcd9a45 100644 --- a/code/TriangulateProcess.cpp +++ b/code/TriangulateProcess.cpp @@ -287,6 +287,8 @@ bool TriangulateProcess::TriangulateMesh( aiMesh* pMesh) // We project it onto a plane to get a 2d triangle. // Collect all vertices of of the polygon. + // size of temp_verts3d is (max_out+2); + // max = (int)face.mNumIndices int smallerMax = (max<=((int)max_out+2))?(max):((int)max_out+2); for (tmp = 0; tmp < smallerMax; ++tmp) { temp_verts3d[tmp] = verts[idx[tmp]]; From 6a45f84b7308b1fe00904298a9bdc7f40c9c93e9 Mon Sep 17 00:00:00 2001 From: Doron Adler Date: Sun, 1 Jul 2018 13:10:44 +0300 Subject: [PATCH 17/19] Revert --- CMakeLists.txt | 6 ------ code/TriangulateProcess.cpp | 5 +---- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f4c59c042..d799c71f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,10 +40,6 @@ PROJECT( Assimp ) # All supported options ############################################### -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE "Release") -endif() - OPTION( BUILD_SHARED_LIBS "Build package with shared libraries." ON @@ -340,9 +336,7 @@ ENDIF(NOT ZLIB_FOUND) INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) # Search for unzip -IF (NOT IOS) use_pkgconfig(UNZIP minizip) -ENDIF (NOT IOS) IF ( ASSIMP_NO_EXPORT ) ADD_DEFINITIONS( -DASSIMP_BUILD_NO_EXPORT) diff --git a/code/TriangulateProcess.cpp b/code/TriangulateProcess.cpp index a0bcd9a45..f8202b3d3 100644 --- a/code/TriangulateProcess.cpp +++ b/code/TriangulateProcess.cpp @@ -287,10 +287,7 @@ bool TriangulateProcess::TriangulateMesh( aiMesh* pMesh) // We project it onto a plane to get a 2d triangle. // Collect all vertices of of the polygon. - // size of temp_verts3d is (max_out+2); - // max = (int)face.mNumIndices - int smallerMax = (max<=((int)max_out+2))?(max):((int)max_out+2); - for (tmp = 0; tmp < smallerMax; ++tmp) { + for (tmp = 0; tmp < max; ++tmp) { temp_verts3d[tmp] = verts[idx[tmp]]; } From 5b20ad3791413d3351c26b71103b20ba8cc2aa4e Mon Sep 17 00:00:00 2001 From: Doron Adler Date: Sun, 1 Jul 2018 14:48:20 +0300 Subject: [PATCH 18/19] Fixed a mistake I Introduced in the build script where debug and shared-lib parameters were expecting a "=" Revert to default Release build type, but this time only for iOS Do not attempt to use minizip if you are building for iOS shared dylib Keep in mind that the "Shared" option only apply to the assimp library and not the other two built libraries --- CMakeLists.txt | 14 +++++++++++++- port/iOS/build.sh | 37 ++++++++++++++++++++++++++----------- 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d799c71f1..66d9ced4d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,6 +106,12 @@ OPTION ( BUILD_DOCS OFF ) +IF (IOS) + IF (NOT CMAKE_BUILD_TYPE) + SET(CMAKE_BUILD_TYPE "Release") + ENDIF (NOT CMAKE_BUILD_TYPE) +ENDIF (IOS) + # Use subset of Windows.h if (WIN32) ADD_DEFINITIONS( -DWIN32_LEAN_AND_MEAN ) @@ -336,7 +342,13 @@ ENDIF(NOT ZLIB_FOUND) INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) # Search for unzip -use_pkgconfig(UNZIP minizip) +IF ( NOT IOS ) + use_pkgconfig(UNZIP minizip) +ELSE ( NOT IOS ) + IF(NOT BUILD_SHARED_LIBS) + use_pkgconfig(UNZIP minizip) + ENDIF (NOT BUILD_SHARED_LIBS) +ENDIF ( NOT IOS ) IF ( ASSIMP_NO_EXPORT ) ADD_DEFINITIONS( -DASSIMP_BUILD_NO_EXPORT) diff --git a/port/iOS/build.sh b/port/iOS/build.sh index 8167c1e0c..5f0abfdb9 100755 --- a/port/iOS/build.sh +++ b/port/iOS/build.sh @@ -90,10 +90,10 @@ build_arch() if [[ "$BUILD_SHARED_LIBS" =~ "ON" ]]; then echo "[!] Moving built dynamic libraries into: $BUILD_DIR/$1/" mv ./lib/*.dylib $BUILD_DIR/$1/ - else - echo "[!] Moving built static libraries into: $BUILD_DIR/$1/" - mv ./lib/*.a $BUILD_DIR/$1/ - fi + fi + + echo "[!] Moving built static libraries into: $BUILD_DIR/$1/" + mv ./lib/*.a $BUILD_DIR/$1/ } echo "[!] $0 - assimp iOS build script" @@ -117,11 +117,11 @@ for i in "$@"; do DEPLOY_ARCHS=`echo $i | sed 's/[-a-zA-Z0-9]*=//'` echo "[!] Selecting architectures: $DEPLOY_ARCHS" ;; - -d=*|--debug=*) + --debug) BUILD_TYPE=Debug echo "[!] Selecting build type: Debug" ;; - -s=*|--shared-lib=*) + --shared-lib) BUILD_SHARED_LIBS=ON echo "[!] Will generate dynamic libraries" ;; @@ -155,7 +155,7 @@ for ARCH_TARGET in $DEPLOY_ARCHS; do done -make_fat_binary() +make_fat_static_or_shared_binary() { LIB_NAME=$1 LIPO_ARGS='' @@ -166,16 +166,31 @@ make_fat_binary() LIPO_ARGS="$LIPO_ARGS-arch $ARCH_TARGET $BUILD_DIR/$ARCH_TARGET/$LIB_NAME.a " fi done - LIPO_ARGS="$LIPO_ARGS-create -output $BUILD_DIR/$LIB_NAME-fat.a" + if [[ "$BUILD_SHARED_LIBS" =~ "ON" ]]; then + LIPO_ARGS="$LIPO_ARGS -create -output $BUILD_DIR/$LIB_NAME-fat.dylib" + else + LIPO_ARGS="$LIPO_ARGS -create -output $BUILD_DIR/$LIB_NAME-fat.a" + fi + lipo $LIPO_ARGS +} + +make_fat_static_binary() +{ + LIB_NAME=$1 + LIPO_ARGS='' + for ARCH_TARGET in $DEPLOY_ARCHS; do + LIPO_ARGS="$LIPO_ARGS-arch $ARCH_TARGET $BUILD_DIR/$ARCH_TARGET/$LIB_NAME.a " + done + LIPO_ARGS="$LIPO_ARGS -create -output $BUILD_DIR/$LIB_NAME-fat.a" lipo $LIPO_ARGS } if [[ "$DEPLOY_FAT" -eq 1 ]]; then echo '[+] Creating fat binaries ...' - make_fat_binary 'libassimp' - make_fat_binary 'libIrrXML' - make_fat_binary 'libzlibstatic' + make_fat_static_or_shared_binary 'libassimp' + make_fat_static_binary 'libIrrXML' + make_fat_static_binary 'libzlibstatic' echo "[!] Done! The fat binaries can be found at $BUILD_DIR" fi From 0adc793eb4dec468acf8e67af36b6bd2e9f7692c Mon Sep 17 00:00:00 2001 From: Doron Adler Date: Sun, 1 Jul 2018 14:53:05 +0300 Subject: [PATCH 19/19] Lipo the debug binaries by appending d to their name --- port/iOS/build.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/port/iOS/build.sh b/port/iOS/build.sh index 5f0abfdb9..288c9c4a4 100755 --- a/port/iOS/build.sh +++ b/port/iOS/build.sh @@ -188,9 +188,15 @@ make_fat_static_binary() if [[ "$DEPLOY_FAT" -eq 1 ]]; then echo '[+] Creating fat binaries ...' - make_fat_static_or_shared_binary 'libassimp' - make_fat_static_binary 'libIrrXML' - make_fat_static_binary 'libzlibstatic' + if [[ "$BUILD_TYPE" =~ "Debug" ]]; then + make_fat_static_or_shared_binary 'libassimpd' + make_fat_static_binary 'libIrrXMLd' + make_fat_static_binary 'libzlibstaticd' + else + make_fat_static_or_shared_binary 'libassimp' + make_fat_static_binary 'libIrrXML' + make_fat_static_binary 'libzlibstatic' + fi echo "[!] Done! The fat binaries can be found at $BUILD_DIR" fi