Last active
November 14, 2022 15:53
-
-
Save cyanide-burnout/ecad2d9a0f0d1a87014cfa2de5c2089e to your computer and use it in GitHub Desktop.
SPIR-V in Docker (clang 15 + libclcxx / clang 14)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:bullseye-slim | |
ENV DEBIAN_FRONTEND=noninteractive | |
RUN apt-get update && apt-get upgrade -y | |
RUN apt-get install -y \ | |
build-essential apt-utils python3 git curl \ | |
libxml2-dev zlib1g-dev libedit-dev | |
RUN git config --global user.email "[email protected]" && git config --global user.name "Your Name" | |
RUN curl -L "https://github.com/Kitware/CMake/releases/download/v3.24.3/cmake-3.24.3-linux-$(uname -m).sh" > /tmp/cmake.sh | |
RUN mkdir -p /opt/cmake && chmod +x /tmp/cmake.sh && /tmp/cmake.sh --prefix=/opt/cmake --skip-license | |
# https://gardinal.net/forums/topic/how-to-build-llvm-on-linux/ | |
RUN cd /tmp && git clone -b llvmorg-15.0.4 https://github.com/llvm/llvm-project.git llvm | |
RUN cd /tmp/llvm && git clone -b ocl-open-150 https://github.com/intel/opencl-clang.git | |
RUN cd /tmp/llvm && git clone -b v0.8.1 https://github.com/intel/vc-intrinsics.git llvm/projects/vc-intrinsics | |
RUN cd /tmp/llvm && git clone -b sdk-1.3.231 https://github.com/KhronosGroup/SPIRV-Headers.git llvm/projects/SPIRV-Headers | |
RUN cd /tmp/llvm && git clone -b v2022.4 https://github.com/KhronosGroup/SPIRV-Tools.git llvm/projects/SPIRV-Tools | |
RUN cd /tmp/llvm && git clone -b v15.0.0 https://github.com/KhronosGroup/SPIRV-LLVM-Translator.git | |
RUN cd /tmp && git clone -b main https://github.com/KhronosGroup/libclcxx.git | |
RUN mkdir -p /tmp/llvm/build | |
RUN mkdir -p /tmp/libclcxx/build | |
RUN cd /tmp/llvm/build && /opt/cmake/bin/cmake --fresh \ | |
-DCMAKE_INSTALL_PREFIX=/opt/llvm/ \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DLLVM_ENABLE_PROJECTS="clang" \ | |
-DLLVM_EXTERNAL_PROJECTS="llvm-spirv;opencl-clang" \ | |
-DLLVM_EXTERNAL_LLVM_SPIRV_SOURCE_DIR="../SPIRV-LLVM-Translator" \ | |
-DLLVM_EXTERNAL_OPENCL_CLANG_SOURCE_DIR="../opencl-clang" \ | |
-G "Unix Makefiles" \ | |
../llvm | |
# -DLLVM_ENABLE_RUNTIMES="libc;libclc;libcxx;libcxxabi" \ | |
# /opt/llvm/lib/x86_64-unknown-linux-gnu/ | |
RUN cd /tmp/llvm/build && make -j8 opencl-clang && make install | |
RUN cd /tmp/libclcxx/build && /opt/cmake/bin/cmake --fresh \ | |
-DCMAKE_INSTALL_PREFIX=/opt/libclcxx/ \ | |
-G "Unix Makefiles" \ | |
.. | |
# -DCLANG_PATH=/opt/llvm/bin/clang \ | |
# -DCMAKE_CXX_FLAGS="-I/opt/llvm/include/ -I/opt/llvm/include/c++/v1/ -I/usr/include -D_LIBCPP_ABI_VERSION=2" \ | |
# -DHAVE_CXX_ATOMICS_WITHOUT_LIB=yes \ | |
# -DHAVE_CXX_ATOMICS64_WITHOUT_LIB=yes \ | |
RUN cd /tmp/libclcxx/build && make -j8 tools && make install | |
RUN rm -rf /tmp/cmake.sh /tmp/llvm /tmp/libclcxx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment