
For now, require the value to be `amd`, since that is the only platform we currently support.
17 lines
579 B
CMake
17 lines
579 B
CMake
cmake_minimum_required(VERSION 3.18)
|
|
project(HIPArchitecture HIP)
|
|
|
|
# Make sure CMake doesn't pass architectures if HIP_ARCHITECTURES is OFF.
|
|
set(CMAKE_HIP_ARCHITECTURES OFF)
|
|
|
|
# Pass our own architecture flags instead.
|
|
if(CMAKE_HIP_PLATFORM STREQUAL "amd")
|
|
string(APPEND CMAKE_HIP_FLAGS " --offload-arch=gfx908")
|
|
endif()
|
|
|
|
add_executable(HIPOnlyArchitectureOff main.hip)
|
|
get_property(hip_archs TARGET HIPOnlyArchitectureOff PROPERTY HIP_ARCHITECTURES)
|
|
if(NOT hip_archs STREQUAL "OFF")
|
|
message(FATAL_ERROR "CMAKE_HIP_ARCHITECTURES did not initialize HIP_ARCHITECTURES")
|
|
endif()
|