Skip to content

Commit

Permalink
intel-opencl-clang-140: Align with IGC for static build
Browse files Browse the repository at this point in the history
Also remove vc-intrinsics build fix as issue now solved with
new version 0.20.0 with ref. PR
intel/vc-intrinsics#130
  • Loading branch information
th0ma7 committed Sep 16, 2024
1 parent 89e3e4a commit f7245b9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 31 deletions.
39 changes: 13 additions & 26 deletions cross/intel-opencl-clang-140/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,29 +35,17 @@ LICENSE = Apache License v2.0 with LLVM Exceptions

POST_EXTRACT_TARGET = opencl-clang_post_extract_target

# Does not fails but when built using Ninja and/or requires various CMP0??? such as:
# CMAKE_ARGS += -DCMAKE_POLICY_DEFAULT_CMP0116='OLD|NEW'
CMAKE_USE_NINJA = 0

# Suppress developer warnings
CMAKE_ARGS += -Wno-dev

# Using various LLVM project sources needs a top-level master directory
CMAKE_BUILD_DIR = $(WORK_DIR)/opencl-clang.build
CMAKE_SOURCE_DIR = $(WORK_DIR)/llvm-project/llvm

# Indicates whether the LLVM Interpreter will be
# linked with the Foreign Function Interface library
# (libffi) in order to enable calling external functions.
DEPENDS += cross/libffi
CMAKE_ARGS += -DLLVM_ENABLE_FFI=ON

DEPENDS += cross/ncursesw
CMAKE_ARGS += -DLLVM_ENABLE_TERMINFO=ON

DEPENDS += cross/libxml2
CMAKE_ARGS += -DLLVM_ENABLE_LIBXML2=ON

# Enable building with zlib to support compression/uncompression
DEPENDS += cross/zlib
CMAKE_ARGS += -DLLVM_ENABLE_ZLIB=ON

# Assertions are internal checks to help find bugs.
# They typically slow down LLVM and Clang when enabled
CMAKE_ARGS += -DLLVM_ENABLE_ASSERTIONS=OFF
Expand All @@ -67,8 +55,6 @@ CMAKE_ARGS += -DLLVM_ENABLE_ASSERTIONS=OFF
# as a shared library, you should use the
# LLVM_BUILD_LLVM_DYLIB option
CMAKE_ARGS += -DBUILD_SHARED_LIBS=OFF
CMAKE_ARGS += -DLLVM_BUILD_LLVM_DYLIB=ON
CMAKE_ARGS += -DLLVM_LINK_LLVM_DYLIB=ON

# Disable third-party benchmarks and unittest
# as not-included in build and fails
Expand All @@ -78,12 +64,8 @@ CMAKE_ARGS += -DLLVM_LINK_LLVM_DYLIB=ON
CMAKE_ARGS += -DLLVM_INCLUDE_BENCHMARKS=OFF
CMAKE_ARGS += -DLLVM_INCLUDE_TESTS=OFF

# Fix build failure against DSM-7.2 toolchain
#CMAKE_ARGS += -DLLVM_OPTIMIZED_TABLEGEN=ON

# intel-vc-intrinsics dependent else error:
# Could not find FOUND_VCS using the following files: VersionFromVCS.cmake
CMAKE_ARGS += -DFOUND_VCS=$(CMAKE_BUILD_DIR)/lib/cmake/llvm/VersionFromVCS.cmake
# [intel-opencl-clang-140]
CMAKE_ARGS += -DAPPLY_PATCHES='OFF'

include ../../mk/spksrc.common.mk

Expand All @@ -98,10 +80,15 @@ CMAKE_ARGS += -DLLVM_EXTERNAL_LLVM_SPIRV_SOURCE_DIR=$(WORK_DIR)/SPIRV-LLVM-Trans
CMAKE_ARGS += -DLLVM_EXTERNAL_VC_INTRINSICS_SOURCE_DIR=$(WORK_DIR)/vc-intrinsics
CMAKE_ARGS += -DLLVM_EXTERNAL_OPENCL_CLANG_SOURCE_DIR=$(WORK_DIR)/$(PKG_NAME)

# Contrary to IGC does not fail to access in NATIVE/bin/llvm-tblgen but reduces built time and size
BUILD_DEPENDS += native/llvm-14.0
CMAKE_ARGS += -DLLVM_TABLEGEN=$(abspath $(PWD)/../../native/llvm-14.0/work-native/install/usr/local/bin/llvm-tblgen)
CMAKE_ARGS += -DCLANG_TABLEGEN=$(abspath $(PWD)/../../native/llvm-14.0/work-native/install/usr/local/bin/clang-tblgen)

include ../../mk/spksrc.cross-cmake.mk

# Requires access to build-time NATIVE tools
ENV += PATH=$(CMAKE_BUILD_DIR)/NATIVE/bin:$$PATH
# Requires access to build-time NATIVE and native/llvm-14.0 tools
ENV += PATH=$(CMAKE_BUILD_DIR)/NATIVE/bin:$(abspath $(PWD)/../../native/llvm-14.0/work-native/install/usr/local/bin):$$PATH

opencl-clang_post_extract_target:
@cd $(WORK_DIR) && ln -s $(PKG_DIR) $(PKG_NAME)
5 changes: 0 additions & 5 deletions cross/intel-opencl-clang-140/PLIST
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,9 @@ lnk:lib/libclang.so.13
lib:lib/libclang.so.14.0.5
lnk:lib/libclang-cpp.so
lib:lib/libclang-cpp.so.14
lnk:lib/libLLVM-14.0.5.so
lnk:lib/libLLVM.so
lib:lib/libLLVM-14.so
lnk:lib/libLTO.so
lib:lib/libLTO.so.14
lnk:lib/libopencl-clang.so
lib:lib/libopencl-clang.so.14
lnk:lib/libRemarks.so
lib:lib/libRemarks.so.14
# intel-vc-intrinsics
lib:lib/libLLVMGenXIntrinsics.so

0 comments on commit f7245b9

Please sign in to comment.