diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2018-04-24 13:48:25 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2018-05-17 11:06:01 -0700 |
commit | 2a2240f41c210557d32717f7fd041a294562e1d1 (patch) | |
tree | a5ce8a2b990ac3eb558cba19d1db5978283213cb /docs | |
parent | 05363d44a0dce99d296510c37f24e38627d127d2 (diff) |
meson: Add support for wrapping llvm
For building on Windows (when not using cygwin), the assumption is that
LLVM will have to be handled via a binary wrap. In this case the user
wanting to use LLVM is this way will need to create a directory in
subprojects (any name is fine), and pass that name via the -Dllvm-wrap
option (for example, assuming subprojects/llvm, -Dllvm-wrap=llvm), which
must have a meson.build file and the installed LLVM to link with (this
can be either static or dynamic). There is documentation for what this
needs to look like and how to define it.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/meson.html | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/docs/meson.html b/docs/meson.html index f394a22fc2..a736363c6c 100644 --- a/docs/meson.html +++ b/docs/meson.html @@ -124,6 +124,72 @@ dependency interface. It will search <code>$PATH</code> (or <code>%PATH%</code> llvm-config, so using an LLVM from a non-standard path is as easy as <code>PATH=/path/with/llvm-config:$PATH meson build</code>. </p></dd> + +<dd><p>On windows (and in other cases), using llvm-config is either undesirable +or impossible. Meson's solution for this is a +<a href="http://mesonbuild.com/Wrap-dependency-system-manual.html">wrap</a>, in +this case a "binary wrap". Follow the steps below:</p> +<ul> + <li>Install the binaries and headers into a directory under the $mesa_src/subprojects</li> + <li>Add a meson build.build file to that directory (more on that later)</li> + <li>add -Dllvm-wrap=$directory to your meson configuration (where $directory is the the directory under subprojects</li> +</ul> + +<p>The wrap file must define the following:</p> +<ul> + <li>ext_llvm: a declare_dependency() object with include_directories, dependencies, and version set)</li> +</ul> + +<p>It may also define:</p> +<ul> + <li>irbuilder_h: a file() object pointing to llvm/IR/IRBuilder.h (for SWR)</li> +</ul> + +<p>such a meson.build file might look like:</p> +<pre> +project('llvm', ['cpp']) + +cpp = meson.get_compiler('cpp') + +_deps = [] +_search = join_paths(meson.current_source_dir(), 'lib') +foreach d : ['libLLVMCodeGen', 'libLLVMScalarOpts', 'libLLVMAnalysis', + 'libLLVMTransformUtils', 'libLLVMCore', 'libLLVMX86CodeGen', + 'libLLVMSelectionDAG', 'libLLVMipo', 'libLLVMAsmPrinter', + 'libLLVMInstCombine', 'libLLVMInstrumentation', 'libLLVMMC', + 'libLLVMGlobalISel', 'libLLVMObjectYAML', 'libLLVMDebugInfoPDB', + 'libLLVMVectorize', 'libLLVMPasses', 'libLLVMSupport', + 'libLLVMLTO', 'libLLVMObject', 'libLLVMDebugInfoCodeView', + 'libLLVMDebugInfoDWARF', 'libLLVMOrcJIT', 'libLLVMProfileData', + 'libLLVMObjCARCOpts', 'libLLVMBitReader', 'libLLVMCoroutines', + 'libLLVMBitWriter', 'libLLVMRuntimeDyld', 'libLLVMMIRParser', + 'libLLVMX86Desc', 'libLLVMAsmParser', 'libLLVMTableGen', + 'libLLVMFuzzMutate', 'libLLVMLinker', 'libLLVMMCParser', + 'libLLVMExecutionEngine', 'libLLVMCoverage', 'libLLVMInterpreter', + 'libLLVMTarget', 'libLLVMX86AsmParser', 'libLLVMSymbolize', + 'libLLVMDebugInfoMSF', 'libLLVMMCJIT', 'libLLVMXRay', + 'libLLVMX86AsmPrinter', 'libLLVMX86Disassembler', + 'libLLVMMCDisassembler', 'libLLVMOption', 'libLLVMIRReader', + 'libLLVMLibDriver', 'libLLVMDlltoolDriver', 'libLLVMDemangle', + 'libLLVMBinaryFormat', 'libLLVMLineEditor', + 'libLLVMWindowsManifest', 'libLLVMX86Info', 'libLLVMX86Utils'] + _deps += cpp.find_library(d, dirs : _search) +endforeach + +ext_llvm = declare_dependency( + include_directories : include_directories('include'), + dependencies : _deps, + version : '6.0.0', +) + +irbuilder_h = files('include/llvm/IR/IRBuilder.h') +</pre> + +<p>It is very important that version is defined and is accurate, if it is not, +workarounds for the wrong version of LLVM might be used resulting in build +failures.</p> + +</dd> </dl> <dl> |