Skip to content

Commit

Permalink
install test
Browse files Browse the repository at this point in the history
  • Loading branch information
strasdat committed Jun 9, 2024
1 parent 43a1d8c commit b7f5e6c
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 13 deletions.
40 changes: 34 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,32 @@ jobs:
build_type: RelWithDebInfo
access: col_major
test: unit_tests
- os: ubuntu-22.04
build_type: RelWithDebInfo
access: col_major
test: install_test
- os: macos-14
build_type: RelWithDebInfo
access: col_major
test: install_test
fail-fast: false

steps:
- name: Set default value for ROW_MAJOR_DEFAULT
- name: Set default value for ROW_MAJOR_DEFAULT to OFF
run: echo "ROW_MAJOR_DEFAULT=OFF" >> $GITHUB_ENV

- name: Update ROW_MAJOR_DEFAULT if condition is met
- name: Update ROW_MAJOR_DEFAULT=ON if condition is met
if: matrix.access == 'row_major'
run: echo "ROW_MAJOR_DEFAULT=ON" >> $GITHUB_ENV

- name: Print ROW_MAJOR_DEFAULT
run: echo $ROW_MAJOR_DEFAULT

- uses: actions/checkout@v2

- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ runner.os }}-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.access }}-${{ matrix.test }}
restore-keys: |
${{ runner.os }}-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.access }}-${{ matrix.test }}
- name: Install dependencies (Linux incl. Ceres)
run: ./scripts/install_ubuntu_deps_incl_ceres.sh
Expand All @@ -60,4 +69,23 @@ jobs:
if: matrix.os == 'macos-14' || matrix.os == 'macos-13'

- name: Run tests
run: ./scripts/run_cpp_tests.sh
run: ./scripts/run_cpp_tests.sh
if: matrix.test == 'unit_tests'

- name: Install test
run: |
echo "Install test"
mkdir build_dir
cd build_dir
cmake -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=$BUILD_TYPE ..
# Ubuntu builds via Github actions run on 2-core virtual machines
make -j2
sudo make install
cd ..
cd examples
mkdir build_dir
cd build_dir
cmake ..
make
ls -la
if: matrix.test == 'install_test'
14 changes: 14 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ project(SophusExample)

find_package(Sophus 1.22.06 REQUIRED)

if(Sophus_FOUND)
message(STATUS "Sophus package found.")
message(STATUS "Version: ${Sophus_VERSION}")
message(STATUS "Include directories: ${Sophus_INCLUDE_DIRS}")
message(STATUS "Libraries: ${Sophus_LIBRARIES}")
else()
message(FATAL_ERROR "Sophus package not found.")
endif()

# Release by default Turn on Debug with "-DCMAKE_BUILD_TYPE=Debug"
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo)
endif()

# Tests to run
set(EXAMPLE_SOURCES HelloSO3)

Expand Down
2 changes: 2 additions & 0 deletions examples/HelloSO3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ int main() {
std::cout << "(R1*R2)*x\n" << (R1 * R2) * x << std::endl;
std::cout << std::endl;

SOPHUS_ENSURE(false, "Message: {}", 33);

// SO(3) are internally represented as unit quaternions.
std::cout << "R1 in matrix form:\n" << R1.matrix() << std::endl;
std::cout << "R1 in unit quaternion form:\n"
Expand Down
12 changes: 11 additions & 1 deletion scripts/install_ubuntu_deps_incl_ceres.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,17 @@ set -e # exit on error
cmake --version

sudo apt update -y
sudo apt install libc++-dev libgflags-dev libsuitesparse-dev libeigen3-dev libfmt-dev
sudo apt install libc++-dev libgflags-dev libsuitesparse-dev libfmt-dev

git clone https://gitlab.com/libeigen/eigen.git
cd eigen
git checkout c1d637433e3b3f9012b226c2c9125c494b470ae6

mkdir build-eigen
cd build-eigen
cmake .. -DEIGEN_DEFAULT_TO_ROW_MAJOR=$ROW_MAJOR_DEFAULT
sudo make install
cd ../..

git clone https://ceres-solver.googlesource.com/ceres-solver ceres-solver
cd ceres-solver
Expand Down
1 change: 0 additions & 1 deletion scripts/run_cpp_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ pwd
cmake -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=$BUILD_TYPE ..
# Ubuntu builds via Github actions run on 2-core virtual machines
make -j2
make CTEST_OUTPUT_ON_FAILURE=1 test
15 changes: 10 additions & 5 deletions sophus/so3.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@
#include "so2.hpp"
#include "types.hpp"

// Include only the selective set of Eigen headers that we need.
// This helps when using Sophus with unusual compilers, like nvcc.
#include <Eigen/src/Geometry/OrthoMethods.h>
#include <Eigen/src/Geometry/Quaternion.h>
#include <Eigen/src/Geometry/RotationBase.h>
#include <Eigen/Geometry>
// // Include only the selective set of Eigen headers that we need.
// // This helps when using Sophus with unusual compilers, like nvcc.
// #include <Eigen/src/Geometry/OrthoMethods.h>
// #include <Eigen/src/Geometry/Quaternion.h>
// #include <Eigen/src/Geometry/RotationBase.h>
//
// Does not work anymore. Newer Eigen versions error out with:
// error: #error "Please include Eigen/Geometry instead of including headers inside the src directory directly."
//

namespace Sophus {
template <class Scalar_, int Options = 0>
Expand Down

0 comments on commit b7f5e6c

Please sign in to comment.