forked from ROCm/ROCm-Device-Libs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
99 lines (77 loc) · 3.5 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
##===--------------------------------------------------------------------------
## ROCm Device Libraries
##
## This file is distributed under the University of Illinois Open Source
## License. See LICENSE.TXT for details.
##===--------------------------------------------------------------------------
cmake_minimum_required(VERSION 2.6)
if (AMDHSACOD)
else()
message(WARNING "amdhsacod is not found, testing disabled")
message(WARNING "Specify amdhsacod executable with -DAMDHSACOD=<...>")
endif()
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
project(ROCm-Device-Libs)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/dist CACHE INTERNAL "Prefix prepended to install directories")
endif()
# Introduce GENERIC_IS_ZERO CMake option
option(GENERIC_IS_ZERO "Teach LLVM/Clang that generic address space IS address space 0 for AMDGPU target" OFF)
if (GENERIC_IS_ZERO)
set(AMDGPU_TARGET_TRIPLE "amdgcn--amdhsa-amdgizcl")
# execute utils/change-addr-space.sh
# the script would apply utils/add_amdgiz.sed
execute_process(COMMAND "utils/change-addr-space.sh"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
else (GENERIC_IS_ZERO)
set(AMDGPU_TARGET_TRIPLE "amdgcn--amdhsa")
# execute utils/change-addr-space.sh x
# the script would apply utils/remove_amdgiz.sed
execute_process(COMMAND "utils/change-addr-space.sh" "x"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
endif (GENERIC_IS_ZERO)
find_package(LLVM REQUIRED CONFIG PATHS ${LLVM_DIR} NO_DEFAULT_PATH)
list(APPEND CMAKE_MODULE_PATH ${LLVM_CMAKE_DIR})
include(AddLLVM)
endif(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
option(BUILD_HC_LIB "Build Heterogeneous Compute built-in library (hc)" ON)
option(ROCM_DEVICELIB_INCLUDE_TESTS "Build tests" ON)
list(APPEND CMAKE_OCL_SOURCE_FILE_EXTENSIONS .cl)
list(APPEND CMAKE_C_SOURCE_FILE_EXTENSIONS .cl)
list(APPEND CMAKE_CXX_SOURCE_FILE_EXTENSIONS .cl)
set (CLANG_OCL_FLAGS "-Werror -x cl -Xclang -cl-std=CL2.0 -fblocks -target ${AMDGPU_TARGET_TRIPLE} -DCL_VERSION_2_0=200 -D__OPENCL_C_VERSION__=200 -Dcl_khr_fp64 -Dcl_khr_fp16 -Dcl_khr_subgroups -Dcl_khr_int64_base_atomics -Dcl_khr_int64_extended_atomics -Xclang -finclude-default-header ${CLANG_OPTIONS_APPEND}")
set (CLANG_OCL_LINK_FLAGS "-target ${AMDGPU_TARGET_TRIPLE} -mcpu=fiji")
if (PREPARE_BUILTINS)
add_custom_target(prepare-builtins COMMAND true)
else()
add_subdirectory(utils/prepare-builtins)
set (PREPARE_BUILTINS $<TARGET_FILE:prepare-builtins>)
endif()
include(OCL.cmake)
add_subdirectory(irif)
add_subdirectory(oclc)
add_subdirectory(ocml)
add_subdirectory(ockl)
add_subdirectory(opencl)
if(BUILD_HC_LIB)
add_subdirectory(hc)
endif(BUILD_HC_LIB)
if(ROCM_DEVICELIB_INCLUDE_TESTS)
add_subdirectory(test/opencl)
add_subdirectory(test/opencl_conformance)
endif(ROCM_DEVICELIB_INCLUDE_TESTS)
## CPack standard variables
set ( CPACK_PACKAGE_NAME "rocm-device-libs" )
set ( CPACK_PACKAGE_VERSION_MAJOR "0" )
set ( CPACK_PACKAGE_VERSION_MINOR "0" )
set ( CPACK_PACKAGE_VERSION_PATCH "1" )
set ( CPACK_PACKAGE_CONTACT "" )
set ( CPACK_PACKAGE_DESCRIPTION_SUMMARY "Radeon Open Compute - device libraries" )
set ( CPACK_PACKAGE_DESCRIPTION "This package includes LLVM bitcode libraries." )
set ( CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/RadeonOpenCompute/ROCm-Device-Libs" )
set ( CPACK_GENERATOR DEB RPM )
## Debian package values
set ( CPACK_DEBIAN_PACKAGE_MAINTAINER "AMD" )
set ( CPACK_PACKAGING_INSTALL_PREFIX "/opt/rocm" )
set ( CPACK_DEBIAN_PACKAGE_DEPENDS "" )
include ( CPack )