Commit 0763f5cc authored by Alexey Tsvetkov's avatar Alexey Tsvetkov

Add optional SKIKO_VSBT_PATH env. variable

Sometimes Gradle C++ plugin fails to find Visual Studio Build Tools
automatically (see https://github.com/gradle/gradle-native/issues/617).

This commit adds optional environment variable for providing
VSBT path manually.
parent 1dbae20d
...@@ -6,3 +6,26 @@ ...@@ -6,3 +6,26 @@
[here](https://bintray.com/beta/#/jetbrains/skija/Skia?tab=files)) [here](https://bintray.com/beta/#/jetbrains/skija/Skia?tab=files))
* Set JAVA_HOME to location of JDK, at least version 11 * Set JAVA_HOME to location of JDK, at least version 11
* `cd skiko && ./gradlew publishToMavenLocal` will build the artefact and publish it to local Maven repo * `cd skiko && ./gradlew publishToMavenLocal` will build the artefact and publish it to local Maven repo
#### Building on Windows
##### Using Visual Studio C++
* Install [Visual Studio Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/) or
[Visual Studio C++](https://visualstudio.microsoft.com/vs/features/cplusplus/).
* If Gradle fails to find Visual C++ toolchain:
```
Execution failed for task ':compileDebugWindowsCpp'.
> No tool chain is available to build C++ for host operating system 'Windows 10' architecture 'x86-64':
- Tool chain 'visualCpp' (Visual Studio):
- Could not locate a Visual Studio installation, using the command line tool, Windows registry or system path.
```
set `SKIKO_VSBT_PATH` environment variable to the location of installed Visual Studio Build Tools.
This could be done in the UI:
```
Control Panel|All Control Panel Items|System|Advanced system settings|Environment variables
```
or by running `cmd` as administrator:
```
setx /M SKIKO_VSBT_PATH "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
```
\ No newline at end of file
...@@ -313,6 +313,16 @@ library { ...@@ -313,6 +313,16 @@ library {
include("**.o") include("**.o")
}) })
} }
toolChains {
withType(VisualCpp::class.java) {
// In some cases Gradle is unable to find VC++ toolchain
// https://github.com/gradle/gradle-native/issues/617
properties.visualStudioBuildToolsDir?.let {
setInstallDir(it)
}
}
}
} }
val skikoJvmJar: Provider<Jar> by tasks.registering(Jar::class) { val skikoJvmJar: Provider<Jar> by tasks.registering(Jar::class) {
...@@ -464,6 +474,9 @@ class SkikoProperties(private val myProject: Project) { ...@@ -464,6 +474,9 @@ class SkikoProperties(private val myProject: Project) {
get() = (myProject.property("dependencies.skia.release.pattern") as String) get() = (myProject.property("dependencies.skia.release.pattern") as String)
.replace("<TARGET_OS>", target) .replace("<TARGET_OS>", target)
val visualStudioBuildToolsDir: File?
get() = System.getenv()["SKIKO_VSBT_PATH"]?.let { File(it) }?.takeIf { it.isDirectory }
val dependenciesDir: File val dependenciesDir: File
get() = myProject.rootProject.projectDir.resolve("dependencies") get() = myProject.rootProject.projectDir.resolve("dependencies")
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment