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/dbgrpt.cpp 40 misc/fltused.c 41 misc/isblank.c 42 misc/iswblank.c 43 misc/ofmt_stub.c 44 stdio/acrt_iob_func.c) 45 46if(MSVC) 47 list(APPEND MSVCRTEX_SOURCE 48 startup/threadSafeInit.c) 49else() 50 list(APPEND MSVCRTEX_SOURCE 51 startup/pseudo-reloc.c 52 startup/pseudo-reloc-list.c) 53endif() 54 55if(ARCH STREQUAL "i386") 56 list(APPEND MSVCRTEX_ASM_SOURCE 57 except/i386/chkstk_asm.s 58 except/i386/chkstk_ms.s 59 math/i386/ftol2_asm.s 60 math/i386/alldiv_asm.s) 61 list(APPEND MSVCRTEX_SOURCE 62 math/i386/ci.c 63 math/i386/cicos.c 64 math/i386/cilog.c 65 math/i386/cipow.c 66 math/i386/cisin.c 67 math/i386/cisqrt.c) 68elseif(ARCH STREQUAL "amd64") 69 list(APPEND MSVCRTEX_ASM_SOURCE 70 except/amd64/chkstk_asm.s 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 ${MSVCRTEX_SOURCE} ${msvcrtex_asm}) 105target_compile_definitions(msvcrtex PRIVATE _DLL _MSVCRTEX_) 106set_source_files_properties(startup/crtdll.c PROPERTIES COMPILE_DEFINITIONS CRTDLL) 107set_source_files_properties(startup/crtexe.c 108 startup/wcrtexe.c PROPERTIES COMPILE_DEFINITIONS _M_CEE_PURE) 109 110if(NOT MSVC) 111 target_link_libraries(msvcrtex oldnames) 112endif() 113 114if(STACK_PROTECTOR) 115 target_link_libraries(msvcrtex gcc_ssp) 116endif() 117 118add_dependencies(msvcrtex psdk asm) 119