Merge pull request #1598 from talregev/TalR/simplify_scripts
commit
d316c08a0f
|
@ -9,14 +9,13 @@ set -x -e
|
||||||
# install TBB with _debug.so files
|
# install TBB with _debug.so files
|
||||||
function install_tbb()
|
function install_tbb()
|
||||||
{
|
{
|
||||||
|
echo install_tbb
|
||||||
if [ "$(uname)" == "Linux" ]; then
|
if [ "$(uname)" == "Linux" ]; then
|
||||||
sudo apt-get -y install libtbb-dev
|
sudo apt-get -y install libtbb-dev
|
||||||
|
|
||||||
elif [ "$(uname)" == "Darwin" ]; then
|
elif [ "$(uname)" == "Darwin" ]; then
|
||||||
brew install tbb
|
brew install tbb
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z ${PYTHON_VERSION+x} ]; then
|
if [ -z ${PYTHON_VERSION+x} ]; then
|
||||||
|
@ -37,19 +36,19 @@ function install_dependencies()
|
||||||
|
|
||||||
export PATH=$PATH:$($PYTHON -c "import site; print(site.USER_BASE)")/bin
|
export PATH=$PATH:$($PYTHON -c "import site; print(site.USER_BASE)")/bin
|
||||||
|
|
||||||
[ "${GTSAM_WITH_TBB:-OFF}" = "ON" ] && install_tbb
|
if [ "${GTSAM_WITH_TBB:-OFF}" == "ON" ]; then
|
||||||
|
install_tbb
|
||||||
|
fi
|
||||||
|
|
||||||
$PYTHON -m pip install -r $GITHUB_WORKSPACE/python/requirements.txt
|
$PYTHON -m pip install -r $GITHUB_WORKSPACE/python/requirements.txt
|
||||||
}
|
}
|
||||||
|
|
||||||
function build()
|
function build()
|
||||||
{
|
{
|
||||||
mkdir $GITHUB_WORKSPACE/build
|
|
||||||
cd $GITHUB_WORKSPACE/build
|
|
||||||
|
|
||||||
BUILD_PYBIND="ON"
|
BUILD_PYBIND="ON"
|
||||||
|
cmake $GITHUB_WORKSPACE \
|
||||||
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \
|
-B build \
|
||||||
|
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \
|
||||||
-DGTSAM_BUILD_TESTS=OFF \
|
-DGTSAM_BUILD_TESTS=OFF \
|
||||||
-DGTSAM_BUILD_UNSTABLE=${GTSAM_BUILD_UNSTABLE:-ON} \
|
-DGTSAM_BUILD_UNSTABLE=${GTSAM_BUILD_UNSTABLE:-ON} \
|
||||||
-DGTSAM_USE_QUATERNIONS=OFF \
|
-DGTSAM_USE_QUATERNIONS=OFF \
|
||||||
|
@ -65,16 +64,16 @@ function build()
|
||||||
|
|
||||||
|
|
||||||
# Set to 2 cores so that Actions does not error out during resource provisioning.
|
# Set to 2 cores so that Actions does not error out during resource provisioning.
|
||||||
make -j2 install
|
cmake --build build -j2
|
||||||
|
|
||||||
cd $GITHUB_WORKSPACE/build/python
|
$PYTHON -m pip install --user build/python
|
||||||
$PYTHON -m pip install --user .
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function test()
|
function test()
|
||||||
{
|
{
|
||||||
cd $GITHUB_WORKSPACE/python/gtsam/tests
|
cd $GITHUB_WORKSPACE/python/gtsam/tests
|
||||||
$PYTHON -m unittest discover -v
|
$PYTHON -m unittest discover -v
|
||||||
|
cd $GITHUB_WORKSPACE
|
||||||
}
|
}
|
||||||
|
|
||||||
# select between build or test
|
# select between build or test
|
||||||
|
|
|
@ -5,33 +5,30 @@
|
||||||
# Specifically Linux and macOS.
|
# Specifically Linux and macOS.
|
||||||
##########################################################
|
##########################################################
|
||||||
|
|
||||||
|
set -e # Make sure any error makes the script to return an error code
|
||||||
|
set -x # echo
|
||||||
|
|
||||||
# install TBB with _debug.so files
|
# install TBB with _debug.so files
|
||||||
function install_tbb()
|
function install_tbb()
|
||||||
{
|
{
|
||||||
|
echo install_tbb
|
||||||
if [ "$(uname)" == "Linux" ]; then
|
if [ "$(uname)" == "Linux" ]; then
|
||||||
sudo apt-get -y install libtbb-dev
|
sudo apt-get -y install libtbb-dev
|
||||||
|
|
||||||
elif [ "$(uname)" == "Darwin" ]; then
|
elif [ "$(uname)" == "Darwin" ]; then
|
||||||
brew install tbb
|
brew install tbb
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# common tasks before either build or test
|
# common tasks before either build or test
|
||||||
function configure()
|
function configure()
|
||||||
{
|
{
|
||||||
set -e # Make sure any error makes the script to return an error code
|
# delete old build
|
||||||
set -x # echo
|
rm -rf build
|
||||||
|
|
||||||
SOURCE_DIR=$GITHUB_WORKSPACE
|
if [ "${GTSAM_WITH_TBB:-OFF}" == "ON" ]; then
|
||||||
BUILD_DIR=$GITHUB_WORKSPACE/build
|
install_tbb
|
||||||
|
fi
|
||||||
#env
|
|
||||||
rm -fr $BUILD_DIR || true
|
|
||||||
mkdir $BUILD_DIR && cd $BUILD_DIR
|
|
||||||
|
|
||||||
[ "${GTSAM_WITH_TBB:-OFF}" = "ON" ] && install_tbb
|
|
||||||
|
|
||||||
if [ ! -z "$GCC_VERSION" ]; then
|
if [ ! -z "$GCC_VERSION" ]; then
|
||||||
export CC=gcc-$GCC_VERSION
|
export CC=gcc-$GCC_VERSION
|
||||||
|
@ -40,7 +37,8 @@ function configure()
|
||||||
|
|
||||||
# GTSAM_BUILD_WITH_MARCH_NATIVE=OFF: to avoid crashes in builder VMs
|
# GTSAM_BUILD_WITH_MARCH_NATIVE=OFF: to avoid crashes in builder VMs
|
||||||
# CMAKE_CXX_FLAGS="-w": Suppress warnings to avoid IO latency in CI logs
|
# CMAKE_CXX_FLAGS="-w": Suppress warnings to avoid IO latency in CI logs
|
||||||
cmake $SOURCE_DIR \
|
cmake $GITHUB_WORKSPACE \
|
||||||
|
-B build \
|
||||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Debug} \
|
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Debug} \
|
||||||
-DCMAKE_CXX_FLAGS="-w" \
|
-DCMAKE_CXX_FLAGS="-w" \
|
||||||
-DGTSAM_BUILD_TESTS=${GTSAM_BUILD_TESTS:-OFF} \
|
-DGTSAM_BUILD_TESTS=${GTSAM_BUILD_TESTS:-OFF} \
|
||||||
|
@ -62,9 +60,9 @@ function configure()
|
||||||
function finish ()
|
function finish ()
|
||||||
{
|
{
|
||||||
# Print ccache stats
|
# Print ccache stats
|
||||||
[ -x "$(command -v ccache)" ] && ccache -s
|
if [ -x "$(command -v ccache)" ]; then
|
||||||
|
ccache -s
|
||||||
cd $SOURCE_DIR
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# compile the code with the intent of populating the cache
|
# compile the code with the intent of populating the cache
|
||||||
|
@ -77,12 +75,12 @@ function build ()
|
||||||
|
|
||||||
if [ "$(uname)" == "Linux" ]; then
|
if [ "$(uname)" == "Linux" ]; then
|
||||||
if (($(nproc) > 2)); then
|
if (($(nproc) > 2)); then
|
||||||
make -j4
|
cmake --build build -j4
|
||||||
else
|
else
|
||||||
make -j2
|
cmake --build build -j2
|
||||||
fi
|
fi
|
||||||
elif [ "$(uname)" == "Darwin" ]; then
|
elif [ "$(uname)" == "Darwin" ]; then
|
||||||
make -j$(sysctl -n hw.physicalcpu)
|
cmake --build build -j$(sysctl -n hw.physicalcpu)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
finish
|
finish
|
||||||
|
@ -99,12 +97,12 @@ function test ()
|
||||||
# Actual testing
|
# Actual testing
|
||||||
if [ "$(uname)" == "Linux" ]; then
|
if [ "$(uname)" == "Linux" ]; then
|
||||||
if (($(nproc) > 2)); then
|
if (($(nproc) > 2)); then
|
||||||
make -j$(nproc) check
|
cmake --build build -j$(nproc) --target check
|
||||||
else
|
else
|
||||||
make -j2 check
|
cmake --build build -j2 --target check
|
||||||
fi
|
fi
|
||||||
elif [ "$(uname)" == "Darwin" ]; then
|
elif [ "$(uname)" == "Darwin" ]; then
|
||||||
make -j$(sysctl -n hw.physicalcpu) check
|
cmake --build build -j$(sysctl -n hw.physicalcpu) --target check
|
||||||
fi
|
fi
|
||||||
|
|
||||||
finish
|
finish
|
||||||
|
@ -118,4 +116,4 @@ case $1 in
|
||||||
-t)
|
-t)
|
||||||
test
|
test
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in New Issue