Skip to content

Commit

Permalink
MSVC: Support using clang build used by clc to build whole Mesa
Browse files Browse the repository at this point in the history
  • Loading branch information
pal1000 committed Aug 9, 2022
1 parent b6b06ad commit 1059438
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
14 changes: 9 additions & 5 deletions buildscript/modules/clang.cmd
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
@rem Detect clang
@setlocal
@set clangstate=0
@IF %toolchain%==msvc IF EXIST "%devroot%\llvm\build\%abi%\bin\clang-cl.exe" set clangstate=1
@IF %toolchain%==msvc IF %abi%==x64 IF EXIST "%ProgramFiles%\LLVM\bin\clang-cl.exe" set clangstate=1
@IF %toolchain%==msvc IF %abi%==x86 IF /I %PROCESSOR_ARCHITECTURE%==AMD64 IF EXIST "%ProgramFiles% (x86)\LLVM\bin\clang-cl.exe" set clangstate=1
@IF %toolchain%==msvc IF %abi%==x86 IF /I %PROCESSOR_ARCHITECTURE%==x86 IF EXIST "%ProgramFiles%\LLVM\bin\clang-cl.exe" set clangstate=1
@IF %toolchain%==msvc set clangstate=0
@IF NOT %toolchain%==msvc set clangstate=1

@set useclang=n
@IF %clangstate% GTR 0 set /p useclang=Use clang compiler with selected toolchain ^(y/n^):
@IF %clangstate% GTR 0 echo.
@endlocal&set useclang=%useclang%

@if /I "%useclang%"=="y" IF %toolchain%==msvc IF %abi%==x64 set PATH=%ProgramFiles%\LLVM\bin\;%PATH%
@if /I "%useclang%"=="y" IF %toolchain%==msvc IF %abi%==x86 IF /I %PROCESSOR_ARCHITECTURE%==AMD64 set PATH=%ProgramFiles% (x86)\LLVM\bin\;%PATH%
@if /I "%useclang%"=="y" IF %toolchain%==msvc IF %abi%==x86 IF /I %PROCESSOR_ARCHITECTURE%==x86 set PATH=%ProgramFiles%\LLVM\bin\;%PATH%
@set llvmalreadyloaded=0
@if /I "%useclang%"=="y" IF %toolchain%==msvc IF EXIST "%devroot%\llvm\build\%abi%\bin\clang-cl.exe" set PATH=%devroot%\llvm\build\%abi%\bin\;%PATH%
@if /I "%useclang%"=="y" IF %toolchain%==msvc IF EXIST "%devroot%\llvm\build\%abi%\bin\clang-cl.exe" set llvmalreadyloaded=1
@if /I "%useclang%"=="y" IF %toolchain%==msvc IF %abi%==x64 IF NOT EXIST "%devroot%\llvm\build\%abi%\bin\clang-cl.exe" set PATH=%ProgramFiles%\LLVM\bin\;%PATH%
@if /I "%useclang%"=="y" IF %toolchain%==msvc IF %abi%==x86 IF /I %PROCESSOR_ARCHITECTURE%==AMD64 IF NOT EXIST "%devroot%\llvm\build\%abi%\bin\clang-cl.exe" set PATH=%ProgramFiles% (x86)\LLVM\bin\;%PATH%
@if /I "%useclang%"=="y" IF %toolchain%==msvc IF %abi%==x86 IF /I %PROCESSOR_ARCHITECTURE%==x86 IF NOT EXIST "%devroot%\llvm\build\%abi%\bin\clang-cl.exe" set PATH=%ProgramFiles%\LLVM\bin\;%PATH%
@if /I "%useclang%"=="y" IF %toolchain%==msvc set CC=clang-cl.exe
@if /I "%useclang%"=="y" IF %toolchain%==msvc set CXX=clang-cl.exe
@if /I "%useclang%"=="y" IF NOT %toolchain%==msvc set MSYSTEM=CLANG%MSYSTEM:~-2%
@if /I "%useclang%"=="y" IF NOT %toolchain%==msvc set LMSYSTEM=clang%MSYSTEM:~-2%
@if /I "%useclang%"=="y" IF NOT %toolchain%==msvc set toolchain=clang
@if /I "%useclang%"=="y" set TITLE=%TITLE% with clang compiler
@if /I "%useclang%"=="y" TITLE %TITLE%
@if /I "%useclang%"=="y" TITLE %TITLE%
@set useclang=
2 changes: 1 addition & 1 deletion buildscript/modules/mesa3d.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
@if /I NOT "%llvmless%"=="y" IF %llvmmethod%==cmake set buildconf=%buildconf% --cmake-prefix-path="%devroot:\=/%/llvm/build/%abi%"
@if /I NOT "%llvmless%"=="y" IF %llvmmethod%==cmake IF %cmakestate% EQU 1 SET PATH=%devroot%\cmake\bin\;%PATH%
@if /I NOT "%llvmless%"=="y" IF NOT %llvmmethod%==cmake set buildconf=%buildconf% --cmake-prefix-path=
@if /I NOT "%llvmless%"=="y" IF NOT %llvmmethod%==cmake IF %toolchain%==msvc SET PATH=%devroot%\llvm\build\%abi%\bin\;%PATH%
@if /I NOT "%llvmless%"=="y" IF NOT %llvmmethod%==cmake IF %toolchain%==msvc if %llvmalreadyloaded% EQU 0 SET PATH=%devroot%\llvm\build\%abi%\bin\;%PATH%
@if /I "%llvmless%"=="y" set buildconf=%buildconf% -Dllvm=%mesonboolfalse%

@set useninja=n
Expand Down
4 changes: 2 additions & 2 deletions releasenotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
- MSYS2: Change currrent directory to Windows current folder;
- MSYS2/Meson: Don't hardcode source code directory;
- MSYS2: Restore option to clear package cache after installing packages;
- MSVC: Prepare to use clang build used by clc to build whole Mesa;
- OpenCL stack: Make sure we never link against clang-cpp library.
- OpenCL stack: Make sure we never link against clang-cpp library;
- MSVC: Support using clang build used by clc to build whole Mesa.
### Distribution
- MSYS2: Strip lib prefix from Microsoft CLC filename [22.2+].
# 22.1.5
Expand Down

0 comments on commit 1059438

Please sign in to comment.