From d3dfb225fc1934e8d5b174fdce23c685e56cc8ea Mon Sep 17 00:00:00 2001 From: Tao Sang Date: Fri, 10 Jul 2020 10:37:59 -0400 Subject: [PATCH] Support static lib of comgr Add "BUILD_SHARED_LIBS" flag to cmake file. To build libamdhip64.so, you don't need change cmake cmd. To build libamdhip64.a, you need append -DBUILD_SHARED_LIBS=OFF to cmake cmd. Change-Id: Ibc30ed52963314b2b8cc1df73c360fc1ba15780a [ROCm/clr commit: 4d67856bed7a8f4817070520e24c18cc53f29e09] --- projects/clr/rocclr/CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/projects/clr/rocclr/CMakeLists.txt b/projects/clr/rocclr/CMakeLists.txt index 5002cd35b1..756f29aa91 100644 --- a/projects/clr/rocclr/CMakeLists.txt +++ b/projects/clr/rocclr/CMakeLists.txt @@ -4,6 +4,9 @@ project(ROCclr VERSION "1.0.0" LANGUAGES C CXX) include(CMakePackageConfigHelpers) +#decide whether .so is to be build or .a +set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared library (.so) or not.") + #example command: #cmake -DOPENCL_DIR=/path to/opencl .. @@ -187,7 +190,11 @@ if(USE_COMGR_LIBRARY) # FIXME: This should not be part of the public interface. Downstream # users need to add these definitions. This should be defined in a # config header here so other builds don't need to be aware of this. - target_compile_definitions(amdrocclr_static PUBLIC USE_COMGR_LIBRARY COMGR_DYN_DLL) + if(${BUILD_SHARED_LIBS}) + target_compile_definitions(amdrocclr_static PUBLIC USE_COMGR_LIBRARY COMGR_DYN_DLL) + else() + target_compile_definitions(amdrocclr_static PUBLIC USE_COMGR_LIBRARY) + endif() endif() target_link_libraries(amdrocclr_static PUBLIC Threads::Threads)