diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 151430846e1..b284bd244fe 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -28,7 +28,6 @@ set(EXAMPLES_LIST par-ilu-convergence performance-debugging preconditioner-export - schroedinger-splitting simple-solver-logging) if(GINKGO_BUILD_CUDA AND GINKGO_BUILD_OMP) @@ -41,9 +40,9 @@ endif() find_package(OpenCV QUIET) if(OpenCV_FOUND) - list(APPEND EXAMPLES_LIST heat-equation) + list(APPEND EXAMPLES_LIST heat-equation schroedinger-splitting) else() - message(STATUS "No OpenCV found, disabling heat-equation example") + message(STATUS "No OpenCV found, disabling examples with video output") endif() if(GINKGO_HAVE_PAPI_SDE) diff --git a/examples/schroedinger-splitting/CMakeLists.txt b/examples/schroedinger-splitting/CMakeLists.txt index 7ae4c758b76..823f3a55f54 100644 --- a/examples/schroedinger-splitting/CMakeLists.txt +++ b/examples/schroedinger-splitting/CMakeLists.txt @@ -1,12 +1,15 @@ -set(target_name "schroedinger-splitting") -find_package(OpenCV) +cmake_minimum_required(VERSION 3.9) +project(schroedinger-splitting) -if (OpenCV_FOUND) - add_executable(${target_name} ${target_name}.cpp) - target_link_libraries(${target_name} Ginkgo::ginkgo ${OpenCV_LIBS}) - target_include_directories(${target_name} PRIVATE ${PROJECT_SOURCE_DIR}) - configure_file(../../matrices/examples/gko_logo_2d.mtx data/gko_logo_2d.mtx COPYONLY) - configure_file(../../matrices/examples/gko_text_2d.mtx data/gko_text_2d.mtx COPYONLY) -else() - message("OpenCV not found, skipping schroedinger-splitting example") +# We only need to find Ginkgo if we build this example stand-alone +if (NOT GINKGO_BUILD_EXAMPLES) + find_package(Ginkgo 1.5.0 REQUIRED) endif() +find_package(OpenCV REQUIRED) + +add_executable(schroedinger-splitting schroedinger-splitting.cpp) +target_link_libraries(schroedinger-splitting Ginkgo::ginkgo ${OpenCV_LIBS}) + +# Copy the data files to the execution directory +configure_file(../../matrices/examples/gko_logo_2d.mtx data/gko_logo_2d.mtx COPYONLY) +configure_file(../../matrices/examples/gko_text_2d.mtx data/gko_text_2d.mtx COPYONLY)