Skip to content
Snippets Groups Projects
Commit 10b4e43a authored by Martin Bauer's avatar Martin Bauer
Browse files

CMake codegen interation fixes & cuda support

- proper escaping of braces when passing JSON to python
- pass information if walberla was built with CUDA to pystencils
  to support apps that use GPU optionally
parent bf85ec98
Branches
Tags
No related merge requests found
......@@ -53,15 +53,16 @@ function( handle_python_codegen sourceFilesOut generatedSourceFilesOut generator
string (REPLACE ";" "\", \"" jsonFileList "${generatedWithAbsolutePath}" )
set(pythonParameters
"{\"EXPECTED_FILES\": [\"${jsonFileList}\"], \"CMAKE_VARS\" : { "
"\\\{\"EXPECTED_FILES\": [\"${jsonFileList}\"], \"CMAKE_VARS\" : \\\{ "
"\"WALBERLA_OPTIMIZE_FOR_LOCALHOST\": \"${WALBERLA_OPTIMIZE_FOR_LOCALHOST}\","
"\"WALBERLA_DOUBLE_ACCURACY\": \"${WALBERLA_DOUBLE_ACCURACY}\","
"\"WALBERLA_BUILD_WITH_MPI\": \"${WALBERLA_BUILD_WITH_MPI}\","
"\"WALBERLA_BUILD_WITH_CUDA\": \"${WALBERLA_BUILD_WITH_CUDA}\","
"\"WALBERLA_BUILD_WITH_OPENMP\": \"${WALBERLA_BUILD_WITH_OPENMP}\" } }"
"\"WALBERLA_BUILD_WITH_OPENMP\": \"${WALBERLA_BUILD_WITH_OPENMP}\" \\\} \\\}"
)
string(REPLACE "\"" "\\\"" pythonParameters ${pythonParameters}) # even one more quoting level required
string(REPLACE "\n" "" pythonParameters ${pythonParameters}) # remove newline characters
add_custom_command(OUTPUT ${generatedWithAbsolutePath}
DEPENDS ${sourceFile}
COMMAND ${PYTHON_EXECUTABLE} ${sourceFile} ${pythonParameters}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment