xref: /reactos/sdk/lib/crt/crt.cmake (revision aad80191)
1
2list(APPEND CRT_SOURCE
3    conio/cgets.c
4    conio/cputs.c
5    conio/getch.c
6    conio/getche.c
7    conio/kbhit.c
8    conio/putch.c
9    conio/ungetch.c
10    direct/chdir.c
11    direct/chdrive.c
12    direct/getcwd.c
13    direct/getdcwd.c
14    direct/getdfree.c
15    direct/getdrive.c
16    direct/mkdir.c
17    direct/rmdir.c
18    direct/wchdir.c
19    direct/wgetcwd.c
20    direct/wgetdcwd.c
21    direct/wmkdir.c
22    direct/wrmdir.c
23    except/cpp.c
24    except/cppexcept.c
25    except/except.c
26    except/matherr.c
27    except/stack.c
28    except/xcptfil.c
29    float/chgsign.c
30    float/copysign.c
31    float/fpclass.c
32    float/fpecode.c
33    float/isnan.c
34    float/nafter.c
35    float/scalb.c
36    locale/locale.c
37    math/abs.c
38    math/acos.c
39    math/adjust.c
40    math/asin.c
41    math/cabs.c
42    math/cosf.c
43    math/cosh.c
44    math/div.c
45    math/fdivbug.c
46    math/frexp.c
47    math/huge_val.c
48    math/hypot.c
49    math/ieee754/j0_y0.c
50    math/ieee754/j1_y1.c
51    math/ieee754/jn_yn.c
52    math/j0_y0.c
53    math/j1_y1.c
54    math/jn_yn.c
55    math/labs.c
56    math/ldiv.c
57    math/logf.c
58    math/modf.c
59    math/powf.c
60    math/rand.c
61    math/s_modf.c
62    math/sinf.c
63    math/sinh.c
64    math/tanh.c
65    mbstring/_setmbcp.c
66    mbstring/hanzen.c
67    mbstring/ischira.c
68    mbstring/iskana.c
69    mbstring/iskmoji.c
70    mbstring/iskpun.c
71    mbstring/islead.c
72    mbstring/islwr.c
73    mbstring/ismbal.c
74    mbstring/ismbaln.c
75    mbstring/ismbc.c
76    mbstring/ismbgra.c
77    mbstring/ismbkaln.c
78    mbstring/ismblead.c
79    mbstring/ismbpri.c
80    mbstring/ismbpun.c
81    mbstring/ismbtrl.c
82    mbstring/isuppr.c
83    mbstring/jistojms.c
84    mbstring/jmstojis.c
85    mbstring/mbbtype.c
86    mbstring/mbccpy.c
87    mbstring/mbclen.c
88    mbstring/mbscat.c
89    mbstring/mbschr.c
90    mbstring/mbscmp.c
91    mbstring/mbscoll.c
92    mbstring/mbscpy.c
93    mbstring/mbscspn.c
94    mbstring/mbsdec.c
95    mbstring/mbsdup.c
96    mbstring/mbsicmp.c
97    mbstring/mbsicoll.c
98    mbstring/mbsinc.c
99    mbstring/mbslen.c
100    mbstring/mbslwr.c
101    mbstring/mbsncat.c
102    mbstring/mbsnccnt.c
103    mbstring/mbsncmp.c
104    mbstring/mbsncoll.c
105    mbstring/mbsncpy.c
106    mbstring/mbsnextc.c
107    mbstring/mbsnicmp.c
108    mbstring/mbsnicoll.c
109    mbstring/mbsninc.c
110    mbstring/mbsnset.c
111    mbstring/mbspbrk.c
112    mbstring/mbsrchr.c
113    mbstring/mbsrev.c
114    mbstring/mbsset.c
115    mbstring/mbsspn.c
116    mbstring/mbsspnp.c
117    mbstring/mbsstr.c
118    mbstring/mbstok.c
119    mbstring/mbstrlen.c
120    mbstring/mbsupr.c
121    mem/memcmp.c
122    mem/memccpy.c
123    mem/memicmp.c
124    misc/__crt_MessageBoxA.c
125    misc/amsg.c
126    misc/assert.c
127    misc/environ.c
128    misc/fltused.c
129    misc/getargs.c
130    misc/i10output.c
131    misc/initterm.c
132    misc/lock.c
133    misc/purecall.c
134    misc/stubs.c
135    misc/tls.c
136    printf/_cprintf.c
137    printf/_cwprintf.c
138    printf/_scprintf.c
139    printf/_scwprintf.c
140    printf/_snprintf.c
141    printf/_snprintf_s.c
142    printf/_snwprintf.c
143    printf/_snwprintf_s.c
144    printf/_vcprintf.c
145    printf/_vcwprintf.c
146    printf/_vscprintf.c
147    printf/_vscwprintf.c
148    printf/_vsnprintf.c
149    printf/_vsnprintf_s.c
150    printf/_vsnwprintf.c
151    printf/_vsnwprintf_s.c
152    printf/_vsprintf_p.c
153    printf/fprintf.c
154    printf/fprintf_s.c
155    printf/fwprintf.c
156    printf/fwprintf_s.c
157    printf/printf.c
158    printf/printf_s.c
159    printf/sprintf.c
160    printf/sprintf_s.c
161    printf/streamout.c
162    printf/swprintf.c
163    printf/swprintf_s.c
164    printf/vfprintf.c
165    printf/vfprintf_s.c
166    printf/vfwprintf.c
167    printf/vfwprintf_s.c
168    printf/vprintf.c
169    printf/vprintf_s.c
170    printf/vsprintf.c
171    printf/vsprintf_s.c
172    printf/vswprintf.c
173    printf/vswprintf_s.c
174    printf/vwprintf.c
175    printf/vwprintf_s.c
176    printf/wprintf.c
177    printf/wprintf_s.c
178    printf/wstreamout.c
179    process/_cwait.c
180    process/_system.c
181    process/dll.c
182    process/process.c
183    process/procid.c
184    process/thread.c
185    process/threadid.c
186    process/threadx.c
187    process/wprocess.c
188    search/bsearch.c
189    search/lfind.c
190    search/lsearch.c
191    signal/signal.c
192    signal/xcptinfo.c
193    startup/crtexe.c
194    startup/wcrtexe.c
195    startup/crt_handler.c
196    startup/crtdll.c
197    startup/_newmode.c
198    startup/wildcard.c
199    startup/tlssup.c
200    startup/mingw_helpers.c
201    startup/natstart.c
202    startup/charmax.c
203    #startup/merr.c
204    #startup/atonexit.c
205    #startup/txtmode.c
206    startup/pesect.c
207    startup/tlsmcrt.c
208    startup/tlsthrd.c
209    startup/tlsmthread.c
210    startup/cinitexe.c
211    startup/gs_support.c
212    startup/dll_argv.c
213    startup/dllargv.c
214    startup/wdllargv.c
215    startup/crt0_c.c
216    startup/crt0_w.c
217    startup/dllentry.c
218    startup/reactos.c
219    stdio/_flsbuf.c
220    stdio/_flswbuf.c
221    stdio/access.c
222    stdio/file.c
223    stdio/find.c
224    stdio/find64.c
225    stdio/findi64.c
226    stdio/fmode.c
227    stdio/perror.c
228    stdio/popen.c
229    stdio/stat.c
230    stdio/stat64.c
231    stdio/waccess.c
232    stdio/wfind.c
233    stdio/wfind64.c
234    stdio/wfindi64.c
235    stdio/wpopen.c
236    stdio/wstat.c
237    stdio/wstat64.c
238    stdlib/_exit.c
239    stdlib/_set_abort_behavior.c
240    stdlib/abort.c
241    stdlib/atexit.c
242    stdlib/ecvt.c
243    stdlib/errno.c
244    stdlib/fcvt.c
245    stdlib/fcvtbuf.c
246    stdlib/fullpath.c
247    stdlib/gcvt.c
248    stdlib/getenv.c
249    stdlib/makepath.c
250    stdlib/makepath_s.c
251    stdlib/mbtowc.c
252    stdlib/mbstowcs.c
253    stdlib/obsol.c
254    stdlib/putenv.c
255    stdlib/qsort.c
256    stdlib/rot.c
257    stdlib/senv.c
258    stdlib/swab.c
259    stdlib/wfulpath.c
260    stdlib/wputenv.c
261    stdlib/wsenv.c
262    stdlib/wmakpath.c
263    stdlib/wmakpath_s.c
264    string/_mbsnlen.c
265    string/_mbstrnlen.c
266    string/_splitpath.c
267    string/_splitpath_s.c
268    string/_wcslwr_s.c
269    string/_wsplitpath.c
270    string/_wsplitpath_s.c
271    string/atof.c
272    string/atoi.c
273    string/atoi64.c
274    string/atol.c
275    string/ctype.c
276    string/iswctype.c
277    string/is_wctype.c
278    string/itoa.c
279    string/itow.c
280    string/mbstowcs_s.c
281    string/scanf.c
282    string/strcoll.c
283    string/strcspn.c
284    string/strdup.c
285    string/strerror.c
286    string/stricmp.c
287    string/string.c
288    string/strlwr.c
289    string/strncoll.c
290    string/strnicmp.c
291    string/strpbrk.c
292    string/strrev.c
293    string/strset.c
294    string/strspn.c
295    string/strstr.c
296    string/strtod.c
297    string/strtoi64.c
298    string/strtok.c
299    #string/strtok_s.c
300    string/strtol.c
301    string/strtoul.c
302    string/strtoull.c
303    string/strupr.c
304    string/strxfrm.c
305    string/wcs.c
306    string/wcstol.c
307    string/wcstombs_s.c
308    string/wcstoul.c
309    string/wctype.c
310    string/wtof.c
311    string/wtoi.c
312    string/wtoi64.c
313    string/wtol.c
314    string/winesup.c
315    sys_stat/systime.c
316    time/asctime.c
317    time/clock.c
318    time/ctime32.c
319    time/ctime64.c
320    time/ctime.c
321    time/difftime32.c
322    time/difftime64.c
323    time/difftime.c
324    time/ftime32.c
325    time/ftime64.c
326    time/ftime.c
327    time/futime32.c
328    time/futime64.c
329    time/futime.c
330    time/gmtime.c
331    time/localtime32.c
332    time/localtime64.c
333    time/localtime.c
334    time/mktime.c
335    time/strdate.c
336    time/strftime.c
337    time/strtime.c
338    time/time32.c
339    time/time64.c
340    time/time.c
341    time/timezone.c
342    time/utime32.c
343    time/utime64.c
344    time/utime.c
345    time/wasctime.c
346    time/wctime32.c
347    time/wctime64.c
348    time/wctime.c
349    time/wstrdate.c
350    time/wstrtime.c
351    time/wutime32.c
352    time/wutime64.c
353    time/wutime.c
354    wstring/wcscoll.c
355    wstring/wcscspn.c
356    wstring/wcsicmp.c
357    wstring/wcslwr.c
358    wstring/wcsnicmp.c
359    wstring/wcsspn.c
360    wstring/wcsstr.c
361    wstring/wcstok.c
362    wstring/wcsupr.c
363    wstring/wcsxfrm.c
364    wine/heap.c
365    wine/undname.c)
366
367if(ARCH STREQUAL "i386")
368    list(APPEND CRT_ASM_SOURCE
369        except/i386/chkesp.s
370        except/i386/prolog.s
371        math/i386/alldiv_asm.s
372        math/i386/alldvrm_asm.s
373        math/i386/allmul_asm.s
374        math/i386/allrem_asm.s
375        math/i386/allshl_asm.s
376        math/i386/allshr_asm.s
377        math/i386/atan_asm.s
378        math/i386/aulldiv_asm.s
379        math/i386/aulldvrm_asm.s
380        math/i386/aullrem_asm.s
381        math/i386/aullshr_asm.s
382        math/i386/ceil_asm.s
383        math/i386/ceilf.S
384        math/i386/cos_asm.s
385        math/i386/fabs_asm.s
386        math/i386/floor_asm.s
387        math/i386/floorf.S
388        math/i386/ftol_asm.s
389        math/i386/ftol2_asm.s
390        math/i386/log_asm.s
391        math/i386/log10_asm.s
392        math/i386/pow_asm.s
393        math/i386/sin_asm.s
394        math/i386/sqrt_asm.s
395        math/i386/tan_asm.s
396        math/i386/atan2_asm.s
397        math/i386/exp_asm.s
398        math/i386/fmod_asm.s
399        math/i386/fmodf_asm.s
400        mem/i386/memchr_asm.s
401        mem/i386/memmove_asm.s
402        mem/i386/memset_asm.s
403        misc/i386/readcr4.S
404        setjmp/i386/setjmp.s
405        string/i386/strcat_asm.s
406        string/i386/strchr_asm.s
407        string/i386/strcmp_asm.s
408        string/i386/strcpy_asm.s
409        string/i386/strlen_asm.s
410        string/i386/strncat_asm.s
411        string/i386/strncmp_asm.s
412        string/i386/strncpy_asm.s
413        string/i386/strnlen_asm.s
414        string/i386/strrchr_asm.s
415        string/i386/wcscat_asm.s
416        string/i386/wcschr_asm.s
417        string/i386/wcscmp_asm.s
418        string/i386/wcscpy_asm.s
419        string/i386/wcslen_asm.s
420        string/i386/wcsncat_asm.s
421        string/i386/wcsncmp_asm.s
422        string/i386/wcsncpy_asm.s
423        string/i386/wcsnlen_asm.s
424        string/i386/wcsrchr_asm.s)
425
426    list(APPEND CRT_SOURCE
427        except/i386/unwind.c
428        float/i386/clearfp.c
429        float/i386/cntrlfp.c
430        float/i386/fpreset.c
431        float/i386/logb.c
432        float/i386/statfp.c
433        math/i386/ci.c
434        math/i386/cicos.c
435        math/i386/cilog.c
436        math/i386/cipow.c
437        math/i386/cisin.c
438        math/i386/cisqrt.c
439        math/i386/ldexp.c)
440    if(MSVC)
441        list(APPEND CRT_ASM_SOURCE
442            except/i386/cpp.s)
443    endif()
444elseif(ARCH STREQUAL "amd64")
445    list(APPEND CRT_ASM_SOURCE
446        except/amd64/seh.s
447        float/amd64/clearfp.S
448        float/amd64/getsetfpcw.S
449        float/amd64/fpreset.S
450        float/amd64/logb.S
451        # math/amd64/acos.S
452        # math/amd64/acosf.S
453        math/amd64/atan.S
454        math/amd64/atan2.S
455        math/amd64/ceil.S
456        # math/amd64/ceilf.S
457        math/amd64/exp.S
458        math/amd64/fabs.S
459        math/amd64/floor.S
460        # math/amd64/floorf.S
461        math/amd64/fmod.S
462        # math/amd64/fmodf.S
463        math/amd64/ldexp.S
464        math/amd64/log.S
465        math/amd64/log10.S
466        math/amd64/pow.S
467        math/amd64/sqrt.S
468        # math/amd64/sqrtf.S
469        math/amd64/tan.S
470        setjmp/amd64/setjmp.s)
471
472    list(APPEND CRT_SOURCE
473        except/amd64/ehandler.c
474        float/i386/cntrlfp.c
475        float/i386/statfp.c)
476    if(MSVC)
477        list(APPEND CRT_ASM_SOURCE
478            except/amd64/cpp.s)
479    endif()
480elseif(ARCH STREQUAL "arm")
481    list(APPEND CRT_SOURCE
482        except/arm/ehandler.c
483        math/fabsf.c
484        math/sqrt.c
485        math/arm/__rt_sdiv.c
486        math/arm/__rt_sdiv64_worker.c
487        math/arm/__rt_udiv.c
488        math/arm/__rt_udiv64_worker.c
489    )
490    list(APPEND CRT_ASM_SOURCE
491        except/arm/_abnormal_termination.s
492        except/arm/_except_handler2.s
493        except/arm/_except_handler3.s
494        except/arm/_global_unwind2.s
495        except/arm/_local_unwind2.s
496        except/arm/chkstk_asm.s
497        float/arm/_clearfp.s
498        float/arm/_controlfp.s
499        float/arm/_fpreset.s
500        float/arm/_statusfp.s
501        math/arm/atan.s
502        math/arm/atan2.s
503        math/arm/ceil.s
504        math/arm/exp.s
505        math/arm/fabs.s
506        math/arm/fmod.s
507        math/arm/floor.s
508        math/arm/ldexp.s
509        math/arm/log.s
510        math/arm/log10.s
511        math/arm/pow.s
512        math/arm/tan.s
513        math/arm/_logb.s
514        math/arm/__dtoi64.s
515        math/arm/__dtou64.s
516        math/arm/__i64tod.s
517        math/arm/__i64tos.s
518        math/arm/__stoi64.s
519        math/arm/__stou64.s
520        math/arm/__u64tod.s
521        math/arm/__u64tos.s
522        math/arm/__rt_sdiv64.s
523        math/arm/__rt_srsh.s
524        math/arm/__rt_udiv64.s
525        setjmp/arm/setjmp.s
526    )
527    if(MSVC)
528        list(APPEND CRT_ASM_SOURCE
529            except/arm/cpp.s)
530    endif()
531endif()
532
533if(NOT ARCH STREQUAL "i386")
534    list(APPEND CRT_SOURCE
535        math/_chgsignf.c
536        math/_copysignf.c
537        math/_hypotf.c
538        math/acosf.c
539        math/asinf.c
540        math/atan2f.c
541        math/atanf.c
542        math/ceilf.c
543        math/cos.c
544        math/coshf.c
545        math/expf.c
546        math/floorf.c
547        math/fmodf.c
548        math/log10f.c
549        math/modff.c
550        math/sin.c
551        math/sinhf.c
552        math/sqrt.c
553        math/sqrtf.c
554        math/tanf.c
555        math/tanhf.c
556        math/stubs.c
557        mem/memchr.c
558        mem/memcpy.c
559        mem/memmove.c
560        mem/memset.c
561        string/strcat.c
562        string/strchr.c
563        string/strcmp.c
564        string/strcpy.c
565        string/strlen.c
566        string/strncat.c
567        string/strncmp.c
568        string/strncpy.c
569        string/strnlen.c
570        string/strrchr.c
571        string/wcscat.c
572        string/wcschr.c
573        string/wcscmp.c
574        string/wcscpy.c
575        string/wcslen.c
576        string/wcsncat.c
577        string/wcsncmp.c
578        string/wcsncpy.c
579        string/wcsnlen.c
580        string/wcsrchr.c)
581endif()
582
583set_source_files_properties(${CRT_ASM_SOURCE} PROPERTIES COMPILE_DEFINITIONS "__MINGW_IMPORT=extern;USE_MSVCRT_PREFIX;_MSVCRT_LIB_;_MSVCRT_;_MT;CRTDLL")
584add_asm_files(crt_asm ${CRT_ASM_SOURCE})
585
586if(USE_CLANG_CL)
587    # clang-cl is missing pragma function support
588    # https://bugs.llvm.org/show_bug.cgi?id=35116
589    set_property(SOURCE stdlib/rot.c APPEND_STRING PROPERTY COMPILE_FLAGS " /fallback")
590endif()
591
592add_library(crt ${CRT_SOURCE} ${crt_asm})
593target_link_libraries(crt chkstk)
594add_target_compile_definitions(crt
595    __MINGW_IMPORT=extern
596    USE_MSVCRT_PREFIX
597    _MSVCRT_LIB_
598    _MSVCRT_
599    _MT
600    CRTDLL)
601#add_pch(crt precomp.h)
602add_dependencies(crt psdk asm)
603