File: CMakeLists.txt

package info (click to toggle)
eccodes 2.45.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 154,404 kB
  • sloc: cpp: 162,953; ansic: 26,308; sh: 21,742; f90: 6,854; perl: 6,361; python: 5,172; java: 2,226; javascript: 1,427; yacc: 854; fortran: 543; lex: 359; makefile: 283; xml: 183; awk: 66
file content (616 lines) | stat: -rw-r--r-- 19,262 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
# tests/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}/utils.sh   ${CMAKE_CURRENT_BINARY_DIR} )

# Build the executables used by test scripts
################################################
list(APPEND test_c_bins
    list_codetable_flagtable_keys
    wmo_read_bufr_from_file
    wmo_read_gts_from_file
    wmo_read_any_from_file
    wmo_read_any_from_file_with_offset
    wmo_read_any_from_stream
    grib_bpv_limit
    grib_double_cmp
    read_any
    julian
    grib_update_sections_lengths
    grib_indexing
    grib_fieldset
    grib_multi_from_message
    grib_clone_headers_only
    grib_read_index
    grib_set_large_message_fail
    unit_tests
    bufr_keys_iter
    bufr_keys_iter_header
    grib_keys_iter
    grib_keys_iter_skip
    grib_geo_iter
    grib_nearest_test
    grib_util_set_spec
    grib_util_set_spec2
    grib_check_param_concepts
    grib_local_MeteoFrance
    grib_2nd_order_numValues
    grib_optimize_scaling
    grib_optimize_scaling_sh
    grib_set_force
    grib_run_length_packing
    grib_partial_message
    grib_codedValues_as_bytes
    grib_ecc-1467
    grib_ecc-1431
    grib_ecc-1433
    grib_ecc-1764
    grib_ecc-2005
    grib_ecc-2019
    grib_ecc-2034
    grib_ecc-2045
    bufr_ecc-517
    bufr_ecc-1288
    bufr_ecc-2011
    bufr_get_element
    bufr_extract_headers
    bufr_check_descriptors
    bufr_coordinate_descriptors
    codes_new_from_samples
    codes_dump_action_tree
    codes_set_samples_path
    codes_compare_keys
    codes_dump_content
    codes_codetable
    codes_get_string
    grib_sh_ieee64
    grib_set_bytes
    grib_copy_message
    grib_packing_order
    grib_unpack_subarray
    grib_sh_imag
    grib_spectral
    grib_lam_bf
    grib_lam_gp)


foreach( tool ${test_c_bins} )
    # here we use the fact that each tool has only one C file that matches its name
    ecbuild_add_executable( TARGET    ${tool}
                            NOINSTALL
                            SOURCES   ${tool}.cc
                            LIBS      eccodes )
endforeach()


# Now add each test (shell scripts)
#################################################
if( HAVE_BUILD_TOOLS )

    # These tests do not require any data downloads
    # and are generally quick
    list(APPEND tests_basic
        codes_info
        codes_deprecated
        unit_tests
        julian
        grib_dump_samples
        bufr_dump_samples
        bufr_check_descriptors
        definitions
        grib2_version
        grib_accessors
        grib_calendar
        grib_md5
        grib_cfNames
        grib_packing_order
        filter_substr
        filter_contains
        filter_size
        filter_is_one_of
        filter_is_in_list
        filter_transient_darray
        grib_ecpoint
        grib_s2s
        grib_fire
        grib_mtg2_switch
        grib_generalised_tiles
        # grib_true_imagery
        grib2_wave_spectra
        grib2_probability
        grib_suppressed
        grib_destine_mars_keys
        grib_destine_test_mars_keys
        grib_2nd_order_numValues
        grib_ecc-136
        grib_ecc-530
        grib_ecc-922
        grib_ecc-966
        grib_ecc-967
        grib_ecc-1150
        grib_ecc-1053
        grib_ecc-1065
        grib_ecc-1167
        grib_ecc-1170
        grib_ecc-1195
        grib_ecc-1212
        grib_ecc-1230
        grib_ecc-1258
        grib_ecc-1260
        grib_ecc-1261
        grib_ecc-1271
        grib_ecc-1315
        grib_ecc-1322
        grib_ecc-1319
        grib_ecc-1406
        grib_ecc-1440
        grib_ecc-1560
        grib_ecc-1571
        grib_ecc-1654
        grib_ecc-1671
        grib_ecc-1708
        grib_ecc-1766
        grib_ecc-1829
        grib_ecc-2140
        bufr_ecc-1028
        bufr_ecc-1195
        bufr_ecc-1259
        bufr_ecc-1290
        bufr_ecc-1304
        bufr_ecc-1347
        bufr_ecc-1395
        bufr_ecc-1840
        bufr_json_samples
        bufr_ecc-359
        bufr_ecc-517
        bufr_ecc-2011
        bufr_ecc-2153
        grib_efas
        grib_sh_imag
        grib_spectral
        grib_levtype
        grib_typeOfLevel
        grib2_product_templates
        grib_grid_unstructured
        grib_grid_lambert_conformal
        grib_grid_polar_stereographic
        grib_grid_healpix
        grib_g1day_of_the_year_date
        grib_paramid_chemid_split
        grib_cmp_paramtype
        grib_timeSpanConcept
        grib_cmp_timeSpan
        grib_stattype
    )

    # These tests require data downloads
    # and/or take much longer
    list(APPEND tests_extra
        error_codes
        grib_datasetForLocal
        grib_isGridded_isSpectral
        grib_data_quality_checks
        grib_check_message_validity
        grib_update_sections_lengths
        grib_units_bias_factor
        grib_set_large_message_fail
        grib_g1monthlydate
        grib_g1fcperiod
        grib_bpv_limit
        grib_complex
        grib_double_cmp
        grib_paramtypeConcept
        grib_element
        grib_change_packing
        grib_complex_spatial_differencing
        grib_codedValues_as_bytes
        grib_run_length_packing
        grib_grid_space_view
        grib_partial_message
        grib_true_imagery
        grib_headers_only
        grib_uerra
        grib_unpack_subarray
        grib_count
        grib_clone_headers_only
        filter_dump_content
        wmo_read_bufr_from_file
        wmo_read_gts_from_file
        wmo_read_any_from_file
        wmo_read_any_from_file_with_offset
        wmo_read_any_from_stream
        bufr_templates
        bufr_rdbSubTypes
        bufr_dump_data
        bufr_dump_descriptors
        bufr_coordinate_descriptors
        bufr_dump_subset
        bufr_dump_decode_filter
        bufr_dump_encode_filter
        bufrdc_desc_ref
        bufrdc_ref
        bufr_compare
        bufr_copy
        bufr_count
        bufr_get
        bufr_operators
        bufr_filter_misc
        bufr_filter_datetime
        bufr_filter_fail
        bufr_filter_extract_subsets
        bufr_filter_extract_datetime
        bufr_filter_extract_area
        bufr_filter_unpack_pack
        bufr_filter_skipExtraKeyAttributes
        bufr_indexing
        bufr_json_data
        bufr_ls
        bufr_ls_json
        bufr_change_edition
        bufr_keys_iter
        bufr_keys_iter_header
        grib_keys_iter
        grib_keys_iter_skip
        grib_geo_iter
        grib_to_json
        grib_to_ppm
        grib_list_keys
        grib_histogram
        bufr_get_element
        bufr_wmo_tables
        bufr_extract_headers
        extract_offsets
        bufr_operator_203
        bufr_ecc-147
        bufr_ecc-389
        bufr_ecc-673
        bufr_ecc-428
        bufr_ecc-286
        bufr_ecc-288
        bufr_ecc-313
        bufr_ecc-616
        bufr_ecc-686
        bufr_ecc-690
        bufr_ecc-379
        bufr_ecc-393
        bufr_ecc-433
        bufr_ecc-750
        bufr_ecc-765
        bufr_ecc-875
        bufr_ecc-887
        bufr_ecc-1187
        bufr_ecc-1305
        bufr_ecc-1476
        bufr_ecc-1623
        bufr_ecc-1785
        bufr_ecc-1958
        bufr_ecc-1938
        bufr_ecc-2030
        bufr_ecc-2037
        bufr_ecc-2100
        bufr_ecc-2189
        grib_488
        grib_ecc-490
        grib_ecc-756
        grib_ecc-806
        grib_ecc-873
        grib_ecc-600
        grib_ecc-813
        grib_ecc-923
        grib_ecc-979
        grib_ecc-984
        grib_ecc-1000
        grib_ecc-1001
        grib_ecc-1030
        grib_ecc-1364
        grib_ecc-1397
        grib_ecc-1425
        grib_ecc-1467
        grib_ecc-1764
        grib_ecc-1792
        grib_ecc-1806
        #grib_ecc-1898
        grib_ecc-1907
        grib_ecc-1941
        grib_ecc-1942
        grib_ecc-1992
        grib_ecc-2005
        grib_ecc-2006
        grib_ecc-2013
        grib_ecc-2019
        grib_ecc-2034
        grib_ecc-2045
        grib_ecc-2050
        grib_ecc-2052
        grib_ecc-2137
        grib_modelName
        grib_sub_hourly
        grib_set_bytes
        grib_set_force
        bufr_ecc-556
        codes_assert
        codes_ecc-1698
        codes_ecc-1929
        codes_get_string
        codes_codetable
        gts_get
        gts_ls
        gts_count
        gts_compare
        gts_dump
        wrap
        hdf5
        taf
        pseudo_diag
        bufr_set
        grib_ieee
        grib1_gds_not_present
        grib_sh_ieee64
        grib_optimize_scaling
        grib_optimize_scaling_sh
        grib_lam_bf
        grib_lam_gp
        grib1to2
        grib2to1
        grib1to3
        grib2to3
        grib2_templates
        grib2_chemicals_aerosols
        grib3_templates
        grib_bad
        grib_ls
        grib_ls_json
        grib_filter
        grib_filter_fail
        grib_multi
        grib_nearest_test
        pseudo_budg
        grib_gridType
        grib_gridSpec
        grib_fieldset
        grib_octahedral
        grib_grid_mercator
        grib_global
        grib_concept
        grib_copy_message
        grib_decimalPrecision
        grib_bitsPerValue
        grib_get_fail
        grib_missing
        grib_local_ECMWF
        grib_step
        grib_set
        grib_set_fail
        grib_iterator
        grib_iterator_fail
        grib_proj_string
        grib_compare
        grib_copy
        grib_level
        grib_indexing
        grib_bitmap
        grib_secondary_bitmap
        grib_list
        grib_second_order
        grib_multi_from_message
        grib_change_scanning
        grib_statistics
        read_any
        codes_new_from_samples
        codes_dump_action_tree
        codes_set_samples_path
        codes_compare_keys
        codes_dump_content
        codes_to_double
        grib_dump
        grib_dump_debug
        grib_dump_json
        grib_local_MeteoFrance
        grib_local_NCEP
        grib_neg_fctime
        codes_split_file
        grib_mars_keys1
        grib_mars_keys2)

    if( HAVE_AEC AND ENABLE_EXTRA_TESTS )
        list(APPEND tests_extra grib_ecc-1431)
        list(APPEND tests_extra grib_ecc-1433)
    endif()
    if( ECCODES_INSTALL_EXTRA_TOOLS AND ENABLE_EXTRA_TESTS )
        list(APPEND tests_extra metar_ls metar_filter metar_get metar_dump metar_compare)
    endif()
    if( HAVE_FORTRAN AND ENABLE_EXTRA_TESTS )
        list(APPEND tests_extra bufr_dump_encode_fortran)
        list(APPEND tests_extra bufr_dump_decode_fortran)
    endif()
    if( ENABLE_EXTRA_TESTS )
        list(APPEND tests_extra grib_util_set_spec)
        list(APPEND tests_extra grib_util_set_spec2)
        list(APPEND tests_extra grib_padding)
        list(APPEND tests_extra grib_tigge_conversions1)
        list(APPEND tests_extra grib_tigge_conversions2)
        list(APPEND tests_extra bufr_dump_encode_C)
        list(APPEND tests_extra bufr_dump_decode_C)
        list(APPEND tests_extra bufr_dump_encode_python)
        list(APPEND tests_extra bufr_dump_decode_python)
        list(APPEND tests_extra list_codetable_flagtable_keys)
    endif()

    # These tests do not require any data downloads
    foreach( test ${tests_basic} )
        ecbuild_add_test( TARGET  eccodes_t_${test}
                          TYPE    SCRIPT
                          LABELS  "sanity"
                          COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh )
    endforeach()
    ecbuild_add_test( TARGET eccodes_t_grib_check_gaussian_grids
                      TYPE SCRIPT
                      CONDITION ECCODES_INSTALL_EXTRA_TOOLS AND ENABLE_EXTRA_TESTS
                      COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_check_gaussian_grids.sh
                      TEST_DEPENDS eccodes_download_gribs )
    ecbuild_add_test( TARGET eccodes_t_grib_repair
                      TYPE SCRIPT
                      CONDITION ECCODES_INSTALL_EXTRA_TOOLS AND ENABLE_EXTRA_TESTS
                      COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_repair.sh
                      TEST_DEPENDS eccodes_download_gribs )


    # Note: making the test dependent on the grib files (with DEPENDS)
    #       means they will be downloaded at "make" time
    #       rather than when you do "ctest". Use TEST_DEPENDS instead
    foreach( test ${tests_extra} )
        ecbuild_add_test( TARGET eccodes_t_${test}
                      TYPE SCRIPT
                      CONDITION ENABLE_EXTRA_TESTS
                      COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh
                      RESOURCES asca_139.t1.ref
                      TEST_DEPENDS eccodes_download_gribs eccodes_download_tigge_gribs
                                   eccodes_download_bufrs eccodes_download_bufr_refs
                                   eccodes_download_metars eccodes_download_gts )
    endforeach()

    if( HAVE_FORTRAN AND ENABLE_EXTRA_TESTS )
        set_tests_properties( eccodes_t_bufr_dump_encode_fortran PROPERTIES TIMEOUT 2500 )
    endif()
    if( ENABLE_EXTRA_TESTS )
        set_tests_properties( eccodes_t_bufr_dump_encode_C PROPERTIES TIMEOUT 2500 )
    endif()


    ###########################################
    # Note: the reference file is in the tests dir not data dir!
    ecbuild_add_test( TARGET eccodes_t_grib_grid_lamb_az_eq_area
                      TYPE SCRIPT
                      CONDITION ENABLE_EXTRA_TESTS
                      COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_grid_lamb_az_eq_area.sh
                      RESOURCES grib_lamb_az_eq_area.ref
                      TEST_DEPENDS eccodes_download_gribs )

    # These ones are conditional
    ###########################################
    ecbuild_add_test( TARGET eccodes_t_tools_data_from_stdin
                      TYPE SCRIPT
                      CONDITION NOT ECCODES_ON_WINDOWS AND ENABLE_EXTRA_TESTS
                      COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tools_data_from_stdin.sh
                      TEST_DEPENDS eccodes_download_bufrs )

    ecbuild_add_test( TARGET eccodes_t_bufr_ecc-197
                      TYPE SCRIPT
                      CONDITION NOT ECCODES_ON_WINDOWS AND ENABLE_EXTRA_TESTS
                      COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bufr_ecc-197.sh
                      TEST_DEPENDS eccodes_download_bufrs )
    ecbuild_add_test( TARGET eccodes_t_bufr_ecc-1288
                      TYPE SCRIPT
                      CONDITION NOT ECCODES_ON_WINDOWS AND ENABLE_EXTRA_TESTS
                      COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bufr_ecc-1288.sh
                      TEST_DEPENDS eccodes_download_bufrs eccodes_download_bufr_refs )


    if( ENABLE_EXTRA_TESTS AND HAVE_ECCODES_THREADS )
        ecbuild_add_executable( TARGET    grib_encode_pthreads
                                NOINSTALL
                                SOURCES   grib_encode_pthreads.cc
                                LIBS      eccodes ${CMAKE_THREAD_LIBS_INIT} )
        ecbuild_add_test( TARGET eccodes_t_grib_encode_pthreads
                          TYPE SCRIPT
                          COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_encode_pthreads.sh )

        foreach( test grib_encode_pthreads2 grib_threads_ecc-604-encode bufr_encode_pthreads )
            ecbuild_add_executable( TARGET    ${test}
                                    NOINSTALL
                                    SOURCES   ${test}.cc
                                    LIBS      eccodes ${CMAKE_THREAD_LIBS_INIT} )
        endforeach()
        ecbuild_add_test( TARGET eccodes_t_grib_encode_pthreads2
                          TYPE SCRIPT
                          TEST_DEPENDS eccodes_download_gribs
                          COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_encode_pthreads2.sh )
        ecbuild_add_test( TARGET eccodes_t_bufr_encode_pthreads
                          TYPE SCRIPT
                          TEST_DEPENDS eccodes_download_bufrs
                          COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bufr_encode_pthreads.sh )
    endif()

    if( NOT ECCODES_ON_WINDOWS )
        ecbuild_add_executable( TARGET    extract_offsets
                                NOINSTALL
                                SOURCES   extract_offsets.cc
                                LIBS      eccodes )
    endif()

    ecbuild_add_test( TARGET eccodes_t_grib_to_netcdf
                      TYPE SCRIPT
                      CONDITION HAVE_NETCDF AND ENABLE_EXTRA_TESTS AND NOT ECCODES_ON_WINDOWS
                      COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_to_netcdf.sh
                      TEST_DEPENDS eccodes_download_gribs )

    ecbuild_add_test( TARGET eccodes_t_grib_jpeg
                      TYPE SCRIPT
                      CONDITION HAVE_JPEG AND ENABLE_EXTRA_TESTS
                      COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_jpeg.sh
                      TEST_DEPENDS eccodes_download_gribs )

    ecbuild_add_test( TARGET eccodes_t_grib_png
                      TYPE SCRIPT
                      CONDITION HAVE_PNG AND ENABLE_EXTRA_TESTS
                      COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_png.sh
                      TEST_DEPENDS eccodes_download_gribs )

    ecbuild_add_test( TARGET eccodes_t_grib_ccsds
                      TYPE SCRIPT
                      CONDITION HAVE_AEC AND ENABLE_EXTRA_TESTS
                      COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_ccsds.sh
                      TEST_DEPENDS eccodes_download_gribs )

    ecbuild_add_test( TARGET eccodes_t_grib_check_param_concepts
                      TYPE SCRIPT
                      CONDITION ENABLE_EXTRA_TESTS
                      COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_check_param_concepts.sh )

    ecbuild_add_test( TARGET eccodes_t_bufr_split_by_rdbSubtype
                      TYPE SCRIPT
                      CONDITION ENABLE_EXTRA_TESTS AND ECCODES_INSTALL_EXTRA_TOOLS
                      COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bufr_split_by_rdbSubtype.sh
                      TEST_DEPENDS eccodes_download_bufrs )

    ecbuild_add_test( TARGET eccodes_t_codes_export_resource
                      TYPE SCRIPT
                      CONDITION ECCODES_INSTALL_EXTRA_TOOLS
                      COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/codes_export_resource.sh )

    # Performance test
    # ecbuild_add_test( TARGET eccodes_t_grib_ecc-386
    #                  TYPE SCRIPT
    #                  CONDITION ENABLE_EXTRA_TESTS
    #                  COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_ecc-386.sh
    #                  TEST_DEPENDS eccodes_download_gribs )
else()
    # No command line tools
    list(APPEND tests_no_tools
        unit_tests
        julian
        bufr_check_descriptors
        grib_sh_imag
        grib_2nd_order_numValues
        grib_sh_ieee64)

    foreach( test ${tests_no_tools} )
    ecbuild_add_test( TARGET  eccodes_t_${test}
                      TYPE    SCRIPT
                      LABELS  "sanity"
                      COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh )
    endforeach()

endif()


if( eccodes_HAVE_ECKIT_GEO AND eccodes_HAVE_GEOGRAPHY )
    foreach( test
            grib_from_gridspec )
        ecbuild_add_test( TARGET  eccodes_t_${test}
                          SOURCES ${test}.cc
                          LIBS    eccodes eckit_geo )
    endforeach()
endif()