Building Flang on Windows

Hello Michael,

Ivan (email in CC) is working on porting the shell scripts (used for testing Flang) to Python. He has already ported one of the scripts and would like to test it on Windows. What is the best way to do this? And could you provide build instructions for building Flang on Windows?

Thanks,
Kiran

If you prefer to not set up a Windows bot, you can also upload the patch to Phabricator (without reviewers added), the pre-merge bot will test the Windows flang build as well. Generally, when the python works on Linux, there are not that many differences on Windows. The main thing are the paths, which should not be a problem if using Python’s functions to manipulate paths.

For building on Windows yourself, you need the following things. I am using Chocolatey, so here are the packages you would need:

choco install -y cmake ninja python3 visualstudio2019community git

My command line is (execute in the “x64 Native Tools Command Prompt For VS 2019” found in the start menu):

$ cmake -GNinja C:\Users\meinersbur\src\llvm-project\llvm -GNinja -DLLVM_ENABLE_PROJECTS=clang;mlir;flang -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DLLVM_ENABLE_ASSERTIONS=ON -DCMAKE_INSTALL_PREFIX=C:\Users\meinersbur\install\llvm-project\release -DLLVM_LIT_ARGS=-svj4

$ ninja check-flang -j4

Alternatively, use the cmake gui.

Michael

I have ported the first script “test_symbols.sh”. This is available for review in https://reviews.llvm.org/D107041. Please have a look.

Thanks,

Ivan