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: 4d67856bed]
This commit is contained in:
Tao Sang
2020-07-10 10:37:59 -04:00
committed by Tao Sang
parent d9c0ab5f91
commit d3dfb225fc
+8 -1
View File
@@ -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)