From eca9083ea76a61e6d7e70edc4970b56c0f5ebff5 Mon Sep 17 00:00:00 2001 From: Daniel Lowell Date: Tue, 16 Jul 2019 15:24:12 -0500 Subject: [PATCH 1/2] Hide symbols. --- CMakeLists.txt | 2 +- miopengemm/CMakeLists.txt | 25 ++++++++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 66181306..e7b524e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ include(ROCMSetupVersion) include(ROCMInstallSymlinks) include(ROCMCreatePackage) -rocm_setup_version(VERSION 1.1.5) +rocm_setup_version(VERSION 1.1.6) #Where to find FindOpenCL.cmake and other files which help locate external files and libraries list( APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ) diff --git a/miopengemm/CMakeLists.txt b/miopengemm/CMakeLists.txt index b1cef17a..4df84ab5 100644 --- a/miopengemm/CMakeLists.txt +++ b/miopengemm/CMakeLists.txt @@ -14,7 +14,27 @@ file(GLOB_RECURSE source_files src/*.cpp) add_library(miopengemm ${source_files}) -target_link_libraries(miopengemm ${OPENCL_LIBRARIES} ${OpenBLAS_LIB} ${CLBLAST_LIB} ${ISAAC_LIB}) +if(NOT WIN32 AND NOT APPLE) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/lib.def " + + MIOPENGEMM_1 + { + global: + miopengemm*; + *MIOpenGEMM*; + extern \"C++\" { + MIOpenGEMM::*; + }; + local: + *; + }; + ") + + target_link_libraries(miopengemm PRIVATE "-Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/lib.def") + target_link_libraries(miopengemm PRIVATE "-Wl,--exclude-libs,ALL") + set_target_properties(miopengemm PROPERTIES VISIBILITY_INLINES_HIDDEN 1) + target_link_libraries(miopengemm PUBLIC ${OPENCL_LIBRARIES} ${OpenBLAS_LIB} ${CLBLAST_LIB} ${ISAAC_LIB}) +endif() target_include_directories (miopengemm PUBLIC $) target_include_directories (miopengemm SYSTEM PUBLIC @@ -29,6 +49,9 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") target_include_directories (miopengemm PUBLIC ${OPENCL_INCLUDE_DIRS}/Headers) endif() + + + rocm_install_targets( TARGETS miopengemm INCLUDE From c0014b1d4759cfc6c40f29ad36d9f1927e395abc Mon Sep 17 00:00:00 2001 From: Daniel Lowell Date: Tue, 16 Jul 2019 20:28:11 -0500 Subject: [PATCH 2/2] Moved target back outside of if --- miopengemm/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/miopengemm/CMakeLists.txt b/miopengemm/CMakeLists.txt index 4df84ab5..c6968715 100644 --- a/miopengemm/CMakeLists.txt +++ b/miopengemm/CMakeLists.txt @@ -14,6 +14,8 @@ file(GLOB_RECURSE source_files src/*.cpp) add_library(miopengemm ${source_files}) +target_link_libraries(miopengemm PUBLIC ${OPENCL_LIBRARIES} ${OpenBLAS_LIB} ${CLBLAST_LIB} ${ISAAC_LIB}) + if(NOT WIN32 AND NOT APPLE) file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/lib.def " @@ -33,7 +35,6 @@ if(NOT WIN32 AND NOT APPLE) target_link_libraries(miopengemm PRIVATE "-Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/lib.def") target_link_libraries(miopengemm PRIVATE "-Wl,--exclude-libs,ALL") set_target_properties(miopengemm PROPERTIES VISIBILITY_INLINES_HIDDEN 1) - target_link_libraries(miopengemm PUBLIC ${OPENCL_LIBRARIES} ${OpenBLAS_LIB} ${CLBLAST_LIB} ${ISAAC_LIB}) endif() target_include_directories (miopengemm PUBLIC $)