####### configuration for OCCT #######

################# iOS: ####
cmake -DCMAKE_TOOLCHAIN_FILE=~/src/gmsh/contrib/mobile/utils/iOS.cmake -DAppkit_LIB="" -DOpenGlLibs_LIB="" -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_SIZEOF_VOID_P=8 -GXcode -DBUILD_MODULE_Draw=0 -DBUILD_MODULE_Visualization=0 -DBUILD_LIBRARY_TYPE=Static -DCMAKE_INSTALL_PREFIX=~/occt_build_install_ios ..

xcodebuild -target install -configuration Release OTHER_CFLAGS="-target arm64-apple-ios9.0 -fembed-bitcode" OTHER_CPLUSPLUSFLAGS="-target arm64-apple-ios9.0 -fembed-bitcode -std=c++11"

# Then
#  1) mv ~/occt_build_install_ios/include/opencascade OCCT-XXX.framework/Header
#  2) cd ~/occt_build_install_ios/lib
#     merge_static_libs.sh *.a
#     mv lib_combined.a ~/src/gmsh/contrib/mobile/frameworks_ios/OCCT-XXX.framework/OCCT

################## iOS Simulator: ####
cmake -DCMAKE_TOOLCHAIN_FILE=~/src/gmsh/contrib/mobile/utils/iOS.cmake -DAppkit_LIB="" -DOpenGlLibs_LIB="" -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="x86_64" -DIOS_PLATFORM=SIMULATOR -DCMAKE_SIZEOF_VOID_P=8 -GXcode -DBUILD_MODULE_Draw=0 -DBUILD_MODULE_Visualization=0 -DBUILD_LIBRARY_TYPE=Static -DCMAKE_INSTALL_PREFIX=~/occt_build_install_iossimulator ..

xcodebuild -target install -configuration Release OTHER_CFLAGS="-target arm64-apple-ios9.0 -fembed-bitcode" OTHER_CPLUSPLUSFLAGS="-target arm64-apple-ios9.0 -fembed-bitcode -std=c++11"

# Then do as for ios

################## Android ####
cmake -DCMAKE_TOOLCHAIN_FILE=~/Library/Android/sdk/ndk-bundle/build/cmake/android.toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_MODULE_Draw=0 -DBUILD_MODULE_Visualization=0 -DBUILD_MODULE_ApplicationFramework=0 -DBUILD_LIBRARY_TYPE=Static -DCMAKE_PREFIX_PATH=/opt/local -DANDROID_ABI=arm64-v8a -DCMAKE_INSTALL_PREFIX=~/occt_build_install_android ..

make -j 8 -k install ### -k so that compilation will continue even when linking to freetype fails
