Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: ac423e4a19
Fetching contributors…

Cannot retrieve contributors at this time

94 lines (80 sloc) 2.374 kb
#!/bin/bash -x -e
#
# Script to cross compile PS Move API for Windows on a Linux host
# Thomas Perl <m@thp.io>; 2012-09-27
#
# Dependencies (Ubuntu/Debian):
#
# sudo apt-get install mingw-w64 g++-mingw-w64
#
export PSMOVEAPI_CHECKOUT=$(pwd)
export TOOLCHAIN=$PSMOVEAPI_CHECKOUT/contrib/toolchain-mingw64.cmake
export OPENCV_CHECKOUT_DIR=$PSMOVEAPI_CHECKOUT/opencv
export OPENCV_INSTALL_DIR=$OPENCV_CHECKOUT_DIR/build/install
# For parallel builds
MAKE_ARGS=-j4
# Take version from Debian package info
PSMOVEAPI_VERSION=$(dpkg-parsechangelog | grep ^Version: | cut -d' ' -f2-)
# Git revision identifier
PSMOVEAPI_REVISION=$(git show-ref --hash=8 HEAD)
if [ ! -f $PSMOVEAPI_CHECKOUT/CMakeLists.txt ]; then
echo "ERROR: You have to run this script in the PS Move API source root."
exit 1
fi
# Build OpenCV
if [ ! -d $OPENCV_INSTALL_DIR ]; then
if [ ! -d opencv ]; then
git clone git://code.opencv.org/opencv.git
fi
cd opencv
rm -rf build
mkdir -p build
cd build
cmake -DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN \
-DBUILD_SHARED_LIBS=OFF \
-DBUILD_PERF_TESTS=OFF \
-DBUILD_TESTS=OFF \
-DBUILD_DOCS=OFF \
-DBUILD_opencv_flann=OFF \
-DBUILD_opencv_features2d=OFF \
-DBUILD_opencv_objdetect=OFF \
-DBUILD_opencv_photo=OFF \
-DBUILD_opencv_ts=OFF \
-DBUILD_opencv_ml=OFF \
-DBUILD_opencv_video=OFF \
-DWITH_OPENEXR=OFF \
-DWITH_FFMPEG=OFF \
-DWITH_JASPER=OFF \
-DWITH_TIFF=OFF \
..
make ${MAKE_ARGS}
make install
fi
cd $PSMOVEAPI_CHECKOUT
# Build PS Move API
rm -rf build
mkdir build
cd build
cmake -DPSMOVE_USE_LOCAL_OPENCV=ON \
-DPSMOVE_BUILD_TRACKER=OFF \
-DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN ..
make ${MAKE_ARGS}
cd $PSMOVEAPI_CHECKOUT
# Packaging
rm -rf dist
mkdir -p dist/bin
echo $PSMOVEAPI_REVISION >dist/revision.txt
cp README COPYING dist/
cp build/*.exe dist/bin/
cp build/libpsmoveapi.dll dist/bin/
cp build/libpsmoveapi_tracker.dll dist/bin/
mkdir -p dist/include
cp include/*.h dist/include/
cd $PSMOVEAPI_CHECKOUT
# Zip it up
PACKAGE_NAME=psmoveapi_${PSMOVEAPI_VERSION}~$(date +%F)+${PSMOVEAPI_REVISION}_win32
rm -rf $PACKAGE_NAME
mv dist $PACKAGE_NAME
mkdir -p upload
zip -r upload/${PACKAGE_NAME}.zip $PACKAGE_NAME
rm -rf $PACKAGE_NAME
Jump to Line
Something went wrong with that request. Please try again.