Last active
June 10, 2021 10:50
-
-
Save johndpope/d2925bd818897dff337abf1aa6cc6121 to your computer and use it in GitHub Desktop.
libceres.a universal build
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#brew install eigen3 | |
EIGEN_PATH=/opt/local/include/eigen3 | |
# build for device | |
cmake . -DCMAKE_TOOLCHAIN_FILE=./cmake/iOS.cmake -DEIGEN_INCLUDE_DIR=${EIGEN_PATH} -DIOS_PLATFORM=OS -DEIGENSPARSE=ON | |
make -j8 | |
# install headers in .. | |
make install | |
# delete the installed lib (we want a universal one) | |
rm ../lib/libceres.a | |
# build for simulator | |
cmake . -DCMAKE_TOOLCHAIN_FILE=./cmake/iOS.cmake -DEIGEN_INCLUDE_DIR=${EIGEN_PATH} -DEIGENSPARSE=ON -DIOS_PLATFORM=SIMULATOR | |
make -j8 | |
mkdir -p build_simulator | |
cp ./lib/libceres.a ./build_simulator | |
# build for simulator64 | |
cmake . -DCMAKE_TOOLCHAIN_FILE=./cmake/iOS.cmake -DEIGEN_INCLUDE_DIR=${EIGEN_PATH} -DEIGENSPARSE=ON -DIOS_PLATFORM=SIMULATOR64 | |
make -j8 | |
mkdir -p build_simulator64 | |
cp ./lib/libceres.a ./build_simulator64 | |
# create universal library | |
lipo -create build/ build_simulator/lib/libceres.a build_simulator64/lib/libceres.a -output lib/libceres-universal.a | |
# clean up | |
#rm -rf build build_simulator build_simulator64 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment