From d3953307b8e9b673072d21a4ddab07c2b024a5a7 Mon Sep 17 00:00:00 2001 From: Hauke Strasdat Date: Wed, 12 Jun 2024 01:17:10 -0700 Subject: [PATCH] compiler toolchain tweaks --- .github/workflows/main.yml | 2 +- CMakeLists.txt | 23 +++++++++++------------ examples/CMakeLists.txt | 4 ++-- package.xml | 2 +- scripts/run_cpp_tests_clang.sh | 2 +- scripts/run_cpp_tests_gcc.sh | 2 +- setup.py | 2 +- 7 files changed, 18 insertions(+), 19 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 650dc204..c8ad0248 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -110,7 +110,7 @@ jobs: echo "Install test" mkdir build_dir cd build_dir - cmake -DCMAKE_CXX_COMPILER_LAUNCHER=ccache .. -DSOPHUS_ENABLE_ENSURE_HANDLER=$SOPHUS_ENABLE_ENSURE_HANDLER + cmake -DCMAKE_CXX_COMPILER_LAUNCHER=ccache .. -DBUILD_SOPHUS_TESTS=Off -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DSOPHUS_ENABLE_ENSURE_HANDLER=$SOPHUS_ENABLE_ENSURE_HANDLER # Ubuntu builds via Github actions run on 2-core virtual machines make -j2 sudo make install diff --git a/CMakeLists.txt b/CMakeLists.txt index ebe479a3..02b4f381 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 3.16) -project(Sophus VERSION 1.24.06) +cmake_minimum_required(VERSION 3.24) +project(Sophus VERSION 1.24.6) include(CMakePackageConfigHelpers) include(GNUInstallDirs) @@ -24,20 +24,19 @@ if(SOPHUS_MASTER_PROJECT) set(CMAKE_CXX_STANDARD 17) + set(CMAKE_COMPILE_WARNING_AS_ERROR Off) + # Set compiler specific settings (FixMe: Should not cmake do this for us # automatically?) if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g") - set(CMAKE_CXX_FLAGS_RELEASE "-O3") - set(CMAKE_CXX_FLAGS - "${CMAKE_CXX_FLAGS} -Wall -Werror -Wextra -Wno-deprecated-register -Qunused-arguments -fcolor-diagnostics" - ) + add_compile_options(-Wall -Wextra -Wno-deprecated-register + -Qunused-arguments -fcolor-diagnostics) elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g") - set(CMAKE_CXX_FLAGS_RELEASE "-O3") - set(CMAKE_CXX_FLAGS - "${CMAKE_CXX_FLAGS} -Wall -Werror -Wextra -std=c++14 -Wno-deprecated-declarations -ftemplate-backtrace-limit=0 -Wno-array-bounds" - ) + add_compile_options(-Wall -Wextra -Wno-deprecated-declarations + -ftemplate-backtrace-limit=0 -Wno-array-bounds) + elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + add_compile_options(/bigobj /wd4305 /wd4244 /MP) + add_compile_definitions(_USE_MATH_DEFINES) endif() # Add local path for finding packages, set the local version first diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 810800e7..eff08758 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,8 +1,8 @@ -cmake_minimum_required(VERSION 3.16) +cmake_minimum_required(VERSION 3.24) project(SophusExample) -find_package(Sophus 1.24.06 REQUIRED) +find_package(Sophus 1.24.6 REQUIRED) set(CMAKE_CXX_STANDARD 17) # Release by default Turn on Debug with "-DCMAKE_BUILD_TYPE=Debug" diff --git a/package.xml b/package.xml index 770074e1..903cd487 100644 --- a/package.xml +++ b/package.xml @@ -1,7 +1,7 @@ sophus - 1.24.06 + 1.24.6 C++ implementation of Lie Groups using Eigen. diff --git a/scripts/run_cpp_tests_clang.sh b/scripts/run_cpp_tests_clang.sh index ed263b78..3047a10a 100755 --- a/scripts/run_cpp_tests_clang.sh +++ b/scripts/run_cpp_tests_clang.sh @@ -6,7 +6,7 @@ set -e # exit on error mkdir build cd build pwd -cmake -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER_LAUNCHER=ccache .. +cmake -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DCMAKE_CXX_COMPILER_LAUNCHER=ccache .. # Ubuntu builds via Github actions run on 2-core virtual machines make -j2 ctest --output-on-failure diff --git a/scripts/run_cpp_tests_gcc.sh b/scripts/run_cpp_tests_gcc.sh index 1798b1a4..cdab231b 100755 --- a/scripts/run_cpp_tests_gcc.sh +++ b/scripts/run_cpp_tests_gcc.sh @@ -6,7 +6,7 @@ set -e # exit on error mkdir build cd build pwd -cmake -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER_LAUNCHER=ccache .. +cmake -DCMAKE_CXX_COMPILER=g++ -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER_LAUNCHER=ccache .. # Ubuntu builds via Github actions run on 2-core virtual machines make -j2 ctest --output-on-failure diff --git a/setup.py b/setup.py index d030bee4..43a57ff1 100644 --- a/setup.py +++ b/setup.py @@ -131,7 +131,7 @@ def main(): # logic and declaration, and simpler if you include description/version in a file. setup( name="sophus_pybind", - version="1.24.06", + version="1.24.6", description="Sophus python API", long_description="Python API for sophus library", url="https://github.com/strasdat/sophus",