1 2include_directories(include/internal/mingw-w64) 3 4list(APPEND MSVCRTEX_SOURCE 5 startup/crtexe.c 6 startup/wcrtexe.c 7 startup/crt_handler.c 8 startup/crtdll.c 9 startup/_newmode.c 10 startup/wildcard.c 11 startup/tlssup.c 12 startup/mingw_helpers.c 13 startup/natstart.c 14 startup/charmax.c 15 startup/merr.c 16 startup/atonexit.c 17 startup/dllmain.c 18 startup/txtmode.c 19 startup/pesect.c 20 startup/tlsmcrt.c 21 startup/tlsthrd.c 22 startup/tlsmthread.c 23 startup/cinitexe.c 24 startup/gs_support.c 25 startup/dll_argv.c 26 startup/dllargv.c 27 startup/wdllargv.c 28 startup/crt0_c.c 29 startup/crt0_w.c 30 startup/dllentry.c 31 startup/reactos.c 32 misc/dbgrpt.cpp 33 misc/fltused.c 34 misc/isblank.c 35 misc/iswblank.c 36 misc/ofmt_stub.c 37 stdio/acrt_iob_func.c) 38 39if(MSVC) 40 list(APPEND MSVCRTEX_SOURCE 41 startup/threadSafeInit.c) 42else() 43 list(APPEND MSVCRTEX_SOURCE 44 startup/pseudo-reloc.c 45 startup/pseudo-reloc-list.c) 46endif() 47 48if(ARCH STREQUAL "i386") 49 list(APPEND MSVCRTEX_ASM_SOURCE 50 except/i386/chkstk_asm.s 51 except/i386/chkstk_ms.s 52 math/i386/alldiv_asm.s) 53 list(APPEND MSVCRTEX_SOURCE 54 math/i386/ci.c 55 math/i386/cicos.c 56 math/i386/cilog.c 57 math/i386/cipow.c 58 math/i386/cisin.c 59 math/i386/cisqrt.c) 60 if (GCC AND CLANG) 61 # CLang performs some optimisations requiring those funtions 62 list(APPEND MSVCRTEX_ASM_SOURCE 63 math/i386/ceilf.S 64 math/i386/exp2_asm.s 65 math/i386/floorf.S) 66 list(APPEND MSVCRTEX_SOURCE 67 math/i386/sqrtf.c) 68 endif() 69elseif(ARCH STREQUAL "amd64") 70 list(APPEND MSVCRTEX_ASM_SOURCE 71 except/amd64/chkstk_ms.s) 72elseif(ARCH STREQUAL "arm") 73 list(APPEND MSVCRTEX_SOURCE 74 math/arm/__rt_sdiv.c 75 math/arm/__rt_sdiv64_worker.c 76 math/arm/__rt_udiv.c 77 math/arm/__rt_udiv64_worker.c 78 ) 79 list(APPEND MSVCRTEX_ASM_SOURCE 80 except/arm/chkstk_asm.s 81 math/arm/__dtoi64.s 82 math/arm/__dtou64.s 83 math/arm/__i64tod.s 84 math/arm/__i64tos.s 85 math/arm/__stoi64.s 86 math/arm/__stou64.s 87 math/arm/__u64tod.s 88 math/arm/__u64tos.s 89 math/arm/__rt_sdiv64.s 90 math/arm/__rt_srsh.s 91 math/arm/__rt_udiv64.s 92 ) 93endif() 94 95if(MSVC) 96 list(APPEND MSVCRTEX_SOURCE startup/mscmain.c) 97else() 98 list(APPEND MSVCRTEX_SOURCE startup/gccmain.c) 99endif() 100 101set_source_files_properties(${MSVCRTEX_ASM_SOURCE} PROPERTIES COMPILE_DEFINITIONS "_DLL;_MSVCRTEX_") 102add_asm_files(msvcrtex_asm ${MSVCRTEX_ASM_SOURCE}) 103 104add_library(msvcrtex OBJECT ${MSVCRTEX_SOURCE} ${msvcrtex_asm}) 105target_compile_definitions(msvcrtex PRIVATE _DLL _MSVCRTEX_) 106 107if(MSVC AND (ARCH STREQUAL "i386")) 108 # user32.dll needs this as a stand-alone object file 109 add_asm_files(ftol2_asm math/i386/ftol2_asm.s) 110 add_library(ftol2_sse OBJECT ${ftol2_asm}) 111 target_compile_definitions(ftol2_sse PRIVATE $<TARGET_PROPERTY:msvcrtex,COMPILE_DEFINITIONS>) 112endif() 113 114 115if(GCC OR CLANG) 116 target_compile_options(msvcrtex PRIVATE $<$<COMPILE_LANGUAGE:C>:-Wno-main>) 117 if(LTCG) 118 target_compile_options(msvcrtex PRIVATE -fno-lto) 119 endif() 120endif() 121 122set_source_files_properties(startup/crtdll.c PROPERTIES COMPILE_DEFINITIONS CRTDLL) 123set_source_files_properties(startup/crtexe.c 124 startup/wcrtexe.c PROPERTIES COMPILE_DEFINITIONS _M_CEE_PURE) 125 126if(NOT MSVC) 127 target_link_libraries(msvcrtex oldnames) 128endif() 129 130add_dependencies(msvcrtex psdk asm) 131