File: ompi_define.cmake

package info (click to toggle)
openmpi 1.6.5-9.1%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 91,628 kB
  • ctags: 44,305
  • sloc: ansic: 408,966; cpp: 44,454; sh: 27,828; makefile: 10,486; asm: 3,882; python: 1,239; lex: 805; perl: 549; csh: 253; fortran: 232; f90: 126; tcl: 12
file content (123 lines) | stat: -rw-r--r-- 3,930 bytes parent folder | download | duplicates (2)
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
#
# Copyright (c) 2010      High Performance Computing Center Stuttgart, 
#                         University of Stuttgart.  All rights reserved.
# $COPYRIGHT$
# 
# Additional copyrights may follow
# 
# $HEADER$
#

#Generate content for opal_config.h.cmake
#
#  NAME:        name of the variable to be defined in configure file
#  VALUE:       value to be defined for the variable
#  DESC:        description of the definition
#  IS_STR:      whether this variable should be defined with quotation marks
#  FORCE_DEF:   whether use "#cmakedefiine" or just "#define" in the line
#  VAR_FORMAT:  whether we should use the variable name instead of the value
#               in the template file.

MACRO(APPEND_CONFIG_FILE NAME VAR_NAME VALUE DESC IS_STR FORCE_DEF VAR_FORMAT)

  #We don't want to always generate the template file, but only when required.
  IF(NOT WRITE_CONFIG_DONE)

    UNSET(APPEND_STRING)

    IF(${VAR_FORMAT})
      IF(${IS_STR})
        IF(${FORCE_DEF})
          SET(APPEND_STRING "/* ${DESC} */\n#define ${NAME} \"\${${VAR_NAME}}\"\n\n")
        ELSE(${FORCE_DEF})
          SET(APPEND_STRING "/* ${DESC} */\n#cmakedefine ${NAME} \"\${${VAR_NAME}}\"\n\n")
        ENDIF(${FORCE_DEF})
      ELSE(${IS_STR})
        IF(${FORCE_DEF})
          SET(APPEND_STRING "/* ${DESC} */\n#define ${NAME} \${${VAR_NAME}}\n\n")
        ELSE(${FORCE_DEF})
          SET(APPEND_STRING "/* ${DESC} */\n#cmakedefine ${NAME} \${${VAR_NAME}}\n\n")
        ENDIF(${FORCE_DEF})
      ENDIF(${IS_STR})
    ELSE(${VAR_FORMAT})
      IF(${IS_STR})
        IF(${FORCE_DEF})
          SET(APPEND_STRING "/* ${DESC} */\n#define ${NAME} \"${VALUE}\"\n\n")
        ELSE(${FORCE_DEF})
          SET(APPEND_STRING "/* ${DESC} */\n#cmakedefine ${NAME} \"${VALUE}\"\n\n")
        ENDIF(${FORCE_DEF})
      ELSE(${IS_STR})
        IF(${FORCE_DEF})
          SET(APPEND_STRING "/* ${DESC} */\n#define ${NAME} ${VALUE}\n\n")
        ELSE(${FORCE_DEF})
          SET(APPEND_STRING "/* ${DESC} */\n#cmakedefine ${NAME} ${VALUE}\n\n")
        ENDIF(${FORCE_DEF})
      ENDIF(${IS_STR})
    ENDIF(${VAR_FORMAT})

    FILE(APPEND ${OpenMPI_BINARY_DIR}/opal/include/opal_config.h.cmake
      ${APPEND_STRING})
  ENDIF(NOT WRITE_CONFIG_DONE)

ENDMACRO(APPEND_CONFIG_FILE NAME VAR_NAME VALUE DESC IS_STR FORCE_DEF VAR_FORMAT)


#define a name with value and
#write the line in template file.
MACRO(OMPI_DEF NAME VALUE DESC IS_STR FORCE_DEF)

  SET(${NAME} ${VALUE})

  APPEND_CONFIG_FILE(${NAME} ${NAME} "${VALUE}" ${DESC} ${IS_STR} ${FORCE_DEF} 0)

ENDMACRO(OMPI_DEF NAME VALUE DESC IS_STR FORCE_DEF)


#define a name with variable and
#write the line in template file.
MACRO(OMPI_DEF_VAR NAME DESC IS_STR FORCE_DEF)

  APPEND_CONFIG_FILE(${NAME} ${NAME} "" ${DESC} ${IS_STR} ${FORCE_DEF} 1)

ENDMACRO(OMPI_DEF_VAR NAME DESC IS_STR FORCE_DEF)


#define/cache a name with value and
#write the line in template file.
MACRO(OMPI_DEF_CACHE NAME VALUE CACHE_TYPE DESC IS_STR FORCE_DEF)

  SET(${NAME} ${VALUE} CACHE ${CACHE_TYPE} "${DESC}")

  APPEND_CONFIG_FILE(${NAME} ${NAME} ${VALUE} ${DESC} ${IS_STR} ${FORCE_DEF} 0)

ENDMACRO(OMPI_DEF_CACHE NAME VALUE OPT DESC IS_STR FORCE_DEF)


#define/cache a name with variable and
#write the line in template file.
MACRO(OMPI_DEF_CACHE_VAR NAME VALUE CACHE_TYPE DESC IS_STR FORCE_DEF)

  SET(${NAME} ${VALUE} CACHE ${CACHE_TYPE} "${DESC}")

  APPEND_CONFIG_FILE(${NAME} ${NAME} "" ${DESC} ${IS_STR} ${FORCE_DEF} 1)

ENDMACRO(OMPI_DEF_CACHE_VAR NAME VALUE OPT DESC IS_STR FORCE_DEF)


#add an configure option and
#write the line in template file.
MACRO(OMPI_DEF_OPT NAME DESC DEFAULT_VAL)

  UNSET(APPEND_STRING)

  OPTION(${NAME} "${DESC}" ${DEFAULT_VAL})

  IF(${${NAME}} STREQUAL "OFF")
    SET(${NAME}_VAL 0)
  ELSE(${${NAME}} STREQUAL "OFF")
    SET(${NAME}_VAL 1)
  ENDIF(${${NAME}} STREQUAL "OFF")

  APPEND_CONFIG_FILE(${NAME} ${NAME}_VAL "" ${DESC} 0 1 1)

ENDMACRO(OMPI_DEF_OPT NAME DESC DEFAULT_VAL)