-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
29 lines (23 loc) · 1.03 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
cmake_minimum_required(VERSION 3.13.4 FATAL_ERROR)
project(compile-amdgpu)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Debug or Release" FORCE)
endif()
add_executable(compile compile.cpp log.h)
#find_package(hsa-runtime64 PATHS /opt/rocm REQUIRED)
find_package(AMDDeviceLibs PATHS /opt/rocm REQUIRED)
get_target_property(ocml_LOCATION ocml LOCATION)
get_filename_component(HSA_BITCODE_PATH ${ocml_LOCATION} DIRECTORY)
get_filename_component(HSA_BITCODE_SUFFIX ${ocml_LOCATION} EXT)
find_package(LLVM REQUIRED)
if(LLVM_LINK_LLVM_DYLIB)
set(LLVM_LINK_SHARED "USE_SHARED")
endif()
add_definitions(${LLVM_DEFINITIONS})
add_definitions(-DHSA_BITCODE_PATH="${HSA_BITCODE_PATH}" -DHSA_BITCODE_SUFFIX="${HSA_BITCODE_SUFFIX}")
include_directories(SYSTEM ${LLVM_INCLUDE_DIRS})
llvm_config(compile ${LLVM_LINK_SHARED} irreader lto option support ${LLVM_TARGETS_TO_BUILD})
find_package(LLD REQUIRED)
target_link_libraries(compile PRIVATE lldELF lldCommon)