2011-05-23 15:50:03 +00:00
|
|
|
|
|
|
|
include_directories(include/internal/mingw-w64)
|
|
|
|
|
|
|
|
list(APPEND MSVCRTEX_SOURCE
|
2021-07-28 08:18:12 +00:00
|
|
|
${CRT_STARTUP_SOURCE}
|
2022-06-25 10:27:39 +00:00
|
|
|
math/sincos.c
|
2011-05-23 15:50:03 +00:00
|
|
|
misc/fltused.c
|
2012-07-30 12:56:25 +00:00
|
|
|
misc/isblank.c
|
|
|
|
misc/iswblank.c
|
2019-10-20 10:44:17 +00:00
|
|
|
misc/ofmt_stub.c
|
|
|
|
stdio/acrt_iob_func.c)
|
2011-05-23 15:50:03 +00:00
|
|
|
|
2024-04-15 17:44:14 +00:00
|
|
|
if(DLL_EXPORT_VERSION LESS 0x600)
|
|
|
|
list(APPEND MSVCRTEX_SOURCE
|
2024-04-27 11:59:06 +00:00
|
|
|
misc/dbgrpt.cpp
|
2024-04-15 17:44:14 +00:00
|
|
|
stdlib/_invalid_parameter.c
|
|
|
|
stdlib/rand_s.c
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2021-08-01 21:19:31 +00:00
|
|
|
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
|
|
|
# Clang performs some optimizations requiring those funtions
|
|
|
|
list(APPEND MSVCRTEX_SOURCE
|
2022-07-15 16:51:20 +00:00
|
|
|
math/round.c
|
|
|
|
math/roundf.c
|
2021-08-01 21:19:31 +00:00
|
|
|
math/exp2.c
|
|
|
|
math/exp2f.c
|
|
|
|
)
|
2011-06-09 17:59:26 +00:00
|
|
|
endif()
|
|
|
|
|
2012-08-27 18:58:27 +00:00
|
|
|
if(ARCH STREQUAL "i386")
|
2021-08-01 21:19:31 +00:00
|
|
|
# Clang wants __aulldiv for its optimizations
|
2013-01-08 20:33:08 +00:00
|
|
|
list(APPEND MSVCRTEX_ASM_SOURCE
|
2011-10-02 18:59:33 +00:00
|
|
|
except/i386/chkstk_asm.s
|
|
|
|
except/i386/chkstk_ms.s
|
2021-08-01 21:19:31 +00:00
|
|
|
math/i386/alldiv_asm.s
|
2021-09-13 01:33:14 +00:00
|
|
|
math/i386/aulldiv_asm.s
|
2021-08-01 21:19:31 +00:00
|
|
|
)
|
2022-05-25 22:37:23 +00:00
|
|
|
if (CMAKE_C_COMPILER_ID STREQUAL "Clang" AND NOT MSVC)
|
2020-11-06 20:39:00 +00:00
|
|
|
list(APPEND MSVCRTEX_ASM_SOURCE
|
|
|
|
math/i386/ceilf.S
|
|
|
|
math/i386/floorf.S)
|
|
|
|
list(APPEND MSVCRTEX_SOURCE
|
|
|
|
math/i386/sqrtf.c)
|
|
|
|
endif()
|
2020-09-24 05:49:16 +00:00
|
|
|
if(MSVC AND DLL_EXPORT_VERSION LESS 0x600)
|
|
|
|
list(APPEND MSVCRTEX_ASM_SOURCE
|
|
|
|
except/i386/__CxxFrameHandler3.s)
|
|
|
|
list(APPEND MSVCRTEX_SOURCE
|
|
|
|
except/i386/CxxHandleV8Frame.c)
|
|
|
|
endif()
|
2012-08-27 18:58:27 +00:00
|
|
|
elseif(ARCH STREQUAL "amd64")
|
2013-01-08 20:33:08 +00:00
|
|
|
list(APPEND MSVCRTEX_ASM_SOURCE
|
2011-10-14 08:33:22 +00:00
|
|
|
except/amd64/chkstk_ms.s)
|
2020-09-24 05:49:16 +00:00
|
|
|
if(MSVC AND DLL_EXPORT_VERSION LESS 0x600)
|
|
|
|
list(APPEND MSVCRTEX_ASM_SOURCE
|
|
|
|
except/amd64/__CxxFrameHandler3.s
|
|
|
|
)
|
|
|
|
endif()
|
2015-05-10 21:04:27 +00:00
|
|
|
elseif(ARCH STREQUAL "arm")
|
|
|
|
list(APPEND MSVCRTEX_SOURCE
|
|
|
|
math/arm/__rt_sdiv.c
|
|
|
|
math/arm/__rt_sdiv64_worker.c
|
|
|
|
math/arm/__rt_udiv.c
|
|
|
|
math/arm/__rt_udiv64_worker.c
|
2021-07-31 01:04:25 +00:00
|
|
|
math/arm/__rt_div_worker.h
|
2021-07-30 19:48:03 +00:00
|
|
|
math/arm/__dtoi64.c
|
|
|
|
math/arm/__dtou64.c
|
|
|
|
math/arm/__stoi64.c
|
|
|
|
math/arm/__stou64.c
|
2021-07-31 01:04:25 +00:00
|
|
|
math/arm/__fto64.h
|
2021-07-28 18:16:04 +00:00
|
|
|
math/arm/__i64tod.c
|
|
|
|
math/arm/__u64tod.c
|
|
|
|
math/arm/__i64tos.c
|
|
|
|
math/arm/__u64tos.c
|
|
|
|
math/arm/__64tof.h
|
2015-05-10 21:04:27 +00:00
|
|
|
)
|
|
|
|
list(APPEND MSVCRTEX_ASM_SOURCE
|
|
|
|
except/arm/chkstk_asm.s
|
|
|
|
math/arm/__rt_sdiv64.s
|
|
|
|
math/arm/__rt_srsh.s
|
|
|
|
math/arm/__rt_udiv64.s
|
|
|
|
)
|
2011-05-23 18:27:16 +00:00
|
|
|
endif()
|
|
|
|
|
2013-01-08 20:33:08 +00:00
|
|
|
set_source_files_properties(${MSVCRTEX_ASM_SOURCE} PROPERTIES COMPILE_DEFINITIONS "_DLL;_MSVCRTEX_")
|
|
|
|
add_asm_files(msvcrtex_asm ${MSVCRTEX_ASM_SOURCE})
|
|
|
|
|
2020-11-02 09:51:08 +00:00
|
|
|
add_library(msvcrtex OBJECT ${MSVCRTEX_SOURCE} ${msvcrtex_asm})
|
2020-04-16 12:59:38 +00:00
|
|
|
target_compile_definitions(msvcrtex PRIVATE _DLL _MSVCRTEX_)
|
2020-09-21 10:16:02 +00:00
|
|
|
|
2020-11-02 09:51:08 +00:00
|
|
|
if(MSVC AND (ARCH STREQUAL "i386"))
|
|
|
|
# user32.dll needs this as a stand-alone object file
|
|
|
|
add_asm_files(ftol2_asm math/i386/ftol2_asm.s)
|
|
|
|
add_library(ftol2_sse OBJECT ${ftol2_asm})
|
|
|
|
target_compile_definitions(ftol2_sse PRIVATE $<TARGET_PROPERTY:msvcrtex,COMPILE_DEFINITIONS>)
|
2021-01-07 21:46:50 +00:00
|
|
|
set_target_properties(ftol2_sse PROPERTIES LINKER_LANGUAGE C)
|
2020-11-02 09:51:08 +00:00
|
|
|
endif()
|
|
|
|
|
2020-10-22 14:29:40 +00:00
|
|
|
|
2022-05-25 22:37:23 +00:00
|
|
|
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
2020-09-21 10:16:02 +00:00
|
|
|
target_compile_options(msvcrtex PRIVATE $<$<COMPILE_LANGUAGE:C>:-Wno-main>)
|
2020-10-16 13:57:20 +00:00
|
|
|
if(LTCG)
|
2020-09-21 10:16:02 +00:00
|
|
|
target_compile_options(msvcrtex PRIVATE -fno-lto)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2011-05-23 18:27:16 +00:00
|
|
|
set_source_files_properties(startup/crtdll.c PROPERTIES COMPILE_DEFINITIONS CRTDLL)
|
2011-11-06 13:07:43 +00:00
|
|
|
set_source_files_properties(startup/crtexe.c
|
|
|
|
startup/wcrtexe.c PROPERTIES COMPILE_DEFINITIONS _M_CEE_PURE)
|
2011-05-23 15:50:03 +00:00
|
|
|
|
2020-10-16 13:57:20 +00:00
|
|
|
if(NOT MSVC)
|
2011-06-05 20:57:13 +00:00
|
|
|
target_link_libraries(msvcrtex oldnames)
|
2011-05-23 15:50:03 +00:00
|
|
|
endif()
|
|
|
|
|
2011-06-18 20:47:44 +00:00
|
|
|
add_dependencies(msvcrtex psdk asm)
|