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