Commit c3b6da1d authored by Michael Kuron's avatar Michael Kuron Committed by Markus Holzer
Browse files

Remove Boost and switch to C++17

Some optional components use Boost MultiArray and PropertyTree, so we still include the headers if available.
We also still search std::experimental for any, filesystem and optional because some otherwise C++17-compliant compilers did not support them in std until recently.
parent 20d3bc62
......@@ -26,6 +26,8 @@ modernize-*,
-modernize-redundant-void-arg,
-modernize-use-trailing-return-type,
-modernize-avoid-c-arrays,
-modernize-concat-nested-namespaces,
-modernize-use-nodiscard,
mpi-*,
-mpi-type-mismatch,
......
......@@ -77,170 +77,6 @@ stages:
intel_18_serial:
extends: .build_template
image: i10git.cs.fau.de:5005/walberla/buildenvs/intel:18
before_script:
- pip3 install lbmpy jinja2
- cd python
- python3 -m unittest discover pystencils_walberla/
- python3 -m unittest discover lbmpy_walberla/
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
WALBERLA_BUILD_WITH_MPI: "OFF"
WALBERLA_BUILD_WITH_OPENMP: "OFF"
WALBERLA_BUILD_WITH_PARMETIS: "OFF"
WALBERLA_BUILD_WITH_CODEGEN: "ON"
WALBERLA_BUILD_WITH_PYTHON: "ON"
only:
variables:
- $ENABLE_NIGHTLY_BUILDS
tags:
- cuda
- docker
- intel
intel_18_mpionly:
extends: .build_template
image: i10git.cs.fau.de:5005/walberla/buildenvs/intel:18
before_script:
- pip3 install lbmpy jinja2
- cd python
- python3 -m unittest discover pystencils_walberla/
- python3 -m unittest discover lbmpy_walberla/
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
WALBERLA_BUILD_WITH_OPENMP: "OFF"
WALBERLA_BUILD_WITH_CODEGEN: "ON"
WALBERLA_BUILD_WITH_PYTHON: "ON"
only:
variables:
- $ENABLE_NIGHTLY_BUILDS
tags:
- cuda
- docker
- intel
intel_18_hybrid:
extends: .build_template
image: i10git.cs.fau.de:5005/walberla/buildenvs/intel:18
before_script:
- pip3 install lbmpy jinja2
- cd python
- python3 -m unittest discover pystencils_walberla/
- python3 -m unittest discover lbmpy_walberla/
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
WALBERLA_ENABLE_GUI: "ON"
WALBERLA_BUILD_WITH_CODEGEN: "ON"
WALBERLA_BUILD_WITH_PYTHON: "ON"
only:
variables:
- $ENABLE_NIGHTLY_BUILDS
tags:
- cuda
- docker
- intel
intel_18_serial_dbg:
extends: .build_template
image: i10git.cs.fau.de:5005/walberla/buildenvs/intel:18
before_script:
- pip3 install lbmpy jinja2
- cd python
- python3 -m unittest discover pystencils_walberla/
- python3 -m unittest discover lbmpy_walberla/
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
WALBERLA_BUILD_WITH_MPI: "OFF"
WALBERLA_BUILD_WITH_OPENMP: "OFF"
WALBERLA_BUILD_WITH_PARMETIS: "OFF"
CMAKE_BUILD_TYPE: "DebugOptimized"
WALBERLA_BUILD_WITH_CODEGEN: "ON"
WALBERLA_BUILD_WITH_PYTHON: "ON"
only:
variables:
- $ENABLE_NIGHTLY_BUILDS
tags:
- cuda
- docker
- intel
intel_18_mpionly_dbg:
extends: .build_template
image: i10git.cs.fau.de:5005/walberla/buildenvs/intel:18
before_script:
- pip3 install lbmpy jinja2
- cd python
- python3 -m unittest discover pystencils_walberla/
- python3 -m unittest discover lbmpy_walberla/
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
CMAKE_BUILD_TYPE: "DebugOptimized"
WALBERLA_BUILD_WITH_OPENMP: "OFF"
WALBERLA_BUILD_WITH_CODEGEN: "ON"
WALBERLA_BUILD_WITH_PYTHON: "ON"
only:
variables:
- $ENABLE_NIGHTLY_BUILDS
tags:
- cuda
- docker
- intel
intel_18_hybrid_dbg:
extends: .build_template
image: i10git.cs.fau.de:5005/walberla/buildenvs/intel:18
before_script:
- pip3 install lbmpy jinja2
- cd python
- python3 -m unittest discover pystencils_walberla/
- python3 -m unittest discover lbmpy_walberla/
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
CMAKE_BUILD_TYPE: "DebugOptimized"
WALBERLA_BUILD_WITH_CODEGEN: "ON"
WALBERLA_BUILD_WITH_PYTHON: "ON"
tags:
- cuda
- docker
- intel
intel_18_hybrid_dbg_sp:
extends: .build_template
image: i10git.cs.fau.de:5005/walberla/buildenvs/intel:18
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
CMAKE_BUILD_TYPE: "DebugOptimized"
WALBERLA_DOUBLE_ACCURACY: "OFF"
WALBERLA_BUILD_WITH_PARMETIS: "OFF"
WALBERLA_BUILD_WITH_METIS: "OFF"
only:
variables:
- $ENABLE_NIGHTLY_BUILDS
tags:
- cuda
- docker
- intel
intel_19_serial:
extends: .build_template
image: i10git.cs.fau.de:5005/walberla/buildenvs/intel:19
......@@ -1858,7 +1694,7 @@ cppcheck:
image: i10git.cs.fau.de:5005/walberla/buildenvs/cppcheck
script:
- cppcheck --version
- cppcheck . --max-configs=10 --enable=warning --enable=style --enable=performance --enable=portability -i src/gui/extern -i src/geometry/structured/extern -i sqlite3.c -i StackWalker.cpp -I src/ -I tests/ -I apps/ -D WALBERLA_BUILD_WITH_MPI -D WALBERLA_BUILD_WITH_METIS -D WALBERLA_BUILD_WITH_BOOST_THREAD -D WALBERLA_BUILD_WITH_PYTHON --xml 2> report.xml
- cppcheck . --max-configs=10 --enable=warning --enable=style --enable=performance --enable=portability -i src/gui/extern -i src/geometry/structured/extern -i sqlite3.c -i StackWalker.cpp -I src/ -I tests/ -I apps/ -D WALBERLA_BUILD_WITH_MPI -D WALBERLA_BUILD_WITH_METIS -D WALBERLA_BUILD_WITH_PYTHON --xml 2> report.xml
- cppcheck-htmlreport --file=report.xml --report-dir=html_report --source-dir=.
artifacts:
untracked: true
......@@ -1919,7 +1755,7 @@ coverage:
- cmake --version
- mkdir build
- cd build
- cmake -LA -DWALBERLA_BUILD_TESTS=ON -DWALBERLA_BUILD_BENCHMARKS=ON -DWALBERLA_BUILD_TUTORIALS=ON -DWALBERLA_BUILD_WITH_MPI=$WALBERLA_BUILD_WITH_MPI -DWALBERLA_BUILD_WITH_OPENMP=$WALBERLA_BUILD_WITH_OPENMP -DWALBERLA_DOUBLE_ACCURACY=$WALBERLA_DOUBLE_ACCURACY -DWARNING_ERROR=ON -G "$CMAKE_GENERATOR" ..
- cmake -LA -DWALBERLA_BUILD_TESTS=ON -DWALBERLA_BUILD_BENCHMARKS=ON -DWALBERLA_BUILD_TUTORIALS=ON -DWALBERLA_BUILD_WITH_MPI=$WALBERLA_BUILD_WITH_MPI -DWALBERLA_BUILD_WITH_OPENMP=$WALBERLA_BUILD_WITH_OPENMP -DWALBERLA_DOUBLE_ACCURACY=$WALBERLA_DOUBLE_ACCURACY -DWARNING_ERROR=ON -G "$CMAKE_GENERATOR" -DCMAKE_DISABLE_FIND_PACKAGE_Boost=TRUE ..
- MSBuild.exe walberla.sln /property:Configuration=$BUILD_CONFIGURATION /verbosity:minimal /maxcpucount:4
- ctest -LE $CTEST_EXCLUDE_LABELS -C $BUILD_CONFIGURATION --output-on-failure -j 4
variables:
......
......@@ -5,7 +5,7 @@
## Contents:
## - definition of build options
## - compiler variables ( c++ standard, warnings etc. )
## - Finding of service libraries. Required: boost, Optional: MPI, PE, METIS
## - Finding of service libraries. Required: none, Optional: Boost, MPI, FFTW3, METIS, OpenMesh, Python
## the include paths are set, and the libraries are added to variable SERVICE_LIBS
## - Subdirectory cmake lists are called
## -> src/ this folder contains all modules, each module (that contains c or cpp files) is linked to a
......@@ -136,7 +136,7 @@ endif()
############################################################################################################################
set( CMAKE_CXX_STANDARD 14 )
set( CMAKE_CXX_STANDARD 17 )
set( CMAKE_CXX_STANDARD_REQUIRED ON )
set( CMAKE_CXX_EXTENSIONS OFF )
......@@ -170,10 +170,16 @@ if( CMAKE_CXX_COMPILER MATCHES "icpc" OR CMAKE_CXX_COMPILER_ARG1 MATCHES "icpc"
SET(CMAKE_LINKER "${XILD}")
ENDIF(XILD)
MARK_AS_ADVANCED(XILD)
if( CMAKE_VERSION VERSION_LESS 3.6.0 )
set( CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14" )
if( CMAKE_VERSION VERSION_LESS 3.11.0 )
set( CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17" )
set( CMAKE_TRY_COMPILE_PLATFORM_VARIABLES CMAKE_CXX17_STANDARD_COMPILE_OPTION )
add_flag ( CMAKE_CXX_FLAGS ${CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION} )
endif()
if( CMAKE_CXX_COMPILER_VERSION VERSION_LESS "19.0.5" )
# std::filesystem uses ABI tags, which don't work 19.0.2 but do in 19.0.5
add_flag ( CMAKE_CXX_FLAGS "-D_GLIBCXX_USE_CXX11_ABI=0" )
endif()
else()
option ( WALBERLA_CXX_COMPILER_IS_INTEL "Use Intel compiler" OFF )
endif()
......@@ -285,7 +291,8 @@ endif()
# C++ language features for NEC compiler
if( WALBERLA_CXX_COMPILER_IS_NEC )
set( CMAKE_CXX14_STANDARD_COMPILE_OPTION "-Kcpp14" )
set( CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION "-Kcpp${CMAKE_CXX_STANDARD}" )
set( CMAKE_TRY_COMPILE_PLATFORM_VARIABLES CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION )
add_flag ( CMAKE_CXX_FLAGS "${CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION} -Krtti -Kexceptions -size_t64 -Kgcc" )
add_flag ( CMAKE_CXX_FLAGS "-D__BIG_ENDIAN -D__BYTE_ORDER=__BIG_ENDIAN" )
add_flag ( CMAKE_CXX_FLAGS "-Tnoauto,used" )
......@@ -314,7 +321,6 @@ endif()
if( WALBERLA_CXX_COMPILER_IS_IBM )
add_flag ( CMAKE_CXX_FLAGS "-qsuppress=1586-267" ) # 1586-267 (I) Inlining of specified subprogram failed due to the presence of a C++ exception handler
add_flag ( CMAKE_CXX_FLAGS "-qsuppress=1586-266" ) # 1586-266 (I) Inlining of specified subprogram failed due to the presence of a global label
add_flag ( CMAKE_CXX_FLAGS "-qsuppress=1540-0724" ) # 1540-0724 (W) The non-type template argument "2147483648" of type "T" has wrapped [coming from boost/integer_traits.hpp]
add_flag ( CMAKE_CXX_FLAGS "-qsuppress=1500-030" ) # 1500-030: (I) INFORMATION: [...] Additional optimization may be attained by recompiling and specifying MAXMEM option with a value greater than 8192.
add_flag ( CMAKE_C_FLAGS "-qsuppress=1500-030" ) # 1500-030: (I) INFORMATION: [...] Additional optimization may be attained by recompiling and specifying MAXMEM option with a value greater than 8192.
endif()
......@@ -366,7 +372,6 @@ endif()
if ( WALBERLA_CXX_COMPILER_IS_CLANG )
add_flag ( CMAKE_CXX_FLAGS "-Wall -Wconversion -Wshadow -Wno-c++11-extensions -Qunused-arguments" )
add_flag ( CMAKE_CXX_FLAGS "-D'_LIBCPP_EXTERN_TEMPLATE(...)='")
endif ( )
if( WALBERLA_CXX_COMPILER_IS_GNU OR WALBERLA_CXX_COMPILER_IS_INTEL OR WALBERLA_CXX_COMPILER_IS_CLANG )
......@@ -433,25 +438,24 @@ endif()
############################################################################################################################
##
## Find optional C++ libraries
## Find newer C++ libraries, which may only be available in std::experimental on some compilers
##
############################################################################################################################
try_compile( WALBERLA_USE_STD_FILESYSTEM "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/TestStdFilesystem.cpp"
COMPILE_DEFINITIONS -DWALBERLA_USE_STD_FILESYSTEM ${CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION} )
COMPILE_DEFINITIONS -DWALBERLA_USE_STD_FILESYSTEM )
if( WALBERLA_USE_STD_FILESYSTEM )
message( STATUS "Found std::filesystem")
else()
try_compile( WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/TestStdFilesystem.cpp"
COMPILE_DEFINITIONS -DWALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM ${CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION} )
COMPILE_DEFINITIONS -DWALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM )
if( WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM )
message( STATUS "Found std::experimental::filesystem")
endif()
if( NOT WALBERLA_CXX_COMPILER_IS_MSVC AND NOT WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM )
unset( WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM CACHE )
try_compile( WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/TestStdFilesystem.cpp"
COMPILE_DEFINITIONS -DWALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM ${CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION}
LINK_LIBRARIES stdc++fs )
COMPILE_DEFINITIONS -DWALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM LINK_LIBRARIES stdc++fs )
if( WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM )
message( STATUS "Found std::experimental::filesystem in libstdc++fs")
list ( APPEND SERVICE_LIBS -lstdc++fs )
......@@ -460,47 +464,23 @@ else()
if( NOT WALBERLA_CXX_COMPILER_IS_MSVC AND NOT WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM )
unset( WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM CACHE )
try_compile( WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/TestStdFilesystem.cpp"
COMPILE_DEFINITIONS -DWALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM ${CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION}
LINK_LIBRARIES c++experimental )
COMPILE_DEFINITIONS -DWALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM LINK_LIBRARIES c++experimental )
if( WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM )
message( STATUS "Found std::experimental::filesystem in libc++experimental")
list ( APPEND SERVICE_LIBS -lc++experimental )
endif()
endif()
endif()
try_compile( WALBERLA_USE_STD_ANY "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/TestStdAny.cpp"
COMPILE_DEFINITIONS -DWALBERLA_USE_STD_ANY ${CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION} )
if( WALBERLA_USE_STD_ANY )
message( STATUS "Found std::any")
else()
try_compile( WALBERLA_USE_STD_EXPERIMENTAL_ANY "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/TestStdAny.cpp"
COMPILE_DEFINITIONS -DWALBERLA_USE_STD_EXPERIMENTAL_ANY ${CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION} )
if( WALBERLA_USE_STD_EXPERIMENTAL_ANY )
message( STATUS "Found std::experimental::any")
endif()
endif()
try_compile( WALBERLA_USE_STD_OPTIONAL "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/TestStdOptional.cpp"
COMPILE_DEFINITIONS -DWALBERLA_USE_STD_OPTIONAL ${CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION} )
if( WALBERLA_USE_STD_OPTIONAL )
message( STATUS "Found std::optional")
else()
try_compile( WALBERLA_USE_STD_EXPERIMENTAL_OPTIONAL "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/TestStdOptional.cpp"
COMPILE_DEFINITIONS -DWALBERLA_USE_STD_EXPERIMENTAL_OPTIONAL ${CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION} )
if( WALBERLA_USE_STD_EXPERIMENTAL_OPTIONAL )
message( STATUS "Found std::experimental::optional")
if( NOT WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM AND NOT WALBERLA_USE_STD_FILESYSTEM)
message(FATAL_ERROR "Neither std::filesystem nor std::experimental::filesystem are available")
endif()
endif()
try_compile( WALBERLA_USE_STD_VARIANT "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/TestStdVariant.cpp"
COMPILE_DEFINITIONS -DWALBERLA_USE_STD_VARIANT ${CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION} )
if( WALBERLA_USE_STD_VARIANT )
message( STATUS "Found std::variant")
if (WALBERLA_BUILD_WITH_CUDA AND CUDA_VERSION VERSION_LESS "11.0")
# CUDA < 11 does not support C++17. std::experimental::any works with C++14, unlike std::any.
set(WALBERLA_USE_STD_EXPERIMENTAL_ANY 1)
endif()
############################################################################################################################
##
## Visual Studio Setup
......@@ -593,10 +573,17 @@ if ( WALBERLA_BUILD_WITH_PYTHON )
message( FATAL_ERROR "Couldn't find any python library" )
endif()
if(WALBERLA_CXX_COMPILER_IS_INTEL)
# Intel C++17 support introduced in 2.6.2 (https://github.com/pybind/pybind11/pull/2729)
set(PYBIND11_MINIMUM_VERSION "2.6.2")
else()
set(PYBIND11_MINIMUM_VERSION "2.6.0")
endif()
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import pybind11; print(pybind11._version.__version__)"
OUTPUT_VARIABLE pybind11_VERSION ERROR_QUIET RESULT_VARIABLE pybind11_VERSION_RESULT)
string(STRIP "${pybind11_VERSION}" pybind11_VERSION)
if(pybind11_VERSION_RESULT EQUAL "0" AND pybind11_VERSION VERSION_GREATER_EQUAL "2.6.0")
if(pybind11_VERSION_RESULT EQUAL "0" AND pybind11_VERSION VERSION_GREATER_EQUAL "${PYBIND11_MINIMUM_VERSION}")
execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pybind11 --cmakedir
OUTPUT_VARIABLE PYBIND11_CMAKE_PATH)
string(STRIP "${PYBIND11_CMAKE_PATH}" PYBIND11_CMAKE_PATH)
......@@ -626,10 +613,12 @@ if ( WALBERLA_BUILD_WITH_PYTHON )
add_subdirectory(extern/pybind11)
# if pybind11 was installed into ${PYTHON_INCLUDE_DIR} (e.g. by pip), that will have a higher priority than the Git submodule unless we reorder the search path
# introduced in 2.6.0 (https://github.com/pybind/pybind11/issues/2709), fixed in 2.6.2 (https://github.com/pybind/pybind11/pull/2716)
set_property( TARGET pybind11::pybind11
PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${PROJECT_SOURCE_DIR}/extern/pybind11/include" "${PYTHON_INCLUDE_DIR}")
if(pybind11_VERSION VERSION_LESS "2.6.2")
# if pybind11 was installed into ${PYTHON_INCLUDE_DIR} (e.g. by pip), that will have a higher priority than the Git submodule unless we reorder the search path
# introduced in 2.6.0 (https://github.com/pybind/pybind11/issues/2709), fixed in 2.6.2 (https://github.com/pybind/pybind11/pull/2716)
set_property( TARGET pybind11::pybind11
PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${PROJECT_SOURCE_DIR}/extern/pybind11/include" "${PYTHON_INCLUDE_DIR}")
endif()
endif()
# a python module is a shared library - so everything has to be compiled to position independent code
......@@ -652,25 +641,14 @@ endif()
## BOOST Libraries
##
#############################################################################################################################
set ( waLBerla_REQUIRED_MIN_BOOST_VERSION "1.48")
set ( Boost_NO_BOOST_CMAKE ON)
if ( NOT WALBERLA_USE_STD_FILESYSTEM AND NOT WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM )
list ( APPEND waLBerla_REQUIRED_BOOST_COMPONENTS filesystem system )
else()
list ( APPEND waLBerla_OPTIONAL_BOOST_COMPONENTS system )
endif()
# This variable is necessary, if the CMAKE version used is not aware of a more recent boost version (keep this up to date!)
set ( Boost_ADDITIONAL_VERSIONS
"1.45" "1.45.0" "1.46" "1.46.0" "1.46.1" "1.47" "1.47.0" "1.48" "1.48.0" "1.49" "1.49.0"
"1.50" "1.50.0" "1.51" "1.51.0" "1.52" "1.52.0" "1.53" "1.53.0" "1.54" "1.54.0" "1.55" "1.55.0"
"1.56" "1.56.0" "1.57" "1.57.0" "1.58" "1.58.0" "1.59" "1.59.0" "1.60" "1.60.0" "1.61" "1.61.0" "1.62" "1.62.0" "1.63" "1.63.0"
"1.64.0" "1.65.0" "1.65.1" "1.66.0" "1.67.0" "1.68.0" "1.69.0" "1.70.0" "1.71.0" "1.72.0" "1.73.0")
set ( Boost_USE_STATIC_LIBS OFF CACHE BOOL "Use boost static libraries" )
set ( Boost_USE_MULTITHREADED OFF CACHE BOOL "Use boost multithreaded libraries" )
set ( Boost_USE_STATIC_RUNTIME OFF CACHE BOOL "Use boost libraries statically linked to runtime libs" )
"1.64.0" "1.65.0" "1.65.1" "1.66.0" "1.67.0" "1.68.0" "1.69.0" "1.70.0" "1.71.0" "1.72.0" "1.73.0" "1.74.0")
# if you defined BOOST_ROOT or BOOST_BASE in your environment use it here to find boost too
if ( NOT BOOST_ROOT )
......@@ -683,28 +661,7 @@ if ( NOT BOOST_ROOT )
endforeach ( )
endif ( )
find_package ( Boost ${waLBerla_REQUIRED_MIN_BOOST_VERSION} COMPONENTS ${waLBerla_REQUIRED_BOOST_COMPONENTS} OPTIONAL_COMPONENTS ${waLBerla_OPTIONAL_BOOST_COMPONENTS} QUIET )
if( NOT Boost_FOUND )
message ( WARNING
"The specified configuration of the BOOST libraries was not found on your system! Now trying some other configuration..." )
foreach ( Boost_USE_STATIC_LIBS ON OFF )
foreach ( Boost_USE_MULTITHREADED ON OFF )
find_package ( Boost ${waLBerla_REQUIRED_MIN_BOOST_VERSION} COMPONENTS ${waLBerla_REQUIRED_BOOST_COMPONENTS} OPTIONAL_COMPONENTS ${waLBerla_OPTIONAL_BOOST_COMPONENTS} QUIET )
if ( Boost_FOUND )
set ( Boost_USE_STATIC_LIBS ${Boost_USE_STATIC_LIBS} CACHE BOOL "Use boost static libraries" FORCE )
set ( Boost_USE_MULTITHREADED ${Boost_USE_MULTITHREADED} CACHE BOOL "Use boost multithreaded libraries" FORCE )
set ( Boost_USE_MULTITHREADED_LIBRARY ${Boost_USE_MULTITHREADED} )
message ( STATUS "Working configuration of the BOOST libraries was found :o)!" )
message ( STATUS "Boost_USE_STATIC_LIBS and Boost_USE_MULTITHREADED was adapted accordingly." )
BREAK ( )
endif ( Boost_FOUND )
endforeach ( Boost_USE_MULTITHREADED )
if ( Boost_FOUND )
BREAK ( )
endif ( Boost_FOUND )
endforeach ( Boost_USE_STATIC_LIBS )
endif ( NOT Boost_FOUND )
find_package ( Boost )
if ( Boost_FOUND )
if(CMAKE_GENERATOR STREQUAL "Xcode")
......@@ -713,24 +670,11 @@ if ( Boost_FOUND )
else()
include_directories ( SYSTEM ${Boost_INCLUDE_DIRS} )
endif()
if( waLBerla_REQUIRED_BOOST_COMPONENTS )
link_directories ( ${Boost_LIBRARY_DIRS} )
list ( APPEND SERVICE_LIBS ${Boost_LIBRARIES} )
endif()
add_definitions ( -DBOOST_ALL_NO_LIB ) # Disable Boost auto-linking (CMAKE does that for us...)
set( WALBERLA_BUILD_WITH_BOOST TRUE CACHE INTERNAL "Build with Boost" )
else( Boost_FOUND )
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()
set( WALBERLA_BUILD_WITH_BOOST FALSE CACHE INTERNAL "Build with Boost" )
endif( Boost_FOUND )
......@@ -864,10 +808,6 @@ if ( WALBERLA_ENABLE_GUI )
INCLUDE( ${QT_USE_FILE} )
list ( APPEND SERVICE_LIBS ${OPENGL_LIBRARIES} ${QT_LIBRARIES} )
# Workaround for Qt4 moc and newer boost versions - moc cannot parse BOOST_JOIN
# so additional defines are passed to the moc compiler that prevent the problematic header to be parsed
set( QT_MOC_EXECUTABLE ${QT_MOC_EXECUTABLE} -DBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED )
endif(WALBERLA_ENABLE_GUI)
############################################################################################################################
......
......@@ -19,8 +19,8 @@ is documented in [Sphinx](http://walberla.net/sphinx/index.html).
## Getting started
The minimum requirements are a C++14-compliant compiler (e.g. GCC or Clang),
the [Boost](http://www.boost.org) library and the [CMake](http://www.cmake.org)
The minimum requirements are a C++17-compliant compiler (e.g. GCC or Clang)
and the [CMake](http://www.cmake.org)
build system. Furthermore, you need an MPI library (like
[Open MPI](http://www.open-mpi.org)) if you want to make use of parallel
processing capabilities. All of these dependencies are typically available in
......
#include <iostream>
#if defined(WALBERLA_USE_STD_ANY)
#include <any>
#elif defined(WALBERLA_USE_STD_EXPERIMENTAL_ANY)
#include <experimental/any>
#endif
int main() {
#if defined(WALBERLA_USE_STD_ANY)
auto a = std::any(42);
std::cout << std::any_cast<int>(a) << std::endl;
#elif defined(WALBERLA_USE_STD_EXPERIMENTAL_ANY)
auto a = std::experimental::any(42);
std::cout << std::experimental::any_cast<int>(a) << std::endl;
#endif
return 0;
}
#include <iostream>
#if defined(WALBERLA_USE_STD_OPTIONAL)
#include <optional>
#elif defined(WALBERLA_USE_STD_EXPERIMENTAL_OPTIONAL)
#include <experimental/optional>
#endif
int main() {
#if defined(WALBERLA_USE_STD_OPTIONAL)
auto a = std::optional<int>();
auto b = std::optional<int>(42);
#elif defined(WALBERLA_USE_STD_EXPERIMENTAL_OPTIONAL)
auto a = std::experimental::optional<int>();
auto b = std::experimental::optional<int>(42);
#endif
if (b)
std::cout << a.value_or(b.value()) << std::endl;
return 0;
}
#include <iostream>
#include <variant>
int main() {
std::variant<int,float> a;
return 0;
}
......@@ -99,7 +99,7 @@ function ( waLBerla_add_module )
waLBerla_register_dependency ( ${moduleName} ${ARG_DEPENDS} )
set_property( TARGET ${moduleName} PROPERTY CXX_STANDARD 14 )
set_property( TARGET ${moduleName} PROPERTY CXX_STANDARD ${CMAKE_CXX_STANDARD} )
# This property is needed for visual studio to group modules together
if( WALBERLA_GROUP_PROJECTS )
......@@ -204,7 +204,7 @@ function ( waLBerla_add_executable )
target_link_modules ( ${ARG_NAME} ${ARG_DEPENDS} )
target_link_libraries( ${ARG_NAME} ${WALBERLA_LINK_LIBRARIES_KEYWORD} ${SERVICE_LIBS} )
set_property( TARGET ${ARG_NAME} PROPERTY CXX_STANDARD 14 )
set_property( TARGET ${ARG_NAME} PROPERTY CXX_STANDARD ${CMAKE_CXX_STANDARD} )
if( WALBERLA_GROUP_PROJECTS )
if( NOT ARG_GROUP )
......
......@@ -22,12 +22,6 @@ If you are not familiar with the git version control system, this
To compile waLBerla with all modules and features a few third-party libraries
are required.
\subsubsection libs_boost Boost
The boost library is the only required third-party library. It is installed on
most Linux system by default and should be detected by cmake.
If boost resides at a non-standard location, you have to set the environment variable
`BOOST_ROOT` in order to have it detected by cmake.
\subsubsection libs_mpi MPI (optional)
The message passing interface (MPI) library is required if you want to run waLBerla
with distributed memory parallelization. If MPI is not installed on your system,
......
Subproject commit 526a7733c773016f2e552777612027954d0765fd
Subproject commit 687c69625bd2b96ac0596d1a9cc0ab2101485d70
......@@ -88,7 +88,7 @@ public:
T getData() const { return walberla::any_cast<T>( data_ ); }
bool hasData() const {
#ifdef WALBERLA_USE_STD_ANY
#ifndef WALBERLA_USE_STD_EXPERIMENTAL_ANY
return data_.has_value();
#else
return !(data_.empty());
......
......@@ -21,29 +21,25 @@
#pragma once
#include "waLBerlaDefinitions.h"
#if defined(WALBERLA_USE_STD_ANY)
#ifndef WALBERLA_USE_STD_EXPERIMENTAL_ANY
#include <any>
#elif defined(WALBERLA_USE_STD_EXPERIMENTAL_ANY)
#else
#undef _LIBCPP_WARN_ON_DEPRECATED_EXPERIMENTAL_HEADER
#include <experimental/any>
#else
#include <boost/any.hpp>
#endif
namespace walberla {
#if defined(WALBERLA_USE_STD_ANY)
#ifndef WALBERLA_USE_STD_EXPERIMENTAL_ANY
using std::any;
using std::any_cast;
#elif defined(WALBERLA_USE_STD_EXPERIMENTAL_ANY)
#else
using std::experimental::any;
using std::experimental::any_cast;
#else
using boost::any;
using boost::any_cast;
#endif
}
......@@ -27,9 +27,15 @@
namespace walberla {
template< typename T >
class ConcatIterator : public std::iterator< std::input_iterator_tag, typename T::value_type, typename T::difference_type, typename T::pointer, typename T::reference >
class ConcatIterator
{
public:
using iterator_category = std::input_iterator_tag;
using value_type = typename T::value_type;
using difference_type = typename T::difference_type;
using pointer = typename T::pointer;
using reference = typename T::reference;
/// default constructed iterator points to end()
ConcatIterator( )
: ended_