From bd0e789f7caa3428cb6504b47997faa2af625a13 Mon Sep 17 00:00:00 2001
From: foreman
Date: Wed, 30 Aug 2017 12:44:23 -0400
Subject: [PATCH] P4 to Git Change 1453266 by fdaniil@rocm_spec on 2017/08/30
12:27:36
SWDEV-102733 - [OCL-LC-ROCm] Cmake build Write CMakeLists.txt to enable building with and without the DK environment
Update from git http://git.amd.com:8080/#/c/103512/
1. fixed ninja warning on multiple targets generating .inc files
2. added libamdocl64.so and libOpenCL.so.1.2 libraries installation into install/lib
3. added Khronos OpenCL headers installation into install/include
4. added clinfo application installation int install/bin
5. removed installation of dozens of LLVM libs and tools
6. fixed minor misspellings in llvm options setup
Affected files ...
... //depot/stg/opencl/drivers/opencl/CMakeLists.txt#15 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/CMakeLists.txt#11 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/CMakeLists.txt#9 edit
... //depot/stg/opencl/drivers/opencl/tools/clinfo/CMakeLists.txt#3 edit
---
opencl/CMakeLists.txt | 26 ++++++++++++++++---------
opencl/api/opencl/amdocl/CMakeLists.txt | 4 +++-
opencl/tools/clinfo/CMakeLists.txt | 2 ++
3 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/opencl/CMakeLists.txt b/opencl/CMakeLists.txt
index 905d9da93a..678ff1ec39 100644
--- a/opencl/CMakeLists.txt
+++ b/opencl/CMakeLists.txt
@@ -14,14 +14,12 @@ set(CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
)
-set(LLVM_INCLUDE_TESTS CACHE BOOL OFF)
-set(LLVM_BUILD_TOOLS CACHE BOOL OFF)
+set(LLVM_INCLUDE_TESTS OFF CACHE BOOL "")
+set(LLVM_BUILD_TOOLS OFF CACHE BOOL "")
+set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")
set(LLVM_TARGETS_TO_BUILD "AMDGPU" CACHE STRING "")
-set(LLVM_ENABLE_PROJECTS CACHE STRING "clang")
-set(LLVM_BUILD_GLOBAL_ISEL CACHE BOOL OFF)
-set(LLVM_ENABLE_ZLIB OFF CACHE BOOL "")
-set(CLANG_ENABLE_ARCMT CACHE BOOL OFF)
-set(CLANG_ENABLE_STATIC_ANALYZER CACHE BOOL OFF)
+set(CLANG_ENABLE_ARCMT OFF CACHE BOOL "")
+set(CLANG_ENABLE_STATIC_ANALYZER OFF CACHE BOOL "")
add_subdirectory(compiler/llvm)
@@ -41,8 +39,8 @@ include_directories(${CMAKE_BINARY_DIR}/compiler/llvm/lib/Target/AMDGPU)
add_subdirectory(compiler/driver)
-set(BUILD_HC_LIB CACHE BOOL OFF)
-set(ROCM_DEVICELIB_INCLUDE_TESTS CACHE BOOL OFF)
+set(BUILD_HC_LIB OFF CACHE BOOL "")
+set(ROCM_DEVICELIB_INCLUDE_TESTS OFF CACHE BOOL "")
set(AMDGCN_TARGETS_LIB_LIST "AMDGCN_LIB_TARGETS")
set(AMDGPU_TARGET_TRIPLE "amdgcn-amd-amdhsa-opencl")
add_subdirectory(library/amdgcn)
@@ -60,3 +58,13 @@ add_subdirectory(api/opencl/amdocl)
add_subdirectory(api/opencl/khronos/icd)
add_subdirectory(tools/clinfo)
+
+
+install(PROGRAMS $
+ DESTINATION lib)
+
+install(DIRECTORY
+ "${CMAKE_CURRENT_SOURCE_DIR}/api/opencl/khronos/headers/opencl2.0"
+ DESTINATION include
+ USE_SOURCE_PERMISSIONS
+ PATTERN cl_egl.h EXCLUDE)
\ No newline at end of file
diff --git a/opencl/api/opencl/amdocl/CMakeLists.txt b/opencl/api/opencl/amdocl/CMakeLists.txt
index 299ecd9358..605dd5356f 100644
--- a/opencl/api/opencl/amdocl/CMakeLists.txt
+++ b/opencl/api/opencl/amdocl/CMakeLists.txt
@@ -22,7 +22,7 @@ include_directories(${CMAKE_SOURCE_DIR}/compiler/lib/loaders)
include_directories(${CMAKE_SOURCE_DIR}/compiler/lib/loaders/elf/utils/libelf)
include_directories(${CMAKE_SOURCE_DIR}/compiler/lib/loaders/elf/utils/common)
include_directories(${CMAKE_SOURCE_DIR}/compiler/tools)
-
+
add_library(amdocl64 SHARED
cl_memobj.cpp
cl_program.cpp
@@ -54,3 +54,5 @@ add_library(amdocl64 SHARED
)
target_link_libraries(amdocl64 opencl_driver oclelf pthread dl ${ROCR_LIBRARIES})
+
+install(TARGETS amdocl64 LIBRARY DESTINATION lib)
\ No newline at end of file
diff --git a/opencl/tools/clinfo/CMakeLists.txt b/opencl/tools/clinfo/CMakeLists.txt
index 0ffcb0f621..d0228d4bb2 100644
--- a/opencl/tools/clinfo/CMakeLists.txt
+++ b/opencl/tools/clinfo/CMakeLists.txt
@@ -9,3 +9,5 @@ add_definitions(-DHAVE_CL2_HPP)
add_executable(clinfo clinfo.cpp)
target_link_libraries(clinfo OpenCL)
+
+install(TARGETS clinfo DESTINATION bin)
\ No newline at end of file