- Install
Python3
and usepip
to installmako
meson
psutil
- download the Win Flex-Bisn portable and extract to a folder
-
clone the llvm project to llvm and checkout 15.0.2
-
set PATH=%PATH%;<absolute Flex and Bison Path>
-
Configure the LLVM
cmake -S llvm\llvm -B buildllvm -DLLVM_TARGETS_TO_BUILD=X86 \
-DLLVM_USE_CRT_RELEASE=MT -DLLVM_USE_CRT_DEBUG=MTd \
-DCMAKE_INSTALL_PREFIX=E:\LLVM15.0.2 \
-G "Visual Studio 17 2022" -Ax64 -T ClangCL
msbuild /p:Configuration=Release INSTALL.vcxproj
- Set clang-cl for meson
set CC=clang-cl
set CXX=clang-cl
set CC_LD=lld-link
set WINDRES=llvm-rc
- Find windows.py in mesonbuild's module folder and add
('/?', '^.*Resource Converter*$', ResourceCompilerType.rc)
to
for (arg, match, rc_type) in [
('/?', '^.*Microsoft.*Resource Compiler.*$', ResourceCompilerType.rc),
('--version', '^.*GNU windres.*$', ResourceCompilerType.windres),
('--version', '^.*Wine Resource Compiler.*$', ResourceCompilerType.wrc),
]:
if the code doesn't contain output string of llvm-rc /?
. Otherwise the meson cannot find llvm-rc
.
-
set PATH=%PATH%;<LLVM INSTALL PREFIX>/bin
-
set LLVM=<LLVM INSTALL PREFIX>
(not necessary?) -
Configure the Mesa3d
meson setup --backend=vs2022 builddir/ -Dbuildtype=release \
-Db_vscrt=static_from_buildtype \
-Dosmesa=true \
-Ddri-drivers= \
-Dgallium-drivers=swrast \
-Dvulkan-drivers=swrast \
-Db_vscrt=static_from_buildtype
meson compile -C builddir
meson install -C builddir --destdir <INSTALL_PREFIX>
make sure the function signature are the same for both declaration and definition, if not modify it
Add following libs to vulkan_lvp, osmesa and libgallium_wgl projects
<LLVM INSTALL PREFIX>/lib/LLVMObjCARCOpts.lib
<LLVM INSTALL PREFIX>/lib/LLVMPasses.lib
Remove the osmesa.sym
in linker option of osmesa
Use the batch file to build
build_llvm.bat
needs admminstrator privilege
Place the Dlls (except the vulan_lvp.dll) to the application folder Some environment varialbes can be overrided, e.g.
set MESA_GL_VERSION_OVERRIDE=4.6
set MESA_GLSL_VERSION_OVERRIDE=460
Set environment variable
set VK_ICD_FILENAMES=<INSTALL_PREFIX>\share\vulkan\icd.d\lvp_icd.x86_64.json
Make sure the json file contains right path for dll