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-*, ...@@ -26,6 +26,8 @@ modernize-*,
-modernize-redundant-void-arg, -modernize-redundant-void-arg,
-modernize-use-trailing-return-type, -modernize-use-trailing-return-type,
-modernize-avoid-c-arrays, -modernize-avoid-c-arrays,
-modernize-concat-nested-namespaces,
-modernize-use-nodiscard,
mpi-*, mpi-*,
-mpi-type-mismatch, -mpi-type-mismatch,
......
...@@ -77,170 +77,6 @@ stages: ...@@ -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: intel_19_serial:
extends: .build_template extends: .build_template
image: i10git.cs.fau.de:5005/walberla/buildenvs/intel:19 image: i10git.cs.fau.de:5005/walberla/buildenvs/intel:19
...@@ -1858,7 +1694,7 @@ cppcheck: ...@@ -1858,7 +1694,7 @@ cppcheck:
image: i10git.cs.fau.de:5005/walberla/buildenvs/cppcheck image: i10git.cs.fau.de:5005/walberla/buildenvs/cppcheck
script: script:
- cppcheck --version - 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=. - cppcheck-htmlreport --file=report.xml --report-dir=html_report --source-dir=.
artifacts: artifacts:
untracked: true untracked: true
...@@ -1919,7 +1755,7 @@ coverage: ...@@ -1919,7 +1755,7 @@ coverage:
- cmake --version - cmake --version
- mkdir build - mkdir build
- cd 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 - 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 - ctest -LE $CTEST_EXCLUDE_LABELS -C $BUILD_CONFIGURATION --output-on-failure -j 4
variables: variables:
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
## Contents: ## Contents:
## - definition of build options ## - definition of build options
## - compiler variables ( c++ standard, warnings etc. ) ## - 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 ## the include paths are set, and the libraries are added to variable SERVICE_LIBS
## - Subdirectory cmake lists are called ## - Subdirectory cmake lists are called
## -> src/ this folder contains all modules, each module (that contains c or cpp files) is linked to a ## -> src/ this folder contains all modules, each module (that contains c or cpp files) is linked to a
...@@ -136,7 +136,7 @@ endif() ...@@ -136,7 +136,7 @@ endif()
############################################################################################################################ ############################################################################################################################
set( CMAKE_CXX_STANDARD 14 ) set( CMAKE_CXX_STANDARD 17 )
set( CMAKE_CXX_STANDARD_REQUIRED ON ) set( CMAKE_CXX_STANDARD_REQUIRED ON )
set( CMAKE_CXX_EXTENSIONS OFF ) set( CMAKE_CXX_EXTENSIONS OFF )
...@@ -170,10 +170,16 @@ if( CMAKE_CXX_COMPILER MATCHES "icpc" OR CMAKE_CXX_COMPILER_ARG1 MATCHES "icpc" ...@@ -170,10 +170,16 @@ if( CMAKE_CXX_COMPILER MATCHES "icpc" OR CMAKE_CXX_COMPILER_ARG1 MATCHES "icpc"
SET(CMAKE_LINKER "${XILD}") SET(CMAKE_LINKER "${XILD}")
ENDIF(XILD) ENDIF(XILD)
MARK_AS_ADVANCED(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} ) add_flag ( CMAKE_CXX_FLAGS ${CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION} )
endif() 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() else()
option ( WALBERLA_CXX_COMPILER_IS_INTEL "Use Intel compiler" OFF ) option ( WALBERLA_CXX_COMPILER_IS_INTEL "Use Intel compiler" OFF )
endif() endif()
...@@ -285,7 +291,8 @@ endif() ...@@ -285,7 +291,8 @@ endif()
# C++ language features for NEC compiler # C++ language features for NEC compiler
if( WALBERLA_CXX_COMPILER_IS_NEC ) 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 "${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 "-D__BIG_ENDIAN -D__BYTE_ORDER=__BIG_ENDIAN" )
add_flag ( CMAKE_CXX_FLAGS "-Tnoauto,used" ) add_flag ( CMAKE_CXX_FLAGS "-Tnoauto,used" )
...@@ -314,7 +321,6 @@ endif() ...@@ -314,7 +321,6 @@ endif()
if( WALBERLA_CXX_COMPILER_IS_IBM ) 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-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=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_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. 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() endif()
...@@ -366,7 +372,6 @@ endif() ...@@ -366,7 +372,6 @@ endif()
if ( WALBERLA_CXX_COMPILER_IS_CLANG ) 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 "-Wall -Wconversion -Wshadow -Wno-c++11-extensions -Qunused-arguments" )
add_flag ( CMAKE_CXX_FLAGS "-D'_LIBCPP_EXTERN_TEMPLATE(...)='")
endif ( ) endif ( )
if( WALBERLA_CXX_COMPILER_IS_GNU OR WALBERLA_CXX_COMPILER_IS_INTEL OR WALBERLA_CXX_COMPILER_IS_CLANG ) if( WALBERLA_CXX_COMPILER_IS_GNU OR WALBERLA_CXX_COMPILER_IS_INTEL OR WALBERLA_CXX_COMPILER_IS_CLANG )
...@@ -433,25 +438,24 @@ endif() ...@@ -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" 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 ) if( WALBERLA_USE_STD_FILESYSTEM )
message( STATUS "Found std::filesystem") message( STATUS "Found std::filesystem")
else() else()
try_compile( WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/TestStdFilesystem.cpp" 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 ) if( WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM )
message( STATUS "Found std::experimental::filesystem") message( STATUS "Found std::experimental::filesystem")
endif() endif()
if( NOT WALBERLA_CXX_COMPILER_IS_MSVC AND NOT WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM ) if( NOT WALBERLA_CXX_COMPILER_IS_MSVC AND NOT WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM )
unset( WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM CACHE ) 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" 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 LINK_LIBRARIES stdc++fs )
LINK_LIBRARIES stdc++fs )
if( WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM ) if( WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM )
message( STATUS "Found std::experimental::filesystem in libstdc++fs") message( STATUS "Found std::experimental::filesystem in libstdc++fs")
list ( APPEND SERVICE_LIBS -lstdc++fs ) list ( APPEND SERVICE_LIBS -lstdc++fs )
...@@ -460,47 +464,23 @@ else() ...@@ -460,47 +464,23 @@ else()
if( NOT WALBERLA_CXX_COMPILER_IS_MSVC AND NOT WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM ) if( NOT WALBERLA_CXX_COMPILER_IS_MSVC AND NOT WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM )
unset( WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM CACHE ) 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" 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 LINK_LIBRARIES c++experimental )
LINK_LIBRARIES c++experimental )
if( WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM ) if( WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM )
message( STATUS "Found std::experimental::filesystem in libc++experimental") message( STATUS "Found std::experimental::filesystem in libc++experimental")
list ( APPEND SERVICE_LIBS -lc++experimental ) list ( APPEND SERVICE_LIBS -lc++experimental )
endif() endif()
endif() endif()
endif() 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")
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")
endif() endif()
endif() endif()
try_compile( WALBERLA_USE_STD_VARIANT "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/TestStdVariant.cpp" if (WALBERLA_BUILD_WITH_CUDA AND CUDA_VERSION VERSION_LESS "11.0")
COMPILE_DEFINITIONS -DWALBERLA_USE_STD_VARIANT ${CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION} ) # CUDA < 11 does not support C++17. std::experimental::any works with C++14, unlike std::any.
if( WALBERLA_USE_STD_VARIANT ) set(WALBERLA_USE_STD_EXPERIMENTAL_ANY 1)
message( STATUS "Found std::variant")
endif() endif()
############################################################################################################################ ############################################################################################################################
## ##
## Visual Studio Setup ## Visual Studio Setup
...@@ -593,10 +573,17 @@ if ( WALBERLA_BUILD_WITH_PYTHON ) ...@@ -593,10 +573,17 @@ if ( WALBERLA_BUILD_WITH_PYTHON )
message( FATAL_ERROR "Couldn't find any python library" ) message( FATAL_ERROR "Couldn't find any python library" )
endif() 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__)" execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import pybind11; print(pybind11._version.__version__)"
OUTPUT_VARIABLE pybind11_VERSION ERROR_QUIET RESULT_VARIABLE pybind11_VERSION_RESULT) OUTPUT_VARIABLE pybind11_VERSION ERROR_QUIET RESULT_VARIABLE pybind11_VERSION_RESULT)
string(STRIP "${pybind11_VERSION}" pybind11_VERSION) 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 execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pybind11 --cmakedir
OUTPUT_VARIABLE PYBIND11_CMAKE_PATH) OUTPUT_VARIABLE PYBIND11_CMAKE_PATH)
string(STRIP "${PYBIND11_CMAKE_PATH}" PYBIND11_CMAKE_PATH) string(STRIP "${PYBIND11_CMAKE_PATH}" PYBIND11_CMAKE_PATH)
...@@ -626,10 +613,12 @@ if ( WALBERLA_BUILD_WITH_PYTHON ) ...@@ -626,10 +613,12 @@ if ( WALBERLA_BUILD_WITH_PYTHON )
add_subdirectory(extern/pybind11) 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 if(pybind11_VERSION VERSION_LESS "2.6.2")
# introduced in 2.6.0 (https://github.com/pybind/pybind11/issues/2709), fixed in 2.6.2 (https://github.com/pybind/pybind11/pull/2716) # 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
set_property( TARGET pybind11::pybind11 # introduced in 2.6.0 (https://github.com/pybind/pybind11/issues/2709), fixed in 2.6.2 (https://github.com/pybind/pybind11/pull/2716)
PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${PROJECT_SOURCE_DIR}/extern/pybind11/include" "${PYTHON_INCLUDE_DIR}") set_property( TARGET pybind11::pybind11
PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${PROJECT_SOURCE_DIR}/extern/pybind11/include" "${PYTHON_INCLUDE_DIR}")
endif()
endif() endif()
# a python module is a shared library - so everything has to be compiled to position independent code # a python module is a shared library - so everything has to be compiled to position independent code
...@@ -652,25 +641,14 @@ endif() ...@@ -652,25 +641,14 @@ endif()
## BOOST Libraries ## BOOST Libraries
## ##
############################################################################################################################# #############################################################################################################################
set ( waLBerla_REQUIRED_MIN_BOOST_VERSION "1.48")
set ( Boost_NO_BOOST_CMAKE ON) 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!) # 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 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.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.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.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") "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")
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" )
# if you defined BOOST_ROOT or BOOST_BASE in your environment use it here to find boost too # if you defined BOOST_ROOT or BOOST_BASE in your environment use it here to find boost too
if ( NOT BOOST_ROOT ) if ( NOT BOOST_ROOT )
...@@ -683,28 +661,7 @@ if ( NOT BOOST_ROOT ) ...@@ -683,28 +661,7 @@ if ( NOT BOOST_ROOT )
endforeach ( ) endforeach ( )
endif ( ) endif ( )
find_package ( Boost ${waLBerla_REQUIRED_MIN_BOOST_VERSION} COMPONENTS ${waLBerla_REQUIRED_BOOST_COMPONENTS} OPTIONAL_COMPONENTS ${waLBerla_OPTIONAL_BOOST_COMPONENTS} QUIET ) find_package ( Boost )
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 )
if ( Boost_FOUND ) if ( Boost_FOUND )
if(CMAKE_GENERATOR STREQUAL "Xcode") if(CMAKE_GENERATOR STREQUAL "Xcode")
...@@ -713,24 +670,11 @@ if ( Boost_FOUND ) ...@@ -713,24 +670,11 @@ if ( Boost_FOUND )
else() else()
include_directories ( SYSTEM ${Boost_INCLUDE_DIRS} ) include_directories ( SYSTEM ${Boost_INCLUDE_DIRS} )
endif() 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...) 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" ) set( WALBERLA_BUILD_WITH_BOOST TRUE CACHE INTERNAL "Build with Boost" )
else( Boost_FOUND ) 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) set( WALBERLA_BUILD_WITH_BOOST FALSE CACHE INTERNAL "Build with Boost" )
# 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 ) endif( Boost_FOUND )
...@@ -864,10 +808,6 @@ if ( WALBERLA_ENABLE_GUI ) ...@@ -864,10 +808,6 @@ if ( WALBERLA_ENABLE_GUI )
INCLUDE( ${QT_USE_FILE} ) INCLUDE( ${QT_USE_FILE} )
list ( APPEND SERVICE_LIBS ${OPENGL_LIBRARIES} ${QT_LIBRARIES} ) 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) endif(WALBERLA_ENABLE_GUI)
############################################################################################################################ ############################################################################################################################
......
...@@ -19,8 +19,8 @@ is documented in [Sphinx](http://walberla.net/sphinx/index.html). ...@@ -19,8 +19,8 @@ is documented in [Sphinx](http://walberla.net/sphinx/index.html).
## Getting started ## Getting started
The minimum requirements are a C++14-compliant compiler (e.g. GCC or Clang), The minimum requirements are a C++17-compliant compiler (e.g. GCC or Clang)
the [Boost](http://www.boost.org) library and the [CMake](http://www.cmake.org) and the [CMake](http://www.cmake.org)
build system. Furthermore, you need an MPI library (like build system. Furthermore, you need an MPI library (like
[Open MPI](http://www.open-mpi.org)) if you want to make use of parallel [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 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() {