Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I change javacppPlatform at runtime? #24

Open
zxdposter opened this issue Jul 7, 2022 · 5 comments
Open

How can I change javacppPlatform at runtime? #24

zxdposter opened this issue Jul 7, 2022 · 5 comments
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@zxdposter
Copy link

I want use macosx-x86_64 on run application, but use linux-x86_64 when package.

These way seems not working.

    parent?.ext?.set("javacppPlatform", "linux-x86_64")
    println(parent?.ext?.get("javacppPlatform"))
    implementation(group = "org.bytedeco", name = "javacpp")
    implementation(group = "org.bytedeco", name = "ffmpeg-platform")
    implementation(group = "org.bytedeco", name = "javacv")

or

tasks {
    "war"(War::class) {
        first {
            parent?.ext?.set("javacppPlatform", "linux-x86_64")
            println(parent?.ext?.get("javacppPlatform"))
            true
        }
        enabled = true
    }
}
@saudet
Copy link
Member

saudet commented Jul 7, 2022

Setting the extra property as shown in the README.md file doesn't work??
https://github.com/bytedeco/gradle-javacpp#the-platform-plugin

@zxdposter
Copy link
Author

@saudet yes it work, I already used with macosx-x86_64, but I want change when some task run such as package task.

@saudet
Copy link
Member

saudet commented Jul 7, 2022

It won't work if you set it after Gradle has resolved the dependencies. You need to make sure to set it before that happens.

@zxdposter
Copy link
Author

yes, I noticed that, so I want find a way to solve, have any suggestions?

@saudet saudet added help wanted Extra attention is needed question Further information is requested labels Jul 7, 2022
@saudet
Copy link
Member

saudet commented Jul 7, 2022

One way to do that kind thing would be to split your project into multiple subprojects. Then we can do anything we need in the parent project, and only call the subproject for that package task, where we can set javacppPlatform early before it resolves its dependencies.

atsushieno added a commit to atsushieno/rtmidi-javacpp that referenced this issue May 27, 2023
… samples.

This does not really help resolving dependencies to incorrect platform-
specific libs e.g. it tries to resolve rtmidi-javacpp-macos-x86_64 even
on linux-x86_64 host.
Looks like bytedeco/gradle-javacpp#24 is a
relevant issue, but it seems unresolved forever.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants