summaryrefslogtreecommitdiff
path: root/src/Persistence_representations/utilities/CMakeLists.txt
blob: 85633b7bb81b3da2a43c763fbf61e0a0f041a66a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Copy files, otherwise result files are created in sources
file(COPY "${CMAKE_SOURCE_DIR}/data/persistence_diagram/first.pers" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/")
file(COPY "${CMAKE_SOURCE_DIR}/data/persistence_diagram/second.pers" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/")

function(add_persistence_representation_creation_utility creation_utility)
    add_executable ( ${creation_utility} ${creation_utility}.cpp )

    # as the function is called in a subdirectory level, need to '../' to find persistence files
    # ARGN will add all the other arguments (except creation_utility) sent to the CMake functions
    add_test(NAME Persistence_representation_utilities_${creation_utility} COMMAND $<TARGET_FILE:${creation_utility}>
        ${ARGN} "${CMAKE_CURRENT_BINARY_DIR}/../first.pers"
        "${CMAKE_CURRENT_BINARY_DIR}/../second.pers")

    install(TARGETS ${creation_utility} DESTINATION bin)
endfunction(add_persistence_representation_creation_utility)

function(add_persistence_representation_plot_utility creation_utility plot_utility tool_extension)
    add_executable ( ${plot_utility} ${plot_utility}.cpp )

    # as the function is called in a subdirectory level, need to '../' to find persistence heat maps files
    add_test(NAME Persistence_representation_utilities_${plot_utility}_first COMMAND $<TARGET_FILE:${plot_utility}>
        "${CMAKE_CURRENT_BINARY_DIR}/../first.pers${tool_extension}")
    #add_test(NAME Persistence_representation_utilities_${plot_utility}_second COMMAND $<TARGET_FILE:${plot_utility}>
    #    "${CMAKE_CURRENT_BINARY_DIR}/../second.pers${tool_extension}")
    set_tests_properties(Persistence_representation_utilities_${plot_utility}_first PROPERTIES DEPENDS
                         Persistence_representation_utilities_${creation_utility})
    if(GNUPLOT_PATH)
        add_test(NAME Persistence_representation_utilities_${plot_utility}_first_gnuplot COMMAND ${GNUPLOT_PATH}
            "-e" "load '${CMAKE_CURRENT_BINARY_DIR}/../first.pers${tool_extension}_GnuplotScript'")
        #add_test(NAME Persistence_representation_utilities_${plot_utility}_second_gnuplot COMMAND ${GNUPLOT_PATH}
        #    "-e" "load '${CMAKE_CURRENT_BINARY_DIR}/../second.pers${tool_extension}_GnuplotScript'")
        set_tests_properties(Persistence_representation_utilities_${plot_utility}_first_gnuplot PROPERTIES DEPENDS
                             Persistence_representation_utilities_${plot_utility}_first)
    endif()

    install(TARGETS ${plot_utility} DESTINATION bin)
endfunction(add_persistence_representation_plot_utility)

function(add_persistence_representation_function_utility creation_utility function_utility tool_extension)
    add_executable ( ${function_utility} ${function_utility}.cpp )

    # ARGV2 is an optional argument
    if (${ARGV2})
        # as the function is called in a subdirectory level, need to '../' to find persistence heat maps files
        add_test(NAME Persistence_representation_utilities_${function_utility} COMMAND $<TARGET_FILE:${function_utility}>
            "${ARGV2}"
            "${CMAKE_CURRENT_BINARY_DIR}/../first.pers${tool_extension}"
            "${CMAKE_CURRENT_BINARY_DIR}/../second.pers${tool_extension}")
    else()
        # as the function is called in a subdirectory level, need to '../' to find persistence heat maps files
        add_test(NAME Persistence_representation_utilities_${function_utility} COMMAND $<TARGET_FILE:${function_utility}>
            "${CMAKE_CURRENT_BINARY_DIR}/../first.pers${tool_extension}"
            "${CMAKE_CURRENT_BINARY_DIR}/../second.pers${tool_extension}")
    endif()
    set_tests_properties(Persistence_representation_utilities_${function_utility} PROPERTIES DEPENDS
                         Persistence_representation_utilities_${creation_utility})

    install(TARGETS ${function_utility} DESTINATION bin)
endfunction(add_persistence_representation_function_utility)

add_subdirectory(persistence_heat_maps)
add_subdirectory(persistence_intervals)
add_subdirectory(persistence_landscapes)
add_subdirectory(persistence_landscapes_on_grid)
add_subdirectory(persistence_vectors)