Unable to build hello-world project.
Kesanov opened this issue · 3 comments
Kesanov commented
I have created a new native project with intelli and added imgui dependencies:
// build.gradle.kts
plugins {
kotlin("multiplatform") version "1.5.0"
}
group = "me.me"
version = "1.0-SNAPSHOT"
val imguiVersion = "0.1.9"
val kglVersion = "0.3-RC1"
repositories {
mavenCentral()
maven("https://maven.pkg.github.com/Dominaezzz/kotlin-imgui") {
credentials {
username = System.getenv("GITHUB_USER") // Your GitHub username.
password = System.getenv("GITHUB_TOKEN") // A GitHub token with `read:packages`.
}
}
}
kotlin {
val hostOs = System.getProperty("os.name")
val isMingwX64 = hostOs.startsWith("Windows")
val nativeTarget = when {
hostOs == "Mac OS X" -> macosX64("native")
hostOs == "Linux" -> linuxX64("native")
isMingwX64 -> mingwX64("native")
else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
}
nativeTarget.apply {
binaries {
executable {
entryPoint = "main"
}
}
}
sourceSets {
val nativeMain by getting {
dependencies {
implementation("com.kotlin-imgui:imgui:$imguiVersion")
implementation("com.kotlin-imgui:imgui-glfw:$imguiVersion")
implementation("com.kotlin-imgui:imgui-opengl:$imguiVersion")
// For jvm binaries
implementation("com.kotlin-imgui:cimgui-jvmlinuxx64:$imguiVersion")
implementation("com.kotlin-imgui:cimgui-jvmmacosx64:$imguiVersion")
implementation("com.kotlin-imgui:cimgui-jvmmingwx64:$imguiVersion")
// Optional
implementation("com.kgl:kgl-glfw:$kglVersion")
implementation("com.kgl:kgl-glfw-static:$kglVersion")
implementation("com.kgl:kgl-opengl:$kglVersion")
}
}
val nativeTest by getting
}
}
But building the project on windows ends up with the following error message:
Execution failed for task ':compileKotlinNative'.
> Could not resolve all files for configuration ':nativeCompileKlibraries'.
> Could not resolve com.kotlin-imgui:cimgui-jvmlinuxx64:0.1.9.
Required by:
project :
> No matching variant of com.kotlin-imgui:cimgui-jvmlinuxx64:0.1.9 was found. The consumer was configured to find a usage of 'kotlin-api' of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native', attribute 'org.jetbrains.kotlin.native.target' with value 'mingw_x64' but:
- Variant 'jvmLinuxX64-api' capability com.kotlin-imgui:cimgui-jvmlinuxx64:0.1.9 declares an API of a component:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
- Other compatible attribute:
- Doesn't say anything about org.jetbrains.kotlin.native.target (required 'mingw_x64')
- Variant 'jvmLinuxX64-runtime' capability com.kotlin-imgui:cimgui-jvmlinuxx64:0.1.9 declares a runtime of a component:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
- Other compatible attribute:
- Doesn't say anything about org.jetbrains.kotlin.native.target (required 'mingw_x64')
- Variant 'metadata-api' capability com.kotlin-imgui:cimgui-jvmlinuxx64:0.1.9 declares a usage of 'kotlin-api' of a component:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'common' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
- Other compatible attribute:
- Doesn't say anything about org.jetbrains.kotlin.native.target (required 'mingw_x64')
> Could not resolve com.kotlin-imgui:cimgui-jvmmacosx64:0.1.9.
Required by:
project :
> No matching variant of com.kotlin-imgui:cimgui-jvmmacosx64:0.1.9 was found. The consumer was configured to find a usage of 'kotlin-api' of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native', attribute 'org.jetbrains.kotlin.native.target' with value 'mingw_x64' but:
- Variant 'jvmMacosX64-api' capability com.kotlin-imgui:cimgui-jvmmacosx64:0.1.9 declares an API of a component:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
- Other compatible attribute:
- Doesn't say anything about org.jetbrains.kotlin.native.target (required 'mingw_x64')
- Variant 'jvmMacosX64-runtime' capability com.kotlin-imgui:cimgui-jvmmacosx64:0.1.9 declares a runtime of a component:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
- Other compatible attribute:
- Doesn't say anything about org.jetbrains.kotlin.native.target (required 'mingw_x64')
- Variant 'metadata-api' capability com.kotlin-imgui:cimgui-jvmmacosx64:0.1.9 declares a usage of 'kotlin-api' of a component:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'common' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
- Other compatible attribute:
- Doesn't say anything about org.jetbrains.kotlin.native.target (required 'mingw_x64')
> Could not resolve com.kotlin-imgui:cimgui-jvmmingwx64:0.1.9.
Required by:
project :
> No matching variant of com.kotlin-imgui:cimgui-jvmmingwx64:0.1.9 was found. The consumer was configured to find a usage of 'kotlin-api' of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native', attribute 'org.jetbrains.kotlin.native.target' with value 'mingw_x64' but:
- Variant 'jvmMingwX64-api' capability com.kotlin-imgui:cimgui-jvmmingwx64:0.1.9 declares an API of a component:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
- Other compatible attribute:
- Doesn't say anything about org.jetbrains.kotlin.native.target (required 'mingw_x64')
- Variant 'jvmMingwX64-runtime' capability com.kotlin-imgui:cimgui-jvmmingwx64:0.1.9 declares a runtime of a component:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
- Other compatible attribute:
- Doesn't say anything about org.jetbrains.kotlin.native.target (required 'mingw_x64')
- Variant 'metadata-api' capability com.kotlin-imgui:cimgui-jvmmingwx64:0.1.9 declares a usage of 'kotlin-api' of a component:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'common' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
- Other compatible attribute:
- Doesn't say anything about org.jetbrains.kotlin.native.target (required 'mingw_x64')
> Could not find com.kgl:kgl-glfw:0.3-RC1.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/com/kgl/kgl-glfw/0.3-RC1/kgl-glfw-0.3-RC1.pom
- https://maven.pkg.github.com/Dominaezzz/kotlin-imgui/com/kgl/kgl-glfw/0.3-RC1/kgl-glfw-0.3-RC1.pom
Required by:
project :
> Could not find com.kgl:kgl-glfw-static:0.3-RC1.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/com/kgl/kgl-glfw-static/0.3-RC1/kgl-glfw-static-0.3-RC1.pom
- https://maven.pkg.github.com/Dominaezzz/kotlin-imgui/com/kgl/kgl-glfw-static/0.3-RC1/kgl-glfw-static-0.3-RC1.pom
Required by:
project :
> Could not find com.kgl:kgl-opengl:0.3-RC1.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/com/kgl/kgl-opengl/0.3-RC1/kgl-opengl-0.3-RC1.pom
- https://maven.pkg.github.com/Dominaezzz/kotlin-imgui/com/kgl/kgl-opengl/0.3-RC1/kgl-opengl-0.3-RC1.pom
Required by:
project :
> Could not find com.kgl:kgl-glfw:0.3-RC1.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/com/kgl/kgl-glfw/0.3-RC1/kgl-glfw-0.3-RC1.pom
- https://maven.pkg.github.com/Dominaezzz/kotlin-imgui/com/kgl/kgl-glfw/0.3-RC1/kgl-glfw-0.3-RC1.pom
Required by:
project : > com.kotlin-imgui:imgui-glfw:0.1.9 > com.kotlin-imgui:imgui-glfw-mingwx64:0.1.9
> Could not find com.kgl:kgl-opengl:0.3-RC1.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/com/kgl/kgl-opengl/0.3-RC1/kgl-opengl-0.3-RC1.pom
- https://maven.pkg.github.com/Dominaezzz/kotlin-imgui/com/kgl/kgl-opengl/0.3-RC1/kgl-opengl-0.3-RC1.pom
Required by:
project : > com.kotlin-imgui:imgui-opengl:0.1.9 > com.kotlin-imgui:imgui-opengl-mingwx64:0.1.9
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
What am I doing wrong? Would you consider creating a self contained hello-world template in its own github repo? Thx!
Dominaezzz commented
Since you're building a native application, you don't need JVM binaries.
You should remove this,
// For jvm binaries
implementation("com.kotlin-imgui:cimgui-jvmlinuxx64:$imguiVersion")
implementation("com.kotlin-imgui:cimgui-jvmmacosx64:$imguiVersion")
implementation("com.kotlin-imgui:cimgui-jvmmingwx64:$imguiVersion")
You'll want to add github repo to get kgl.
maven("https://maven.pkg.github.com/Dominaezzz/kgl") {
credentials {
username = System.getenv("GITHUB_USER") // Your GitHub username.
password = System.getenv("GITHUB_TOKEN") // A GitHub token with `read:packages`.
}
}
Also, 0.3-RC1
is not a valid version of kgl. Try using 0.1.11
.
Dominaezzz commented
Would you consider creating a self contained hello-world template in its own github repo?
Maybe, when I find time. Create a separate issue for this.
Dominaezzz commented
Looks like you managed to build this in the other issue.