From dd83249cc29d71890f6a76ebe26c0bda03dc1230 Mon Sep 17 00:00:00 2001 From: Gabriel Dantas Date: Thu, 31 Oct 2024 12:39:23 -0300 Subject: [PATCH] fix copy onednnl 5 --- CMakeLists.txt | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 036ce69..6e0941b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -150,27 +150,26 @@ endif() if(APPLE) # Copy required dylibs to the build directory and adjust LC_LOAD_DYLIB path add_custom_command(TARGET metaltranslate POST_BUILD - COMMAND bash -c " - ICU_UC_LIB_NAME=$(otool -L ${EXTERNAL_INSTALL_LOCATION}/lib/libOpenNMTTokenizer.dylib | grep 'libicuuc' | sed -E 's|.*(libicuuc[^ ]*).*|\\1|'); - ICU_DATA_LIB_NAME=$(otool -L ${EXTERNAL_INSTALL_LOCATION}/lib/libOpenNMTTokenizer.dylib | grep 'libicudata' | sed -E 's|.*(libicudata[^ ]*).*|\\1|'); - DNNL_LIB_NAME=$(otool -L ${EXTERNAL_INSTALL_LOCATION}/lib/libctranslate2.4.3.1.dylib | grep 'libdnnl' | sed -E 's|.*(libdnnl[^ ]*).*|\\1|'); + COMMAND ICU_UC_LIB_NAME=$(otool -L ${EXTERNAL_INSTALL_LOCATION}/lib/libOpenNMTTokenizer.dylib | grep 'libicuuc' | sed -E 's|.*(libicuuc[^ ]*).*|\1|') + COMMAND ICU_DATA_LIB_NAME=$(otool -L ${EXTERNAL_INSTALL_LOCATION}/lib/libOpenNMTTokenizer.dylib | grep 'libicudata' | sed -E 's|.*(libicudata[^ ]*).*|\1|') + COMMAND DNNL_LIB_NAME=$(otool -L ${EXTERNAL_INSTALL_LOCATION}/lib/libctranslate2.4.3.1.dylib | grep 'libdnnl' | sed -E 's|.*(libdnnl[^ ]*).*|\1|') - echo 'Extracted ICU UC library name: ${ICU_UC_LIB_NAME}'; - echo 'Extracted ICU DATA library name: ${ICU_DATA_LIB_NAME}'; - echo 'Extracted DNNL library name: ${DNNL_LIB_NAME}'; + COMMAND echo 'Extracted ICU UC library name: ${ICU_UC_LIB_NAME}' + COMMAND echo 'Extracted ICU DATA library name: ${ICU_DATA_LIB_NAME}' + COMMAND echo 'Extracted DNNL library name: ${DNNL_LIB_NAME}' - install_name_tool -change ${ONEDNN_ROOT}/lib/${DNNL_LIB_NAME} @rpath/libdnnl.3.dylib ${EXTERNAL_INSTALL_LOCATION}/lib/libctranslate2.4.3.1.dylib # change lib path of ctranslate2 lib - install_name_tool -change ${ICU_LIBRARY_DIR}/${ICU_UC_LIB_NAME} @rpath/libicuuc.dylib ${EXTERNAL_INSTALL_LOCATION}/lib/libctranslate2.4.3.1.dylib - install_name_tool -change ${ICU_LIBRARY_DIR}/${ICU_DATA_LIB_NAME} @rpath/libicudata.dylib ${EXTERNAL_INSTALL_LOCATION}/lib/libOpenNMTTokenizer.dylib - install_name_tool -change ${ICU_LIBRARY_DIR}/${ICU_UC_LIB_NAME} @rpath/libicuuc.dylib ${EXTERNAL_INSTALL_LOCATION}/lib/libOpenNMTTokenizer.dylib + COMMAND install_name_tool -change ${ONEDNN_ROOT}/lib/${DNNL_LIB_NAME} @rpath/libdnnl.3.dylib ${EXTERNAL_INSTALL_LOCATION}/lib/libctranslate2.4.3.1.dylib # change lib path of ctranslate2 lib + COMMAND install_name_tool -change ${ICU_LIBRARY_DIR}/${ICU_UC_LIB_NAME} @rpath/libicuuc.dylib ${EXTERNAL_INSTALL_LOCATION}/lib/libctranslate2.4.3.1.dylib + COMMAND install_name_tool -change ${ICU_LIBRARY_DIR}/${ICU_DATA_LIB_NAME} @rpath/libicudata.dylib ${EXTERNAL_INSTALL_LOCATION}/lib/libOpenNMTTokenizer.dylib + COMMAND install_name_tool -change ${ICU_LIBRARY_DIR}/${ICU_UC_LIB_NAME} @rpath/libicuuc.dylib ${EXTERNAL_INSTALL_LOCATION}/lib/libOpenNMTTokenizer.dylib # copy files to build directory - ${CMAKE_COMMAND} -E copy ${ONEDNN_ROOT}/lib/libdnnl.3.dylib $ - ${CMAKE_COMMAND} -E copy ${ICU_LIBRARY_DIR}/libicuuc.dylib $ - ${CMAKE_COMMAND} -E copy ${ICU_LIBRARY_DIR}/libicudata.dylib $ + COMMAND ${CMAKE_COMMAND} -E copy ${ONEDNN_ROOT}/lib/libdnnl.3.dylib $ + COMMAND ${CMAKE_COMMAND} -E copy ${ICU_LIBRARY_DIR}/libicuuc.dylib $ + COMMAND ${CMAKE_COMMAND} -E copy ${ICU_LIBRARY_DIR}/libicudata.dylib $ + - " COMMENT "Adjusting LC_LOAD_DYLIB path for libdnnl" ) elseif(UNIX)