diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b3460c00..b8bcddeb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 @@ -60,4 +69,23 @@ jobs: if: matrix.os == 'macos-14' || matrix.os == 'macos-13' - name: Run tests - run: ./scripts/run_cpp_tests.sh \ No newline at end of file + 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' diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 38ef83f1..d6aa071c 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -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) diff --git a/examples/HelloSO3.cpp b/examples/HelloSO3.cpp index a9ccf13a..6ea9ca1b 100644 --- a/examples/HelloSO3.cpp +++ b/examples/HelloSO3.cpp @@ -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" diff --git a/scripts/install_ubuntu_deps_incl_ceres.sh b/scripts/install_ubuntu_deps_incl_ceres.sh index c1dc08ab..89c5baa4 100755 --- a/scripts/install_ubuntu_deps_incl_ceres.sh +++ b/scripts/install_ubuntu_deps_incl_ceres.sh @@ -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 diff --git a/scripts/run_cpp_tests.sh b/scripts/run_cpp_tests.sh index 3ec55820..38b3f024 100755 --- a/scripts/run_cpp_tests.sh +++ b/scripts/run_cpp_tests.sh @@ -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 diff --git a/sophus/so3.hpp b/sophus/so3.hpp index 20b98161..b32071b6 100644 --- a/sophus/so3.hpp +++ b/sophus/so3.hpp @@ -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 -#include -#include +#include +// // Include only the selective set of Eigen headers that we need. +// // This helps when using Sophus with unusual compilers, like nvcc. +// #include +// #include +// #include +// +// 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