From 5d39669d88cf3d6e156f44503800d80f6c02e5b7 Mon Sep 17 00:00:00 2001 From: Chuck Atkins <chuck.atkins@kitware.com> Date: Mon, 3 Apr 2017 15:55:00 -0400 Subject: [PATCH] Add examples as tests --- examples/hello/bpWriter/CMakeLists.txt | 13 +++++++++-- examples/hello/datamanReader/CMakeLists.txt | 26 +++++++++++++++++---- examples/hello/datamanWriter/CMakeLists.txt | 26 +++++++++++++++++---- examples/hello/timeBP/CMakeLists.txt | 16 ++++++++++--- 4 files changed, 68 insertions(+), 13 deletions(-) diff --git a/examples/hello/bpWriter/CMakeLists.txt b/examples/hello/bpWriter/CMakeLists.txt index 3518b4278..67e193342 100644 --- a/examples/hello/bpWriter/CMakeLists.txt +++ b/examples/hello/bpWriter/CMakeLists.txt @@ -8,7 +8,16 @@ if(ADIOS_USE_MPI) add_executable(hello_bpWriter helloBPWriter.cpp) target_include_directories(hello_bpWriter PRIVATE ${MPI_C_INCLUDE_PATH}) target_link_libraries(hello_bpWriter adios2 ${MPI_C_LIBRARIES}) + + if(ADIOS_BUILD_TESTING) + add_test( NAME Example::hello::bpWriter COMMAND hello_bpWriter) + endif() +else() + add_executable(hello_bpWriter_nompi helloBPWriter_nompi.cpp) + target_link_libraries(hello_bpWriter_nompi adios2) + + if(ADIOS_BUILD_TESTING) + add_test( NAME Example::hello::bpWriter_nompi COMMAND hello_bpWriter_nompi) + endif() endif() -add_executable(hello_bpWriter_nompi helloBPWriter_nompi.cpp) -target_link_libraries(hello_bpWriter_nompi adios2) diff --git a/examples/hello/datamanReader/CMakeLists.txt b/examples/hello/datamanReader/CMakeLists.txt index f32a22838..3aa3e264a 100644 --- a/examples/hello/datamanReader/CMakeLists.txt +++ b/examples/hello/datamanReader/CMakeLists.txt @@ -3,8 +3,26 @@ # accompanying file Copyright.txt for details. #------------------------------------------------------------------------------# -add_executable(hello_datamanReader helloDataManReader.cpp) -target_link_libraries(hello_datamanReader adios2) +if(ADIOS_USE_MPI) + find_package(MPI COMPONENTS C REQUIRED) -add_executable(hello_datamanReader_nompi helloDataManReader_nompi.cpp) -target_link_libraries(hello_datamanReader_nompi adios2) + add_executable(hello_datamanReader helloDataManReader.cpp) + target_link_libraries(hello_datamanReader adios2) + target_include_directories(hello_datamanReader PRIVATE ${MPI_C_INCLUDE_PATH}) + target_link_libraries(hello_datamanReader adios2 ${MPI_C_LIBRARIES}) + + if(ADIOS_BUILD_TESTING) + add_test(NAME Example::hello::datamanReader COMMAND hello_datamanReader) + endif() +else() + add_executable(hello_datamanReader_nompi helloDataManReader_nompi.cpp) + target_link_libraries(hello_datamanReader_nompi adios2) + + if(ADIOS_BUILD_TESTING) + add_test( + NAME Example::hello::datamanReader_nompi + COMMAND hello_datamanReader_nompi + ) + endif() +endif() + diff --git a/examples/hello/datamanWriter/CMakeLists.txt b/examples/hello/datamanWriter/CMakeLists.txt index dee5f38e1..7defd6c40 100644 --- a/examples/hello/datamanWriter/CMakeLists.txt +++ b/examples/hello/datamanWriter/CMakeLists.txt @@ -3,8 +3,26 @@ # accompanying file Copyright.txt for details. #------------------------------------------------------------------------------# -add_executable(hello_datamanWriter helloDataManWriter.cpp) -target_link_libraries(hello_datamanWriter adios2) +if(ADIOS_USE_MPI) + find_package(MPI COMPONENTS C REQUIRED) + + add_executable(hello_datamanWriter helloDataManWriter.cpp) + target_link_libraries(hello_datamanWriter adios2) + target_include_directories(hello_datamanWriter PRIVATE ${MPI_C_INCLUDE_PATH}) + target_link_libraries(hello_datamanWriter adios2 ${MPI_C_LIBRARIES}) + + if(ADIOS_BUILD_TESTING) + add_test(NAME Example::hello::datamanWriter COMMAND hello_datamanWriter) + endif() +else() + add_executable(hello_datamanWriter_nompi helloDataManWriter_nompi.cpp) + target_link_libraries(hello_datamanWriter_nompi adios2) + + if(ADIOS_BUILD_TESTING) + add_test( + NAME Example::hello::datamanWriter_nompi + COMMAND hello_datamanWriter_nompi + ) + endif() +endif() -add_executable(hello_datamanWriter_nompi helloDataManWriter_nompi.cpp) -target_link_libraries(hello_datamanWriter_nompi adios2) diff --git a/examples/hello/timeBP/CMakeLists.txt b/examples/hello/timeBP/CMakeLists.txt index a0e382825..d86828c90 100644 --- a/examples/hello/timeBP/CMakeLists.txt +++ b/examples/hello/timeBP/CMakeLists.txt @@ -9,8 +9,18 @@ if(ADIOS_USE_MPI) target_link_libraries(hello_timeBPWriter adios2) target_include_directories(hello_timeBPWriter PRIVATE ${MPI_C_INCLUDE_PATH}) target_link_libraries(hello_timeBPWriter adios2 ${MPI_C_LIBRARIES}) -endif() + if(ADIOS_BUILD_TESTING) + add_test(NAME Example::hello::timeBPWriter COMMAND hello_timeBPWriter) + endif() +else() + add_executable(hello_timeBPWriter_nompi timeBPWriter_nompi.cpp) + target_link_libraries(hello_timeBPWriter_nompi adios2) -add_executable(hello_timeBPWriter_nompi timeBPWriter_nompi.cpp) -target_link_libraries(hello_timeBPWriter_nompi adios2) + if(ADIOS_BUILD_TESTING) + add_test( + NAME Example::hello::timeBPWriter_nompi + COMMAND hello_timeBPWriter_nompi + ) + endif() +endif() -- GitLab