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