From a1efbe4b5b883e081e3fc537e408103cacab93b2 Mon Sep 17 00:00:00 2001
From: foreman
Date: Wed, 26 Apr 2017 16:10:30 -0400
Subject: [PATCH] P4 to Git Change 1402945 by lmoriche@lmoriche_palamida on
2017/04/26 16:03:39
SWDEV-102733 - [OCL-LC-ROCm] Cmake build Write CMakeLists.txt to enable building with and without the DK environment
Affected files ...
... //depot/stg/opencl/drivers/opencl/CMakeLists.txt#5 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/CMakeLists.txt#1 add
... //depot/stg/opencl/drivers/opencl/compiler/lib/loaders/elf/utils/libelf/CMakeLists.txt#1 add
... //depot/stg/opencl/drivers/opencl/runtime/CMakeLists.txt#1 add
... //depot/stg/opencl/drivers/opencl/runtime/device/appprofile.cpp#18 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/CMakeLists.txt#1 add
... //depot/stg/opencl/drivers/opencl/tools/bc2h/CMakeLists.txt#1 add
---
opencl/CMakeLists.txt | 18 ++++++++-
opencl/api/opencl/amdocl/CMakeLists.txt | 49 +++++++++++++++++++++++++
2 files changed, 66 insertions(+), 1 deletion(-)
create mode 100644 opencl/api/opencl/amdocl/CMakeLists.txt
diff --git a/opencl/CMakeLists.txt b/opencl/CMakeLists.txt
index 48824f86bf..1ba68e03d3 100644
--- a/opencl/CMakeLists.txt
+++ b/opencl/CMakeLists.txt
@@ -10,6 +10,9 @@ project(OpenCL-ROCm)
set(LLVM_INCLUDE_TESTS CACHE BOOL OFF)
set(LLVM_TARGETS_TO_BUILD "AMDGPU" "X86" CACHE STRING "")
set(LLVM_ENABLE_PROJECTS CACHE STRING "clang")
+set(LLVM_BUILD_GLOBAL_ISEL CACHE BOOL OFF)
+set(CLANG_ENABLE_ARCMT CACHE BOOL OFF)
+set(CLANG_ENABLE_STATIC_ANALYZER CACHE BOOL OFF)
add_subdirectory(compiler/llvm)
@@ -27,9 +30,22 @@ include_directories(${CMAKE_BINARY_DIR}/compiler/llvm/tools/clang/include)
include_directories(${CMAKE_SOURCE_DIR}/compiler/llvm/lib/Target/AMDGPU)
include_directories(${CMAKE_BINARY_DIR}/compiler/llvm/lib/Target/AMDGPU)
+set(AMD_EXTENSIONS CACHE BOOL OFF)
+set(BUILD_HSAILASM CACHE BOOL OFF)
+add_subdirectory(compiler/sc/HSAIL/hsail-tools)
+
add_subdirectory(compiler/driver)
set(CMAKE_C_COMPILER "${PROJECT_BINARY_DIR}/compiler/llvm/bin/clang")
set(BUILD_HC_LIB CACHE BOOL OFF)
set(ROCM_DEVICELIB_INCLUDE_TESTS CACHE BOOL OFF)
-add_subdirectory(library/amdgcn)
\ No newline at end of file
+add_subdirectory(library/amdgcn)
+
+add_subdirectory(compiler/lib/loaders/elf/utils/libelf)
+
+add_subdirectory(tools/bc2h)
+add_dependencies(bc2h clang) # FIXME: remove
+add_dependencies(oclelf clang) # FIXME: remove
+
+add_subdirectory(runtime)
+add_subdirectory(api/opencl/amdocl)
diff --git a/opencl/api/opencl/amdocl/CMakeLists.txt b/opencl/api/opencl/amdocl/CMakeLists.txt
new file mode 100644
index 0000000000..5d217c2712
--- /dev/null
+++ b/opencl/api/opencl/amdocl/CMakeLists.txt
@@ -0,0 +1,49 @@
+find_library(HSA_LIB hsa-runtime64 HINTS /opt/rocm/lib)
+
+set(CMAKE_CXX_FLAGS "-std=c++11")
+set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--unresolved-symbols=report-all")
+
+add_definitions(-DLINUX -D__x86_64__ -D__AMD64__ -DUNIX_OS -DqLittleEndian -DAMD_LIBELF -DOPENCL_MAJOR=2 -DOPENCL_MINOR=0 -DWITH_AQL -DWITH_ONLINE_COMPILER -DATI_OS_LINUX -DATI_ARCH_X86 -DLITTLEENDIAN_CPU -DATI_BITS_64 -DATI_COMP_GCC -DWITH_HSA_DEVICE -DWITH_TARGET_AMDGCN -DOPENCL_EXPORTS -DCL_USE_DEPRECATED_OPENCL_1_1_APIS -DCL_USE_DEPRECATED_OPENCL_1_2_APIS -DCL_USE_DEPRECATED_OPENCL_2_0_APIS -DWITH_VERSION_0_8=1 -DVEGA10_ONLY=false -DWITH_LIGHTNING_COMPILER)
+
+include_directories(${CMAKE_SOURCE_DIR}/runtime)
+include_directories(${CMAKE_SOURCE_DIR}/api/opencl)
+include_directories(${CMAKE_SOURCE_DIR}/api/opencl/khronos)
+include_directories(${CMAKE_SOURCE_DIR}/api/opencl/khronos/headers)
+include_directories(${CMAKE_SOURCE_DIR}/api/opencl/khronos/headers/opencl2.0)
+include_directories(${CMAKE_SOURCE_DIR}/compiler/driver/src)
+include_directories(${CMAKE_SOURCE_DIR}/compiler/lib)
+include_directories(${CMAKE_SOURCE_DIR}/compiler/lib/include)
+include_directories(${CMAKE_SOURCE_DIR}/compiler/lib/backends/common)
+include_directories(${CMAKE_SOURCE_DIR}/compiler/lib/loaders)
+include_directories(${CMAKE_SOURCE_DIR}/compiler/tools)
+
+add_library(amdocl64 SHARED
+ cl_memobj.cpp
+ cl_program.cpp
+ cl_sdi_amd.cpp
+ cl_device.cpp
+ cl_debugger_amd.cpp
+ cl_svm.cpp
+ cl_sampler.cpp
+ cl_thread_trace_amd.cpp
+ cl_object.cpp
+ cl_counter.cpp
+ cl_d3d10.cpp
+ cl_d3d9.cpp
+ cl_command.cpp
+ cl_platform_amd.cpp
+ cl_event.cpp
+ cl_lqdflash_amd.cpp
+ cl_kernel_info_amd.cpp
+ cl_execute.cpp
+ cl_gl.cpp
+ cl_icd.cpp
+ cl_pipe.cpp
+ cl_d3d11.cpp
+ cl_context.cpp
+ cl_profile_amd.cpp
+ $
+ $
+)
+
+target_link_libraries(amdocl64 opencl_driver oclelf pthread dl ${HSA_LIB})