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