File: settings.cmake

package info (click to toggle)
emoslib 2%3A4.5.9-11
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 356,680 kB
  • sloc: fortran: 93,146; ansic: 27,963; sh: 7,598; f90: 5,215; perl: 604; cpp: 305; makefile: 89; python: 53
file content (128 lines) | stat: -rw-r--r-- 4,208 bytes parent folder | download | duplicates (5)
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
# Helper functions to abstract interpolation tools/environments


# Set testing tools/environments:
# - int (internal)
# - gg_gridname (internal)
# - grib_compare (bundle, on provided path, or on system path)
# - cmp (strict binary comparison)

if( ENABLE_INSTALL_TOOLS )
  get_target_property( CMD_INT         int         LOCATION )
  get_target_property( CMD_GG_GRIDNAME gg_gridname LOCATION )
endif()

if( TARGET grib_compare )
  get_target_property( CMD_GRIB_COMPARE grib_compare LOCATION )
endif()
if( NOT CMD_GRIB_COMPARE )
  find_program( CMD_GRIB_COMPARE grib_compare NO_DEFAULT_PATH HINTS "${eccodes_BASE_DIR}" PATH_SUFFIXES "bin" )
endif()
if( NOT CMD_GRIB_COMPARE )
  find_program( CMD_GRIB_COMPARE grib_compare )
endif()

find_program( CMD_CMP cmp )


if( NOT eccodes_BASE_DIR AND CMD_GRIB_COMPARE )
  get_filename_component( _grib_compare_dir "${CMD_GRIB_COMPARE}" PATH )
  get_filename_component( eccodes_BASE_DIR "${_grib_compare_dir}" ABSOLUTE )
  set( eccodes_BASE_DIR "${eccodes_BASE_DIR}/../" )
endif()

unset( _grib_environment )
if( grib_api_BASE_DIR )
  set( _grib_environment
    GRIB_DEFINITION_PATH=${grib_api_BASE_DIR}/share/${grib_handling_pkg}/definitions
    GRIB_SAMPLES_PATH=${grib_api_BASE_DIR}/share/${grib_handling_pkg}/samples )
endif()
set( _emos_environment
  "${_grib_environment}"
# JDCNDBG=2
# INTF2_DEBUG=1
  CONFIG_INTERP=ON_FLY
  MARS_LSM_PATH=${PROJECT_SOURCE_DIR}/tables/interpol
  ECMWF_LOCAL_TABLE_PATH=${PROJECT_SOURCE_DIR}/gribtables
  LOCAL_DEFINITION_TEMPLATES=${PROJECT_SOURCE_DIR}/gribtemplates )


# log information
ecbuild_info( "Test tool int:          ${CMD_INT}" )
ecbuild_info( "Test tool gg_gridname:  ${CMD_GG_GRIDNAME}" )
ecbuild_info( "Test tool grib_compare: ${CMD_GRIB_COMPARE}" )
ecbuild_info( "Test tool cmp:          ${CMD_CMP}" )
if( NOT CMD_INT OR NOT CMD_GG_GRIDNAME OR NOT CMD_GRIB_COMPARE OR NOT CMD_CMP )
  ecbuild_warn( "(some tools not found, some tests disabled)" )
endif()
ecbuild_debug( "Test _grib_environment: ${_grib_environment}" )
ecbuild_debug( "Test _emos_environment: ${_emos_environment}" )


# Easily add interpolation tests
# (optional arg #5: test dependencies, default none)
# (optional arg #6: environment variables, default none additional)
function( interpolation_add_test_interpol
        _label
        _file1
        _file2
        _options )
    set( _depends     "" )
    set( _environment "" )
    if( ${ARGC} GREATER 4 )
        set( _depends "${ARGV4}" )
    endif()
    if( ${ARGC} GREATER 5 )
        set( _environment "${ARGV5}" )
    endif()
    ecbuild_add_test(
        TARGET       ${_label}_interpol
        TEST_DEPENDS ${_depends}
        DEPENDS      int
        COMMAND      ${CMD_INT}
        ARGS         --input=${_file1} --output=${_file2} ${_options}
        ENVIRONMENT  ${_environment} ${_emos_environment} )
endfunction()


# Easily add comparison-to-reference results tests
# (optional arg #4: test dependencies, default none)
function( interpolation_add_test_compare
        _label
        _file1
        _file2 )
    set( _depends "" )
    if( ${ARGC} GREATER 3 )
        set( _depends "${ARGV3}" )
    endif()
    set( _tolerate "" )
    if(    (label MATCHES "F640_to_(F48|F80_sub-area|regular_ll)$")
        OR (label MATCHES "(N640|O1280)_to_(F48|F80|regular_ll)(|_sub-area)$")
        OR (label MATCHES "(N640|O1280)_to_(N80|O80)$")
        OR (label MATCHES "O1280_to_regular_ll_1-16$")
        OR (label MATCHES "regular_ll_to_regular_ll$") )
        set( _tolerate -P -T 2 )
    endif()
    ecbuild_add_test(
        TARGET       ${_label}_compare
        TEST_DEPENDS ${_label}_interpol ${_depends}
        COMMAND      ${CMD_GRIB_COMPARE}
        ARGS         ${_tolerate} ${_file1} ${_file2}
        ENVIRONMENT  ${_grib_environment} )
endfunction()


# Easily add expected-gridname tests
function( interpolation_add_test_gridname
        _label
        _file
        _gridname )
    ecbuild_add_test(
        TARGET       ${_label}_gridname
        TEST_DEPENDS ${_label}_interpol
        CONDITION    ENABLE_INSTALL_TOOLS
        COMMAND      ${CMD_GG_GRIDNAME}
        ARGS         --eq=${_gridname} ${_file}
        ENVIRONMENT  ${_grib_environment} )
endfunction()