[Python] Additional Cmake arguments to Python generator Dune 2.9
I try to use JIT compilation for my module. Since my code uses c+20, the generator.load
call fails with
1: /dune/dune-localfefunctions/dune/localfefunctions/expressions/rebind.hh:14:26: error: ‘remove_cvref_t’ in namespace ‘std’ does not name a template type
1: 14 | auto rebind(const std::remove_cvref_t<E1>& u, const std::remove_cvref_t<E2>& v,
1: | ^~~~~~~~~~~~~~
1: /dune/dune-localfefunctions/dune/localfefunctions/expressions/rebind.hh:14:21: note: ‘std::remove_cvref_t’ is only available from C++20 onwards
1: 14 | auto rebind(const std::remove_cvref_t<E1>& u, const std::remove_cvref_t<E2>& v,
in an included header. My generator code looks like
from dune.generator.generator import SimpleGenerator
from dune.common.hashit import hashIt
def linearElasticElement(basis, element, youngsMod, nu) :
generator = SimpleGenerator("LinearElastic", "Ikarus::Python")
element_type = f"Ikarus::LinearElastic<{basis.cppTypeName}>"
extraCM=["target_compile_features( TARGET PUBLIC cxx_std_20)"] # make sure we compile with C++20 enabled
#extraCM=["set(CMAKE_CXX_STANDARD 20)"] # make sure we compile with C++20 enabled
includes = []
includes += ["ikarus/finiteElements/mechanics/linearElastic.hh"]
includes += ["ikarus/python/finiteElements/linearElastic.hh"]
moduleName = "linearElastic_" + hashIt(element_type)
module = generator.load(
includes=includes,
typeName=element_type,
moduleName=moduleName,
extraCMake=extraCM,
holder="std::shared_ptr",
)
return module.LinearElastic(basis, element, youngsMod, nu)
is the extraCMake
input argument suited for this use case?
Both extraCM
I defined there didn't change the error message.
Thanks in advance! @andreas.dedner @tkoch @robert.kloefkorn
Edited by Alexander Müller