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 if (GCC AND CLANG) 54 # CLang performs some optimisations requiring those funtions 55 list(APPEND MSVCRTEX_ASM_SOURCE 56 math/i386/ceilf.S 57 math/i386/exp2_asm.s 58 math/i386/floorf.S) 59 list(APPEND MSVCRTEX_SOURCE 60 math/i386/sqrtf.c) 61 endif() 62elseif(ARCH STREQUAL "amd64") 63 list(APPEND MSVCRTEX_ASM_SOURCE 64 except/amd64/chkstk_ms.s) 65elseif(ARCH STREQUAL "arm") 66 list(APPEND MSVCRTEX_SOURCE 67 math/arm/__rt_sdiv.c 68 math/arm/__rt_sdiv64_worker.c 69 math/arm/__rt_udiv.c 70 math/arm/__rt_udiv64_worker.c 71 ) 72 list(APPEND MSVCRTEX_ASM_SOURCE 73 except/arm/chkstk_asm.s 74 math/arm/__dtoi64.s 75 math/arm/__dtou64.s 76 math/arm/__i64tod.s 77 math/arm/__i64tos.s 78 math/arm/__stoi64.s 79 math/arm/__stou64.s 80 math/arm/__u64tod.s 81 math/arm/__u64tos.s 82 math/arm/__rt_sdiv64.s 83 math/arm/__rt_srsh.s 84 math/arm/__rt_udiv64.s 85 ) 86endif() 87 88if(MSVC) 89 list(APPEND MSVCRTEX_SOURCE startup/mscmain.c) 90else() 91 list(APPEND MSVCRTEX_SOURCE startup/gccmain.c) 92endif() 93 94set_source_files_properties(${MSVCRTEX_ASM_SOURCE} PROPERTIES COMPILE_DEFINITIONS "_DLL;_MSVCRTEX_") 95add_asm_files(msvcrtex_asm ${MSVCRTEX_ASM_SOURCE}) 96 97add_library(msvcrtex OBJECT ${MSVCRTEX_SOURCE} ${msvcrtex_asm}) 98target_compile_definitions(msvcrtex PRIVATE _DLL _MSVCRTEX_) 99 100if(MSVC AND (ARCH STREQUAL "i386")) 101 # user32.dll needs this as a stand-alone object file 102 add_asm_files(ftol2_asm math/i386/ftol2_asm.s) 103 add_library(ftol2_sse OBJECT ${ftol2_asm}) 104 target_compile_definitions(ftol2_sse PRIVATE $<TARGET_PROPERTY:msvcrtex,COMPILE_DEFINITIONS>) 105 set_target_properties(ftol2_sse PROPERTIES LINKER_LANGUAGE C) 106endif() 107 108 109if(GCC OR CLANG) 110 target_compile_options(msvcrtex PRIVATE $<$<COMPILE_LANGUAGE:C>:-Wno-main>) 111 if(LTCG) 112 target_compile_options(msvcrtex PRIVATE -fno-lto) 113 endif() 114endif() 115 116set_source_files_properties(startup/crtdll.c PROPERTIES COMPILE_DEFINITIONS CRTDLL) 117set_source_files_properties(startup/crtexe.c 118 startup/wcrtexe.c PROPERTIES COMPILE_DEFINITIONS _M_CEE_PURE) 119 120if(NOT MSVC) 121 target_link_libraries(msvcrtex oldnames) 122endif() 123 124add_dependencies(msvcrtex psdk asm) 125