The plugin provides basic build tuning according to the current profile (Debug/Release) and used toolchain. Also, some customization is available via the plugin configuration section.
The cpp-build-tuner
require to work another Gradle core plugins: cpp-application
/cpp-library
/cpp-unit-test
.
plugins {
id 'cpp-library'
id 'cpp-unit-test'
id 'loggersoft.cpp-build-tuner' version '2.3'
}
MSVC and GCC compatible toolchains (CLang).
The plugin tries to reduce build time for the Debug variant and save maximum information for debugging. In opposite, for Release variant debug information is disabled and maximum speed optimizations (include link-time optimizations) are enabled.
buildTuner {
lto = false
gtest = '1.8.1'
libraries {
common = ['cutils.lib']
windows = ['ole32', 'user32']
linux = ['pthread', 'z']
}
libDirs.common = ['../build/debug', '../release']
defines {
common = ['DEF_COMMON_1', ' DEF_COMMON_2 = 7 ']
windows = [' DEF_WINDOWS_1', ' DEF_WINDOWS_2=9']
linux = ['DEF_LINUX_1 ', ' DEF_LINUX_2 =3 ']
}
dependencies.common = ['loggersoft.jvm:class-reader:0.1']
preferCLang = true
standard = 17
generateCompileCommands = true
}
The plugin provides an extension for cpp-application
which allow running application via Gradle (like as Java Application plugin).
For application projects, a plugin adds tasks: run
, runDebug
(same as run
) and runRelease
. Those tasks depend on assemble
, assembleDebug
and assembleRelease
correspondently.
Also, you can pass command-line arguments as in Java Application plugin:
gradle run --args="arg1 arg2 ..."
gcc
, mingw
, clang
, visualcpp
(msvc
).How to use Gradle command-line interface to change Java system properties:
gradle -D<property name>=<value>
Examples:
gradle build -Dtoolchain=mingw
gradle publish -Dversion=0.5
gradle publish -Dversion=0.5-?
Variate version can be used to publish artifacts are built by different toolchains.
Version format is: <version>-<variant></variant></version>
Variants:
Example:
version = 0.1-?
The final version will be:
So all binaries can be stored in single Artifactory at the same time.