summaryrefslogtreecommitdiff
path: root/dev-libs/rocm-opencl-runtime/files/rocm-opencl-runtime-3.0.0-change-install-location.patch
blob: eb1901f6a1edb60840118343232e37583fbfb639 (plain)
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
--- a/CMakeLists.txt	2019-12-28 09:34:17.470030419 +0100
+++ b/CMakeLists.txt	2019-12-28 09:32:14.939030886 +0100
@@ -21,12 +21,26 @@
 
 project(rocm-opencl)
 
+include (GNUInstallDirs)
+
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
 set(OPENCL_ICD_LOADER_HEADERS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/api/opencl/khronos/headers/opencl2.2" CACHE PATH "")
 
 find_package(ROCT REQUIRED)
 find_package(ROCR REQUIRED)
 
+find_package(LLVM REQUIRED CONFIG PATHS ${LLVM_DIR} "/opt/rocm/llvm" NO_DEFAULT_PATH)
+set(USE_COMGR_LIBRARY "yes")
+find_package(amd_comgr REQUIRED CONFIG)
+add_definitions(-DUSE_COMGR_LIBRARY)
+FOREACH(DIR ${LLVM_INCLUDE_DIRS})
+  include_directories("${DIR}")
+  include_directories("${DIR}/clang")
+  include_directories("${DIR}/lld")
+  # TODO: move AMDGPU.h header to include folder
+  include_directories("${DIR}/llvm/Target/AMDGPU")
+ENDFOREACH()
+
 # FIXME: Remove following if block after enabling COMGR by default
 if (${USE_COMGR_LIBRARY} STREQUAL "no")
   set(LLVM_INCLUDE_TESTS OFF CACHE BOOL "")
@@ -39,29 +53,19 @@
   # override default option value in library and driver
   set(GENERIC_IS_ZERO ON CACHE BOOL ON FORCE)
 
-  add_subdirectory(compiler/llvm EXCLUDE_FROM_ALL)
-
-  find_package(LLVM REQUIRED CONFIG PATHS ${CMAKE_BINARY_DIR}/compiler/llvm NO_DEFAULT_PATH)
+  find_package(LLVM REQUIRED CONFIG PATHS ${LLVM_DIR} "/opt/rocm/llvm" NO_DEFAULT_PATH)
 
   list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
   include(AddLLVM)
 
   add_definitions(${LLVM_DEFINITIONS})
-  # TODO: add find_package for Clang and lld, and also use LLVM/Clang variables got from their config
-  include_directories(${CMAKE_SOURCE_DIR}/compiler/llvm/tools/clang/include)
-  include_directories(${CMAKE_BINARY_DIR}/compiler/llvm/tools/clang/include)
-  include_directories(${CMAKE_SOURCE_DIR}/compiler/llvm/tools/lld/include)
-
-  # TODO: move AMDGPU.h header to include folder
-  include_directories(${CMAKE_SOURCE_DIR}/compiler/llvm/lib/Target/AMDGPU)
-  include_directories(${CMAKE_BINARY_DIR}/compiler/llvm/lib/Target/AMDGPU)
 
   set(BUILD_HC_LIB OFF CACHE BOOL "")
   set(ROCM_DEVICELIB_INCLUDE_TESTS OFF CACHE BOOL "")
   set(AMDGCN_TARGETS_LIB_LIST "AMDGCN_LIB_TARGETS")
   set(AMDGCN_TARGETS_LIB_DEPS "AMDGCN_DEP_TARGETS")
   set(AMDGPU_TARGET_TRIPLE "amdgcn-amd-amdhsa")
-  add_subdirectory(library/amdgcn EXCLUDE_FROM_ALL)
+
   add_subdirectory(compiler/driver EXCLUDE_FROM_ALL)
 
   install(PROGRAMS $<TARGET_FILE:clang> $<TARGET_FILE:lld>
@@ -77,22 +81,22 @@
   endforeach()
 endif() # if (${USE_COMGR_LIBRARY} STREQUAL "no")
 
-if(${USE_COMGR_LIBRARY} MATCHES "yes")
-  set(COMGR_DYN_DLL "yes")
-  add_definitions(-DCOMGR_DYN_DLL)
-  add_definitions(-DUSE_COMGR_LIBRARY)
-  if( ${BUILD_HIP} MATCHES "yes")
-    add_subdirectory(api/hip)
-  endif()
-endif()
+#if(${USE_COMGR_LIBRARY} MATCHES "yes")
+#  set(COMGR_DYN_DLL "yes")
+#  add_definitions(-DCOMGR_DYN_DLL)
+#  add_definitions(-DUSE_COMGR_LIBRARY)
+#  if( ${BUILD_HIP} MATCHES "yes")
+#    add_subdirectory(api/hip)
+#  endif()
+#endif()
 
 add_subdirectory(api/opencl/amdocl)
 add_subdirectory(compiler/lib/loaders/elf/utils/libelf)
 add_subdirectory(runtime)
-add_subdirectory(tools/clinfo)
+#add_subdirectory(tools/clinfo)
 
 set(BUILD_SHARED_LIBS "Build shared libs" ON)
-add_subdirectory(api/opencl/khronos/icd)
+#add_subdirectory(api/opencl/khronos/icd)
 
 ###--- Packaging ------------------------------------------------------------###
 
@@ -101,31 +105,31 @@
 rocm_setup_version( VERSION "2.0.0" )
 
 # MAIN package
-install(PROGRAMS $<TARGET_FILE:clinfo>
-        DESTINATION bin/x86_64
-        COMPONENT MAIN)
+#install(PROGRAMS $<TARGET_FILE:clinfo>
+#        DESTINATION bin/x86_64
+#        COMPONENT MAIN)
 install(PROGRAMS $<TARGET_FILE:amdocl64>
-        DESTINATION lib/x86_64
-        COMPONENT MAIN)
-install(PROGRAMS $<TARGET_FILE:OpenCL>
-        DESTINATION lib/x86_64
-        COMPONENT MAIN)
-install(PROGRAMS $<TARGET_SONAME_FILE:OpenCL>
-        DESTINATION lib/x86_64
+        DESTINATION lib64
         COMPONENT MAIN)
+#install(PROGRAMS $<TARGET_FILE:OpenCL>
+#        DESTINATION lib/x86_64
+#        COMPONENT MAIN)
+#install(PROGRAMS $<TARGET_SONAME_FILE:OpenCL>
+#        DESTINATION lib/x86_64
+#        COMPONENT MAIN)
 
 # DEV package
-install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/api/opencl/khronos/headers/opencl2.2/CL"
-        DESTINATION include
-        COMPONENT DEV
-        USE_SOURCE_PERMISSIONS
-        PATTERN cl_d3d10.h EXCLUDE
-        PATTERN cl_d3d11.h EXCLUDE
-        PATTERN cl_dx9_media_sharing.h EXCLUDE
-        PATTERN cl_egl.h EXCLUDE)
-install(PROGRAMS $<TARGET_LINKER_FILE:OpenCL>
-        DESTINATION lib/x86_64
-        COMPONENT DEV)
+#install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/api/opencl/khronos/headers/opencl2.2/CL"
+#        DESTINATION include
+#        COMPONENT DEV
+#        USE_SOURCE_PERMISSIONS
+#        PATTERN cl_d3d10.h EXCLUDE
+#        PATTERN cl_d3d11.h EXCLUDE
+#        PATTERN cl_dx9_media_sharing.h EXCLUDE
+#        PATTERN cl_egl.h EXCLUDE)
+#install(PROGRAMS $<TARGET_LINKER_FILE:OpenCL>
+#        DESTINATION lib/x86_64
+#        COMPONENT DEV)
 
 # Generic CPACK variables
 set(CPACK_GENERATOR "DEB;RPM" CACHE STRING "Default packaging generators")