You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Decide if the project use Maven, Gradle or something else
Note, some early work for Maven support is available in 2.8.1-experimental branch, authored kindly by @vogt31337
Decide if we keep cmake or do we leverage Maven's native build capabilities directly
// edit by @bmhm: As discussed, we stick to cmake because of MacOS builds
Note, the temporarily cmake branch has a boilerplate for native and cross-compiling. This will be merged back into mainline once the above decisions are made.
Further TODO for the maven-cmake-branch:
move the java parts to src/main/java
restructure into submodules, so there can be multiple build jobs (one for each platform).
find and replace hardcoded occurrences of linux_64.
ask @tresf or @woodrowbarlow how to fix that UnsatisfiedLinkError in my previous comment.
I converted some directories to the maven standard directory layout. If you haven't seen it before, please take a quick look.
Built files go to target/ and get removed on a clean build (mvn clean install).
JDK compatiblity
I set some properties to force java 1.6, as requested. javah does not exist in JDK 9 updwards, so I had to add a profile where the maven compiler plugin does this job instead.
cmake invocation
cmake can only generate headers from jar files, which doesn't help us very much. We had to repackage the jar. So I decided to let maven do all the stuff it can do nicely first (executing cmake-generate, compiling, generating headers), then executing cmake-compile. This seems to work nicely.
^-- This has FIXMES in the code. We'll do this eventually but we'd like to move over open PRs before we do any major refactoring. This is a followup task.
restructure into submodules, so there can be multiple build jobs (one for each platform).
This concern is still valid, but has less to do with the build system and more to do with how we store the binaries.
Choose a build system
We've chosen maven for now. WIP is happening in a few branches until they're merged to master. For now, see #14 and #18. They should be merged to master as soon as humanly possible. 😄
Activity
bmarwell commentedon Mar 27, 2019
As discussed, I based a new example on the existing
cmakebranch authored by @woodrowbarlow. You can find it here:https://github.com/java-native/java-simple-serial-connector/tree/maven-cmake
Caveats
I added a test, but it crashes with
java.lang.UnsatisfiedLinkError: jssc.SerialNativeInterface.getNativeLibraryVersion()Ljava/lang/String;Although the method exists:
Generated files
I deleted all generated files (
.so,.dll,.h, etc.).I found that there was a manually added line in the
.hfile by @scream3r:Meaning it wasn't truly generated after all.
Directory structure
I converted some directories to the maven standard directory layout. If you haven't seen it before, please take a quick look.
Built files go to
target/and get removed on a clean build (mvn clean install).JDK compatiblity
I set some properties to force java 1.6, as requested.
javahdoes not exist in JDK 9 updwards, so I had to add a profile where the maven compiler plugin does this job instead.cmakeinvocationcmakecan only generate headers from jar files, which doesn't help us very much. We had to repackage the jar. So I decided to let maven do all the stuff it can do nicely first (executing cmake-generate, compiling, generating headers), then executing cmake-compile. This seems to work nicely.native-lib-loader
I started using https://github.com/scijava/native-lib-loader because it has some sane fail-safes and is well tested.
cmakewill put it's files totarget/classes/META-INF/lib/<platform>/libjssc.<ext>accordingly, so native-lib-loader can find them.Work towards #4 and replace the cmake-maven-plugin with the maven-ant…
tresf commentedon Apr 5, 2019
^-- This has FIXMES in the code. We'll do this eventually but we'd like to move over open PRs before we do any major refactoring. This is a followup task.
This concern is still valid, but has less to do with the build system and more to do with how we store the binaries.
We've chosen maven for now. WIP is happening in a few branches until they're merged to master. For now, see #14 and #18. They should be merged to
masteras soon as humanly possible. 😄