1+ set (all_example_runs ${all_example_runs} )
2+ set (all_advec_example_runs)
3+
14message (STATUS " advection_diffusion" )
25include_directories (
36 ${3rdparty_INCLUDES}
4- ${fftw3_INCLUDES }
7+ ${FFTW_INCLUDE_PATH }
58 ${pfasst_INCLUDES}
69)
710
@@ -11,13 +14,72 @@ set(advec_examples
1114 serial_mlsdc_autobuild
1215)
1316
14- foreach (example ${advec_examples} )
17+ set (advec_mpi_examples)
18+
19+ if (${pfasst_WITH_MPI} )
20+ set (advec_mpi_examples
21+ mpi_pfasst
22+ )
23+ endif ()
24+
25+ set (all_advec_examples
26+ ${advec_examples}
27+ ${advec_mpi_examples}
28+ )
29+
30+ foreach (example ${all_advec_examples} )
1531 add_executable (${example} ${CMAKE_CURRENT_SOURCE_DIR} /${example} .cpp)
16- add_dependencies (${example} fftw3)
32+ if (NOT FFTW_FOUND)
33+ add_dependencies (${example} fftw3)
34+ endif ()
1735 target_link_libraries (${example}
18- ${fftw3_LIBS }
36+ ${FFTW_LIBRARIES }
1937 )
2038 set_target_properties (${example}
2139 PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} /examples/advection_diffusion
2240 )
2341endforeach (example)
42+
43+ message (STATUS " creating make targets to run examples" )
44+ foreach (example ${advec_examples} )
45+ add_custom_target (run_example_advec_${example}
46+ COMMAND ${example}
47+ DEPENDS ${example}
48+ WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} /examples/advection_diffusion
49+ COMMENT "Running Advection-Diffusion example: ${example} " VERBATIM
50+ )
51+ list (APPEND all_advec_example_runs run_example_advec_${example} )
52+ message (STATUS " - run_example_advec_${example} " )
53+ endforeach (example)
54+
55+ if (${pfasst_WITH_MPI} )
56+ include_directories (${MPI_CXX_INCLUDE_PATH} )
57+ foreach (example ${advec_mpi_examples} )
58+ if (MPI_COMPILE_FLAGS)
59+ set_target_properties (${example} PROPERTIES COMPILE_FLAGS "${MPI_COMPILE_FLAGS} " )
60+ endif ()
61+ if (MPI_LINK_FLAGS)
62+ set_target_properties (${example} PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS} " )
63+ endif ()
64+ target_link_libraries (${example} ${MPI_CXX_LIBRARIES} )
65+ endforeach (example)
66+ message (STATUS " creating make targets to run MPI examples" )
67+ foreach (example ${advec_mpi_examples} )
68+ add_custom_target (run_example_advec_${example}
69+ COMMAND ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 4 ${MPIEXEC_PREFLAGS} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} /examples/advection_diffusion/${example} ${MPIEXEC_POSTFLAGS}
70+ DEPENDS ${example}
71+ WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} /examples/advection_diffusion
72+ COMMENT "Running Advection-Diffusion example: ${example} " VERBATIM
73+ )
74+ list (APPEND all_advec_example_runs run_example_advec_${example} )
75+ message (STATUS " - run_example_advec_${example} " )
76+ endforeach (example)
77+ endif ()
78+
79+ add_custom_target (run_example_advec_all
80+ DEPENDS ${all_advec_example_runs}
81+ COMMENT "Running all Advection-Diffusion examples" VERBATIM
82+ )
83+ message (STATUS " - run_example_advec_all" )
84+
85+ set (all_example_runs ${all_advec_example_runs} PARENT_SCOPE)
0 commit comments