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/_snprintf.c 139 printf/_snprintf_s.c 140 printf/_snwprintf.c 141 printf/_snwprintf_s.c 142 printf/_vcprintf.c 143 printf/_vcwprintf.c 144 printf/_vscprintf.c 145 printf/_vscwprintf.c 146 printf/_vsnprintf.c 147 printf/_vsnprintf_s.c 148 printf/_vsnwprintf.c 149 printf/_vsnwprintf_s.c 150 printf/_vsprintf_p.c 151 printf/fprintf.c 152 printf/fprintf_s.c 153 printf/fwprintf.c 154 printf/fwprintf_s.c 155 printf/printf.c 156 printf/printf_s.c 157 printf/sprintf.c 158 printf/sprintf_s.c 159 printf/streamout.c 160 printf/swprintf.c 161 printf/swprintf_s.c 162 printf/vfprintf.c 163 printf/vfprintf_s.c 164 printf/vfwprintf.c 165 printf/vfwprintf_s.c 166 printf/vprintf.c 167 printf/vprintf_s.c 168 printf/vsprintf.c 169 printf/vsprintf_s.c 170 printf/vswprintf.c 171 printf/vswprintf_s.c 172 printf/vwprintf.c 173 printf/vwprintf_s.c 174 printf/wprintf.c 175 printf/wprintf_s.c 176 printf/wstreamout.c 177 process/_cwait.c 178 process/_system.c 179 process/dll.c 180 process/process.c 181 process/procid.c 182 process/thread.c 183 process/threadid.c 184 process/threadx.c 185 process/wprocess.c 186 search/bsearch.c 187 search/lfind.c 188 search/lsearch.c 189 signal/signal.c 190 signal/xcptinfo.c 191 startup/crtexe.c 192 startup/wcrtexe.c 193 startup/crt_handler.c 194 startup/crtdll.c 195 startup/_newmode.c 196 startup/wildcard.c 197 startup/tlssup.c 198 startup/mingw_helpers.c 199 startup/natstart.c 200 startup/charmax.c 201 #startup/merr.c 202 #startup/atonexit.c 203 #startup/txtmode.c 204 startup/pesect.c 205 startup/tlsmcrt.c 206 startup/tlsthrd.c 207 startup/tlsmthread.c 208 startup/cinitexe.c 209 startup/gs_support.c 210 startup/dll_argv.c 211 startup/dllargv.c 212 startup/wdllargv.c 213 startup/crt0_c.c 214 startup/crt0_w.c 215 startup/dllentry.c 216 startup/reactos.c 217 stdio/_flsbuf.c 218 stdio/_flswbuf.c 219 stdio/access.c 220 stdio/file.c 221 stdio/find.c 222 stdio/find64.c 223 stdio/findi64.c 224 stdio/fmode.c 225 stdio/perror.c 226 stdio/popen.c 227 stdio/stat.c 228 stdio/stat64.c 229 stdio/waccess.c 230 stdio/wfind.c 231 stdio/wfind64.c 232 stdio/wfindi64.c 233 stdio/wpopen.c 234 stdio/wstat.c 235 stdio/wstat64.c 236 stdlib/_exit.c 237 stdlib/_set_abort_behavior.c 238 stdlib/abort.c 239 stdlib/atexit.c 240 stdlib/ecvt.c 241 stdlib/errno.c 242 stdlib/fcvt.c 243 stdlib/fcvtbuf.c 244 stdlib/fullpath.c 245 stdlib/gcvt.c 246 stdlib/getenv.c 247 stdlib/makepath.c 248 stdlib/makepath_s.c 249 stdlib/mbtowc.c 250 stdlib/mbstowcs.c 251 stdlib/obsol.c 252 stdlib/putenv.c 253 stdlib/qsort.c 254 stdlib/rot.c 255 stdlib/senv.c 256 stdlib/swab.c 257 stdlib/wfulpath.c 258 stdlib/wputenv.c 259 stdlib/wsenv.c 260 stdlib/wmakpath.c 261 stdlib/wmakpath_s.c 262 string/_mbsnlen.c 263 string/_mbstrnlen.c 264 string/_splitpath.c 265 string/_splitpath_s.c 266 string/_wcslwr_s.c 267 string/_wsplitpath.c 268 string/_wsplitpath_s.c 269 string/atof.c 270 string/atoi.c 271 string/atoi64.c 272 string/atol.c 273 string/ctype.c 274 string/iswctype.c 275 string/is_wctype.c 276 string/itoa.c 277 string/itow.c 278 string/mbstowcs_s.c 279 string/scanf.c 280 string/strcoll.c 281 string/strcspn.c 282 string/strdup.c 283 string/strerror.c 284 string/stricmp.c 285 string/string.c 286 string/strlwr.c 287 string/strncoll.c 288 string/strnicmp.c 289 string/strpbrk.c 290 string/strrev.c 291 string/strset.c 292 string/strspn.c 293 string/strstr.c 294 string/strtod.c 295 string/strtoi64.c 296 string/strtok.c 297 #string/strtok_s.c 298 string/strtol.c 299 string/strtoul.c 300 string/strtoull.c 301 string/strupr.c 302 string/strxfrm.c 303 string/wcs.c 304 string/wcstol.c 305 string/wcstombs_s.c 306 string/wcstoul.c 307 string/wctype.c 308 string/wtof.c 309 string/wtoi.c 310 string/wtoi64.c 311 string/wtol.c 312 string/winesup.c 313 sys_stat/systime.c 314 time/asctime.c 315 time/clock.c 316 time/ctime32.c 317 time/ctime64.c 318 time/ctime.c 319 time/difftime32.c 320 time/difftime64.c 321 time/difftime.c 322 time/ftime32.c 323 time/ftime64.c 324 time/ftime.c 325 time/futime32.c 326 time/futime64.c 327 time/futime.c 328 time/gmtime.c 329 time/localtime32.c 330 time/localtime64.c 331 time/localtime.c 332 time/mktime.c 333 time/strdate.c 334 time/strftime.c 335 time/strtime.c 336 time/time32.c 337 time/time64.c 338 time/time.c 339 time/timezone.c 340 time/utime32.c 341 time/utime64.c 342 time/utime.c 343 time/wasctime.c 344 time/wctime32.c 345 time/wctime64.c 346 time/wctime.c 347 time/wstrdate.c 348 time/wstrtime.c 349 time/wutime32.c 350 time/wutime64.c 351 time/wutime.c 352 wstring/wcscoll.c 353 wstring/wcscspn.c 354 wstring/wcsicmp.c 355 wstring/wcslwr.c 356 wstring/wcsnicmp.c 357 wstring/wcsspn.c 358 wstring/wcsstr.c 359 wstring/wcstok.c 360 wstring/wcsupr.c 361 wstring/wcsxfrm.c 362 wine/heap.c 363 wine/undname.c) 364 365if(ARCH STREQUAL "i386") 366 list(APPEND CRT_ASM_SOURCE 367 except/i386/chkesp.s 368 except/i386/prolog.s 369 math/i386/alldiv_asm.s 370 math/i386/alldvrm_asm.s 371 math/i386/allmul_asm.s 372 math/i386/allrem_asm.s 373 math/i386/allshl_asm.s 374 math/i386/allshr_asm.s 375 math/i386/atan_asm.s 376 math/i386/aulldiv_asm.s 377 math/i386/aulldvrm_asm.s 378 math/i386/aullrem_asm.s 379 math/i386/aullshr_asm.s 380 math/i386/ceil_asm.s 381 math/i386/ceilf.S 382 math/i386/cos_asm.s 383 math/i386/fabs_asm.s 384 math/i386/floor_asm.s 385 math/i386/floorf.S 386 math/i386/ftol_asm.s 387 math/i386/ftol2_asm.s 388 math/i386/log_asm.s 389 math/i386/log10_asm.s 390 math/i386/pow_asm.s 391 math/i386/sin_asm.s 392 math/i386/sqrt_asm.s 393 math/i386/tan_asm.s 394 math/i386/atan2_asm.s 395 math/i386/exp_asm.s 396 math/i386/fmod_asm.s 397 math/i386/fmodf_asm.s 398 mem/i386/memchr_asm.s 399 mem/i386/memmove_asm.s 400 mem/i386/memset_asm.s 401 misc/i386/readcr4.S 402 setjmp/i386/setjmp.s 403 string/i386/strcat_asm.s 404 string/i386/strchr_asm.s 405 string/i386/strcmp_asm.s 406 string/i386/strcpy_asm.s 407 string/i386/strlen_asm.s 408 string/i386/strncat_asm.s 409 string/i386/strncmp_asm.s 410 string/i386/strncpy_asm.s 411 string/i386/strnlen_asm.s 412 string/i386/strrchr_asm.s 413 string/i386/wcscat_asm.s 414 string/i386/wcschr_asm.s 415 string/i386/wcscmp_asm.s 416 string/i386/wcscpy_asm.s 417 string/i386/wcslen_asm.s 418 string/i386/wcsncat_asm.s 419 string/i386/wcsncmp_asm.s 420 string/i386/wcsncpy_asm.s 421 string/i386/wcsnlen_asm.s 422 string/i386/wcsrchr_asm.s) 423 424 list(APPEND CRT_SOURCE 425 except/i386/unwind.c 426 float/i386/clearfp.c 427 float/i386/cntrlfp.c 428 float/i386/fpreset.c 429 float/i386/logb.c 430 float/i386/statfp.c 431 math/i386/ci.c 432 math/i386/cicos.c 433 math/i386/cilog.c 434 math/i386/cipow.c 435 math/i386/cisin.c 436 math/i386/cisqrt.c 437 math/i386/ldexp.c) 438 if(MSVC) 439 list(APPEND CRT_ASM_SOURCE 440 except/i386/cpp.s) 441 endif() 442elseif(ARCH STREQUAL "amd64") 443 list(APPEND CRT_ASM_SOURCE 444 except/amd64/seh.s 445 float/amd64/clearfp.S 446 float/amd64/getsetfpcw.S 447 float/amd64/fpreset.S 448 float/amd64/logb.S 449 # math/amd64/acos.S 450 # math/amd64/acosf.S 451 math/amd64/atan.S 452 math/amd64/atan2.S 453 math/amd64/ceil.S 454 # math/amd64/ceilf.S 455 math/amd64/exp.S 456 math/amd64/fabs.S 457 math/amd64/floor.S 458 # math/amd64/floorf.S 459 math/amd64/fmod.S 460 # math/amd64/fmodf.S 461 math/amd64/ldexp.S 462 math/amd64/log.S 463 math/amd64/log10.S 464 math/amd64/pow.S 465 math/amd64/sqrt.S 466 # math/amd64/sqrtf.S 467 math/amd64/tan.S 468 setjmp/amd64/setjmp.s) 469 470 list(APPEND CRT_SOURCE 471 except/amd64/ehandler.c 472 float/i386/cntrlfp.c 473 float/i386/statfp.c) 474 if(MSVC) 475 list(APPEND CRT_ASM_SOURCE 476 except/amd64/cpp.s) 477 endif() 478elseif(ARCH STREQUAL "arm") 479 list(APPEND CRT_SOURCE 480 except/arm/ehandler.c 481 math/fabsf.c 482 math/sqrt.c 483 math/arm/__rt_sdiv.c 484 math/arm/__rt_sdiv64_worker.c 485 math/arm/__rt_udiv.c 486 math/arm/__rt_udiv64_worker.c 487 ) 488 list(APPEND CRT_ASM_SOURCE 489 except/arm/_abnormal_termination.s 490 except/arm/_except_handler2.s 491 except/arm/_except_handler3.s 492 except/arm/_global_unwind2.s 493 except/arm/_local_unwind2.s 494 except/arm/chkstk_asm.s 495 float/arm/_clearfp.s 496 float/arm/_controlfp.s 497 float/arm/_fpreset.s 498 float/arm/_statusfp.s 499 math/arm/atan.s 500 math/arm/atan2.s 501 math/arm/ceil.s 502 math/arm/exp.s 503 math/arm/fabs.s 504 math/arm/fmod.s 505 math/arm/floor.s 506 math/arm/ldexp.s 507 math/arm/log.s 508 math/arm/log10.s 509 math/arm/pow.s 510 math/arm/tan.s 511 math/arm/_logb.s 512 math/arm/__dtoi64.s 513 math/arm/__dtou64.s 514 math/arm/__i64tod.s 515 math/arm/__i64tos.s 516 math/arm/__stoi64.s 517 math/arm/__stou64.s 518 math/arm/__u64tod.s 519 math/arm/__u64tos.s 520 math/arm/__rt_sdiv64.s 521 math/arm/__rt_srsh.s 522 math/arm/__rt_udiv64.s 523 setjmp/arm/setjmp.s 524 ) 525 if(MSVC) 526 list(APPEND CRT_ASM_SOURCE 527 except/arm/cpp.s) 528 endif() 529endif() 530 531if(NOT ARCH STREQUAL "i386") 532 list(APPEND CRT_SOURCE 533 math/_chgsignf.c 534 math/_copysignf.c 535 math/_hypotf.c 536 math/acosf.c 537 math/asinf.c 538 math/atan2f.c 539 math/atanf.c 540 math/ceilf.c 541 math/cos.c 542 math/coshf.c 543 math/expf.c 544 math/floorf.c 545 math/fmodf.c 546 math/log10f.c 547 math/modff.c 548 math/sin.c 549 math/sinhf.c 550 math/sqrt.c 551 math/sqrtf.c 552 math/tanf.c 553 math/tanhf.c 554 math/stubs.c 555 mem/memchr.c 556 mem/memcpy.c 557 mem/memmove.c 558 mem/memset.c 559 string/strcat.c 560 string/strchr.c 561 string/strcmp.c 562 string/strcpy.c 563 string/strlen.c 564 string/strncat.c 565 string/strncmp.c 566 string/strncpy.c 567 string/strnlen.c 568 string/strrchr.c 569 string/wcscat.c 570 string/wcschr.c 571 string/wcscmp.c 572 string/wcscpy.c 573 string/wcslen.c 574 string/wcsncat.c 575 string/wcsncmp.c 576 string/wcsncpy.c 577 string/wcsnlen.c 578 string/wcsrchr.c) 579endif() 580 581set_source_files_properties(${CRT_ASM_SOURCE} PROPERTIES COMPILE_DEFINITIONS "__MINGW_IMPORT=extern;USE_MSVCRT_PREFIX;_MSVCRT_LIB_;_MSVCRT_;_MT;CRTDLL") 582add_asm_files(crt_asm ${CRT_ASM_SOURCE}) 583 584if(USE_CLANG_CL) 585 # clang-cl is missing pragma function support 586 # https://bugs.llvm.org/show_bug.cgi?id=35116 587 set_property(SOURCE stdlib/rot.c APPEND_STRING PROPERTY COMPILE_FLAGS " /fallback") 588endif() 589 590add_library(crt ${CRT_SOURCE} ${crt_asm}) 591target_link_libraries(crt chkstk) 592add_target_compile_definitions(crt 593 __MINGW_IMPORT=extern 594 USE_MSVCRT_PREFIX 595 _MSVCRT_LIB_ 596 _MSVCRT_ 597 _MT 598 CRTDLL) 599#add_pch(crt precomp.h) 600add_dependencies(crt psdk asm) 601