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