From c60d7d860da875599444dd5c9f04aa5bbdd8382b Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Wed, 22 Apr 2020 13:06:45 -0400 Subject: [PATCH] Add comgr macros to public definition export This should allow the cmake build for the opencl runtime to work without manually adding these definitions. The PAL build also adds these as private defines in its build, so change rocm to match. This should probably be including these a config header to benefit other builds, but this will at least avoid some clutter in the opencl build for now. Change-Id: I1044984b87ba3fc72e280e255ceea2dd9e3337ff --- rocclr/CMakeLists.txt | 12 +++++++++++- rocclr/device/rocm/CMakeLists.txt | 3 +-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/rocclr/CMakeLists.txt b/rocclr/CMakeLists.txt index 0498e200fa..fd0acab0e1 100644 --- a/rocclr/CMakeLists.txt +++ b/rocclr/CMakeLists.txt @@ -5,8 +5,9 @@ cmake_minimum_required(VERSION 3.5) #cmake -DOPENCL_DIR=/path to/opencl .. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") + +# FIXME: Should be option and ON/OFF, not yes/no variable. set(USE_COMGR_LIBRARY "yes") -add_definitions(-DUSE_COMGR_LIBRARY -DCOMGR_DYN_DLL) if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") add_compile_options("-Wno-ignored-attributes") @@ -149,6 +150,15 @@ add_library(amdvdi_static STATIC set_target_properties(amdvdi_static PROPERTIES POSITION_INDEPENDENT_CODE ON) + +if(${USE_COMGR_LIBRARY} MATCHES "yes") + # 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(oclruntime PUBLIC USE_COMGR_LIBRARY COMGR_DYN_DLL) + target_compile_definitions(amdvdi_static INTERFACE USE_COMGR_LIBRARY COMGR_DYN_DLL) +endif() + target_link_libraries(amdvdi_static PUBLIC Threads::Threads) target_link_libraries(amdvdi_static PUBLIC dl ${ROCT_LIBRARIES} ${ROCR_LIBRARIES} ) diff --git a/rocclr/device/rocm/CMakeLists.txt b/rocclr/device/rocm/CMakeLists.txt index b31673f5a4..de032caad2 100644 --- a/rocclr/device/rocm/CMakeLists.txt +++ b/rocclr/device/rocm/CMakeLists.txt @@ -28,10 +28,9 @@ target_include_directories(oclrocm ${ROCR_INCLUDES}) -# FIXME: Move this to config header. if(${USE_COMGR_LIBRARY} MATCHES "yes") target_compile_definitions(oclrocm - PUBLIC USE_COMGR_LIBRARY) + PRIVATE USE_COMGR_LIBRARY) endif() set_target_properties(oclrocm PROPERTIES POSITION_INDEPENDENT_CODE ON)