cmake: Fix BUILD_SHARED_LIBS option and README for it
BUILD_SHARED_LIBS is a global flag so we don't need to set a default
option for it in both libhsakmt and hsa-runtime, only the top level
CMakeLists file. Also updated README to reflect that libhsakmt is
always built statically and gets linked to libhsa-runtime.
Change-Id: I1511f68a268032bec9758bc731d8074f33ec980f
[ROCm/ROCR-Runtime commit: ff01f62777]
This commit is contained in:
@@ -48,6 +48,12 @@ project("rocr")
|
||||
|
||||
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||
|
||||
## Expose static library option
|
||||
if ( NOT DEFINED BUILD_SHARED_LIBS )
|
||||
set ( BUILD_SHARED_LIBS ON )
|
||||
endif()
|
||||
set ( BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS} CACHE BOOL "Build shared library (.so) or not.")
|
||||
|
||||
if (NOT DEFINED BUILD_ROCR)
|
||||
set(BUILD_ROCR ON)
|
||||
endif()
|
||||
|
||||
@@ -79,9 +79,9 @@ Ensure you have the following installed:
|
||||
```
|
||||
|
||||
- *Control whether libhsakmt and libhsa-runtime are shared or static*
|
||||
The default (when `BUILD_SHARED_LIBS` is unset) is for libhsakmt to be static and libhsa-runtime to be shared. Setting `BUILD_SHARED_LIBS` to `OFF` will make both static and setting it to `ON` will make them both shared.
|
||||
libhsakmt is always built as a static library that gets linked into libhsa-runtime, so there is a single library generated called libhsa-runtime64{.so/.a}. If `BUILD_SHARED_LIBS` is not set, this is a shared library by default. Setting `BUILD_SHARED_LIBS` to `OFF` will make it static.
|
||||
```sh
|
||||
-DBUILD_SHARED_LIBS=OFF # or ON for both libs shared
|
||||
-DBUILD_SHARED_LIBS=ON # or OFF for static lib
|
||||
```
|
||||
### Building the tests
|
||||
#### rocrtst
|
||||
|
||||
@@ -35,12 +35,6 @@ set(HSAKMT_STATIC_DRM_TARGET "${HSAKMT_TARGET}-staticdrm")
|
||||
|
||||
project ( ${HSAKMT_TARGET} VERSION 1.9.0)
|
||||
|
||||
# Build thunk as static by default
|
||||
if ( NOT DEFINED BUILD_SHARED_LIBS )
|
||||
set ( BUILD_SHARED_LIBS "off" )
|
||||
endif()
|
||||
set ( BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS} CACHE BOOL "Build shared library (.so) or not.")
|
||||
|
||||
# Optionally, build HSAKMT with ccache.
|
||||
set(ROCM_CCACHE_BUILD OFF CACHE BOOL "Set to ON for a ccache enabled build")
|
||||
if (ROCM_CCACHE_BUILD)
|
||||
|
||||
@@ -63,12 +63,6 @@ include ( utils )
|
||||
include ( hsa_common )
|
||||
include ( GNUInstallDirs )
|
||||
|
||||
## Expose static library option
|
||||
if ( NOT DEFINED BUILD_SHARED_LIBS )
|
||||
set ( BUILD_SHARED_LIBS ON )
|
||||
endif()
|
||||
set ( BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS} CACHE BOOL "Build shared library (.so) or not.")
|
||||
|
||||
## Adjust target name for static builds
|
||||
## Original name will be an interface target that adds --whole-archive linker options around the target.
|
||||
if( NOT ${BUILD_SHARED_LIBS} )
|
||||
|
||||
Fai riferimento in un nuovo problema
Block a user