The plugin allow to start working with LLVM framework in a very simple way:
The cpp-llvm
require to work another Gradle core plugins: cpp-application
/cpp-library
/cpp-unit-test
.
plugins { id 'cpp-application' id 'loggersoft.cpp-llvm' version '2.2' }
8.0.0
Unofficial builds for x86_64 on Windows and Linux. Also, RTTI and exceptions are enabled on those builds. There are two build variants for each platforms: Debug and Release.
See llvm-binaries.
7.1.0
Since version 11.0.0 total number of exported symbols reached the limit for Windows PE DLL file format which has an obsolete 16-bit capacity of slot where stored total exports number (restricted within 65535).
https://developercommunity.visualstudio.com/content/problem/220174/fix-msvc-65535-symbol-limit-in-lib-files-lnk1189.html
In this context from Windows DLL files (MSVC/MinGW) were excluded several rarely used targets:
Linux version and static version of LLVM for Windows the same as before contains all targets without any excludes.
In versions 11.0.0 and 12.0.0 in Windows Debug builds (msvc) statistic collection is disabled in ADT/Statistic.h (LLVM_ENABLE_STATS 0) to prevent export issues for the shared version.
llvmVersions - list of supported versions for the current environment/platform
gradle llvmVersions > Task :llvm-app:llvmVersions 9.0.0 8.0.0 BUILD SUCCESSFUL in 1s 1 actionable task: 1 executed
llvmComponents - list of supported LLVM components for static linkage.
llvmCleanCache - clean of local user cache with LLVM downloads.
llvmBuildInfo, llvmBuildInfoDebug, llvmBuildInfoRelease - show information about used LLVM build.
gradle llvmBuildInfoRelease > Task :llvm-app:llvmBuildInfoRelease version: 9.0.0 sources link: http://releases.llvm.org/9.0.0/llvm-9.0.0.src.tar.xz platform: SMP Debian 4.19.67-2 (2019-08-28) x86_64 toolchain: clang version 10.0.0-svn372778-1~exp1+0~20190924203139.1491~1.gbpb209ff (trunk) profile: Release cmake config: CC=/usr/bin/clang CXX=/usr/bin/clang++ -DLLVM_ENABLE_EH=ON -DLLVM_ENABLE_RTTI=ON -DCMAKE_BUILD_TYPE=Release cmake build: --build . BUILD SUCCESSFUL in 830ms
llvm { version = '9.0.0' linkage = Linkage.SHARED serverUrl = 'http://releases.llvm.org/7.0.1/clang%2bllvm-7.0.1-x86_64-linux-gnu-ubuntu-18.04.tar.xz' localPath = '<path to unpacked LLVM build>' components = ['Engine', 'OrcJIT'] forceReleaseLinux = true preferCLang = true suppressWarningsMsvc = true }
version (string) - version of LLVM. Version should present in a list which returns llvmVersions. This parameter is mandatory.
linkage (enum) - type of linkage shared (Linkage.SHARED) or static (Linkage.STATIC). The static linkage is used by default.
serverUrl (string) - specify a particular URL to download. Make sure that the specified version of LLVM is the same with the version which will be downloaded from the URL. Otherwise, the configuration of the build might be incorrect.
localPath (string) - you can work offline with already downloaded or manual built binaries. In this case, nothing connected with LLVM will be downloaded from a net. Make sure that the specified version of LLVM is the same as the version of the local binaries. The plugin assumes to have ‘lib’ and ‘include’ directories inside the specified path.
components (list of strings) - particular components to static linking. Potentially, decrease of libraries for linking might improve linking time. If none of the components are chosen default component ‘all’ will be used. To see the whole list of supported components you can use llvmComponents task.
forceReleaseLinux (boolean) - force to use release variant of LLVM for debug build on Linux. This affects only Linux builds and can improve linking time (and size of download archive will be less). Unfortunately, MSVC 2019 doesn’t allow to mix debug and release object files within the build and we have to use debug variant. Recommended to switch it on if you don’t really need binary with debug information of LLVM itself. By default is switched off.
preferCLang (boolean) - prefers CLang LLVM build on Windows if available. By default is switched off.
suppressWarningsMsvc (boolean) - disables compilation warnings for MSVC (C4141, C4244, C4291, C4624, C4996);
Full sources of simple LLVM application.