Merge pull request #11172 from mskvortsov/ArithOverflowChecks
[platform/upstream/coreclr.git] / clrdefinitions.cmake
1 if(WIN32 AND CLR_CMAKE_TARGET_ARCH_I386 AND BUILD_JIT32)  
2   set(CLR_BUILD_JIT32 1)  
3 else()  
4   set(CLR_BUILD_JIT32 0)  
5 endif()  
6
7 include(clrfeatures.cmake)
8
9 if (CLR_CMAKE_TARGET_ARCH_AMD64)
10   if (CLR_CMAKE_PLATFORM_UNIX)
11     add_definitions(-DDBG_TARGET_AMD64_UNIX)
12   endif()
13   add_definitions(-D_TARGET_AMD64_=1)
14   add_definitions(-DDBG_TARGET_64BIT=1)
15   add_definitions(-DDBG_TARGET_AMD64=1)
16   add_definitions(-DDBG_TARGET_WIN64=1)
17 elseif (CLR_CMAKE_TARGET_ARCH_ARM64)
18   if (CLR_CMAKE_PLATFORM_UNIX)
19     add_definitions(-DDBG_TARGET_ARM64_UNIX)
20   endif()
21   add_definitions(-D_TARGET_ARM64_=1)
22   add_definitions(-DDBG_TARGET_64BIT=1)
23   add_definitions(-DDBG_TARGET_ARM64=1)
24   add_definitions(-DDBG_TARGET_WIN64=1)
25   add_definitions(-DFEATURE_MULTIREG_RETURN)
26 elseif (CLR_CMAKE_TARGET_ARCH_ARM)
27   if (CLR_CMAKE_PLATFORM_UNIX)
28     add_definitions(-DDBG_TARGET_ARM_UNIX)
29   elseif (WIN32 AND NOT DEFINED CLR_CROSS_COMPONENTS_BUILD)
30     # Set this to ensure we can use Arm SDK for Desktop binary linkage when doing native (Arm32) build
31     add_definitions(-D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1)
32     add_definitions(-D_ARM_WORKAROUND_)
33   endif (CLR_CMAKE_PLATFORM_UNIX)
34   add_definitions(-D_TARGET_ARM_=1)
35   add_definitions(-DDBG_TARGET_32BIT=1)
36   add_definitions(-DDBG_TARGET_ARM=1)
37 elseif (CLR_CMAKE_TARGET_ARCH_I386)
38   add_definitions(-D_TARGET_X86_=1)
39   add_definitions(-DDBG_TARGET_32BIT=1)
40   add_definitions(-DDBG_TARGET_X86=1)
41 else ()
42   clr_unknown_arch()
43 endif (CLR_CMAKE_TARGET_ARCH_AMD64)
44
45 if (CLR_CMAKE_PLATFORM_UNIX)
46
47   if(CLR_CMAKE_PLATFORM_DARWIN)
48     add_definitions(-D_XOPEN_SOURCE)
49   endif(CLR_CMAKE_PLATFORM_DARWIN)
50
51   if (CLR_CMAKE_TARGET_ARCH_AMD64)
52     add_definitions(-DUNIX_AMD64_ABI)
53   elseif (CLR_CMAKE_TARGET_ARCH_ARM)
54     add_definitions(-DUNIX_ARM_ABI)
55   elseif (CLR_CMAKE_TARGET_ARCH_I386)
56     add_definitions(-DUNIX_X86_ABI)
57   endif()
58
59 endif(CLR_CMAKE_PLATFORM_UNIX)
60
61 if(CLR_CMAKE_PLATFORM_ALPINE_LINUX)
62   # Alpine Linux doesn't have fixed stack limit, this define disables some stack pointer
63   # sanity checks in debug / checked build that rely on a fixed stack limit
64   add_definitions(-DNO_FIXED_STACK_LIMIT)
65 endif(CLR_CMAKE_PLATFORM_ALPINE_LINUX)
66
67 add_definitions(-D_BLD_CLR)
68 add_definitions(-DDEBUGGING_SUPPORTED)
69 add_definitions(-DPROFILING_SUPPORTED)
70
71 if(WIN32)
72   add_definitions(-DWIN32)
73   add_definitions(-D_WIN32)
74   add_definitions(-DWINVER=0x0602)
75   add_definitions(-D_WIN32_WINNT=0x0602)
76   add_definitions(-DWIN32_LEAN_AND_MEAN=1)
77   add_definitions(-D_CRT_SECURE_NO_WARNINGS)
78   if(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386)
79     # Only enable edit and continue on windows x86 and x64
80     # exclude Linux, arm & arm64
81     add_definitions(-DEnC_SUPPORTED)
82   endif(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386)
83 endif(WIN32)
84
85 # Features - please keep them alphabetically sorted
86
87 add_definitions(-DFEATURE_APPDOMAIN_RESOURCE_MONITORING)
88 if(WIN32)
89   add_definitions(-DFEATURE_APPX)
90   if(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_ARM64)
91     add_definitions(-DFEATURE_ARRAYSTUB_AS_IL)
92   endif()
93 else(WIN32)
94   add_definitions(-DFEATURE_ARRAYSTUB_AS_IL)
95 endif(WIN32)
96
97 add_definitions(-DFEATURE_COLLECTIBLE_TYPES)
98
99 if(WIN32)
100     add_definitions(-DFEATURE_CLASSIC_COMINTEROP)
101     add_definitions(-DFEATURE_COMINTEROP)
102     add_definitions(-DFEATURE_COMINTEROP_APARTMENT_SUPPORT)
103     add_definitions(-DFEATURE_COMINTEROP_UNMANAGED_ACTIVATION)
104     add_definitions(-DFEATURE_COMINTEROP_WINRT_MANAGED_ACTIVATION)
105 endif(WIN32)
106
107 add_definitions(-DFEATURE_CORECLR)
108 if (CLR_CMAKE_PLATFORM_UNIX)
109   add_definitions(-DFEATURE_COREFX_GLOBALIZATION)
110 endif(CLR_CMAKE_PLATFORM_UNIX)
111 add_definitions(-DFEATURE_CORESYSTEM)
112 add_definitions(-DFEATURE_CORRUPTING_EXCEPTIONS)
113 if(FEATURE_DBGIPC)
114   add_definitions(-DFEATURE_DBGIPC_TRANSPORT_DI)
115   add_definitions(-DFEATURE_DBGIPC_TRANSPORT_VM)
116 endif(FEATURE_DBGIPC)
117 if(FEATURE_EVENT_TRACE)
118     add_definitions(-DFEATURE_EVENT_TRACE=1)
119 endif(FEATURE_EVENT_TRACE)
120 add_definitions(-DFEATURE_PERFTRACING)
121 if(CLR_CMAKE_PLATFORM_UNIX)
122     add_definitions(-DFEATURE_EVENTSOURCE_XPLAT=1)
123 endif(CLR_CMAKE_PLATFORM_UNIX)
124 add_definitions(-DFEATURE_TIERED_COMPILATION)
125 # NetBSD doesn't implement this feature
126 if(NOT CMAKE_SYSTEM_NAME STREQUAL NetBSD)
127     add_definitions(-DFEATURE_HIJACK)
128 endif(NOT CMAKE_SYSTEM_NAME STREQUAL NetBSD)
129 add_definitions(-DFEATURE_ICASTABLE)
130 if (WIN32 AND (CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386))
131     add_definitions(-DFEATURE_INTEROP_DEBUGGING)
132 endif (WIN32 AND (CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386))
133 if (CLR_CMAKE_PLATFORM_UNIX OR CLR_CMAKE_TARGET_ARCH_ARM64)
134   add_definitions(-DFEATURE_IMPLICIT_TLS)
135   set(FEATURE_IMPLICIT_TLS 1)
136 endif(CLR_CMAKE_PLATFORM_UNIX OR CLR_CMAKE_TARGET_ARCH_ARM64)
137 add_definitions(-DFEATURE_ISYM_READER)
138 add_definitions(-DFEATURE_LOADER_OPTIMIZATION)
139 if (NOT CLR_CMAKE_PLATFORM_UNIX)
140     add_definitions(-DFEATURE_MANAGED_ETW)
141 endif(NOT CLR_CMAKE_PLATFORM_UNIX)
142 add_definitions(-DFEATURE_MANAGED_ETW_CHANNELS)
143
144 if(FEATURE_MERGE_JIT_AND_ENGINE)
145   add_definitions(-DFEATURE_MERGE_JIT_AND_ENGINE)
146 endif(FEATURE_MERGE_JIT_AND_ENGINE)
147 add_definitions(-DFEATURE_MULTICOREJIT)
148 if(CLR_CMAKE_PLATFORM_UNIX)
149   add_definitions(-DFEATURE_PAL)
150   add_definitions(-DFEATURE_PAL_SXS)
151   add_definitions(-DFEATURE_PAL_ANSI)
152 endif(CLR_CMAKE_PLATFORM_UNIX)
153 if(CLR_CMAKE_PLATFORM_LINUX)
154     add_definitions(-DFEATURE_PERFMAP)
155 endif(CLR_CMAKE_PLATFORM_LINUX)
156 add_definitions(-DFEATURE_PREJIT)
157 add_definitions(-DFEATURE_RANDOMIZED_STRING_HASHING)
158
159 add_definitions(-DFEATURE_READYTORUN)
160 set(FEATURE_READYTORUN 1)
161
162 if (CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386)
163   add_definitions(-DFEATURE_REJIT)
164 endif(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386)
165
166 add_definitions(-DFEATURE_STANDALONE_SN)
167 add_definitions(-DFEATURE_STRONGNAME_DELAY_SIGNING_ALLOWED)
168 add_definitions(-DFEATURE_STRONGNAME_MIGRATION)
169 if (CLR_CMAKE_PLATFORM_UNIX OR CLR_CMAKE_TARGET_ARCH_ARM64)
170     add_definitions(-DFEATURE_STUBS_AS_IL)
171 endif ()
172 add_definitions(-DFEATURE_SVR_GC)
173 add_definitions(-DFEATURE_SYMDIFF)
174 if (CLR_CMAKE_PLATFORM_ARCH_AMD64)
175   # Enable the AMD64 Unix struct passing JIT-EE interface for all AMD64 platforms, to enable altjit.
176   add_definitions(-DFEATURE_UNIX_AMD64_STRUCT_PASSING_ITF)
177 endif (CLR_CMAKE_PLATFORM_ARCH_AMD64)
178 if(CLR_CMAKE_PLATFORM_UNIX_AMD64)
179   add_definitions(-DFEATURE_MULTIREG_RETURN)
180   add_definitions(-DFEATURE_UNIX_AMD64_STRUCT_PASSING)
181 endif (CLR_CMAKE_PLATFORM_UNIX_AMD64)
182 add_definitions(-DFEATURE_USE_ASM_GC_WRITE_BARRIERS)
183 if(CLR_CMAKE_PLATFORM_ARCH_AMD64 AND NOT WIN32)
184   add_definitions(-DFEATURE_MANUALLY_MANAGED_CARD_BUNDLES)
185   add_definitions(-DFEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP)
186 endif(CLR_CMAKE_PLATFORM_ARCH_AMD64 AND NOT WIN32)
187 if(WIN32)
188     add_definitions(-DFEATURE_VERSIONING_LOG)
189 endif(WIN32)
190 if(NOT CLR_CMAKE_PLATFORM_UNIX)
191     add_definitions(-DFEATURE_WIN32_REGISTRY)
192 endif(NOT CLR_CMAKE_PLATFORM_UNIX)
193 add_definitions(-DFEATURE_LEGACYNETCF_DBG_HOST_CONTROL)
194 add_definitions(-DFEATURE_WINDOWSPHONE)
195 add_definitions(-DFEATURE_WINMD_RESILIENT)
196 add_definitions(-D_SECURE_SCL=0)
197 add_definitions(-DUNICODE)
198 add_definitions(-D_UNICODE)