Skip to content

Commit

Permalink
Add build capability for multiple envs
Browse files Browse the repository at this point in the history
  • Loading branch information
ckebschull committed Dec 4, 2024
1 parent 9994297 commit a60bc91
Showing 1 changed file with 33 additions and 15 deletions.
48 changes: 33 additions & 15 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,68 @@
# Define how to build the libraries and executables:
BUILD_TYPE=Debug
Fortran_COMPILER=gfortran
LIBSUFFIX="so"
if [[ "$OSTYPE" == "linux-gnu" ]]; then
LIBSUFFIX="so"
elif [[ "$OSTYPE" == "darwin"* ]]; then
LIBSUFFIX="dylib"
elif [[ "$OSTYPE" == "CYGWIN"* ]]; then
LIBSUFFIX="dll"
elif [[ "$OSTYPE" == "MINGW"* ]]; then
LIBSUFFIX="dll"
elif [[ "$OSTYPE" == "msys"* ]]; then
LIBSUFFIX="dll"
GENERATOR="MSYS Makefiles"
fi
git submodule update --init --recursive
################################################################################
# #
# Build pFUnit #
# #
################################################################################
cd pFUnit || exit
cd pFUnit || exit || exit
# Create the build directory if it does not exist
if [[ ! -d "build" ]]; then
mkdir build
else
rm -rf build/*
fi
cd build || exit
cd build || exit || exit
echo "Updating cmake"
export PFUNIT_DIR=..//pFUnit/build/installed
export FC=$Fortran_COMPILER
cmake -DSKIP_MPI=yes ../
cmake -DSKIP_MPI=yes -G "$GENERATOR" ../
echo "Building pFUnit"
make
make install
cd ../
cmake --build .
cmake --install .
cd ../ || exit || exit
echo "Leaving pFUnit"
cd ../
cd ../ || exit || exit
################################################################################
# #
# Build libslam #
# #
################################################################################
# Create the build directory if it does not exist
if [[ ! -d "build" ]]; then
mkdir build
else
rm -rf build/*
fi
cd build
cd build || exit || exit
echo "Executing cmake"

cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_Fortran_COMPILER=$Fortran_COMPILER -DENABLE_OpenMP_SUPPORT=ON -DENABLE_POSTGRESQL_SUPPORT=ON -DENABLE_PFUNIT=ON ../
echo "Running make install"
make install
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_Fortran_COMPILER=$Fortran_COMPILER -DENABLE_OpenMP_SUPPORT=ON -DENABLE_POSTGRESQL_SUPPORT=ON -DENABLE_PFUNIT=ON -G "$GENERATOR" ../
echo "Building libslam"
cmake --build .
cmake --install .
if [[ $? -ne 0 ]]; then
echo "Could not build libslam. Exiting."
exit $?
fi
echo "Manually preparing 'lib' and 'include' directories"
cd ../
ln -sf build/include include
ln -sf build/lib lib
cd ../ || exit || exit
ln -sf build/include include || exit || exit
ln -sf build/lib lib || exit || exit
echo "Leaving libslam"

echo "Done"

0 comments on commit a60bc91

Please sign in to comment.