diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d028aee86..109a5e7cf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -90,6 +90,7 @@ jobs: - uses: actions/checkout@v3 - name: Install dependencies run: | + brew update brew install \ cmake \ coreutils \ diff --git a/CMakeLists.txt b/CMakeLists.txt index 49dd87f7f..947a8a56f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,15 @@ set( Boost_USE_STATIC_RUNTIME OFF ) set( CMAKE_CXX_STANDARD 14 CACHE STRING "The C++ standard whose features are requested to build this target" ) mark_as_advanced( FORCE CMAKE_CXX_STANDARD ) + +# ROOT may force a newer C++ standard +# Using the same C++ standard as ROOT is recommended in https://root.cern/manual/integrate_root_into_my_cmake_project/ . +# Older ROOT releases don't export ROOT_CXX_STANDARD at all, so only override our default when it's actually set. +find_package(ROOT QUIET) +if(ROOT_FOUND AND KASPER_USE_ROOT AND ROOT_CXX_STANDARD) + set( CMAKE_CXX_STANDARD ${ROOT_CXX_STANDARD} CACHE STRING "The C++ standard, as requested by the ROOT library. Can't be changed." FORCE) +endif() + set( CMAKE_CXX_STANDARD_REQUIRED ON ) set( CMAKE_CXX_EXTENSIONS ON ) set( CMAKE_EXPORT_COMPILE_COMMANDS ON ) @@ -187,7 +196,7 @@ mark_as_advanced( CLEAR CMAKE_VERBOSE_MAKEFILE ) #option( KASPER_USE_BOOST "Build Boost dependent modules" ${Boost_FOUND} ) set(KASPER_USE_BOOST ON) -find_package(ROOT QUIET) +#ROOT was already searched at the beginning for the C++ standard if(ROOT_FOUND AND NOT DEFINED KASPER_USE_ROOT) message("ROOT was found and enabled automatically. Set KASPER_USE_ROOT=OFF to change this.") endif() diff --git a/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGExtrudedSurfaceMesher.cc b/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGExtrudedSurfaceMesher.cc index 10a92df37..50495553b 100644 --- a/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGExtrudedSurfaceMesher.cc +++ b/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGExtrudedSurfaceMesher.cc @@ -261,7 +261,7 @@ void KGExtrudedSurfaceMesher::DiscretizeSegment(const KGExtrudedObject::Arc* arc double n1[3] = {}; n1[2] = 0; - double p0[3]; + double p0[3] = {}; p0[2] = fExtrudedObject->GetZMin(); double xy_len = 0; diff --git a/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGPortHousingSurfaceMesher.cc b/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGPortHousingSurfaceMesher.cc index 4a7bf0e69..73e0c7a5d 100644 --- a/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGPortHousingSurfaceMesher.cc +++ b/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGPortHousingSurfaceMesher.cc @@ -40,8 +40,8 @@ void KGPortHousingSurfaceMesher::VisitWrappedSurface(KGWrappedSurface - */ -#ifndef K_ALGORITHM_H_ -#define K_ALGORITHM_H_ - -#include -#include - -namespace katrin -{ - -namespace Algorithm -{ -// the following supports maps implemented as std::vector which lack map::at -template const auto& FindValue(const Map& map, const Key& key) -{ - - auto it = std::find_if(std::cbegin(map), std::cend(map), [&](const auto& pair) { return pair.first == key; }); - if (it == std::cend(map)) - throw std::out_of_range("Utility::Algorithm::FindValue(map, key): key not in map"); - - return it->second; -} - -template const auto& FindKey(const Map& map, const Value& value) -{ - - auto it = std::find_if(std::cbegin(map), std::cend(map), [&](const auto& pair) { return pair.second == value; }); - if (it == std::cend(map)) - throw std::out_of_range("Utility::Algorithm::FindKey(map, value): value not in map"); - - return it->first; -} - -template -RandomAccessIt SumStride(RandomAccessIt begin, RandomAccessIt end, Distance stride) -{ - while (begin != end) { - *begin += *(begin + stride); - ++begin; - } - return begin; -} - -} // namespace Algorithm - -} // namespace katrin - -#endif diff --git a/Kommon/Math/include/KMathIntegrator.h b/Kommon/Math/include/KMathIntegrator.h index 1cb6422e6..7725ed7b1 100644 --- a/Kommon/Math/include/KMathIntegrator.h +++ b/Kommon/Math/include/KMathIntegrator.h @@ -516,7 +516,7 @@ template inline XFloatT KMathIntegrator::QAGS(XIntegrandType&& integrand) { /*Use gsl implementation for integral int_a^b. Implementation is experimental. */ - const uint ws_size = 100; + const size_t ws_size = 100; gsl_integration_workspace* workspace = gsl_integration_workspace_alloc(ws_size); FType proxy = integrand; gsl_function F=GSLFunction(proxy); @@ -561,7 +561,7 @@ template inline XFloatT KMathIntegrator::QAGIU(XIntegrandType&& integrand) { /*Use gsl implementation for integral int_xmin^infty. Use case is the krypton spectrum. Implementation is experimental. */ - const uint ws_size = 100; + const size_t ws_size = 100; gsl_integration_workspace* workspace = gsl_integration_workspace_alloc(ws_size); FType proxy = integrand; gsl_function F=GSLFunction(proxy);