-
Notifications
You must be signed in to change notification settings - Fork 487
CMake for building the support library #248
base: master
Are you sure you want to change the base?
Conversation
Automated message from Dropbox CLA bot @mknejp, it looks like you've already signed the Dropbox CLA. Thanks! |
Since they're mixed, this will need to wait to be resolved/merged until after #247. This seems like a good idea, but since I don't use CMake myself, I can't really review it in detail. I'd welcome comments from others in the community who do use CMake. Lacking that, I'm relatively willing to merge whatever works for you, then accept further PRs if others try it out and suggest changes. It doesn't look like the new CMake project for the support-lib is actually being referenced by the existing CMakeLists.txt files for the example or test suite. Am I misinterpreting that? It would be valuable for the new file to actually be used by something buildable out of the Djinni repo. Otherwise there will be nothing to ensure they don't break with future changes. |
That's right. My priority was to get the support lib exposed to users first, then worry about adding the test suite later. |
I'd encourage you to go ahead and add some test coverage, lest it break constantly. |
I have tested this and it works :) |
Decoupling PRs is a good idea in my book. |
@mknejp Is it ok to you that I create a PR with the CMakeLists.txt modified to the current djinni structure, or do you want to do that? |
This separation of public and private headers allows users to specify "support-lib/include/" as obvious header search path and then use "#include <djinni/...>" as reliable include prefix. This also gives a sensible default for all the "--xxx-base-lib-include-prefix" values.
What are the status of this one? I think it could be really usefull to build the supportlib with CMake. |
I don't think the |
This has now been adjusted for the changes in #281. |
Adds the target "djinni" with the options DJINNI_WITH_OBJC, DJINNI_WITH_JNI and DJINNI_FRAMEWORK. Sets the cache variable DINNI_RUN_PATH to the location of the "run" generator script.
Update: new option |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sending this back to resolve conflicts and update after #281 is fully resolved (hopefully soon). I'll do another full review after that point.
@mknejp I really would like to see this PR get merged, but it cannot be merged before https://github.com/dropbox/djinni/pull/281… |
I think with #303 merged this isn't needed anymore. Unfortunately I haven't worked on a project that uses Djinni for quite a while now so I don't know if I ever get around to finishing this. |
I have added a
CMakeLists.txt
that allows building the support-lib with CMake. The target name isdjinni
and it comes with a few options:DJINNI_WITH_OBJC
adds the Objective-C support files to the targetDJINNI_WITH_JNI
adds the JNI support files to the targetDJINNI_FRAMEWORK
builds the library as a.framework
on Apple systemsDJINNI_STATIC_LIB
builds Djinni as a static library instead of the default dynamicThere is nothing stopping you from having a single djinni library that contains both language support bindings if you're doing desktop work. The default library type is
SHARED
to make sure theJNI_OnLoad
andJNI_OnUnload
entry points are present. This has led to confusion in the past. If you chose to turnDJINNI_STATIC_LIB
on it is your job to calljniInit()
andjniShutdown()
appropriately.Because the
CXX_STANDARD
property cannot be propagated to consuming targets it needs to be set to >=11
manually there.The cache variable
DJINNI_RUN_PATH
is set to the location of Djinni'srun
script so it can be passed as argument toadd_custom_command()
-based generator scripts.Note this includes the changes of #281 because it depends on its new file structure to make sure building from the repository and from an installed binary are source compatible.