Coder Social home page Coder Social logo

zufuliu / llvm-utils Goto Github PK

View Code? Open in Web Editor NEW
196.0 11.0 35.0 293 KB

LLVM/Clang toolsets for Visual Studio 2022, 2019, 2017, 2015, 2013, 2012 and 2010.

License: Other

Batchfile 15.13% Python 55.02% C++ 29.86%
llvm-utils llvm-vs2019 llvm-vs2017 llvm-vs2015 llvm-vs2013 llvm-vs2012 clang-vs2012 llvm-vs2010 clang-plugin llvm-extensions

llvm-utils's Introduction

LLVM Utils

LLVM for Visual Studio

License

Latest release

LLVM for Visual Studio 2017, 2019 and 2022

Installation

Please download and install LLVM from https://github.com/llvm/llvm-project/releases or https://releases.llvm.org/.

VS2017\install.bat can be used to install MSBuild script for Visual Studio 2017, 2019 and 2022. (may require Administrator privilege. In Windows 8 or later, you can quickly open an elevated PowerShell prompt by File -> Open Windows PowerShell -> Open PowerShell as Administrator).

Visual Studio 2022

The Platform Toolset is "LLVM for Visual Studio 2022 (LLVM_v143)", "LLVM for Visual Studio 2019 (LLVM_v142)", "LLVM for Visual Studio 2017 (LLVM_v141)" and "LLVM for Visual Studio 2017 - Windows XP (LLVM_v141_xp)".

Assume VS_PATH is your Visual Studio 2020 installation path (e.g: C:\Program Files\Microsoft Visual Studio\2022\Community), please manually copy folders under VS2017 to their target paths.

Folder Target Path
VS2017\LLVM %VS_PATH%\MSBuild\Microsoft\VC\v170\
VS2017\LLVM_v143 %VS_PATH%\MSBuild\Microsoft\VC\v170\Platforms\x64\PlatformToolsets\
VS2017\LLVM_v143 %VS_PATH%\MSBuild\Microsoft\VC\v170\Platforms\Win32\PlatformToolsets\
VS2017\LLVM_v143 %VS_PATH%\MSBuild\Microsoft\VC\v170\Platforms\ARM64\PlatformToolsets\
VS2017\LLVM_v143 %VS_PATH%\MSBuild\Microsoft\VC\v170\Platforms\ARM\PlatformToolsets\
VS2017\LLVM %VS_PATH%\MSBuild\Microsoft\VC\v160\
VS2017\LLVM_v142 %VS_PATH%\MSBuild\Microsoft\VC\v160\Platforms\x64\PlatformToolsets\
VS2017\LLVM_v142 %VS_PATH%\MSBuild\Microsoft\VC\v160\Platforms\Win32\PlatformToolsets\
VS2017\LLVM_v142 %VS_PATH%\MSBuild\Microsoft\VC\v160\Platforms\ARM64\PlatformToolsets\
VS2017\LLVM_v142 %VS_PATH%\MSBuild\Microsoft\VC\v160\Platforms\ARM\PlatformToolsets\
VS2017\LLVM %VS_PATH%\MSBuild\Microsoft\VC\v150\
VS2017\LLVM_v141 %VS_PATH%\MSBuild\Microsoft\VC\v150\Platforms\x64\PlatformToolsets\
VS2017\LLVM_v141_xp %VS_PATH%\MSBuild\Microsoft\VC\v150\Platforms\x64\PlatformToolsets\
VS2017\LLVM_v141 %VS_PATH%\MSBuild\Microsoft\VC\v150\Platforms\Win32\PlatformToolsets\
VS2017\LLVM_v141_xp %VS_PATH%\MSBuild\Microsoft\VC\v150\Platforms\Win32\PlatformToolsets\
VS2017\LLVM_v141 %VS_PATH%\MSBuild\Microsoft\VC\v150\Platforms\ARM64\PlatformToolsets\
VS2017\LLVM_v141 %VS_PATH%\MSBuild\Microsoft\VC\v150\Platforms\ARM\PlatformToolsets\

Visual Studio 2019

The Platform Toolset is "LLVM for Visual Studio 2019 (LLVM_v142)", "LLVM for Visual Studio 2017 (LLVM_v141)" and "LLVM for Visual Studio 2017 - Windows XP (LLVM_v141_xp)".

Assume VS_PATH is your Visual Studio 2019 installation path (e.g: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community), please manually copy folders under VS2017 to their target paths.

Folder Target Path
VS2017\LLVM %VS_PATH%\MSBuild\Microsoft\VC\v160\
VS2017\LLVM_v142 %VS_PATH%\MSBuild\Microsoft\VC\v160\Platforms\x64\PlatformToolsets\
VS2017\LLVM_v142 %VS_PATH%\MSBuild\Microsoft\VC\v160\Platforms\Win32\PlatformToolsets\
VS2017\LLVM_v142 %VS_PATH%\MSBuild\Microsoft\VC\v160\Platforms\ARM64\PlatformToolsets\
VS2017\LLVM_v142 %VS_PATH%\MSBuild\Microsoft\VC\v160\Platforms\ARM\PlatformToolsets\
VS2017\LLVM %VS_PATH%\MSBuild\Microsoft\VC\v150\
VS2017\LLVM_v141 %VS_PATH%\MSBuild\Microsoft\VC\v150\Platforms\x64\PlatformToolsets\
VS2017\LLVM_v141_xp %VS_PATH%\MSBuild\Microsoft\VC\v150\Platforms\x64\PlatformToolsets\
VS2017\LLVM_v141 %VS_PATH%\MSBuild\Microsoft\VC\v150\Platforms\Win32\PlatformToolsets\
VS2017\LLVM_v141_xp %VS_PATH%\MSBuild\Microsoft\VC\v150\Platforms\Win32\PlatformToolsets\
VS2017\LLVM_v141 %VS_PATH%\MSBuild\Microsoft\VC\v150\Platforms\ARM64\PlatformToolsets\
VS2017\LLVM_v141 %VS_PATH%\MSBuild\Microsoft\VC\v150\Platforms\ARM\PlatformToolsets\

Visual Studio 2017

The Platform Toolset is "LLVM for Visual Studio 2017 (LLVM_v141)" and "LLVM for Visual Studio 2017 - Windows XP (LLVM_v141_xp)".

Assume VS_PATH is your Visual Studio 2017 installation path (e.g: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community), please manually copy folders under VS2017 to their target paths.

Folder Target Path
VS2017\LLVM %VS_PATH%\Common7\IDE\VC\VCTargets\
VS2017\LLVM_v141 %VS_PATH%\Common7\IDE\VC\VCTargets\Platforms\x64\PlatformToolsets\
VS2017\LLVM_v141_xp %VS_PATH%\Common7\IDE\VC\VCTargets\Platforms\x64\PlatformToolsets\
VS2017\LLVM_v141 %VS_PATH%\Common7\IDE\VC\VCTargets\Platforms\Win32\PlatformToolsets\
VS2017\LLVM_v141_xp %VS_PATH%\Common7\IDE\VC\VCTargets\Platforms\Win32\PlatformToolsets\
VS2017\LLVM_v141 %VS_PATH%\Common7\IDE\VC\VCTargets\Platforms\ARM64\PlatformToolsets\
VS2017\LLVM_v141 %VS_PATH%\Common7\IDE\VC\VCTargets\Platforms\ARM\PlatformToolsets\

LLVM for Visual Studio 2010, 2012, 2013 and 2015

Assume MB_PATH is the MSBuild path for Visual C++ (e.g.: C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0 or C:\Program Files\MSBuild\Microsoft.Cpp\v4.0), please manually copy VS2017\LLVM and related folders under VS2015 to their target paths.

VS2015\install.bat (based on install script for LLVM 6.0.1) can be used to install MSBuild script for Visual Studio 2010, 2012, 2013 and 2015.

Visual Studio 2015

The Platform Toolset is "LLVM for Visual Studio 2015 (LLVM_v140)" and "LLVM for Visual Studio 2015 - Windows XP (LLVM_v140_xp)".

Folder Target Path
VS2017\LLVM %MB_PATH%\V140\
VS2015\LLVM_v140 %MB_PATH%\V140\Platforms\x64\PlatformToolsets\
VS2015\LLVM_v140_xp %MB_PATH%\V140\Platforms\x64\PlatformToolsets\
VS2015\LLVM_v140 %MB_PATH%\V140\Platforms\Win32\PlatformToolsets\
VS2015\LLVM_v140_xp %MB_PATH%\V140\Platforms\Win32\PlatformToolsets\

Visual Studio 2013

The Platform Toolset is "LLVM for Visual Studio 2013 (LLVM_v120)" and "LLVM for Visual Studio 2013 - Windows XP (LLVM_v120_xp)".

Folder Target Path
VS2017\LLVM %MB_PATH%\v120\
VS2015\LLVM_v120 %MB_PATH%\v120\Platforms\x64\PlatformToolsets\
VS2015\LLVM_v120_xp %MB_PATH%\v120\Platforms\x64\PlatformToolsets\
VS2015\LLVM_v120 %MB_PATH%\v120\Platforms\Win32\PlatformToolsets\
VS2015\LLVM_v120_xp %MB_PATH%\v120\Platforms\Win32\PlatformToolsets\

Visual Studio 2012

The Platform Toolset is "LLVM for Visual Studio 2012 (LLVM_v110)" and "LLVM for Visual Studio 2012 - Windows XP (LLVM_v110_xp)".

Folder Target Path
VS2017\LLVM %MB_PATH%\v110\
VS2015\x64\LLVM_v110 %MB_PATH%\v110\Platforms\x64\PlatformToolsets\
VS2015\x64\LLVM_v110_xp %MB_PATH%\v110\Platforms\x64\PlatformToolsets\
VS2015\Win32\LLVM_v110 %MB_PATH%\v110\Platforms\Win32\PlatformToolsets\
VS2015\Win32\LLVM_v110_xp %MB_PATH%\v110\Platforms\Win32\PlatformToolsets\

Visual Studio 2010

The Platform Toolset is "LLVM for Visual Studio 2010 (LLVM_v100)" and "LLVM for Visual Studio 2008 (LLVM_v90)".

Folder Target Path
VS2017\LLVM %MB_PATH%\
VS2015\x64\LLVM_v100 %MB_PATH%\Platforms\x64\PlatformToolsets\
VS2015\x64\LLVM_v90 %MB_PATH%\Platforms\x64\PlatformToolsets\
VS2015\Win32\LLVM_v100 %MB_PATH%\Platforms\Win32\PlatformToolsets\
VS2015\Win32\LLVM_v90 %MB_PATH%\Platforms\Win32\PlatformToolsets\

Install to AppVeyor or GitHub Actions Build Image

Install LLVM on the build image

curl -fsSL -o "LLVM-18.1.0-win64.exe" "https://github.com/llvm/llvm-project/releases/download/llvmorg-18.1.0/LLVM-18.1.0-win64.exe"
LLVM-18.1.0-win64.exe /S

Install from release archives

Archive Name Visual Studio Version
LLVM_VS2017.zip 2017, 2019 and 2022
LLVM_VS2010_2015.zip 2010, 2012, 2013 and 2015
LLVM_VS2015.zip 2015
LLVM_VS2013.zip 2013
LLVM_VS2012.zip 2012
LLVM_VS2010.zip 2010

Examples:

curl -fsSL -o "LLVM_VS2017.zip" "https://github.com/zufuliu/llvm-utils/releases/download/v23.05/LLVM_VS2017.zip"
7z x -y "LLVM_VS2017.zip" >NUL
CALL "LLVM_VS2017\install.bat" 1

curl -fsSL -o "LLVM_VS2010_2015.zip" "https://github.com/zufuliu/llvm-utils/releases/download/v23.05/LLVM_VS2010_2015.zip"
7z x -y "LLVM_VS2010_2015.zip" >NUL
CALL "LLVM_VS2010_2015\install.bat" 1

Install from latest main source code

curl -fsSL -o "llvm-utils-main.zip" "https://github.com/zufuliu/llvm-utils/archive/main.zip"
7z x -y "llvm-utils-main.zip" >NUL
CALL "llvm-utils-main\VS2017\install.bat" 1
CALL "llvm-utils-main\VS2015\install.bat" 1

or

git clone -q --depth=1 --branch=main https://github.com/zufuliu/llvm-utils.git c:\projects\llvm-utils
CALL "c:\projects\llvm-utils\VS2017\install.bat" 1
CALL "c:\projects\llvm-utils\VS2015\install.bat" 1

clang-cl for Python 3 distutils

See clang\clang-cl-py3.diff for the changes on hwo to use clang-cl as distutils compiler. After apply these changes, you can build your extension with

python setup.py build --compiler=clang-cl

LLVM Windows Symbolic Link Maker

The huge size of LLVM Windows installation can be reduced dramatically by using Windows symbolic link (see mklink command.

Usage

Just copy llvm\llvm-link.bat to LLVM installation path (e.g.: C:\Program Files\LLVM\), and run it (may require Administrator privilege).

Related Links

llvm-utils's People

Contributors

mohitsethi99 avatar zufuliu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

llvm-utils's Issues

CMake uses wrong compiler for detection.

D:\Data\Development\HonokaMiku5>cmake -Bbuild -H. -A x64 -T LLVM_v120
-- Building for: Visual Studio 15 2017
-- Selecting Windows SDK version 10.0.17134.0 to target Windows 10.0.17763.
-- The C compiler identification is Clang 8.0.0
-- The CXX compiler identification is Clang 8.0.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: D:/Data/Development/HonokaMiku5/build

At first, it shows correctly that the compiler identification is "Clang 8.0.0", but then it uses cl.exe to detect whetever the compiler is working. This doesn't happen when using "LLVM Compiler Toolchain" addon.

D:\Data\Development\HonokaMiku5>cmake -Bbuild -H. -A x64 -T llvm
-- Building for: Visual Studio 15 2017
-- Selecting Windows SDK version 10.0.17134.0 to target Windows 10.0.17763.
-- The C compiler identification is Clang 8.0.0
-- The CXX compiler identification is Clang 8.0.0
-- Check for working C compiler: C:/Program Files/LLVM/bin/clang-cl.exe
-- Check for working C compiler: C:/Program Files/LLVM/bin/clang-cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files/LLVM/bin/clang-cl.exe
-- Check for working CXX compiler: C:/Program Files/LLVM/bin/clang-cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: D:/Data/Development/HonokaMiku5/build

But in my case I need to use VS2013 toolchain because my cl.exe for VS2013 actually broken due to "Use unicode UTF-8 for worldwide language support" in Windows 10 and I have no plans to turn that feature back off.

[enhancement] Support for Developer Command Prompt / vcvarsall possible?

Hi,
would it be possible to add the required scripts to make the LLVM v14* toolchains available in the Developer Command Prompt?

The toolchain files you provide work amazingly well with MSBuild targets, but it would be awesome if we could also use them from within a terminal so they get picked up by CMake / Ninja as is currently possible by using helpers like vcvarsall.bat

Example for CI builds

Got it working on my machine, just did VS2017/install.bat and it worked like charm, now I can manually change toolset to use LLVM_v143 and it works.
But the problem is with CI builds, how will I change the toolset there? Can you please provide an example for that?
My current build pipeline includes making vs project files with premake and building the generated solution with msbuild.

LibraryPath + IncludePath

неверные пути

Note: If your LLVM version is not 7.0, please change $(LLVMInstallDir)\lib\clang\7.0\ in each Toolset.props to appropriate value.

...
исправить на \7.0.0\

  <PropertyGroup>
....
    <IncludePath>$(LLVMInstallDir)\lib\clang\7.0.0\include;$(IncludePath)</IncludePath>
    <LibraryPath>$(LLVMInstallDir)\lib\clang\7.0.0\lib\windows;$(LibraryPath)</LibraryPath>
  </PropertyGroup>

Generated solution does not recompile modified files

Manually recompiling a source file, will trigger the linker to pick up the new .obj and build the .exe, but changing the source file and building does not regenerate the obj.

I am using:

  • Microsoft Visual Studio Community 2019, Version 16.8.4
  • clang version 11.0.1, target: x86_64-pc-windows-msvc

The specified task executable location "bin\clang-cl.exe" is invalid.

Hi,
I have installed llvm-utils for visual studio 2019. And i have installed llvm in C:\llvm
But when i compile a project with LLVM v 142 as toolchain. i get the error The specified task executable location "bin\clang-cl.exe" is invalid.
I have a Directory.build.props in my project root with the following contents:

<Project>
  <PropertyGroup>
    <LLVMInstallDir>C:\llvm\</LLVMInstallDir>
	<LLVMToolsVersion>14.0.0</LLVMToolsVersion>
  </PropertyGroup>
</Project>

choco install llvm-utils

It would be awesome if you add a choco install llvm-utils command too. That makes the installation a bit easier.

support for Visual studio build tools

Hello,

I would like to use LLVM without the Visual Studio IDE (either cmdline or other editors).
They tend to be hard to find, but the toolset is available standalone Visual Studio 2019 Build Tools.

What I effectively had to do was replace the detection in the install script with:

SET VCT_PATH=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools\MSBuild\Microsoft\VC\v160\Platforms
IF EXIST "!VCT_PATH!" CALL :SUB_VS2019 "!VCT_PATH!"

this lets me use CMake for Projects by using

"%ProgramFiles%\CMake\bin\cmake.exe" -G"Visual Studio 16 2019" -A x64 -T "LLVM_v142" SOURCEDIR

PS. is it possible to pass target properties to CMake ? like using ldd-link and llvm-rc?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.