From 41b3eb08d9feac97ac1be1802093ad4cc4c6ecaf Mon Sep 17 00:00:00 2001
From: Dylan Baker
On windows you can also use the visual studio backend
++ meson builddir --backend=vs + cd builddir + msbuild mesa.sln /m ++ +
+Please read the detailed meson instructions +for more information +
++As of meson 0.51.0 meson can use cmake to find llvm (the cmake finder +was added in meson 0.49.0, but LLVM cannot be found until 0.51) Due to the +way LLVM implements its cmake finder it will only find static libraries, it +will never find libllvm.so. + +There is also a
-Dcmake_module_pathoption in this meson version, +which points to the root of an alternative installation (the prefix). For +example: +
+ meson builddir -Dcmake_module_path=/home/user/mycmake/prefix ++
As of meson 0.49.0 meson also has the concept of a "native file", @@ -325,8 +339,11 @@ should be used. It uses the same format as the native file above: [binaries] ... llvm-config = '/usr/lib/llvm-config-32' + cmake = '/usr/bin/cmake-for-my-arch' +
Obviously, only cmake or llvm-config is required.
+Then configure meson:
meson builddir/ --cross-file cross-llvm.ini @@ -335,6 +352,74 @@ should be used. It uses the same format as the native file above: See the Cross Compilation section for more information.
On windows (and in other cases), using llvm-config or cmake may be +either undesirable or impossible. Meson's solution for this is a +wrap, in +this case a "binary wrap". Follow the steps below:
+$mesa_src/subprojects/llvm
The wrap file must define the following:
+dep_llvm
: a declare_dependency()
object with include_directories, dependencies, and version set)It may also define:
+irbuilder_h
: a files()
object pointing to llvm/IR/IRBuilder.h (this is requred for SWR)has_rtti
: a bool
that declares whether LLVM was built with RTTI. Defaults to truesuch a meson.build file might look like:
++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 + +dep_llvm = declare_dependency( + include_directories : include_directories('include'), + dependencies : _deps, + version : '6.0.0', +) + +has_rtti = false +irbuilder_h = files('include/llvm/IR/IRBuilder.h') ++ +
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.
+ +PKG_CONFIG_PATH
The
pkg-config
utility is a hard requirement for configuring and
--
2.30.2