Commit 28b356f6 authored by Nikolay Igotti's avatar Nikolay Igotti

Docs update

parent 7e4259ca
## Building JVM bindings
* Set JAVA_HOME to location of JDK, at least version 11
* `./gradlew :skiko:publishToMavenLocal` will build the artifact and publish it to local Maven repo
To build with debug symbols and debug Skia build use `-Pskiko.debug=true` Gradle argument.
#### Working with Skia sources
Gradle build downloads the necessary version of Skia by default.
However, if downloaded sources are modified, changes are discarded (Gradle
re-evaluates tasks, when outputs are changed).
To use custom version of the dependencies, specify `SKIA_DIR` environment variable.
#### 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"
```
#### Running UI tests
Add `-Dskiko.test.ui.enabled=true` to enable UI tests (integration tests, which run in the native window). Each UI test will be run on every available Graphics API of the current target.
For example, if we want to include UI tests when we test JVM target, call this:
```
./gradlew awtTest -Dskiko.test.ui.enabled=true
```
Don't run any background tasks, click mouse, or press keys during the tests. Otherwise, they probably fail.
#### Run samples
- First follow the instruction here: [Building JVM bindings](#building-jvm-bindings)
- `./gradlew :SkiaAwtSample:run`
...@@ -25,6 +25,7 @@ i.e. something like this ...@@ -25,6 +25,7 @@ i.e. something like this
```kotlin ```kotlin
repositories { repositories {
mavenCentral()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
} }
...@@ -77,53 +78,54 @@ fun main() { ...@@ -77,53 +78,54 @@ fun main() {
} }
``` ```
To use latest development snapshot use version `0.0.0-SNAPSHOT`. Simple example for iOS
```kotlin
## Building JVM bindings fun main() {
val args = emptyArray<String>()
* Set JAVA_HOME to location of JDK, at least version 11 memScoped {
* `./gradlew :skiko:publishToMavenLocal` will build the artifact and publish it to local Maven repo val argc = args.size + 1
val argv = (arrayOf("skikoApp") + args).map { it.cstr.ptr }.toCValues()
To build with debug symbols and debug Skia build use `-Pskiko.debug=true` Gradle argument. autoreleasepool {
UIApplicationMain(argc, argv, null, NSStringFromClass(SkikoAppDelegate))
}
}
}
#### Working with Skia sources class SkikoAppDelegate : UIResponder, UIApplicationDelegateProtocol {
companion object : UIResponderMeta(), UIApplicationDelegateProtocolMeta
Gradle build downloads the necessary version of Skia by default. @ObjCObjectBase.OverrideInit
However, if downloaded sources are modified, changes are discarded (Gradle constructor() : super()
re-evaluates tasks, when outputs are changed).
To use custom version of the dependencies, specify `SKIA_DIR` environment variable.
#### Building on Windows private var _window: UIWindow? = null
override fun window() = _window
override fun setWindow(window: UIWindow?) {
_window = window
}
##### Using Visual Studio C++ override fun application(application: UIApplication, didFinishLaunchingWithOptions: Map<Any?, *>?): Boolean {
* Install [Visual Studio Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/) or window = UIWindow(frame = UIScreen.mainScreen.bounds)
[Visual Studio C++](https://visualstudio.microsoft.com/vs/features/cplusplus/). window!!.rootViewController = SkikoViewController(
* If Gradle fails to find Visual C++ toolchain: SkikoUIView(
``` SkiaLayer().apply {
Execution failed for task ':compileDebugWindowsCpp'. gesturesToListen = SkikoGestureEventKind.values()
> No tool chain is available to build C++ for host operating system 'Windows 10' architecture 'x86-64': skikoView = GenericSkikoView(skiaLayer, object : SkikoView {
- Tool chain 'visualCpp' (Visual Studio): val paint = Paint().apply { color = Color.RED }
- Could not locate a Visual Studio installation, using the command line tool, Windows registry or system path. override fun onRender(canvas: Canvas, width: Int, height: Int, nanoTime: Long) {
``` canvas.clear(Color.CYAN)
set `SKIKO_VSBT_PATH` environment variable to the location of installed Visual Studio Build Tools. val ts = nanoTime / 5_000_000
This could be done in the UI: canvas.drawCircle( (ts % width).toFloat(), (ts % height).toFloat(), 20f, paint )
``` }
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" window!!.makeKeyAndVisible()
return true
}
}
``` ```
See this [sample](/sample/SkiaMultiplatformSample) for complete example.
#### Running UI tests To use latest development snapshot use version `0.0.0-SNAPSHOT`.
Add `-Dskiko.test.ui.enabled=true` to enable UI tests (integration tests, which run in the native window). Each UI test will be run on every available Graphics API of the current target.
For example, if we want to include UI tests when we test JVM target, call this:
```
./gradlew awtTest -Dskiko.test.ui.enabled=true
```
Don't run any background tasks, click mouse, or press keys during the tests. Otherwise, they probably fail.
#### Run samples
- First follow the instruction here: [Building JVM bindings](#building-jvm-bindings)
- `./gradlew :SkiaAwtSample:run`
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