From e59f2fa65abb489775489c7d3332a4c010a065b0 Mon Sep 17 00:00:00 2001 From: Dominic Kempf <dominic.kempf@iwr.uni-heidelberg.de> Date: Tue, 23 Jul 2019 10:33:09 +0200 Subject: [PATCH] Automatically set the with_mpi option from CMake using command line arguments --- cmake/modules/DuneCodegenMacros.cmake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmake/modules/DuneCodegenMacros.cmake b/cmake/modules/DuneCodegenMacros.cmake index da322586..91e48d73 100644 --- a/cmake/modules/DuneCodegenMacros.cmake +++ b/cmake/modules/DuneCodegenMacros.cmake @@ -116,6 +116,11 @@ function(dune_add_generated_executable) message(FATAL_ERROR "Unrecognized arguments in dune_add_generated_executable. This usually indicates a typo.") endif() + set(MPI_OPTION "0") + if(MPI_FOUND) + set(MPI_OPTION "1") + endif() + # Apply defaults and enforce requirements if(NOT GEN_TARGET) message(FATAL_ERROR "Need to specify the TARGET parameter for dune_add_generated_executable") @@ -139,6 +144,7 @@ function(dune_add_generated_executable) --target-name ${GEN_TARGET} --driver-file ${GEN_SOURCE} --project-basedir ${CMAKE_BINARY_DIR} + --with-mpi ${MPI_OPTION} ${GEN_FORM_COMPILER_ARGS} DEPENDS ${GEN_UFLFILE} ${UFL2PDELAB_SOURCES} ${GEN_DEPENDS} ${DUNE_CODEGEN_ADDITIONAL_PYTHON_SOURCES} COMMENT "Generating driver for the target ${GEN_TARGET}" @@ -199,6 +205,7 @@ function(dune_add_generated_executable) --ini-file ${GEN_INIFILE} --target-name ${GEN_TARGET} --operator-to-build ${op} + --with-mpi ${MPI_OPTION} ${ANALYZE_GRID_OPTION} DEPENDS ${GEN_UFLFILE} ${UFL2PDELAB_SOURCES} ${GEN_DEPENDS} ${DUNE_CODEGEN_ADDITIONAL_PYTHON_SOURCES} ${ANALYZE_GRID_FILE} COMMENT "Generating operator file ${depdata___${op}} for the target ${GEN_TARGET}" -- GitLab