Support 64bit MP_DIGIT on Windows under clang-cl#592
Support 64bit MP_DIGIT on Windows under clang-cl#592R-Goc wants to merge 1 commit intolibtom:developfrom
Conversation
|
This also allows for building a debug version with clang-cl. I couldn't get it to happen with msvc. As in if I did the things required for it it is no longer a debug build as it would require at least turning off real time checks (/RTC1 passed by cmake) which defeats the purpose of a debug build. Maybe I am missing something here. |
c7bd2fd to
1a39ed7
Compare
|
My only concern is what happens if tommath is compiled with msvc but the consumer uses clang-cl. At that point everything will break I am afraid. Is MP_WORD anywhere in the ABI of the library? If so then that could also cause issues as __int128 is not stable in the msvc ABI and afaik not even defined. |
This commit make MP_DIGIT 64 bit when using clang-cl. It also explicitly sets compile flags for clang-cl.
sjaeckel
left a comment
There was a problem hiding this comment.
Thanks for the PR!
Basically LGTM besides the comments.
| target_include_directories(${PROJECT_NAME} PUBLIC | ||
| $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> | ||
| $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}> | ||
| $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> |
There was a problem hiding this comment.
This change must be reverted. We decided that our header files will reside in a separate folder.
| # We need to link the runtime for 128 bit int support, which clang-cl has | ||
| link_libraries(clang_rt.builtins-x86_64.lib) | ||
| else() | ||
| set(LTM_C_FLAGS /W3 /D_CRT_SECURE_NO_WARNINGS) |
There was a problem hiding this comment.
Not sure if we want _CRT_SECURE_NO_WARNINGS defined or not. Someone else who cares about Windows as a platform has to decide on that.
| if (CMAKE_C_COMPILER_ID STREQUAL "Clang") | ||
| # We are clang-cl | ||
| # Some flags for linux similarity and warnings | ||
| set(LTM_C_FLAGS -fstrict-aliasing /W3 /D_CRT_SECURE_NO_WARNINGS) |
This commit make MP_DIGIT 64 bit when using clang-cl. It also explicitly sets compile flags for clang-cl.