Skip to content

Instantly share code, notes, and snippets.

@cwoffenden
Created March 13, 2024 14:14
Show Gist options
  • Save cwoffenden/91a2a49ea6b4faf0f9083f33d1f19820 to your computer and use it in GitHub Desktop.
Save cwoffenden/91a2a49ea6b4faf0f9083f33d1f19820 to your computer and use it in GitHub Desktop.
Build LLVM (with Wasm) on Windows
Build LLVM (with Wasm) on Windows
---------------------------------
Tested with VS2019 (probably works with older versions). See here for original instructions:
https://emscripten.org/docs/building_from_source/index.html
http://llvm.org/docs/CMake.html
Make sure you have CMake (tested with 3.15.5), Ninja (tested with 1.9.0) and Git installed and on your Path.
1. Launch the "x64 Native Tools" command prompt for VS. Don't skip this.
2. Checkout LLVM:
git clone --config core.autocrlf=false https://github.com/llvm/llvm-project.git \Path\To\LLVM
3. Create the CMake Ninja generator, building for 'all' targets or alternatively just for -DLLVM_TARGETS_TO_BUILD="WebAssembly":
cd \Path\To\LLVM
mkdir build
cd build
cmake -G Ninja ../llvm -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS='lld;clang' -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF
4. Build it! Probably best to go for lunch or something:
cmake --build .
5. Any 'host' errors, missing includes, etc., are probably down you skipping step 1.
6. Open the %HOMEPATH%\.emscripten config file and point LLVM_ROOT to the generated binaries:
LLVM_ROOT = "C:\Path\To\LLVM\build\bin"
That's it!
TODO: why aren't we building libcxx?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment