Fix reading Time zone rules using Julian days (#17672)
[platform/upstream/coreclr.git] / src / jit / CMakeLists.txt
1 set(CMAKE_INCLUDE_CURRENT_DIR ON)
2 set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
3
4 include_directories("./jitstd")
5 include_directories("../inc")
6
7 if (CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64 OR (CLR_CMAKE_TARGET_ARCH_I386 AND NOT CLR_CMAKE_PLATFORM_UNIX))
8   add_definitions(-DFEATURE_SIMD)
9   add_definitions(-DFEATURE_HW_INTRINSICS)
10 endif ()
11
12 # JIT_BUILD disables certain PAL_TRY debugging features
13 add_definitions(-DJIT_BUILD=1)
14
15 if(WIN32)
16   set(JIT_RESOURCES Native.rc)
17 endif(WIN32)
18
19 set( JIT_SOURCES
20   alloc.cpp
21   assertionprop.cpp
22   bitset.cpp
23   block.cpp
24   codegencommon.cpp
25   codegenlinear.cpp
26   compiler.cpp
27   copyprop.cpp
28   disasm.cpp
29   earlyprop.cpp
30   ee_il_dll.cpp
31   eeinterface.cpp
32   emit.cpp
33   error.cpp
34   flowgraph.cpp
35   gcdecode.cpp
36   gcencode.cpp
37   gcinfo.cpp
38   gentree.cpp
39   gschecks.cpp
40   hashbv.cpp
41   hwintrinsic.cpp
42   hostallocator.cpp
43   importer.cpp
44   inline.cpp
45   inlinepolicy.cpp
46   instr.cpp
47   jitconfig.cpp
48   jiteh.cpp
49   jittelemetry.cpp
50   lclvars.cpp
51   lir.cpp
52   liveness.cpp
53   loopcloning.cpp
54   lower.cpp
55   lsra.cpp
56   lsrabuild.cpp
57   morph.cpp
58   objectalloc.cpp
59   optcse.cpp
60   optimizer.cpp
61   rangecheck.cpp
62   rationalize.cpp
63   regalloc.cpp
64   register_arg_convention.cpp
65   regset.cpp
66   scopeinfo.cpp
67   sharedfloat.cpp
68   sideeffects.cpp
69   sm.cpp
70   smdata.cpp
71   smweights.cpp
72   ssabuilder.cpp
73   ssarenamestate.cpp
74   typeinfo.cpp
75   unwind.cpp
76   utils.cpp
77   valuenum.cpp
78   stacklevelsetter.cpp
79 )
80
81 # Add header files to Visual Studio vcxproj, not required for unixes
82 # change has effect on editor experience and has no impact on build
83 if (WIN32)
84   set( JIT_HEADERS
85     _typeinfo.h
86     alloc.h
87     arraystack.h
88     bitset.h
89     bitsetasshortlong.h
90     bitsetasuint64.h
91     bitsetasuint64inclass.h
92     bitsetops.h
93     bitvec.h
94     block.h
95     blockset.h
96     codegen.h
97     codegenclassic.h
98     codegeninterface.h
99     codegenlinear.h
100     compiler.h
101     compiler.hpp
102     compilerbitsettraits.h
103     compilerbitsettraits.hpp
104     compmemkind.h
105     compphases.h
106     dataflow.h
107     decomposelongs.h
108     disasm.h
109     emit.h
110     emitarm.h
111     emitarm64.h
112     emitdef.h
113     emitfmts.h
114     emitfmtsarm.h
115     emitfmtsarm64.h
116     emitfmtsxarch.h
117     emitinl.h
118     emitjmps.h
119     emitpub.h
120     emitxarch.h
121     error.h
122     fp.h
123     gentree.h
124     gtlist.h
125     gtstructs.h
126     hashbv.h
127     host.h
128     hostallocator.h
129     hwintrinsiclistxarch.h
130     ICorJitInfo_API_names.h
131     ICorJitInfo_API_wrapper.hpp
132     inline.h
133     inlinepolicy.h
134     instr.h
135     instrs.h
136     instrsarm.h
137     instrsarm64.h
138     instrsxarch.h
139     jit.h
140     jitconfig.h
141     jitconfigvalues.h
142     jitee.h
143     jiteh.h
144     jitexpandarray.h
145     jitgcinfo.h
146     jithashtable.h
147     jitpch.h
148     jitstd.h
149     jittelemetry.h
150     lir.h
151     loopcloning.h
152     loopcloningopts.h
153     lower.h
154     lsra_reftypes.h
155     lsra.h
156     namedintrinsiclist.h
157     nodeinfo.h
158     objectalloc.h
159     opcode.h
160     phase.h
161     rangecheck.h
162     rationalize.h
163     regalloc.h
164     register_arg_convention.h
165     register.h
166     registerarm.h
167     registerarm64.h
168     registerfp.h
169     registerxmm.h
170     reglist.h
171     regpair.h
172     regset.h
173     sideeffects.h
174     simd.h
175     simdintrinsiclist.h
176     sm.h
177     smallhash.h
178     smcommon.h
179     smopenum.h
180     ssabuilder.h
181     ssaconfig.h
182     ssarenamestate.h
183     target.h
184     tinyarray.h
185     titypes.h
186     typelist.h
187     unwind.h
188     utils.h
189     valuenum.h
190     valuenumtype.h
191     varset.h
192     vartype.h
193     x86_instrs.h
194   )
195 endif(WIN32)
196
197 # The following defines all the source files used by the "legacy" back-end (#ifdef LEGACY_BACKEND).
198 # It is always safe to include both legacy and non-legacy files in the build, as everything is properly
199 # #ifdef'ed, though it makes the build slightly slower to do so. Note there is only a legacy backend for
200 # x86 and ARM.
201
202 set(JIT_ARM_LEGACY_SOURCES
203     codegenlegacy.cpp
204     registerfp.cpp
205 )
206 set(JIT_I386_LEGACY_SOURCES
207     codegenlegacy.cpp
208     stackfp.cpp
209 )
210
211 # Define all the architecture-specific source files
212
213 set( JIT_AMD64_SOURCES
214   codegenxarch.cpp
215   emitxarch.cpp
216   lowerxarch.cpp
217   lsraxarch.cpp
218   simd.cpp
219   simdcodegenxarch.cpp
220   targetamd64.cpp
221   unwindamd64.cpp
222   hwintrinsicxarch.cpp
223   hwintrinsiccodegenxarch.cpp
224 )
225
226 set( JIT_ARM_SOURCES
227   ${JIT_ARM_LEGACY_SOURCES}
228   codegenarmarch.cpp
229   codegenarm.cpp
230   decomposelongs.cpp
231   emitarm.cpp
232   lowerarmarch.cpp
233   lowerarm.cpp
234   lsraarmarch.cpp
235   lsraarm.cpp
236   targetarm.cpp
237   unwindarm.cpp
238 )
239
240 set( JIT_I386_SOURCES
241   ${JIT_I386_LEGACY_SOURCES}
242   codegenxarch.cpp
243   decomposelongs.cpp
244   emitxarch.cpp
245   lowerxarch.cpp
246   lsraxarch.cpp
247   simd.cpp
248   simdcodegenxarch.cpp
249   targetx86.cpp
250   unwindx86.cpp
251   hwintrinsicxarch.cpp
252   hwintrinsiccodegenxarch.cpp
253 )
254
255 set( JIT_ARM64_SOURCES
256   codegenarmarch.cpp
257   codegenarm64.cpp
258   emitarm64.cpp
259   lowerarmarch.cpp
260   lowerarm64.cpp
261   lsraarmarch.cpp
262   lsraarm64.cpp
263   simd.cpp
264   targetarm64.cpp
265   unwindarm.cpp
266   unwindarm64.cpp
267   hwintrinsicArm64.cpp
268 )
269
270 if(CLR_CMAKE_TARGET_ARCH_AMD64)
271   set(JIT_ARCH_SOURCES ${JIT_AMD64_SOURCES})
272 elseif(CLR_CMAKE_TARGET_ARCH_ARM)
273   set(JIT_ARCH_SOURCES ${JIT_ARM_SOURCES})
274 elseif(CLR_CMAKE_TARGET_ARCH_I386)
275   set(JIT_ARCH_SOURCES ${JIT_I386_SOURCES})
276 elseif(CLR_CMAKE_TARGET_ARCH_ARM64)
277   set(JIT_ARCH_SOURCES ${JIT_ARM64_SOURCES})
278 else()
279   clr_unknown_arch()
280 endif()
281
282 set( SOURCES
283   ${JIT_SOURCES}
284   ${JIT_HEADERS}
285   ${JIT_RESOURCES}
286 )
287
288 convert_to_absolute_path(SOURCES ${SOURCES})
289 convert_to_absolute_path(JIT_ARCH_SOURCES ${JIT_ARCH_SOURCES})
290
291 # Also convert the per-architecture sources to absolute paths, if the subdirs want to use them.
292
293 convert_to_absolute_path(JIT_AMD64_SOURCES ${JIT_AMD64_SOURCES})
294 convert_to_absolute_path(JIT_ARM_SOURCES ${JIT_ARM_SOURCES})
295 convert_to_absolute_path(JIT_I386_SOURCES ${JIT_I386_SOURCES})
296 convert_to_absolute_path(JIT_ARM64_SOURCES ${JIT_ARM64_SOURCES})
297
298 if(WIN32)
299   add_precompiled_header(jitpch.h ../jitpch.cpp SOURCES)
300
301   # Create .def file containing a list of exports preceeded by
302   # 'EXPORTS'.  The file "ClrJit.exports" already contains the list, so we
303   # massage it into the correct format here to create "ClrJit.exports.def".
304   set(JIT_EXPORTS_FILE ${CMAKE_CURRENT_BINARY_DIR}/ClrJit.exports.def)
305   set(JIT_EXPORTS_FILE_TEMP ${JIT_EXPORTS_FILE}.txt)
306   file(READ "ClrJit.exports" exports_list)
307   file(WRITE ${JIT_EXPORTS_FILE_TEMP} "LIBRARY CLRJIT\n")
308   file(APPEND ${JIT_EXPORTS_FILE_TEMP} "EXPORTS\n")
309   file(APPEND ${JIT_EXPORTS_FILE_TEMP} ${exports_list})
310
311   # Copy the file only if it has changed.
312   execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
313     ${JIT_EXPORTS_FILE_TEMP} ${JIT_EXPORTS_FILE})
314
315   set(SHARED_LIB_SOURCES ${SOURCES} ${JIT_EXPORTS_FILE})
316 else()
317   set(JIT_EXPORTS_IN_FILE ${CMAKE_CURRENT_BINARY_DIR}/clrjit.exports.in)
318   file(READ "${CMAKE_CURRENT_LIST_DIR}/ClrJit.exports" jit_exports)
319   file(READ "${CMAKE_CURRENT_LIST_DIR}/ClrJit.PAL.exports" pal_exports)
320   file(WRITE ${JIT_EXPORTS_IN_FILE} ${jit_exports})
321   file(APPEND ${JIT_EXPORTS_IN_FILE} "\n")
322   file(APPEND ${JIT_EXPORTS_IN_FILE} ${pal_exports})
323
324   set(JIT_EXPORTS_FILE ${CMAKE_CURRENT_BINARY_DIR}/clrjit.exports)
325   generate_exports_file(${JIT_EXPORTS_IN_FILE} ${JIT_EXPORTS_FILE})
326
327   if(CMAKE_SYSTEM_NAME STREQUAL Linux OR CMAKE_SYSTEM_NAME STREQUAL FreeBSD OR CMAKE_SYSTEM_NAME STREQUAL NetBSD)
328     # This is required to force using our own PAL, not one that we are loaded with.
329     set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Xlinker -Bsymbolic -Bsymbolic-functions")
330
331     set(JIT_EXPORTS_LINKER_OPTION -Wl,--version-script=${JIT_EXPORTS_FILE})
332   elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
333     set(JIT_EXPORTS_LINKER_OPTION -Wl,-exported_symbols_list,${JIT_EXPORTS_FILE})
334   endif()
335
336   set(SHARED_LIB_SOURCES ${SOURCES})
337 endif()
338
339 add_custom_target(jit_exports DEPENDS ${JIT_EXPORTS_FILE})
340
341 set(RYUJIT_LINK_LIBRARIES
342    utilcodestaticnohost
343    gcinfo
344 )
345
346 if(CLR_CMAKE_PLATFORM_UNIX)
347     list(APPEND RYUJIT_LINK_LIBRARIES
348        mscorrc_debug
349        coreclrpal
350        palrt
351     )
352 else()
353     list(APPEND RYUJIT_LINK_LIBRARIES
354        ${STATIC_MT_CRT_LIB}
355        ${STATIC_MT_VCRT_LIB}
356        kernel32.lib
357        advapi32.lib
358        ole32.lib
359        oleaut32.lib
360        uuid.lib
361        user32.lib
362        version.lib
363        shlwapi.lib
364        bcrypt.lib
365        crypt32.lib
366        RuntimeObject.lib
367     )
368 endif(CLR_CMAKE_PLATFORM_UNIX)
369
370 if (FEATURE_MERGE_JIT_AND_ENGINE)
371   # Despite the directory being named "dll", it creates a static library "clrjit_static" to link into the VM.
372   add_subdirectory(dll)
373   add_subdirectory(crossgen)
374 endif (FEATURE_MERGE_JIT_AND_ENGINE)
375
376 add_subdirectory(standalone)
377
378 if (CLR_CMAKE_TARGET_ARCH_ARM)
379     # Build arm32 legacy_backend to run on both x86 host (crossgen build) and arm host (native).
380     add_subdirectory(legacyjit)
381 endif (CLR_CMAKE_TARGET_ARCH_ARM)
382
383 if (CLR_CMAKE_PLATFORM_ARCH_I386 OR CLR_CMAKE_PLATFORM_ARCH_AMD64)
384     # On x86, build RyuJIT/ARM32 cross-compiling altjit.
385     # On amd64, build RyuJIT/ARM64 cross-compiling altjit.
386     add_subdirectory(protononjit)
387 endif ()
388
389 if (CLR_CMAKE_PLATFORM_ARCH_I386)
390      # On x86, build RyuJIT/ARM32 cross-compiling altjit for ARM_SOFTFP (armel).
391     add_subdirectory(armelnonjit)
392 endif ()
393
394 if ((CLR_CMAKE_PLATFORM_ARCH_I386 OR CLR_CMAKE_PLATFORM_ARCH_AMD64) AND WIN32)
395     # On Windows, build altjit that targets the Linux ABI:
396     #   On x86, build Linux/x86 altjit. This enables UNIX_X86_ABI.
397     #   On amd64, build Linux/AMD64 altjit. This enables UNIX_AMD64_ABI and FEATURE_UNIX_AMD64_STRUCT_PASSING.
398     add_subdirectory(linuxnonjit)
399 endif ()
400
401 if (CLR_CMAKE_PLATFORM_ARCH_I386 AND WIN32)
402     # On Windows x86, build altjit generating Windows/ARM32 code using LEGACY_BACKEND.
403     # (Note: we could also create linuxlegacynonjit for generating Linux/ARM32 code using LEGACY_BACKEND, if needed.)
404     add_subdirectory(legacynonjit)
405 endif (CLR_CMAKE_PLATFORM_ARCH_I386 AND WIN32)