blob: 4254eeb54edd983b4fc6e626c7cc7874ad0be0cf [file] [log] [blame]
Jim Cownie3b81ce62014-08-05 09:32:28 +00001#
2#//===----------------------------------------------------------------------===//
3#//
4#// The LLVM Compiler Infrastructure
5#//
6#// This file is dual licensed under the MIT and the University of Illinois Open
7#// Source Licenses. See LICENSE.txt for details.
8#//
9#//===----------------------------------------------------------------------===//
10#
11
12# void append_ev_flags(string new_flag);
13# - appends new_flag to ev_flags list
14macro(append_ev_flags new_flag)
15 list(APPEND local_ev_flags "${new_flag}")
16endmacro()
17
18# void append_gd_flags(string new_flag);
19# - appends new_flag to gd_flags list
20macro(append_gd_flags new_flag)
21 list(APPEND local_gd_flags "${new_flag}")
22endmacro()
23
24include(HelperFunctions) # for set_legal_type(), set_legal_arch()
25
26# Perl expand-vars.pl flags
27function(set_ev_flags input_ev_flags)
28 set(local_ev_flags)
Jonathan Peyton7979a072015-05-20 22:33:24 +000029 set_legal_type("${LIBOMP_LIB_TYPE}" legal_type)
30 set_legal_arch("${LIBOMP_ARCH}" legal_arch)
Jim Cownie3b81ce62014-08-05 09:32:28 +000031 # need -D Revision="\$Revision" to show up
32 append_ev_flags("-D Revision=\"\\\\$$Revision\"")
33 append_ev_flags("-D Date=\"\\\\$$Date\"")
34 append_ev_flags("-D KMP_TYPE=\"${legal_type}\"")
35 append_ev_flags("-D KMP_ARCH=\"${legal_arch}\"")
Jonathan Peyton7979a072015-05-20 22:33:24 +000036 append_ev_flags("-D KMP_VERSION_MAJOR=${LIBOMP_VERSION}")
Jim Cownie3b81ce62014-08-05 09:32:28 +000037 append_ev_flags("-D KMP_VERSION_MINOR=0")
38 append_ev_flags("-D KMP_VERSION_BUILD=${build_number}")
39 append_ev_flags("-D KMP_BUILD_DATE=\"${date}\"")
40 append_ev_flags("-D KMP_TARGET_COMPILER=12")
41 if(${DEBUG_BUILD} OR ${RELWITHDEBINFO_BUILD})
42 append_ev_flags("-D KMP_DIAG=1")
43 append_ev_flags("-D KMP_DEBUG_INFO=1")
44 else()
45 append_ev_flags("-D KMP_DIAG=0")
46 append_ev_flags("-D KMP_DEBUG_INFO=0")
47 endif()
Jonathan Peyton7979a072015-05-20 22:33:24 +000048 if(${LIBOMP_VERSION} EQUAL 40)
Jim Cownie3b81ce62014-08-05 09:32:28 +000049 append_ev_flags("-D OMP_VERSION=201307")
Jonathan Peyton7979a072015-05-20 22:33:24 +000050 elseif(${LIBOMP_VERSION} EQUAL 30)
Jim Cownie3b81ce62014-08-05 09:32:28 +000051 append_ev_flags("-D OMP_VERSION=201107")
52 else()
53 append_ev_flags("-D OMP_VERSION=200505")
54 endif()
55 set(${input_ev_flags} "${local_ev_flags}" PARENT_SCOPE)
56endfunction()
57
58function(set_gd_flags input_gd_flags)
59 set(local_gd_flags)
60 if(${IA32})
61 append_gd_flags("-D arch_32")
62 elseif(${INTEL64})
63 append_gd_flags("-D arch_32e")
64 else()
Jonathan Peyton7979a072015-05-20 22:33:24 +000065 append_gd_flags("-D arch_${LIBOMP_ARCH}")
Jim Cownie3b81ce62014-08-05 09:32:28 +000066 endif()
67 if(${NORMAL_LIBRARY})
68 append_gd_flags("-D norm")
69 elseif(${PROFILE_LIBRARY})
70 append_gd_flags("-D prof")
71 elseif(${STUBS_LIBRARY})
72 append_gd_flags("-D stub")
73 endif()
Jonathan Peyton7979a072015-05-20 22:33:24 +000074 if(${LIBOMP_OMP_VERSION} GREATER 41 OR ${LIBOMP_OMP_VERSION} EQUAL 41)
Andrey Churbanov062e1982015-05-07 17:07:06 +000075 append_gd_flags("-D OMP_41")
76 endif()
Jonathan Peyton7979a072015-05-20 22:33:24 +000077 if(${LIBOMP_OMP_VERSION} GREATER 40 OR ${LIBOMP_OMP_VERSION} EQUAL 40)
Jim Cownie3b81ce62014-08-05 09:32:28 +000078 append_gd_flags("-D OMP_40")
79 endif()
Jonathan Peyton7979a072015-05-20 22:33:24 +000080 if(${LIBOMP_OMP_VERSION} GREATER 30 OR ${LIBOMP_OMP_VERSION} EQUAL 30)
Jim Cownie3b81ce62014-08-05 09:32:28 +000081 append_gd_flags("-D OMP_30")
82 endif()
Jonathan Peyton7979a072015-05-20 22:33:24 +000083 if(NOT "${LIBOMP_VERSION}" STREQUAL "4")
Jim Cownie3b81ce62014-08-05 09:32:28 +000084 append_gd_flags("-D msvc_compat")
85 endif()
86 if(${DEBUG_BUILD} OR ${RELWITHDEBINFO_BUILD})
87 append_gd_flags("-D KMP_DEBUG")
88 endif()
Jonathan Peyton7979a072015-05-20 22:33:24 +000089 if(${LIBOMP_COMPILER_SUPPORTS_QUAD_PRECISION})
Jim Cownie3b81ce62014-08-05 09:32:28 +000090 append_gd_flags("-D HAVE_QUAD")
91 endif()
92 set(${input_gd_flags} "${local_gd_flags}" PARENT_SCOPE)
93endfunction()