summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Sotkin <alexey.sotkin@intel.com>2018-05-15 12:10:37 +0300
committerAlexey Sotkin <alexey.sotkin@intel.com>2018-05-16 17:08:12 +0300
commit3b312fa3cf22997abff4419ba410b2fd243ed7bd (patch)
treedaafc07ca8db0181b7e723343514b6ddaaf7dd01
parent76e2aa33f3e4e5be50ef32ab4add858c2926b0ff (diff)
Adding build instructions to README.mdHEADmaster
-rw-r--r--README.md64
1 files changed, 52 insertions, 12 deletions
diff --git a/README.md b/README.md
index f763f12..9927456 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
-LLVM/SPIR-V Bi-Directional Translator
--------------------------------------
+# LLVM/SPIR-V Bi-Directional Translator
+
[![Build Status](https://travis-ci.org/KhronosGroup/SPIRV-LLVM-Translator.svg?branch=master)](https://travis-ci.org/KhronosGroup/SPIRV-LLVM-Translator)
This repository contains source code for the LLVM/SPIR-V Bi-Directional Translator, a library and tool for translation between LLVM IR and [SPIR-V](https://www.khronos.org/registry/spir-v/).
@@ -7,22 +7,62 @@ This repository contains source code for the LLVM/SPIR-V Bi-Directional Translat
The LLVM/SPIR-V Bi-Directional Translator is open source software. You may freely distribute it under the terms of the license agreement found in LICENSE.txt.
-Directory Structure
--------------------
+## Directory Structure
+
The files/directories related to the translator:
-* [include/SPIRV.h](include/SPIRV.h) - header file
+* [include/LLVMSPIRVLib.h](include/LLVMSPIRVLib.h) - header file
* [lib/SPIRV](lib/SPIRV) - library for SPIR-V in-memory representation, decoder/encoder and LLVM/SPIR-V translator
* [tools/llvm-spirv](tools/llvm-spirv) - command line utility for translating between LLVM bitcode and SPIR-V binary
-Build Instructions
-------------------
+## Build Instructions
+
+Master branch of this repo is aimed to be buildable with the latest LLVM version.
-TBD
+### Build with pre-installed LLVM
+
+The translator can be built with the latest(nightly) package of LLVM. For Ubuntu and Debian systems LLVM provides repositories with nightly builds at http://apt.llvm.org/. For example the latest package for Ubuntu 16.04 can be installed with the following commands:
+```
+sudo add-apt-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial main"
+sudo apt-get update
+sudo apt-get install llvm-7-dev
+```
+The intalled version of LLVM will be used by default for out-of-tree build of the translator.
+```
+git clone https://github.com/KhronosGroup/SPIRV-LLVM-Translator.git
+mkdir SPIRV-LLVM-Translator/build && cd SPIRV-LLVM-Translator/build
+cmake ..
+make llvm-spirv -j`nproc`
+```
-Test instructions
------------------
+### Build with pre-built LLVM
+
+If you have a custom build(based on the latest version) of LLVM libraries you can link the translator against it.
+```
+git clone https://github.com/KhronosGroup/SPIRV-LLVM-Translator.git
+mkdir SPIRV-LLVM-Translator/build && cd SPIRV-LLVM-Translator/build
+cmake .. -DLLVM_DIR=<llvm_build_dir>/lib/cmake/llvm/
+make llvm-spirv -j`nproc`
+```
+Where `llvm_build_dir` is the LLVM build directory.
+
+### LLVM in-tree build
+
+The translator can be built as a regular LLVM subproject. To do that you need to clone it to `llvm/projects` or `llvm/tools` directory.
+```
+git clone http://llvm.org/git/llvm.git
+cd llvm/project
+git clone https://github.com/KhronosGroup/SPIRV-LLVM-Translator.git
+```
+Run(re-run) cmake as usually for LLVM. After that you should have `llvm-spirv` and `check-llvm-spirv` targets available.
+```
+mkdir llvm/build && cd llvm/build
+cmake ..
+make llvm-spirv -j`nproc`
+```
+
+## Test instructions
All tests related to the translator are placed in the [test](test) directory.
@@ -31,8 +71,8 @@ Execute the following command to run translator tests:
llvm-lit test
```
-Run Instructions for `llvm-spirv`
-----------------
+## Run Instructions for `llvm-spirv`
+
To translate between LLVM IR and SPIR-V: