Steps I followed to build lavapipe on Windows (1/9/24). Documenting the steps so that I remember, and putting them on gist in case it's useful to anyone else. Much of this info is courtesy of Mike Blumenkrantz.
- From cmd.exe as Administrator:
choco install winflexbison pkgconfiglite /Y
- Clone mesa:
git clone https://gitlab.freedesktop.org/mesa/mesa.git
- I have a hacky local patch to find the DX headers, there is surely a way to specify the windows SDK include with meson, but I'm too lazy to figure it out:
diff --git a/src/vulkan/wsi/wsi_common_win32.cpp b/src/vulkan/wsi/wsi_common_win32.cpp
index e614dae9782..3759a9cd381 100644
--- a/src/vulkan/wsi/wsi_common_win32.cpp
+++ b/src/vulkan/wsi/wsi_common_win32.cpp
@@ -34,9 +34,10 @@
#include "wsi_common_private.h"
#define D3D12_IGNORE_SDK_LAYERS
-#include <dxgi1_4.h>
-#include <directx/d3d12.h>
-#include <dxguids/dxguids.h>
+#include <C:/Program Files (x86)/Windows Kits/10/Include/10.0.22000.0/shared/dxgi1_4.h>
+#include <C:/Program Files (x86)/Windows Kits/10/Include/10.0.22000.0/um/d3d12.h>
+
+//#include <dxguids/dxguids.h>
#include <dcomp.h>
- Make folder for LLVM:
mkdir -p mesa/subprojects/llvm
- Drop the following file as meson.build in mesa/subprojects/llvm:
project('llvm', ['cpp'])
cpp = meson.get_compiler('cpp')
_deps = []
_search = join_paths(meson.current_source_dir(), 'lib')
foreach d : ['LLVMCodeGen', 'LLVMScalarOpts', 'LLVMAnalysis',
'LLVMTransformUtils', 'LLVMCore', 'LLVMX86CodeGen',
'LLVMSelectionDAG', 'LLVMipo', 'LLVMAsmPrinter',
'LLVMInstCombine', 'LLVMInstrumentation', 'LLVMMC',
'LLVMGlobalISel', 'LLVMObjectYAML', 'LLVMDebugInfoPDB',
'LLVMVectorize', 'LLVMPasses', 'LLVMSupport',
'LLVMLTO', 'LLVMObject', 'LLVMDebugInfoCodeView',
'LLVMDebugInfoDWARF', 'LLVMOrcJIT', 'LLVMProfileData',
'LLVMObjCARCOpts', 'LLVMBitReader', 'LLVMCoroutines',
'LLVMBitWriter', 'LLVMRuntimeDyld', 'LLVMMIRParser',
'LLVMX86Desc', 'LLVMAsmParser', 'LLVMTableGen',
'LLVMFuzzMutate', 'LLVMLinker', 'LLVMMCParser',
'LLVMExecutionEngine', 'LLVMCoverage', 'LLVMInterpreter',
'LLVMTarget', 'LLVMX86AsmParser', 'LLVMSymbolize',
'LLVMDebugInfoMSF', 'LLVMMCJIT', 'LLVMXRay',
'LLVMX86AsmParser', 'LLVMX86Disassembler',
'LLVMMCDisassembler', 'LLVMOption', 'LLVMIRReader',
'LLVMLibDriver', 'LLVMDlltoolDriver', 'LLVMDemangle',
'LLVMBinaryFormat', 'LLVMLineEditor',
'LLVMWindowsManifest', 'LLVMX86Info', 'LLVMX86Info',
'LLVMTargetParser', 'LLVMTargetParser', 'LLVMRemarks',
'LLVMBitstreamReader', 'LLVMFrontendOpenMP', 'LLVMFrontendOffloading',
'LLVMCFGuard', 'LLVMCodeGenTypes',
'LLVMAggressiveInstCombine', 'LLVMIRPrinter', 'LLVMHipStdPar',
'LLVMTextAPI', 'LLVMOrcTargetProcess' ]
_deps += cpp.find_library(d, dirs : _search)
endforeach
inc_llvm = include_directories('./include')
dep_llvm = declare_dependency(
include_directories : [inc_llvm],
dependencies : _deps,
version : '17.0.6',
)
has_rtti = false
irbuilder_h = files('include/llvm/IR/IRBuilder.h')
- Clone LLVM
git clone https://github.com/llvm/llvm-project.git
- Build LLVM following instructions here: https://llvm.org/docs/GettingStartedVS.html. Specifically I did (don't need clang as in the instructions there):
cmake -S llvm\llvm -B build -DLLVM_TARGETS_TO_BUILD=X86 -Thost=x64 --prefix /path/to/mesa/subprojects/llvm
- Build LLVM project, then build INSTALL project inside LLVM solution in VS 2022. Having set --prefix, it should install to mesa/subprojects/llvm
- Now we can build mesa, first run meson to generate sln/vcxproj:
meson release --wipe --reconfigure --backend=vs -Dprefix=d:/mesa/release --buildtype=debugoptimized -Dgallium-drivers=swrast -Dvulkan-drivers=swrast
- Open mesa.sln in VS 2022 and Build All.
- Make a copy of /path/to/mesa/release/src/gallium/targets/lavapipe/lvp_devenv_icd.x86_64.json and rename it (the build copy has the wrong name for the DLL, it has the soname)
- Put this in your json (note renaming libvulkan_lvp.so -> vulkan_lvp.dll):
{
"ICD": {
"api_version": "1.1.274",
"library_path": "D:/Users/Dan/src/mesa/release/src/gallium/targets/lavapipe/vulkan_lvp.dll"
},
"file_format_version": "1.0.0"
}
- Now can run with:
VK_ICD_FILENAMES=D:/Users/Dan/src/mesa/release/src/gallium/targets/lavapipe/lvp_devenv_icd_mine.x86_64.json