diff --git a/projects/rocr-runtime/CMakeLists.txt b/projects/rocr-runtime/CMakeLists.txt index 5d6669ff5e..56b09494c8 100644 --- a/projects/rocr-runtime/CMakeLists.txt +++ b/projects/rocr-runtime/CMakeLists.txt @@ -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() diff --git a/projects/rocr-runtime/README.md b/projects/rocr-runtime/README.md index ea532c7a11..a8fa83b577 100644 --- a/projects/rocr-runtime/README.md +++ b/projects/rocr-runtime/README.md @@ -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 diff --git a/projects/rocr-runtime/libhsakmt/CMakeLists.txt b/projects/rocr-runtime/libhsakmt/CMakeLists.txt index 0539f46808..431721b38f 100644 --- a/projects/rocr-runtime/libhsakmt/CMakeLists.txt +++ b/projects/rocr-runtime/libhsakmt/CMakeLists.txt @@ -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) diff --git a/projects/rocr-runtime/runtime/hsa-runtime/CMakeLists.txt b/projects/rocr-runtime/runtime/hsa-runtime/CMakeLists.txt index 03a36a50cb..53c52ceb7a 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/CMakeLists.txt +++ b/projects/rocr-runtime/runtime/hsa-runtime/CMakeLists.txt @@ -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} )