Skip to content

Commit

Permalink
* Added cmake script for simplifying and focusing on cmake builds for…
Browse files Browse the repository at this point in the history
… gams (#90)

* Removed eigen code requirement for base_build and instead just have it installing Eigen. Didn't try this on MPC build, but it's probably a good idea to move away from MPC anyway
* Fixed warnings in cmake build
  • Loading branch information
jredmondson authored Dec 16, 2023
1 parent cd1a894 commit fba3aeb
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 37 deletions.
38 changes: 1 addition & 37 deletions scripts/linux/base_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1206,30 +1206,8 @@ fi

if [ $GAMS -eq 1 ] || [ $EIGEN_AS_A_PREREQ -eq 1 ]; then

cd $INSTALL_DIR
sudo apt install libeigen3-dev

echo "ENTERING $EIGEN_ROOT"
if [ -d $EIGEN_ROOT ]; then
(
cd $EIGEN_ROOT
if git branch | grep "* master"; then
echo "EIGEN IN $EIGEN_ROOT IS MASTER BRANCH"
echo "Deleting and redownloading stable release..."
cd $HOME
rm -rf $EIGEN_ROOT
fi
)
fi
if [ ! -d $EIGEN_ROOT ] ; then
echo "git clone https://gitlab.com/libeigen/eigen.git $EIGEN_ROOT"
git clone https://gitlab.com/libeigen/eigen.git $EIGEN_ROOT
EIGEN_REPO_RESULT=$?
else
echo "UPDATING Eigen"
cd $EIGEN_ROOT
git pull
EIGEN_REPO_RESULT=$?
fi
else
echo "NOT CHECKING EIGEN"
fi
Expand Down Expand Up @@ -2144,14 +2122,6 @@ if [ $AIRLIB -eq 1 ] && [ $FORCE_AIRSIM -eq 1 ]; then
fi

if [ $GAMS -eq 1 ] || [ $GAMS_AS_A_PREREQ -eq 1 ]; then
echo " EIGEN"
if [ $EIGEN_REPO_RESULT -eq 0 ]; then
echo -e " REPO=\e[92mPASS\e[39m"
else
echo -e " REPO=\e[91mFAIL\e[39m"
(( BUILD_ERRORS++ ))
fi

echo " GAMS"
if [ $GAMSPULL -eq 1 ]; then
if [ $GAMS_REPO_RESULT -eq 0 ]; then
Expand Down Expand Up @@ -2195,12 +2165,6 @@ else
echo "export MPC_ROOT=$MPC_ROOT" >> $HOME/.gams/env.sh
fi

if grep -q "export EIGEN_ROOT" $HOME/.gams/env.sh ; then
sed -i 's@EIGEN_ROOT=.*@EIGEN_ROOT='"$EIGEN_ROOT"'@' $HOME/.gams/env.sh
else
echo "export EIGEN_ROOT=$EIGEN_ROOT" >> $HOME/.gams/env.sh
fi

if grep -q "export CAPNP_ROOT" $HOME/.gams/env.sh ; then
sed -i 's@CAPNP_ROOT=.*@CAPNP_ROOT='"$CAPNP_ROOT"'@' $HOME/.gams/env.sh
else
Expand Down
18 changes: 18 additions & 0 deletions scripts/linux/cmake.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

SCRIPT_PATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"

PROJECT_PATH=$SCRIPT_PATH/../..

echo SCRIPT_PATH=$SCRIPT_PATH
echo PROJECT_PATH=$PROJECT_PATH

cd $PROJECT_PATH
mkdir build
mkdir install
cd build
cmake -DCMAKE_INSTALL_PREFIX="../install" -D'CMAKE_INSTALL_PREFIX=/usr/local' -DCMAKE_PREFIX_PATH=$PROJECT_PATH/install ..
cmake --build . --config debug -j$(nproc)
cmake --build . --config release
sudo cmake --build . --target install --config release
sudo cmake --build . --target install --config debug
2 changes: 2 additions & 0 deletions scripts/projects/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# To do: modify gpc.pl to generate the files rather than copying
# them or copy the files to /usr/local
11 changes: 11 additions & 0 deletions src/gams/pose/Region.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,17 @@ gams::pose::Region::Region(
}
}

gams::pose::Region::Region(const Region& rhs) :
Containerize(rhs.name_), vertices(rhs.vertices),
min_lat_(rhs.min_lat_), max_lat_(rhs.max_lat_),
min_lon_(rhs.min_lon_), max_lon_(rhs.max_lon_),
min_alt_(rhs.min_alt_), max_alt_(rhs.max_alt_),
type_(rhs.type_)
{
// note that if calculate_bounding_box ever does more than min/max vars
// then we need to update either the BMI or call calculate_bounding_box
}

gams::pose::Region::~Region()
{
}
Expand Down
6 changes: 6 additions & 0 deletions src/gams/pose/Region.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ namespace gams
std::vector<Position>(), unsigned int type = 0,
const std::string& name = "");

/**
* Copy constructor
* @param rhs values to copy
**/
Region(const Region& rhs);

/**
* Destructor
**/
Expand Down

0 comments on commit fba3aeb

Please # to comment.