Use custom memcpy only for AArch64

This commit is contained in:
Alexey Milovidov 2021-03-13 22:39:10 +03:00
parent a446612e8a
commit 37cc2fe977
2 changed files with 11 additions and 6 deletions

View File

@ -1,5 +1,8 @@
if (GLIBC_COMPATIBILITY) if (GLIBC_COMPATIBILITY)
add_subdirectory(memcpy) add_subdirectory(memcpy)
if(TARGET memcpy)
set(MEMCPY_LIBRARY memcpy)
endif()
enable_language(ASM) enable_language(ASM)
include(CheckIncludeFile) include(CheckIncludeFile)
@ -44,10 +47,10 @@ if (GLIBC_COMPATIBILITY)
target_compile_options(glibc-compatibility PRIVATE -fPIC) target_compile_options(glibc-compatibility PRIVATE -fPIC)
endif () endif ()
target_link_libraries(global-libs INTERFACE glibc-compatibility memcpy) target_link_libraries(global-libs INTERFACE glibc-compatibility ${MEMCPY_LIBRARY})
install( install(
TARGETS glibc-compatibility memcpy TARGETS glibc-compatibility ${MEMCPY_LIBRARY}
EXPORT global EXPORT global
ARCHIVE DESTINATION lib ARCHIVE DESTINATION lib
) )

View File

@ -1,6 +1,8 @@
if (ARCH_AMD64)
add_library(memcpy STATIC memcpy.cpp) add_library(memcpy STATIC memcpy.cpp)
# We allow to include memcpy.h from user code for better inlining. # We allow to include memcpy.h from user code for better inlining.
target_include_directories(memcpy PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>) target_include_directories(memcpy PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
target_compile_options(memcpy PRIVATE -fno-builtin-memcpy) target_compile_options(memcpy PRIVATE -fno-builtin-memcpy)
endif ()