Skip to content

Commit

Permalink
MIVisionx - cmake clean up - part2 (#946)
Browse files Browse the repository at this point in the history
  • Loading branch information
AryanSalmanpour authored Sep 14, 2022
1 parent d43ee41 commit 5c9fc31
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 22 deletions.
17 changes: 6 additions & 11 deletions amd_openvx/openvx/hipvx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,12 @@ list(APPEND HIPVX_SOURCES

set_source_files_properties(${HIPVX_SOURCES} PROPERTIES HIP_SOURCE_PROPERTY_FORMAT 1)

set(COMPILER_FOR_HIP ${ROCM_PATH}/bin/hipcc)
set(HIP_CXX_FLAGS -std=gnu++14)
set(COMPILER_FOR_HIP ${ROCM_PATH}/llvm/bin/clang++)
set(CMAKE_CXX_COMPILER ${COMPILER_FOR_HIP})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${HIP_CXX_FLAGS}")

add_library(openvx_hip OBJECT ${HIPVX_SOURCES})
set_target_properties(openvx_hip PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_compile_definitions(openvx_hip PRIVATE __HIP_PLATFORM_AMD__)

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD /DVX_API_ENTRY=__declspec(dllexport)")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd /DVX_API_ENTRY=__declspec(dllexport)")
else()
set(HIP_CXX_FLAGS -std=gnu++14)
endif()
add_library(${PROJECT_NAME} OBJECT ${HIPVX_SOURCES})
set_target_properties(${PROJECT_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_compile_definitions(${PROJECT_NAME} PRIVATE __HIP_PLATFORM_AMD__)
target_link_libraries(${PROJECT_NAME} hip::device)
11 changes: 6 additions & 5 deletions amd_openvx_extensions/amd_nn/nn_hip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ set(NN_HIP_SOURCES

set_source_files_properties(${NN_HIP_SOURCES} PROPERTIES HIP_SOURCE_PROPERTY_FORMAT 1)
set(HIP_CXX_FLAGS -std=gnu++14)

set(COMPILER_FOR_HIP ${ROCM_PATH}/bin/hipcc)
set(COMPILER_FOR_HIP ${ROCM_PATH}/llvm/bin/clang++)
set(CMAKE_CXX_COMPILER ${COMPILER_FOR_HIP})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${HIP_CXX_FLAGS}")
add_library(nn_hip OBJECT ${NN_HIP_SOURCES})
set_target_properties(nn_hip PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_compile_definitions(nn_hip PRIVATE __HIP_PLATFORM_AMD__)

add_library(${PROJECT_NAME} OBJECT ${NN_HIP_SOURCES})
set_target_properties(${PROJECT_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_compile_definitions(${PROJECT_NAME} PRIVATE __HIP_PLATFORM_AMD__)
target_link_libraries(${PROJECT_NAME} hip::device)
2 changes: 0 additions & 2 deletions apps/cloud_inference/server_app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@ elseif(MIVISIONX_BACKEND_HIP_FOUND)
set(ENABLE_HIP 1)
set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)
set_target_properties(${PROJECT_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)
set(COMPILER_FOR_HIP ${ROCM_PATH}/${CMAKE_INSTALL_BINDIR}/hipcc)
set(CMAKE_CXX_COMPILER ${COMPILER_FOR_HIP})
include_directories(${ROCM_PATH}/${CMAKE_INSTALL_INCLUDEDIR})
link_directories(${HIP_PATH}/${CMAKE_INSTALL_LIBDIR})
target_link_libraries(${PROJECT_NAME} hip::host)
Expand Down
9 changes: 5 additions & 4 deletions rocAL/rocAL/rocAL_hip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ list(APPEND rocAL_HIP_SOURCES
set_source_files_properties(${rocAL_HIP_SOURCES} PROPERTIES HIP_SOURCE_PROPERTY_FORMAT 1)

set(HIP_CXX_FLAGS -std=gnu++14)
set(COMPILER_FOR_HIP ${ROCM_PATH}/bin/hipcc)
set(COMPILER_FOR_HIP ${ROCM_PATH}/llvm/bin/clang++)
set(CMAKE_CXX_COMPILER ${COMPILER_FOR_HIP})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${HIP_CXX_FLAGS}")

add_library(rocAL_hip OBJECT ${rocAL_HIP_SOURCES})
set_target_properties(rocAL_hip PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_compile_definitions(rocAL_hip PRIVATE __HIP_PLATFORM_AMD__)
add_library(${PROJECT_NAME} OBJECT ${rocAL_HIP_SOURCES})
set_target_properties(${PROJECT_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_compile_definitions(${PROJECT_NAME} PRIVATE __HIP_PLATFORM_AMD__)
target_link_libraries(${PROJECT_NAME} hip::device)

0 comments on commit 5c9fc31

Please sign in to comment.