From 3a55c9556c380e17348309aaa4d2de78b788f867 Mon Sep 17 00:00:00 2001 From: Michael Kuron <mkuron@icp.uni-stuttgart.de> Date: Thu, 11 Apr 2019 11:02:14 +0200 Subject: [PATCH] Support building without Boost --- .gitlab-ci.yml | 16 ++++++++++++ CMakeLists.txt | 13 ++++++++-- src/blockforest/BlockForest.h | 2 +- src/core/config/ConfigToBoostPropertyTree.cpp | 5 ++++ src/core/config/all.h | 2 ++ src/core/math/PhysicalCheck.cpp | 5 ++++ src/core/math/all.h | 2 ++ .../math/equation_system/EquationParser.cpp | 5 ++++ .../math/equation_system/EquationSystem.cpp | 5 ++++ src/core/math/equation_system/all.h | 2 ++ src/waLBerlaDefinitions.in.h | 1 + tests/core/CMakeLists.txt | 26 ++++++++++++------- 12 files changed, 72 insertions(+), 12 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7fcdc8c5d..f7332d158 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -795,6 +795,22 @@ gcc_8_hybrid_dbg: tags: - docker +gcc_8_hybrid_dbg_noboost: + <<: *build_definition + image: i10git.cs.fau.de:5005/walberla/buildenvs/gcc:8 + before_script: + - rm -rf /opt/boost /usr/include/boost + variables: + <<: *build_hybrid_dbg_variables + WALBERLA_BUILD_WITH_CUDA: "OFF" + WALBERLA_ENABLE_GUI: 0 + WALBERLA_BUILD_WITH_PYTHON: "OFF" + except: + variables: + - $DISABLE_PER_COMMIT_BUILDS + tags: + - docker + gcc_8_hybrid_dbg_sp: <<: *build_definition image: i10git.cs.fau.de:5005/walberla/buildenvs/gcc:8 diff --git a/CMakeLists.txt b/CMakeLists.txt index 735bbe5ed..d3234150d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -718,9 +718,18 @@ if ( Boost_FOUND ) list( APPEND LINK_DIRS ${PYTHON_LIBRARY_DIR}/libs ) endif() + set( WALBERLA_BUILD_WITH_BOOST TRUE CACHE INTERNAL "Build with Boost" ) else( Boost_FOUND ) - # Search again, this time with the REQUIRED option. This will give a CMAKE error and a detailed error message for the user - find_package ( Boost ${waLBerla_REQUIRED_MIN_BOOST_VERSION} REQUIRED ${waLBerla_REQUIRED_BOOST_COMPONENTS} OPTIONAL_COMPONENTS ${waLBerla_OPTIONAL_BOOST_COMPONENTS} ) + if( (WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM OR WALBERLA_USE_STD_FILESYSTEM) AND (WALBERLA_USE_STD_EXPERIMENTAL_ANY OR WALBERLA_USE_STD_ANY) AND (WALBERLA_USE_STD_EXPERIMENTAL_OPTIONAL OR WALBERLA_USE_STD_OPTIONAL) AND NOT WALBERLA_BUILD_WITH_PYTHON) + # we don't really need Boost + set( WALBERLA_BUILD_WITH_BOOST FALSE CACHE INTERNAL "Build with Boost" ) + else() + # Search again, this time with the REQUIRED option. This will give a CMAKE error and a detailed error message for the user + find_package ( Boost ${waLBerla_REQUIRED_MIN_BOOST_VERSION} REQUIRED ${waLBerla_REQUIRED_BOOST_COMPONENTS} OPTIONAL_COMPONENTS ${waLBerla_OPTIONAL_BOOST_COMPONENTS} ) + if( (WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM OR WALBERLA_USE_STD_FILESYSTEM) AND (WALBERLA_USE_STD_EXPERIMENTAL_ANY OR WALBERLA_USE_STD_ANY) AND (WALBERLA_USE_STD_EXPERIMENTAL_OPTIONAL OR WALBERLA_USE_STD_OPTIONAL) ) + message(WARNING "If you set WALBERLA_BUILD_WITH_PYTHON=OFF, you can build without the Boost library.") + endif() + endif() endif( Boost_FOUND ) diff --git a/src/blockforest/BlockForest.h b/src/blockforest/BlockForest.h index c109a6053..45f39dcef 100644 --- a/src/blockforest/BlockForest.h +++ b/src/blockforest/BlockForest.h @@ -854,7 +854,7 @@ template< typename T > inline BlockDataID BlockForest::addBlockData( const shared_ptr< T > & dataHandling, const std::string & identifier, const Set<SUID> & requiredSelectors, const Set<SUID> & incompatibleSelectors ) { - //static_assert( boost::is_base_of< BlockDataHandling<typename T::value_type>, T >::value ); + //static_assert( std::is_base_of< BlockDataHandling<typename T::value_type>, T >::value ); auto downcast = dynamic_pointer_cast< blockforest::BlockDataHandling<typename T::value_type> >( dataHandling ); diff --git a/src/core/config/ConfigToBoostPropertyTree.cpp b/src/core/config/ConfigToBoostPropertyTree.cpp index e3b5e6b40..45a04fc47 100644 --- a/src/core/config/ConfigToBoostPropertyTree.cpp +++ b/src/core/config/ConfigToBoostPropertyTree.cpp @@ -19,6 +19,9 @@ // //====================================================================================================================== +#include "waLBerlaDefinitions.h" +#ifdef WALBERLA_BUILD_WITH_BOOST + #include "ConfigToBoostPropertyTree.h" #include <boost/property_tree/ptree.hpp> @@ -51,3 +54,5 @@ boost::property_tree::iptree configToBoostPropertyTree( const Config & config ) } // namespace config } // namespace walberla + +#endif diff --git a/src/core/config/all.h b/src/core/config/all.h index 0994ebc80..43bbd4f68 100644 --- a/src/core/config/all.h +++ b/src/core/config/all.h @@ -23,5 +23,7 @@ #pragma once #include "Config.h" +#ifdef WALBERLA_BUILD_WITH_BOOST #include "ConfigToBoostPropertyTree.h" +#endif #include "Create.h" diff --git a/src/core/math/PhysicalCheck.cpp b/src/core/math/PhysicalCheck.cpp index 7c3342449..4800f1929 100644 --- a/src/core/math/PhysicalCheck.cpp +++ b/src/core/math/PhysicalCheck.cpp @@ -19,6 +19,9 @@ // //====================================================================================================================== +#include "waLBerlaDefinitions.h" +#ifdef WALBERLA_BUILD_WITH_BOOST + #include "PhysicalCheck.h" #include "core/Abort.h" #include "core/logging/Logging.h" @@ -536,3 +539,5 @@ namespace math { } // namespace math } // namespace walberla + +#endif diff --git a/src/core/math/all.h b/src/core/math/all.h index 29295fc4f..0d5c22ad7 100644 --- a/src/core/math/all.h +++ b/src/core/math/all.h @@ -36,7 +36,9 @@ #include "Matrix3.h" #include "Parser.h" #include "ParserOMP.h" +#ifdef WALBERLA_BUILD_WITH_BOOST #include "PhysicalCheck.h" +#endif #include "Plane.h" #include "Primes.h" #include "Random.h" diff --git a/src/core/math/equation_system/EquationParser.cpp b/src/core/math/equation_system/EquationParser.cpp index 5f064d79c..4a3894268 100644 --- a/src/core/math/equation_system/EquationParser.cpp +++ b/src/core/math/equation_system/EquationParser.cpp @@ -19,6 +19,9 @@ // //====================================================================================================================== +#include "waLBerlaDefinitions.h" +#ifdef WALBERLA_BUILD_WITH_BOOST + #include "Equation.h" #include "EquationParser.h" #include "Operator.h" @@ -340,3 +343,5 @@ EquationPtr EquationParser::parseEquation( const std::string& str, size_t& index } // namespace math } // namespace walberla + +#endif \ No newline at end of file diff --git a/src/core/math/equation_system/EquationSystem.cpp b/src/core/math/equation_system/EquationSystem.cpp index a1293082f..433a1283c 100644 --- a/src/core/math/equation_system/EquationSystem.cpp +++ b/src/core/math/equation_system/EquationSystem.cpp @@ -19,6 +19,9 @@ // //====================================================================================================================== +#include "waLBerlaDefinitions.h" +#ifdef WALBERLA_BUILD_WITH_BOOST + #include "Equation.h" #include "EquationSystem.h" #include "Variable.h" @@ -198,3 +201,5 @@ std::ostream& operator<<( std::ostream& os, EquationSystem& es ) } // namespace math } // namespace walberla + +#endif diff --git a/src/core/math/equation_system/all.h b/src/core/math/equation_system/all.h index 7ab238733..5c3cc61ed 100644 --- a/src/core/math/equation_system/all.h +++ b/src/core/math/equation_system/all.h @@ -23,7 +23,9 @@ #pragma once #include "Equation.h" +#ifdef WALBERLA_BUILD_WITH_BOOST #include "EquationParser.h" #include "EquationSystem.h" +#endif #include "Operator.h" #include "Variable.h" \ No newline at end of file diff --git a/src/waLBerlaDefinitions.in.h b/src/waLBerlaDefinitions.in.h index 610aea18d..82f38181f 100644 --- a/src/waLBerlaDefinitions.in.h +++ b/src/waLBerlaDefinitions.in.h @@ -19,6 +19,7 @@ // External libraries +#cmakedefine WALBERLA_BUILD_WITH_BOOST #cmakedefine WALBERLA_BUILD_WITH_MPI #cmakedefine WALBERLA_BUILD_WITH_OPENMP #cmakedefine WALBERLA_BUILD_WITH_METIS diff --git a/tests/core/CMakeLists.txt b/tests/core/CMakeLists.txt index e0a417390..0a2f5a385 100644 --- a/tests/core/CMakeLists.txt +++ b/tests/core/CMakeLists.txt @@ -21,12 +21,16 @@ waLBerla_execute_test( NAME CellIntervalTest ) waLBerla_compile_test( FILES config/ConfigTest.cpp ) waLBerla_execute_test( NAME ConfigTest COMMAND $<TARGET_FILE:ConfigTest> ${CMAKE_CURRENT_SOURCE_DIR}/config/ConfigTest.dat ) -waLBerla_compile_test( FILES config/PropertyTreeTest.cpp) -#waLBerla_execute_test(NAME PropertyTreeTest COMMAND $<TARGET_FILE:PropertyTreeTest> ) +if( WALBERLA_BUILD_WITH_BOOST ) + waLBerla_compile_test( FILES config/PropertyTreeTest.cpp) + #waLBerla_execute_test(NAME PropertyTreeTest COMMAND $<TARGET_FILE:PropertyTreeTest> ) +endif( WALBERLA_BUILD_WITH_BOOST ) -waLBerla_compile_test( FILES config/MultiArrayIOTest.cpp ) -waLBerla_execute_test( NAME MultiArrayIOTest COMMAND $<TARGET_FILE:MultiArrayIOTest> ) +if( WALBERLA_BUILD_WITH_BOOST ) + waLBerla_compile_test( FILES config/MultiArrayIOTest.cpp ) + waLBerla_execute_test( NAME MultiArrayIOTest COMMAND $<TARGET_FILE:MultiArrayIOTest> ) +endif( WALBERLA_BUILD_WITH_BOOST ) ######### @@ -84,9 +88,11 @@ waLBerla_execute_test( NAME Matrix3Test ) waLBerla_compile_test( FILES math/GenericAABBTest.cpp DEPENDS stencil domain_decomposition ) waLBerla_execute_test( NAME GenericAABBTest ) -waLBerla_compile_test( FILES math/PhysicalCheckTest.cpp DEPENDS stencil ) -waLBerla_execute_test( NAME PhysicalCheckTest - COMMAND $<TARGET_FILE:PhysicalCheckTest> ${CMAKE_CURRENT_SOURCE_DIR}/math/PhysicalCheckTestInput.prm ) +if( WALBERLA_BUILD_WITH_BOOST ) + waLBerla_compile_test( FILES math/PhysicalCheckTest.cpp DEPENDS stencil ) + waLBerla_execute_test( NAME PhysicalCheckTest + COMMAND $<TARGET_FILE:PhysicalCheckTest> ${CMAKE_CURRENT_SOURCE_DIR}/math/PhysicalCheckTestInput.prm ) +endif( WALBERLA_BUILD_WITH_BOOST ) waLBerla_compile_test( FILES math/FastInvSqrtTest.cpp ) @@ -96,8 +102,10 @@ waLBerla_execute_test( NAME FastInvSqrtTest ) # math/equation_system # ######################## -waLBerla_compile_test( FILES math/equation_system/EquationSolverTest.cpp ) -waLBerla_execute_test( NAME EquationSolverTest ) +if( WALBERLA_BUILD_WITH_BOOST ) + waLBerla_compile_test( FILES math/equation_system/EquationSolverTest.cpp ) + waLBerla_execute_test( NAME EquationSolverTest ) +endif( WALBERLA_BUILD_WITH_BOOST ) ####### # mpi # -- GitLab