From 43accd001b060af7ccf8a1aa42378aa74b55def1 Mon Sep 17 00:00:00 2001 From: Martin Bauer <martin.bauer@fau.de> Date: Fri, 26 Jul 2019 12:09:34 +0200 Subject: [PATCH] CMake waLBerla_python_file_generates: no need to add header files any more --- cmake/waLBerlaFunctions.cmake | 11 +++++++++-- tests/cuda/CMakeLists.txt | 5 +---- tests/field/CMakeLists.txt | 7 ++----- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/cmake/waLBerlaFunctions.cmake b/cmake/waLBerlaFunctions.cmake index 3de113afa..091a9048b 100644 --- a/cmake/waLBerlaFunctions.cmake +++ b/cmake/waLBerlaFunctions.cmake @@ -263,13 +263,20 @@ endfunction ( waLBerla_add_executable ) # Function to tell CMake which C/C++/CUDA files are generated by a python file # # Example: -# waLBerla_python_file_generates(MyPythonCodeGenScript.py Sweep1.cpp Sweep1.h Sweep2.h Sweep2.cu) +# waLBerla_python_file_generates(MyPythonCodeGenScript.py Sweep1.cpp Sweep2.cu) # # ####################################################################################################################### function( waLBerla_python_file_generates pythonFile ) + set(generatedFiles "") + foreach(element ${ARGN}) + string(REGEX REPLACE "\\.[^.]*$" "" elementWithoutExtension ${element}) + list(APPEND generatedFiles ${element}) + list(APPEND generatedFiles "${elementWithoutExtension}.h") + endforeach() + list(REMOVE_DUPLICATES generatedFiles) get_filename_component(pythonFileAbsolutePath ${pythonFile} ABSOLUTE) - set( "WALBERLA_CODEGEN_INFO_${pythonFileAbsolutePath}" ${ARGN} + set( "WALBERLA_CODEGEN_INFO_${pythonFileAbsolutePath}" ${generatedFiles} CACHE INTERNAL "Files generated by python script ${pythonFile}" FORCE) endfunction(waLBerla_python_file_generates) diff --git a/tests/cuda/CMakeLists.txt b/tests/cuda/CMakeLists.txt index 11213e011..6fdeb8352 100644 --- a/tests/cuda/CMakeLists.txt +++ b/tests/cuda/CMakeLists.txt @@ -38,8 +38,5 @@ waLBerla_compile_test( FILES CudaMPI DEPENDS blockforest timeloop gui ) waLBerla_compile_test( FILES AlignmentTest.cpp DEPENDS blockforest timeloop ) - -waLBerla_python_file_generates(codegen/MicroBenchmarkGpuLbm.py - MicroBenchmarkStreamKernel.cu MicroBenchmarkStreamKernel.h - MicroBenchmarkCopyKernel.cu MicroBenchmarkCopyKernel.h) +waLBerla_python_file_generates(codegen/MicroBenchmarkGpuLbm.py MicroBenchmarkStreamKernel.cu MicroBenchmarkCopyKernel.cu) waLBerla_compile_test( FILES codegen/MicroBenchmarkGpuLbm.cpp codegen/MicroBenchmarkGpuLbm.py) diff --git a/tests/field/CMakeLists.txt b/tests/field/CMakeLists.txt index 57114a6d1..2fb6b9188 100644 --- a/tests/field/CMakeLists.txt +++ b/tests/field/CMakeLists.txt @@ -60,11 +60,8 @@ endif( WALBERLA_BUILD_WITH_MPI ) # CodeGen Tests -waLBerla_python_file_generates(codegen/JacobiKernel.py - JacobiKernel2D.cpp JacobiKernel2D.h - JacobiKernel3D.cpp JacobiKernel3D.h) -waLBerla_compile_test( FILES codegen/CodegenJacobiCPU.cpp codegen/JacobiKernel.py - DEPENDS gui timeloop ) +waLBerla_python_file_generates(codegen/JacobiKernel.py JacobiKernel2D.cpp JacobiKernel3D.cpp ) +waLBerla_compile_test( FILES codegen/CodegenJacobiCPU.cpp codegen/JacobiKernel.py DEPENDS gui timeloop ) waLBerla_execute_test( NAME CodegenJacobiCPU ) -- GitLab