| 1 |
include(ParseArguments.cmake) |
| 2 |
|
| 3 |
include_directories(${CMAKE_CURRENT_SOURCE_DIR}) |
| 4 |
include_directories(${CMAKE_SOURCE_DIR}) |
| 5 |
include_directories(${CMAKE_BINARY_DIR}) |
| 6 |
|
| 7 |
add_custom_target(stencils ALL) |
| 8 |
|
| 9 |
set(GENERATED_FILES) |
| 10 |
macro(STENCIL_DOC name define) |
| 11 |
add_executable(${name} dump-stencil.cpp) |
| 12 |
target_compile_definitions(${name} PRIVATE -Dstenciltoapply=${name}_stencilop -Dstencilargs=${define}) |
| 13 |
target_link_libraries(${name} blitz) |
| 14 |
set(texi ${name}.texi) |
| 15 |
add_custom_target(${texi} |
| 16 |
DEPENDS ${name} |
| 17 |
COMMAND $<TARGET_FILE:${name}> > ${texi} 2>&1 |
| 18 |
OUTPUTS ${texi}) |
| 19 |
add_dependencies(stencils ${texi}) |
| 20 |
# For some reason the generated files are not cleaned up (contrarily to what is said for cmake). |
| 21 |
set(GENERATED_FILES ${GENERATED_FILES} ${texi}) |
| 22 |
endmacro() |
| 23 |
|
| 24 |
macro(GENERATE_STENCILS_DOCS) |
| 25 |
set(args ${ARGN}) |
| 26 |
PARSE_ARGUMENTS(STENCIL "NORMAL;LAPLACIAN" "" ${args}) |
| 27 |
foreach(texi ${STENCIL_NORMAL}) |
| 28 |
STENCIL_DOC(${texi} "A,1") |
| 29 |
endforeach() |
| 30 |
foreach(texi ${STENCIL_LAPLACIAN}) |
| 31 |
STENCIL_DOC(${texi} "A") |
| 32 |
endforeach() |
| 33 |
endmacro() |
| 34 |
|
| 35 |
set(NORMAL_STENCILS |
| 36 |
central12 central22 central32 central42 central14 central24 central34 central44 |
| 37 |
forward11 forward21 forward31 forward41 forward12 forward22 forward32 forward42 |
| 38 |
backward11 backward21 backward31 backward41 backward12 backward22 backward32 backward42) |
| 39 |
|
| 40 |
set(LAPLACIAN_STENCILS Laplacian2D Laplacian2D4) |
| 41 |
|
| 42 |
GENERATE_STENCILS_DOCS(NORMAL ${NORMAL_STENCILS} LAPLACIAN ${LAPLACIAN_STENCILS}) |
| 43 |
|
| 44 |
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${GENERATED_FILES}") |