CMakeLists.txt 1.5 KB
Newer Older
1
# Create binaries for examples in bin/examples
2
3
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/examples)

4
5
6
7
8
9
10
11
function(add_example example_name example_source)
    add_executable(${example_name} ${example_source})
    target_link_libraries(${example_name} PRIVATE elsa::all)
    target_compile_features(${example_name} PUBLIC cxx_std_17)
    set_quickvec_options(${example_name} ${example_source})
    add_dependencies(build-examples ${example_name})
endfunction()

12
# define a target for all examples
13
add_custom_target(build-examples)
14

15
16
17
# build a simple 2D reconstruction
add_example(simple_recon2d simple_recon2d.cpp)

Tobias Lasser's avatar
Tobias Lasser committed
18
# build the 2d example program
19
add_example(example2d example2d.cpp)
20

21
# build the 2d limited angle trajectory example program
22
add_example(limited_angle_example2d limited_angle_example2d.cpp)
23

Andi Braimllari's avatar
Andi Braimllari committed
24
# build the 2d example admm program
25
add_example(example2d_admm example2d_admm.cpp)
Andi Braimllari's avatar
Andi Braimllari committed
26

27
# build the shearlet example program
28
add_example(shearlet_example example2d_shearlet.cpp)
29

30
31
32
33
34
35
36
37
CPMAddPackage(
    NAME argparse
    GITHUB_REPOSITORY p-ranav/argparse
    GIT_TAG v2.2
)

add_example(example_argparse example_argparse.cpp)
target_link_libraries(example_argparse PRIVATE argparse::argparse)
Tobias Lasser's avatar
Tobias Lasser committed
38

39
40
41
42
43
if(ELSA_BUILD_CUDA_PROJECTORS)
  include(CheckLanguage)
  check_language(CUDA)
  if(CMAKE_CUDA_COMPILER)
    enable_language(CUDA)
Tobias Lasser's avatar
Tobias Lasser committed
44
        # build the 3d example program
45
        add_example(example3d example3d.cpp)
Tobias Lasser's avatar
Tobias Lasser committed
46
47

        # build the GPU projector speed test program
48
        add_example(speed_test speed_test.cpp)
49
  endif()
50
endif()