diff --git a/CMakeLists.txt b/CMakeLists.txt index 3df8ab232..5c1c5cdab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -175,6 +175,7 @@ set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSIO #set(CPACK_INSTALLED_DIRECTORIES ".") # FIXME: throws error set(CPACK_SOURCE_IGNORE_FILES "/build*;/\\\\.;/makestats.sh$") set(CPACK_SOURCE_IGNORE_FILES "${CPACK_SOURCE_IGNORE_FILES}" "/gtsam_unstable/") +set(CPACK_SOURCE_IGNORE_FILES "${CPACK_SOURCE_IGNORE_FILES}" "/package_scripts/") set(CPACK_SOURCE_PACKAGE_FILE_NAME "gtsam-${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH}") #set(CPACK_SOURCE_PACKAGE_FILE_NAME "gtsam-aspn${GTSAM_VERSION_PATCH}") # Used for creating ASPN tarballs diff --git a/package_scripts/toolbox_package_unix.sh b/package_scripts/toolbox_package_unix.sh new file mode 100755 index 000000000..44d0dac87 --- /dev/null +++ b/package_scripts/toolbox_package_unix.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +# Detect platform +os=`uname -s` +arch=`uname -p` +if [ "$os" = "Linux" -a "$arch" = "x86_64" ]; then + platform=lin64 +elif [ "$os" = "Linux" -a "$arch" = "i686" ]; then + platform=lin32 +else + echo "Unrecognized platform" + exit 1 +fi + +echo "Platform is ${platform}" + +# Check for empty directory +if [ ! -z "`ls`" ]; then + echo "Please run this script from an empty build directory" + exit 1 +fi + +# Check for boost +if [ -z "$1" -o -z "$2" ]; then + echo "Usage: $0 BOOSTTREE MEX" + echo "BOOSTTREE should be a boost source tree compiled with toolbox_build_boost." + echo "MEX should be the full path of the mex compiler" + exit 1 +fi + +# Run cmake +cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$PWD/stage" -DBoost_NO_SYSTEM_PATHS:bool=true -DBoost_USE_STATIC_LIBS:bool=true -DBOOST_ROOT="$1" -DGTSAM_BUILD_UNSTABLE:bool=false -DGTSAM_DISABLE_EXAMPLES_ON_INSTALL:bool=true -DGTSAM_DISABLE_TESTS_ON_INSTALL:bool=true -DGTSAM_MEX_BUILD_STATIC_MODULE:bool=true -DMEX_COMMAND="$2" .. + +if [ ! $? ]; then + echo "CMake failed" + exit 1 +fi + +# Compile +make -j4 install + +# Create package +tar czf gtsam-toolbox-2.1.0-$platform.tgz -C stage/borg toolbox