Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • jakub.both/dune-common
  • samuel.burbulla/dune-common
  • patrick.jaap/dune-common
  • tobias.leibner/dune-common
  • alexander.mueller/dune-common
  • pipping/dune-common
  • Xinyun.Li/dune-common
  • felix.schindler/dune-common
  • simon.praetorius/dune-common
  • ani.anciaux-sedrakian/dune-common
  • henrik.stolzmann/dune-common
  • matthew.t.collins/dune-common
  • liam.keegan/dune-common
  • felix.mueller/dune-common
  • ansgar/dune-common
  • dominic/dune-common
  • lars.lubkoll/dune-common
  • exadune/dune-common
  • felix.gruber/dune-common
  • govind.sahai/dune-common
  • michael.sghaier/dune-common
  • core/dune-common
  • kilian.weishaupt/dune-common
  • markus.blatt/dune-common
  • joscha.podlesny/dune-common
  • tobias.meyer.andersen/dune-common
  • andreas.thune/dune-common
  • lars.bilke/dune-common
  • daniel.kienle/dune-common
  • lukas.renelt/dune-common
  • smuething/dune-common
  • stephan.hilb/dune-common
  • tkoch/dune-common
  • nils.dreier/dune-common
  • rene.milk/dune-common
  • lasse.hinrichsen/dune-common
  • yunus.sevinchan/dune-common
  • lisa_julia.nebel/dune-common
  • claus-justus.heine/dune-common
  • lorenzo.cerrone/dune-common
  • eduardo.bueno/dune-common
41 results
Show changes
Commits on Source (39)
Showing
with 188 additions and 314 deletions
# Master (will become release 2.8) # Master (will become release 2.8)
- Deprecate fallback implementations `Dune::Std::apply`, `Dune::Std::bool_constant`, and
`Dune::Std::make_array` in favor of std c++ implementations.
- Remove c++ feature tests in cmake for existing c++-17 standards. Add default
defines for `DUNE_HAVE_CXX_BOOL_CONSTANT`, `DUNE_HAVE_CXX_EXPERIMENTAL_BOOL_CONSTANT`,
`DUNE_HAVE_HEADER_EXPERIMENTAL_TYPE_TRAITS`, `DUNE_HAVE_CXX_APPLY`,
`DUNE_HAVE_CXX_EXPERIMENTAL_APPLY`, `HAVE_IS_INDEXABLE_SUPPORT` in `config.h` for one
more release.
- Add backport of `FindPkgConfig.cmake` from cmake 3.19.4 since there was a bug in - Add backport of `FindPkgConfig.cmake` from cmake 3.19.4 since there was a bug in
an older find module leading to problems finding tbb in debian:10. an older find module leading to problems finding tbb in debian:10.
......
#!/usr/bin/env python3 #!/usr/bin/env python3
import sys, os, io, getopt, re import sys, os, io, getopt, re, shutil
import importlib, subprocess import importlib, subprocess
import email.utils import email.utils
import pkg_resources import pkg_resources
...@@ -22,10 +22,10 @@ def main(argv): ...@@ -22,10 +22,10 @@ def main(argv):
repositories = ["gitlab", "testpypi", "pypi"] repositories = ["gitlab", "testpypi", "pypi"]
def usage(): def usage():
return 'usage: dunepackaging.py [--upload <'+"|".join(repositories)+'> | -c | --clean | --version <version> | --onlysdist]' return 'usage: dunepackaging.py [--upload <'+"|".join(repositories)+'> | -c | --clean | --version <version> | --onlysdist | --bdist_conda]'
try: try:
opts, args = getopt.getopt(argv, "hc", ["upload=", "clean", "version=", "onlysdist"]) opts, args = getopt.getopt(argv, "hc", ["upload=", "clean", "version=", "onlysdist", "bdist_conda"])
except getopt.GetoptError: except getopt.GetoptError:
print(usage()) print(usage())
sys.exit(2) sys.exit(2)
...@@ -35,6 +35,7 @@ def main(argv): ...@@ -35,6 +35,7 @@ def main(argv):
clean = False clean = False
version = None version = None
onlysdist = False onlysdist = False
bdistconda = False
for opt, arg in opts: for opt, arg in opts:
if opt == '-h': if opt == '-h':
print(usage()) print(usage())
...@@ -52,6 +53,9 @@ def main(argv): ...@@ -52,6 +53,9 @@ def main(argv):
version = arg version = arg
elif opt in ("--onlysdist"): elif opt in ("--onlysdist"):
onlysdist = True onlysdist = True
elif opt in ("--bdist_conda"):
onlysdist = True
bdistconda = True
# Remove generated files # Remove generated files
def removeFiles(): def removeFiles():
...@@ -93,7 +97,7 @@ def main(argv): ...@@ -93,7 +97,7 @@ def main(argv):
print("Generate pyproject.toml") print("Generate pyproject.toml")
f = open("pyproject.toml", "w") f = open("pyproject.toml", "w")
requires = ["setuptools", "wheel", "scikit-build", "cmake", "ninja", "requests"] requires = ["setuptools", "wheel", "scikit-build", "cmake", "ninja", "requests"]
requires += data.asPythonRequirementString(data.depends + data.python_requires) requires += [r for r in data.asPythonRequirementString(data.depends + data.python_requires) if r not in requires]
f.write("[build-system]\n") f.write("[build-system]\n")
f.write("requires = "+requires.__str__()+"\n") f.write("requires = "+requires.__str__()+"\n")
f.write("build-backend = 'setuptools.build_meta'\n") f.write("build-backend = 'setuptools.build_meta'\n")
...@@ -113,6 +117,13 @@ def main(argv): ...@@ -113,6 +117,13 @@ def main(argv):
print("Please install the pip package 'scikit-build' to build the source distribution.") print("Please install the pip package 'scikit-build' to build the source distribution.")
sys.exit(2) sys.exit(2)
# append hash of current git commit to README
shutil.copy('README.md', 'tmp_README.md')
githash = ['git', 'rev-parse', 'HEAD']
hash = subprocess.check_output(githash, encoding='UTF-8')
with open("README.md", "a") as f:
f.write("\n\ngit-" + hash)
print("Create source distribution") print("Create source distribution")
# make sure setup.py/pyproject.toml are tracked by git so that # make sure setup.py/pyproject.toml are tracked by git so that
# they get added to the package by scikit # they get added to the package by scikit
...@@ -125,6 +136,9 @@ def main(argv): ...@@ -125,6 +136,9 @@ def main(argv):
gitreset = ['git', 'reset', 'setup.py', 'pyproject.toml'] gitreset = ['git', 'reset', 'setup.py', 'pyproject.toml']
subprocess.call(gitreset) subprocess.call(gitreset)
# restore README.md
shutil.move('tmp_README.md', 'README.md')
if not onlysdist: if not onlysdist:
# check if we have twine # check if we have twine
import pkg_resources import pkg_resources
...@@ -140,5 +154,66 @@ def main(argv): ...@@ -140,5 +154,66 @@ def main(argv):
removeFiles() removeFiles()
# create conda package meta.yaml (experimental)
if bdistconda:
import hashlib
remove = ['rm', '-rf', 'dist/'+data.name]
subprocess.call(remove)
mkdir = ['mkdir', 'dist/'+data.name ]
subprocess.call(mkdir)
print("Create bdist_conda (experimental)")
distfile = 'dist/'+data.name+'-'+version+'.tar.gz'
datahash = ''
with open(distfile, "rb") as include:
source = include.read()
datahash = hashlib.sha256( source ).hexdigest()
print("Generate ",'dist/'+data.name+'/meta.yaml')
f = open('dist/'+data.name+'/meta.yaml', "w")
f.write('{% set name = "' + data.name + '" %}\n')
f.write('{% set version = "' + version + '" %}\n')
f.write('{% set hash = "' + datahash + '" %}\n\n')
f.write('package:\n')
f.write(' name: "{{ name|lower }}"\n')
f.write(' version: "{{ version }}"\n\n')
f.write('source:\n')
f.write(' path: ../{{ name }}-{{ version }}/\n')
f.write(' sha256: {{ hash }}\n\n')
f.write('build:\n')
f.write(' number: 1\n')
if 'TMPDIR' in os.environ:
f.write(' script_env:\n')
f.write(' - TMPDIR=' + os.environ['TMPDIR'] +'\n')
f.write(' script: "{{ PYTHON }} -m pip install . --no-deps --ignore-installed -vv "\n\n')
f.write('requirements:\n')
requirements = ['pip', 'python', 'mkl', 'tbb', 'intel-openmp',
'libgcc-ng', 'libstdcxx-ng', 'gmp', 'scikit-build',
'mpi4py', 'matplotlib', 'numpy', 'scipy', 'ufl']
for dep in data.depends:
requirements += [dep[0]]
f.write(' host:\n')
for dep in requirements:
f.write(' - ' + dep + '\n')
f.write('\n')
f.write(' run:\n')
for dep in requirements:
f.write(' - ' + dep + '\n')
f.write('\n')
f.write('test:\n')
f.write(' imports:\n')
f.write(' - ' + data.name.replace('-','.') + '\n\n')
f.write('about:\n')
f.write(' home: '+data.url+'\n')
f.write(' license: GPLv2 with linking exception.\n')
f.write(' license_family: GPL\n')
f.write(' summary: '+data.description+'\n')
f.close()
if __name__ == "__main__": if __name__ == "__main__":
main(sys.argv[1:]) main(sys.argv[1:])
...@@ -11,6 +11,7 @@ logger = logging.getLogger(__name__) ...@@ -11,6 +11,7 @@ logger = logging.getLogger(__name__)
try: try:
from dune.common.module import build_dune_py_module, get_dune_py_dir, make_dune_py_module, select_modules, resolve_dependencies, resolve_order from dune.common.module import build_dune_py_module, get_dune_py_dir, make_dune_py_module, select_modules, resolve_dependencies, resolve_order
from dune.common.locking import Lock, LOCK_EX
except ImportError: except ImportError:
import os import os
here = os.path.dirname(os.path.abspath(__file__)) here = os.path.dirname(os.path.abspath(__file__))
...@@ -20,6 +21,7 @@ except ImportError: ...@@ -20,6 +21,7 @@ except ImportError:
sys.path.append(modsA) sys.path.append(modsA)
if os.path.exists(os.path.join(modsB, "module.py")): if os.path.exists(os.path.join(modsB, "module.py")):
from module import build_dune_py_module, get_dune_py_dir, make_dune_py_module, select_modules, resolve_dependencies, resolve_order from module import build_dune_py_module, get_dune_py_dir, make_dune_py_module, select_modules, resolve_dependencies, resolve_order
from locking import Lock, LOCK_EX
else: else:
raise raise
...@@ -48,9 +50,9 @@ def main(argv): ...@@ -48,9 +50,9 @@ def main(argv):
sys.exit(2) sys.exit(2)
elif opt in ("-o", "--opts"): elif opt in ("-o", "--opts"):
optsfile = arg optsfile = arg
elif opt in ("--builddir"): elif opt in ("--builddir",):
builddir = arg builddir = arg
elif opt in ("--module"): elif opt in ("--module",):
masterModule = arg masterModule = arg
if len(args) > 0: if len(args) > 0:
execute = args[0] execute = args[0]
...@@ -82,11 +84,6 @@ def main(argv): ...@@ -82,11 +84,6 @@ def main(argv):
if builddir is None: if builddir is None:
builddir = os.environ.get('DUNE_BUILDDIR', 'build-cmake') builddir = os.environ.get('DUNE_BUILDDIR', 'build-cmake')
dunepy = get_dune_py_dir()
if os.path.exists(dunepy):
shutil.rmtree(dunepy)
# Generate list of all modules # Generate list of all modules
duneModules = select_modules() duneModules = select_modules()
...@@ -101,18 +98,6 @@ def main(argv): ...@@ -101,18 +98,6 @@ def main(argv):
deps = resolve_order(deps) deps = resolve_order(deps)
deps += [masterModule] deps += [masterModule]
foundModule = make_dune_py_module(dunepy, deps)
output = build_dune_py_module(dunepy, cmake_args, None, builddir, deps)
print("CMake output")
print(output)
# set a tag file to avoid automatic reconfiguration in builder
tagfile = os.path.join(dunepy, ".noconfigure")
f = open(tagfile, 'w')
f.close()
if execute == "install": if execute == "install":
for m in deps: for m in deps:
moddir = duneModules[1][m] moddir = duneModules[1][m]
...@@ -126,5 +111,19 @@ def main(argv): ...@@ -126,5 +111,19 @@ def main(argv):
except FileNotFoundError: except FileNotFoundError:
print("Warning: build dir not found possibly module is installed then python bindings should be already available") print("Warning: build dir not found possibly module is installed then python bindings should be already available")
dunepy = get_dune_py_dir()
dunepyBase = os.path.realpath( os.path.join(dunepy,"..") )
if not os.path.exists(dunepyBase):
os.makedirs(dunepyBase)
with Lock(os.path.join(dunepyBase, 'lock-module.lock'), flags=LOCK_EX):
if os.path.exists(dunepy):
shutil.rmtree(dunepy)
os.makedirs(dunepy)
foundModule = make_dune_py_module(dunepy, deps)
output = build_dune_py_module(dunepy, cmake_args, None, builddir, deps, writetagfile=True)
print("CMake output")
print(output)
if __name__ == "__main__": if __name__ == "__main__":
main(sys.argv[1:]) main(sys.argv[1:])
# Defines the functions to use BLAS/Lapack
#
# .. cmake_function:: add_dune_blas_lapack_flags
#
# .. cmake_param:: targets
# :positional:
# :single:
# :required:
#
# A list of targets to use BLAS/Lapack with.
#
include_guard(GLOBAL)
set_package_properties("BLAS" PROPERTIES
DESCRIPTION "fast linear algebra routines")
set_package_properties("LAPACK" PROPERTIES
DESCRIPTION "fast linear algebra routines")
# register HAVE_BLAS and HAVE_LAPACK for config.h
set(HAVE_BLAS ${BLAS_FOUND})
set(HAVE_LAPACK ${LAPACK_FOUND})
# register Lapack library as dune package
if(HAVE_LAPACK)
dune_register_package_flags(LIBRARIES "${LAPACK_LIBRARIES}")
cmake_push_check_state()
set(CMAKE_REQUIRED_LIBRARIES ${LAPACK_LIBRARIES})
check_function_exists("dsyev_" LAPACK_NEEDS_UNDERLINE)
cmake_pop_check_state()
elseif(HAVE_BLAS)
dune_register_package_flags(LIBRARIES "${BLAS_LIBRARIES}")
endif()
# add function to link against the BLAS/Lapack library
function(add_dune_blas_lapack_flags _targets)
foreach(_target ${_targets})
if(LAPACK_FOUND)
target_link_libraries(${_target} PUBLIC ${LAPACK_LIBRARIES})
elseif(BLAS_FOUND)
target_link_libraries(${_target} PUBLIC ${BLAS_LIBRARIES})
endif()
endforeach(_target)
endfunction(add_dune_blas_lapack_flags)
# Always link threading libraries to targets # Always link threading libraries to targets
# text for feature summary
set_package_properties("Threads" PROPERTIES
DESCRIPTION "Multi-threading library")
# set HAVE_THREADS for config.h # set HAVE_THREADS for config.h
set(HAVE_THREADS ${Threads_FOUND}) set(HAVE_THREADS ${Threads_FOUND})
......
...@@ -13,6 +13,12 @@ ...@@ -13,6 +13,12 @@
# A list of targets to use VC with. # A list of targets to use VC with.
# #
# text for feature summary
set_package_properties("Vc" PROPERTIES
DESCRIPTION "C++ Vectorization library"
URL "https://github.com/VcDevel/Vc"
PURPOSE "For use of SIMD instructions")
function(add_dune_vc_flags _targets) function(add_dune_vc_flags _targets)
if(Vc_FOUND) if(Vc_FOUND)
foreach(_target ${_targets}) foreach(_target ${_targets})
......
...@@ -2,6 +2,7 @@ add_subdirectory(FindPkgConfig) ...@@ -2,6 +2,7 @@ add_subdirectory(FindPkgConfig)
add_subdirectory(FindPython3) add_subdirectory(FindPython3)
install(FILES install(FILES
AddBLASLapackFlags.cmake
AddGMPFlags.cmake AddGMPFlags.cmake
AddMETISFlags.cmake AddMETISFlags.cmake
AddParMETISFlags.cmake AddParMETISFlags.cmake
......
...@@ -264,54 +264,6 @@ check_cxx_source_compiles(" ...@@ -264,54 +264,6 @@ check_cxx_source_compiles("
" HAS_ATTRIBUTE_DEPRECATED_MSG " HAS_ATTRIBUTE_DEPRECATED_MSG
) )
# full support for is_indexable (checking whether a type supports operator[])
check_cxx_source_compiles("
#include <utility>
#include <type_traits>
#include <array>
template <class T>
typename std::add_rvalue_reference<T>::type declval();
namespace detail {
template<typename T, typename I, typename = int>
struct _is_indexable
: public std::false_type
{};
template<typename T, typename I>
struct _is_indexable<T,I,typename std::enable_if<(sizeof(declval<T>()[declval<I>()]) > 0),int>::type>
: public std::true_type
{};
}
template<typename T, typename I = std::size_t>
struct is_indexable
: public detail::_is_indexable<T,I>
{};
struct foo_type {};
int main()
{
double x;
std::array<double,4> y;
double z[5];
foo_type f;
static_assert(not is_indexable<decltype(x)>::value,\"scalar type\");
static_assert(is_indexable<decltype(y)>::value,\"indexable class\");
static_assert(is_indexable<decltype(z)>::value,\"array\");
static_assert(not is_indexable<decltype(f)>::value,\"not indexable class\");
static_assert(not is_indexable<decltype(y),foo_type>::value,\"custom index type\");
return 0;
}
" HAVE_IS_INDEXABLE_SUPPORT
)
# ****************************************************************************** # ******************************************************************************
# #
# Checks for standard library features # Checks for standard library features
...@@ -326,40 +278,6 @@ check_cxx_source_compiles(" ...@@ -326,40 +278,6 @@ check_cxx_source_compiles("
# #
# ****************************************************************************** # ******************************************************************************
# Check whether we have <experimental/type_traits> (for is_detected et. al.)
check_include_file_cxx(
experimental/type_traits
DUNE_HAVE_HEADER_EXPERIMENTAL_TYPE_TRAITS
)
check_cxx_symbol_exists(
"std::move<std::bool_constant<true>>"
"utility;type_traits"
DUNE_HAVE_CXX_BOOL_CONSTANT
)
if (NOT DUNE_HAVE_CXX_BOOL_CONSTANT)
check_cxx_symbol_exists(
"std::move<std::experimental::bool_constant<true>>"
"utility;experimental/type_traits"
DUNE_HAVE_CXX_EXPERIMENTAL_BOOL_CONSTANT
)
endif()
check_cxx_symbol_exists(
"std::apply<std::negate<int>,std::tuple<int>>"
"functional;tuple"
DUNE_HAVE_CXX_APPLY
)
if (NOT DUNE_HAVE_CXX_APPLY)
check_cxx_symbol_exists(
"std::experimental::apply<std::negate<int>,std::tuple<int>>"
"functional;experimental/tuple"
DUNE_HAVE_CXX_EXPERIMENTAL_APPLY
)
endif()
check_cxx_symbol_exists( check_cxx_symbol_exists(
"std::experimental::make_array<int,int>" "std::experimental::make_array<int,int>"
"experimental/array" "experimental/array"
......
...@@ -6,20 +6,7 @@ dune_set_minimal_debug_level() ...@@ -6,20 +6,7 @@ dune_set_minimal_debug_level()
# search for lapack # search for lapack
find_package(LAPACK) find_package(LAPACK)
set(HAVE_LAPACK ${LAPACK_FOUND}) include(AddBLASLapackFlags)
if(${HAVE_LAPACK})
dune_register_package_flags(LIBRARIES "${LAPACK_LIBRARIES}")
cmake_push_check_state()
set(CMAKE_REQUIRED_LIBRARIES ${LAPACK_LIBRARIES})
check_function_exists("dsyev_" LAPACK_NEEDS_UNDERLINE)
cmake_pop_check_state()
endif(${HAVE_LAPACK})
set(HAVE_BLAS ${BLAS_FOUND})
set_package_properties("BLAS" PROPERTIES
DESCRIPTION "fast linear algebra routines")
set_package_properties("LAPACK" PROPERTIES
DESCRIPTION "fast linear algebra routines")
find_package(GMP) find_package(GMP)
include(AddGMPFlags) include(AddGMPFlags)
...@@ -34,9 +21,6 @@ include(FindMProtect) ...@@ -34,9 +21,6 @@ include(FindMProtect)
# find the threading library # find the threading library
find_package(Threads) find_package(Threads)
include(AddThreadsFlags) include(AddThreadsFlags)
# text for feature summary
set_package_properties("Threads" PROPERTIES
DESCRIPTION "Multi-threading library")
# find library for Threading Building Blocks # find library for Threading Building Blocks
find_package(TBB) find_package(TBB)
...@@ -57,11 +41,6 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL Clang) AND ...@@ -57,11 +41,6 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL Clang) AND
endif() endif()
find_package(Vc ${MINIMUM_VC_VERSION} NO_MODULE) find_package(Vc ${MINIMUM_VC_VERSION} NO_MODULE)
include(AddVcFlags) include(AddVcFlags)
# text for feature summary
set_package_properties("Vc" PROPERTIES
DESCRIPTION "C++ Vectorization library"
URL "https://github.com/VcDevel/Vc"
PURPOSE "For use of SIMD instructions")
# Run the python extension of the Dune cmake build system # Run the python extension of the Dune cmake build system
include(DunePythonCommonMacros) include(DunePythonCommonMacros)
...@@ -1108,7 +1108,7 @@ macro(replace_properties_for_one) ...@@ -1108,7 +1108,7 @@ macro(replace_properties_for_one)
endmacro(replace_properties_for_one) endmacro(replace_properties_for_one)
function(dune_target_link_libraries basename libraries) function(dune_target_link_libraries basename libraries)
target_link_libraries(${basename} ${libraries}) target_link_libraries(${basename} PUBLIC ${libraries})
endfunction(dune_target_link_libraries basename libraries) endfunction(dune_target_link_libraries basename libraries)
function(replace_properties) function(replace_properties)
......
...@@ -141,12 +141,11 @@ function(dune_python_install_package) ...@@ -141,12 +141,11 @@ function(dune_python_install_package)
# #
# Construct the wheel installation commandline # Construct the wheel installation commandline
set(WHEEL_COMMAND ${Python3_EXECUTABLE} -m pip wheel -w ${DUNE_PYTHON_WHEELHOUSE} ${PYINST_FULLPATH}) set(WHEEL_COMMAND ${Python3_EXECUTABLE} -m pip wheel -w ${DUNE_PYTHON_WHEELHOUSE} ${PYINST_ADDITIONAL_PIP_PARAMS} ${DUNE_PYTHON_ADDITIONAL_PIP_PARAMS} ${PYINST_FULLPATH})
# Add the installation rule # Add the installation rule
install(CODE "message(\"Installing wheel for python package at ${PYINST_FULLPATH}...\") install(CODE "message(\"Installing wheel for python package at ${PYINST_FULLPATH}...\")
dune_execute_process(COMMAND ${WHEEL_COMMAND} dune_execute_process(COMMAND ${WHEEL_COMMAND}
ERROR_MESSAGE \"Error installing wheel for python package at ${PYINST_FULLPATH}\"
)" )"
) )
endfunction() endfunction()
...@@ -23,4 +23,10 @@ if( DUNE_ENABLE_PYTHONBINDINGS ) ...@@ -23,4 +23,10 @@ if( DUNE_ENABLE_PYTHONBINDINGS )
endfunction() endfunction()
include(DuneAddPybind11Module) include(DuneAddPybind11Module)
# Add a custom command that triggers the configuration of dune-py
add_custom_command(TARGET install_python POST_BUILD
COMMAND ${Python3_EXECUTABLE} -m dune configure
)
endif() endif()
...@@ -52,7 +52,7 @@ set_package_properties("TBB" PROPERTIES ...@@ -52,7 +52,7 @@ set_package_properties("TBB" PROPERTIES
# first, try to find TBBs cmake configuration # first, try to find TBBs cmake configuration
find_package(TBB ${TBB_FIND_VERSION} QUIET CONFIG) find_package(TBB ${TBB_FIND_VERSION} QUIET CONFIG)
if(TBB_tbb_FOUND) if(TBB_FOUND AND TARGET TBB::tbb)
message(STATUS "Found TBB: using configuration from TBB_DIR=${TBB_DIR} (found version \"${TBB_VERSION}\")") message(STATUS "Found TBB: using configuration from TBB_DIR=${TBB_DIR} (found version \"${TBB_VERSION}\")")
return() return()
endif() endif()
......
...@@ -29,21 +29,6 @@ ...@@ -29,21 +29,6 @@
/* does the compiler support __attribute__((unused))? */ /* does the compiler support __attribute__((unused))? */
#cmakedefine HAS_ATTRIBUTE_UNUSED 1 #cmakedefine HAS_ATTRIBUTE_UNUSED 1
/* does the standard library provide <experimental/type_traits> ? */
#cmakedefine DUNE_HAVE_HEADER_EXPERIMENTAL_TYPE_TRAITS 1
/* does the standard library provide bool_constant ? */
#cmakedefine DUNE_HAVE_CXX_BOOL_CONSTANT 1
/* does the standard library provide experimental::bool_constant ? */
#cmakedefine DUNE_HAVE_CXX_EXPERIMENTAL_BOOL_CONSTANT 1
/* does the standard library provide apply() ? */
#cmakedefine DUNE_HAVE_CXX_APPLY 1
/* does the standard library provide experimental::apply() ? */
#cmakedefine DUNE_HAVE_CXX_EXPERIMENTAL_APPLY 1
/* does the standard library provide experimental::make_array() ? */ /* does the standard library provide experimental::make_array() ? */
#cmakedefine DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY 1 #cmakedefine DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY 1
...@@ -62,9 +47,6 @@ ...@@ -62,9 +47,6 @@
/* Define if you have LAPACK library. */ /* Define if you have LAPACK library. */
#cmakedefine HAVE_LAPACK 1 #cmakedefine HAVE_LAPACK 1
/* Define to 1 if you have the <malloc.h> header file. */
// Not used! #cmakedefine01 HAVE_MALLOC_H
/* Define if you have the MPI library. */ /* Define if you have the MPI library. */
#cmakedefine HAVE_MPI ENABLE_MPI #cmakedefine HAVE_MPI ENABLE_MPI
...@@ -83,9 +65,6 @@ ...@@ -83,9 +65,6 @@
/* Define to 1 if you have the symbol mprotect. */ /* Define to 1 if you have the symbol mprotect. */
#cmakedefine HAVE_MPROTECT 1 #cmakedefine HAVE_MPROTECT 1
/* Define to 1 if you have the <stdint.h> header file. */
#cmakedefine HAVE_STDINT_H 1
/* Define to 1 if you have <sys/mman.h>. */ /* Define to 1 if you have <sys/mman.h>. */
#cmakedefine HAVE_SYS_MMAN_H 1 #cmakedefine HAVE_SYS_MMAN_H 1
...@@ -129,10 +108,12 @@ ...@@ -129,10 +108,12 @@
#define DUNE_HAVE_CXX_VARIANT 1 #define DUNE_HAVE_CXX_VARIANT 1
#define DUNE_SUPPORTS_CXX_THROW_IN_CONSTEXPR 1 #define DUNE_SUPPORTS_CXX_THROW_IN_CONSTEXPR 1
#define DUNE_HAVE_C_ALIGNED_ALLOC 1 #define DUNE_HAVE_C_ALIGNED_ALLOC 1
#define DUNE_HAVE_CXX_BOOL_CONSTANT 1
#define DUNE_HAVE_CXX_EXPERIMENTAL_BOOL_CONSTANT 0
/* Define to 1 if the compiler properly supports testing for operator[] */ #define DUNE_HAVE_HEADER_EXPERIMENTAL_TYPE_TRAITS 0
#cmakedefine HAVE_IS_INDEXABLE_SUPPORT 1 #define DUNE_HAVE_CXX_APPLY 1
#define DUNE_HAVE_CXX_EXPERIMENTAL_APPLY 0
#define HAVE_IS_INDEXABLE_SUPPORT 1
/* Define to ENABLE_UMFPACK if the UMFPack library is available */ /* Define to ENABLE_UMFPACK if the UMFPack library is available */
#cmakedefine HAVE_UMFPACK ENABLE_SUITESPARSE #cmakedefine HAVE_UMFPACK ENABLE_SUITESPARSE
......
...@@ -4,5 +4,5 @@ Author: The Dune Core developers ...@@ -4,5 +4,5 @@ Author: The Dune Core developers
Maintainer: dune-devel@lists.dune-project.org Maintainer: dune-devel@lists.dune-project.org
Description: Basis infrastructure for all Dune modules Description: Basis infrastructure for all Dune modules
URL: https://gitlab.dune-project.org/core/dune-common URL: https://gitlab.dune-project.org/core/dune-common
Python-Requires: portalocker numpy wheel Python-Requires: portalocker numpy wheel mpi4py
Whitespace-Hook: Yes Whitespace-Hook: Yes
...@@ -4,11 +4,6 @@ add_subdirectory("std") ...@@ -4,11 +4,6 @@ add_subdirectory("std")
add_subdirectory("test") add_subdirectory("test")
#build the library dunecommon #build the library dunecommon
if(LAPACK_FOUND)
set(_additional_libs ${LAPACK_LIBRARIES})
elseif(BLAS_FOUND)
set(_additional_libs ${BLAS_LIBRARIES})
endif(LAPACK_FOUND)
if(HAVE_MPROTECT) if(HAVE_MPROTECT)
set(debugallocator_src "debugallocator.cc") set(debugallocator_src "debugallocator.cc")
...@@ -25,10 +20,11 @@ dune_add_library("dunecommon" ...@@ -25,10 +20,11 @@ dune_add_library("dunecommon"
path.cc path.cc
simd/test.cc simd/test.cc
stdstreams.cc stdstreams.cc
stdthread.cc stdthread.cc)
ADD_LIBS "${_additional_libs}")
add_dune_blas_lapack_flags(dunecommon)
add_dune_tbb_flags(dunecommon) add_dune_tbb_flags(dunecommon)
#install headers #install headers
install(FILES install(FILES
alignedallocator.hh alignedallocator.hh
......
...@@ -3,54 +3,17 @@ ...@@ -3,54 +3,17 @@
#ifndef DUNE_COMMON_STD_APPLY_HH #ifndef DUNE_COMMON_STD_APPLY_HH
#define DUNE_COMMON_STD_APPLY_HH #define DUNE_COMMON_STD_APPLY_HH
#if DUNE_HAVE_CXX_APPLY #include <tuple>
#include <tuple>
#elif DUNE_HAVE_CXX_EXPERIMENTAL_APPLY
#include <experimental/tuple>
#else
#include <cstddef>
#include <utility>
#include <tuple>
#endif
#include <dune/common/tupleutility.hh>
namespace Dune namespace Dune
{ {
namespace Std namespace Std
{ {
#if DUNE_HAVE_CXX_APPLY /// Invoke the Callable object f with a tuple of arguments.
/// \deprecated Use `std::apply` directly.
using std::apply; using std::apply;
#elif DUNE_HAVE_CXX_EXPERIMENTAL_APPLY
using std::experimental::apply;
#else
/**
* \brief Apply function with arguments given as tuple
*
* \param f A callable object
* \param args Tuple of arguments
*
* This will call the function with arguments generated by unpacking the tuple.
*
* \ingroup CxxUtilities
*/
template<class F, class ArgTuple>
decltype(auto) apply(F&& f, ArgTuple&& args)
{
auto indices = std::make_index_sequence<std::tuple_size<std::decay_t<ArgTuple>>::value>();
return applyPartial(std::forward<F>(f), std::forward<ArgTuple>(args), indices);
}
#endif
} // namespace Std } // namespace Std
} // namespace Dune } // namespace Dune
......
...@@ -13,6 +13,7 @@ namespace Std { ...@@ -13,6 +13,7 @@ namespace Std {
#if DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY #if DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY
/// \deprecated Use deduction guide of `std::array` or `std::to_array`.
using std::experimental::make_array; using std::experimental::make_array;
#else // DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY #else // DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY
...@@ -30,6 +31,7 @@ namespace Std { ...@@ -30,6 +31,7 @@ namespace Std {
* give a diagnostic when anyone happens to do that. * give a diagnostic when anyone happens to do that.
* *
* \ingroup CxxUtilities * \ingroup CxxUtilities
* \deprecated Use deduction guide of `std::array` or `std::to_array`.
*/ */
template <typename... Args> template <typename... Args>
std::array<typename std::common_type<Args...>::type, sizeof...(Args)> std::array<typename std::common_type<Args...>::type, sizeof...(Args)>
......
...@@ -97,27 +97,9 @@ namespace Std ...@@ -97,27 +97,9 @@ namespace Std
struct to_true_type : public std::true_type {}; struct to_true_type : public std::true_type {};
#if DUNE_HAVE_CXX_BOOL_CONSTANT /// A helper alias template std::bool_constant imported into the namespace Dune::Std
/// \deprecated Use the `std::bool_constant` directly.
using std::bool_constant; using std::bool_constant;
#elif DUNE_HAVE_CXX_EXPERIMENTAL_BOOL_CONSTANT
using std::experimental::bool_constant;
#else
/**
* \brief A template alias for std::integral_constant<bool, value>
*
* \tparam value Boolean value to encode as std::integral_constant<bool, value>
*
* \ingroup CxxUtilities
*/
template <bool value>
using bool_constant = std::integral_constant<bool, value>;
#endif
namespace Impl { namespace Impl {
......
...@@ -197,8 +197,6 @@ namespace Dune ...@@ -197,8 +197,6 @@ namespace Dune
struct [[deprecated("Has been renamed to 'HasNaN'.")]] has_nan struct [[deprecated("Has been renamed to 'HasNaN'.")]] has_nan
: HasNaN<T> {}; : HasNaN<T> {};
#if defined(DOXYGEN) or HAVE_IS_INDEXABLE_SUPPORT
#ifndef DOXYGEN #ifndef DOXYGEN
namespace Impl { namespace Impl {
...@@ -227,95 +225,8 @@ namespace Dune ...@@ -227,95 +225,8 @@ namespace Dune
: public Impl::IsIndexable<T,I> : public Impl::IsIndexable<T,I>
{}; {};
#else // defined(DOXYGEN) or HAVE_IS_INDEXABLE_SUPPORT
// okay, here follows a mess of compiler bug workarounds...
// GCC 4.4 dies if we try to subscript a simple type like int and
// both GCC 4.4 and 4.5 don't like using arbitrary types as subscripts
// for macros.
// So we make sure to only ever attempt the SFINAE for operator[] for
// class types, and to make sure the compiler doesn't become overly eager
// we have to do some lazy evaluation tricks with nested templates and
// stuff.
// Let's get rid of GCC 4.4 ASAP!
namespace Impl {
// simple wrapper template to support the lazy evaluation required
// in _is_indexable
template<typename T>
struct _lazy
{
template<typename U>
struct evaluate
{
typedef T type;
};
};
// default version, gets picked if SFINAE fails
template<typename T, typename = int>
struct IsIndexable
: public std::false_type
{};
// version for types supporting the subscript operation
template<typename T>
struct IsIndexable<T,decltype(std::declval<T>()[0],0)>
: public std::true_type
{};
// helper struct for delaying the evaluation until we are sure
// that T is a class (i.e. until we are outside std::conditional
// below)
struct _check_for_index_operator
{
template<typename T>
struct evaluate
: public IsIndexable<T>
{};
};
}
// The rationale here is as follows:
// 1) If we have an array, we assume we can index into it. That isn't
// true if I isn't an integral type, but that's why we have the static assertion
// in the body - we could of course try and check whether I is integral, but I
// can't be arsed and want to provide a motivation to switch to a newer compiler...
// 2) If we have a class, we use SFINAE to check for operator[]
// 3) Otherwise, we assume that T does not support indexing
//
// In order to make sure that the compiler doesn't accidentally try the SFINAE evaluation
// on an array or a scalar, we have to resort to lazy evaluation.
template<typename T, typename I = std::size_t>
struct IsIndexable
: public std::conditional<
std::is_array<T>::value,
Impl::_lazy<std::true_type>,
typename std::conditional<
std::is_class<T>::value,
Impl::_check_for_index_operator,
Impl::_lazy<std::false_type>
>::type
>::type::template evaluate<T>::type
{
static_assert(std::is_same<I,std::size_t>::value,"Your compiler is broken and does not support checking for arbitrary index types");
};
#endif // defined(DOXYGEN) or HAVE_IS_INDEXABLE_SUPPORT
//! Type trait to determine whether an instance of T has an operator[](I), i.e. whether it can be indexed with an index of type I. //! Type trait to determine whether an instance of T has an operator[](I), i.e. whether it can be indexed with an index of type I.
//! \deprecated is_indexable is deprecated, use `Dune::IsIndexable` instead //! \deprecated is_indexable is deprecated, use `Dune::IsIndexable` instead
/**
* \warning Not all compilers support testing for arbitrary index types. In particular, there
* are problems with GCC 4.4 and 4.5.
*/
template<typename T, typename I = std::size_t> template<typename T, typename I = std::size_t>
struct [[deprecated("Has been renamed to 'IsIndexable'.")]] is_indexable struct [[deprecated("Has been renamed to 'IsIndexable'.")]] is_indexable
: public IsIndexable<T,I> {}; : public IsIndexable<T,I> {};
......