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
101 lines
3.7 KiB
CMake
101 lines
3.7 KiB
CMake
# Copyright (c) Advanced Micro Devices, Inc. All rights reserved.
|
|
#
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
include(AISCompilerOptions)
|
|
|
|
# Add an executable program using AIS build conventions
|
|
#
|
|
# Parameters:
|
|
# NAME <name> The name of the executable program to create
|
|
# DEPS [dependency1 [dependency2 ...]] List of AIS target library dependencies
|
|
# SRCS [src1 [src2 ...]] The source files
|
|
# SYSINCLS [path1 [path2 ...]] Paths to include dirs
|
|
#
|
|
# NOTE: Assumes AIS target libraries are named <foo>_(static|shared)
|
|
#
|
|
# NOTE: This isn't the most robust function. It's mainly intended
|
|
# to reduce code duplication. For example, DEPS is for passing
|
|
# the hipFile shared/static dependency and won't work for passing
|
|
# general library dependencies.
|
|
function(ais_add_executable)
|
|
|
|
# Parse arguments
|
|
set(options) # None at this time
|
|
set(oneValueArgs NAME)
|
|
set(multiValueArgs SRCS DEPS SYSINCLS)
|
|
cmake_parse_arguments(arg "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
|
|
|
add_executable(${arg_NAME} ${arg_SRCS})
|
|
ais_set_compiler_flags(${arg_NAME})
|
|
|
|
# Set C++ standard
|
|
target_compile_features(${arg_NAME} PRIVATE cxx_std_${AIS_CXX_STANDARD})
|
|
set_target_properties(${arg_NAME} PROPERTIES CXX_EXTENSIONS OFF)
|
|
|
|
# Turn sanitizers off for executables
|
|
target_compile_options(${arg_NAME} PRIVATE -fno-sanitize=all)
|
|
|
|
get_target_property(linker_language ${arg_NAME} LINKER_LANGUAGE)
|
|
if(linker_language STREQUAL "HIP")
|
|
target_link_libraries(${arg_NAME} PRIVATE hip::device)
|
|
endif()
|
|
|
|
if(BUILD_TESTING)
|
|
target_compile_definitions(${arg_NAME} PRIVATE AIS_TESTING)
|
|
endif()
|
|
|
|
if(CMAKE_HIP_PLATFORM STREQUAL "amd")
|
|
target_compile_definitions(${arg_NAME} PRIVATE __HIP_PLATFORM_AMD__)
|
|
elseif(CMAKE_HIP_PLATFORM STREQUAL "nvidia")
|
|
target_compile_definitions(${arg_NAME} PRIVATE __HIP_PLATFORM_NVIDIA__)
|
|
target_include_directories(${arg_NAME} SYSTEM PRIVATE ${HIP_INCLUDE_DIRS})
|
|
|
|
# CUDA include needs to come first. We get a CUB / Thrust version conflict otherwise.
|
|
target_include_directories(${arg_NAME} SYSTEM BEFORE PRIVATE ${CUDAToolkit_INCLUDE_DIRS})
|
|
|
|
target_link_libraries(${arg_NAME} PRIVATE CUDA::cuda_driver)
|
|
target_link_libraries(${arg_NAME} PRIVATE CUDA::cudart)
|
|
endif()
|
|
target_link_libraries(${arg_NAME} PRIVATE hip::host)
|
|
|
|
foreach(dep IN LISTS arg_DEPS)
|
|
add_dependencies(${arg_NAME} ${dep})
|
|
target_link_libraries(${arg_NAME} PRIVATE ${dep})
|
|
endforeach()
|
|
|
|
foreach(incl IN LISTS arg_SYSINCLS)
|
|
target_include_directories(${arg_NAME} SYSTEM PRIVATE ${incl})
|
|
endforeach()
|
|
|
|
target_include_directories(${arg_NAME} PRIVATE "${HIPFILE_ROOT_PATH}/shared")
|
|
endfunction()
|
|
|
|
# Add an executable test program using AIS build conventions
|
|
#
|
|
# Parameters:
|
|
# NAME <name> The name of the executable program to create
|
|
# DEPS [dependency1 [dependency2 ...]] List of AIS target library dependencies
|
|
# SRCS [src1 [src2 ...]] The source files
|
|
# SYSINCLS [path1 [path2 ...]] Paths to include dirs
|
|
#
|
|
# NOTE: Simply a pass-through to add -UNDEBUG to test programs so they
|
|
# always have assert() available.
|
|
function(ais_add_test_executable)
|
|
|
|
# Parse arguments
|
|
set(options) # None at this time
|
|
set(oneValueArgs NAME)
|
|
set(multiValueArgs SRCS DEPS SYSINCLS)
|
|
cmake_parse_arguments(arg "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
|
|
|
ais_add_executable(
|
|
NAME ${arg_NAME}
|
|
DEPS ${arg_DEPS}
|
|
SRCS ${arg_SRCS}
|
|
SYSINCLS ${arg_SYSINCLS}
|
|
)
|
|
target_compile_options(${arg_NAME} PRIVATE -UNDEBUG)
|
|
|
|
endfunction()
|