File: CMakeLists.txt

package info (click to toggle)
eccodes 2.20.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 400,332 kB
  • sloc: ansic: 167,977; makefile: 21,348; sh: 10,719; f90: 5,927; python: 4,831; perl: 3,031; javascript: 1,427; yacc: 818; lex: 356; awk: 66
file content (148 lines) | stat: -rw-r--r-- 4,647 bytes parent folder | download
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# examples/python/CMakeLists.txt

# Configure the file which all CMake tests will include
configure_file( include.ctest.sh.in  include.ctest.sh  @ONLY )

execute_process( COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/include.sh ${CMAKE_CURRENT_BINARY_DIR} )

# Build the executables used by test scripts
################################################
list(APPEND test_bins
   grib_keys_iterator
   grib_print_data
   grib_iterator
   grib_count_messages
)

foreach( tool ${test_bins} )
   ecbuild_add_executable( TARGET    p_${tool}
                           NOINSTALL
                           SOURCES   ${tool}.c
                           CONDITION HAVE_PYTHON2
                           LIBS      eccodes )
   list( APPEND ptools  p_${tool} )
endforeach()


# Now add each test
################################################
if( HAVE_BUILD_TOOLS )
    list(APPEND tests_basic
       grib_set_pv
       grib_read_sample
       bufr_read_sample
       bufr_ecc-869
    )
    list(APPEND tests_extra
       grib_clone
       grib_count_messages
       grib_get_message_offset
       grib_get_keys
       grib_index
       grib_iterator
       grib_keys_iterator
       grib_multi_write
       grib_nearest
       grib_print_data
       grib_samples
       grib_set_missing
       binary_message
       grib_set_bitmap
       bufr_attributes
       bufr_clone
       bufr_copy_data
       bufr_expanded
       bufr_get_keys
       bufr_keys_iterator
       bufr_read_header
       bufr_read_scatterometer
       bufr_read_tropical_cyclone
       bufr_read_synop
       bufr_read_temp
       bufr_set_keys
       bufr_subset
       get_product_kind
       gts_get_keys
       metar_get_keys
       bufr_ecc-448
    )
else()
    # No command line tools
    list(APPEND tests_basic
       grib_read_sample
       bufr_read_sample
    )
    list(APPEND tests_extra
       grib_clone
       grib_count_messages
       grib_get_keys
       grib_index
       grib_iterator
       grib_keys_iterator
       grib_multi_write
       grib_nearest
       grib_print_data
       grib_samples
       bufr_attributes
       bufr_clone
       bufr_expanded
       bufr_get_keys
       bufr_keys_iterator
       bufr_read_header
       bufr_read_scatterometer
       bufr_read_tropical_cyclone
       bufr_read_synop
       bufr_read_temp
       bufr_set_keys
       bufr_subset
       get_product_kind
       gts_get_keys
       metar_get_keys
       bufr_ecc-448
    )
endif()

# The high level python test requires new features in the unittest
# which are only there for python 2.7 onwards
if( HAVE_PYTHON2 AND PYTHON_VERSION_STRING VERSION_GREATER "2.7" )
    #ecbuild_info("Python examples: Adding test for High-level Pythonic Interface")
    list( APPEND tests_extra high_level_api )
    list( APPEND tests_extra grib_set_keys ) # Uses OrderedDict
endif()

foreach( test ${tests_basic} )
    ecbuild_add_test( TARGET eccodes_p_${test}_test
                      TYPE       SCRIPT
                      DEPENDS    ${ptools}
                      COMMAND    ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh
                      CONDITION  HAVE_PYTHON2
                      ENVIRONMENT PYTHON=${PYTHON_EXECUTABLE} )
endforeach()
foreach( test ${tests_extra} )
    ecbuild_add_test( TARGET eccodes_p_${test}_test
                      TYPE       SCRIPT
                      DEPENDS    ${ptools}
                      COMMAND    ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh
                      CONDITION  HAVE_PYTHON2 AND ENABLE_EXTRA_TESTS
                      ENVIRONMENT PYTHON=${PYTHON_EXECUTABLE}
                      TEST_DEPENDS eccodes_download_gribs eccodes_download_tigge_gribs eccodes_download_bufrs )
endforeach()

# Add test which requires input CSV file
ecbuild_add_test( TARGET eccodes_p_bufr_encode_flight_test
                  TYPE       SCRIPT
                  DEPENDS    ${ptools}
                  COMMAND    ${CMAKE_CURRENT_SOURCE_DIR}/bufr_encode_flight.sh
                  CONDITION  HAVE_PYTHON2 AND ENABLE_EXTRA_TESTS AND HAVE_BUILD_TOOLS
                  ENVIRONMENT PYTHON=${PYTHON_EXECUTABLE}
                  RESOURCES   flight_data.csv
                  TEST_DEPENDS eccodes_download_bufrs )

# Conditional tests
ecbuild_add_test( TARGET eccodes_p_grib_ccsds_test
                  TYPE       SCRIPT
                  DEPENDS    ${ptools}
                  COMMAND    ${CMAKE_CURRENT_SOURCE_DIR}/grib_ccsds.sh
                  CONDITION  HAVE_PYTHON2 AND HAVE_AEC AND ENABLE_EXTRA_TESTS
                  ENVIRONMENT PYTHON=${PYTHON_EXECUTABLE}
                  TEST_DEPENDS eccodes_download_gribs )