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
pull/2045/head
Doron Adler 2018-07-01 14:48:20 +03:00
parent 6a45f84b73
commit 5b20ad3791
2 changed files with 39 additions and 12 deletions

View File

@ -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)

View File

@ -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