CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
96 lines
3.8 KiB
CMake
96 lines
3.8 KiB
CMake
#[[
|
|
MIT License
|
|
|
|
Copyright (c) 2019 - 2025 Advanced Micro Devices, Inc.
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
in the Software without restriction, including without limitation the rights
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
The above copyright notice and this permission notice shall be included in all
|
|
copies or substantial portions of the Software.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
SOFTWARE.
|
|
]]
|
|
|
|
cmake_minimum_required(VERSION 3.10)
|
|
|
|
# ROCM Path
|
|
if(DEFINED ENV{ROCM_PATH})
|
|
set(ROCM_PATH $ENV{ROCM_PATH} CACHE PATH "Default ROCm installation path")
|
|
elseif(ROCM_PATH)
|
|
message("-- examples/brightness: INFO - ROCM_PATH Set -- ${ROCM_PATH}")
|
|
else()
|
|
set(ROCM_PATH /opt/rocm CACHE PATH "Default ROCm installation path")
|
|
endif()
|
|
# Set AMD Clang as default compiler
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED On)
|
|
set(CMAKE_CXX_EXTENSIONS ON)
|
|
if(NOT DEFINED CMAKE_CXX_COMPILER AND EXISTS "${ROCM_PATH}/lib/llvm/bin/amdclang++")
|
|
set(CMAKE_C_COMPILER ${ROCM_PATH}/lib/llvm/bin/amdclang)
|
|
set(CMAKE_CXX_COMPILER ${ROCM_PATH}/lib/llvm/bin/amdclang++)
|
|
elseif(NOT DEFINED CMAKE_CXX_COMPILER AND NOT EXISTS "${ROCM_PATH}/lib/llvm/bin/amdclang++")
|
|
set(CMAKE_C_COMPILER clang)
|
|
set(CMAKE_CXX_COMPILER clang++)
|
|
endif()
|
|
|
|
project(examples/brightness)
|
|
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../../cmake)
|
|
list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH}/lib/cmake)
|
|
|
|
# Set message options
|
|
if(NOT WIN32)
|
|
string(ASCII 27 Esc)
|
|
set(ColourReset "${Esc}[m")
|
|
set(Red "${Esc}[31m")
|
|
set(Green "${Esc}[32m")
|
|
set(Yellow "${Esc}[33m")
|
|
set(Blue "${Esc}[34m")
|
|
set(BoldBlue "${Esc}[1;34m")
|
|
set(Magenta "${Esc}[35m")
|
|
set(Cyan "${Esc}[36m")
|
|
set(White "${Esc}[37m")
|
|
endif()
|
|
|
|
find_package(HIP QUIET)
|
|
find_package(OpenCV QUIET)
|
|
find_package(TurboJpeg QUIET)
|
|
|
|
# OpenMP
|
|
find_package(OpenMP COMPONENTS CXX REQUIRED)
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
|
|
set(LINK_LIBRARY_LIST ${LINK_LIBRARY_LIST} OpenMP::OpenMP_CXX)
|
|
|
|
if(TurboJpeg_FOUND)
|
|
message("-- ${Green}${PROJECT_NAME} set to build with rpp and TurboJpeg${ColourReset}")
|
|
include_directories(${TurboJpeg_INCLUDE_DIRS})
|
|
set(LINK_LIBRARY_LIST ${LINK_LIBRARY_LIST} ${TurboJpeg_LIBRARIES_DIR})
|
|
else()
|
|
message("-- ${Yellow}Error: TurboJpeg must be installed to install ${PROJECT_NAME} successfully!${ColourReset}")
|
|
endif()
|
|
|
|
if (HIP_FOUND AND OpenCV_FOUND)
|
|
message("-- ${Green}${PROJECT_NAME} set to build with rpp, hip and OpenCV${ColourReset}")
|
|
include_directories(${HIP_INCLUDE_DIRS} ${HIP_INCLUDE_DIRS}/hip)
|
|
include_directories(${OpenCV_INCLUDE_DIRS})
|
|
include_directories(${ROCM_PATH}/include ${ROCM_PATH}/include/rpp /usr/local/include)
|
|
link_directories(${ROCM_PATH}/lib /usr/local/lib)
|
|
|
|
add_executable(brightness_hip brightness_hip.cpp)
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGPU_SUPPORT=1 -DRPP_BACKEND_HIP=1")
|
|
target_link_libraries(brightness_hip ${OpenCV_LIBS} -lturbojpeg -lrpp ${HIP_LIBRARIES} ${LINK_LIBRARY_LIST} hip::device)
|
|
|
|
else()
|
|
message("-- ${Yellow}Error: OpenCV and hip must be installed to install ${PROJECT_NAME} successfully!${ColourReset}")
|
|
endif()
|