djinni
djinni copied to clipboard
Add Windows Phone (C++/Cx) support
The code in this PR is over a year old. I don't rightly know how hard this is going to be to merge. I imagine it's not going to be easy—there'll be changes that need to be made. Let's talk! I'm ready to finally get this in.
Automated message from Dropbox CLA bot
@DEGoodmanWilson, thanks for the pull request! It looks like you haven't yet signed the Dropbox CLA. Please sign it here.
Automated message from Dropbox CLA bot
@DEGoodmanWilson, thanks for signing the CLA!
@DEGoodmanWilson have you seen the blog MS released this morning? I know it is early, but would this change your thinking or do you think Cx is still a valid way to go? https://blogs.windows.com/buildingapps/2016/11/28/standard-c-windows-runtime-cwinrt
Well, that's pretty darned cool! I like Cx OK, but it's got its quirks (and was a huge step up on CLI), but this looks very very promising. That said, in the end, if you are developing with .NET assemblies, you might not care how those assemblies were built, and to the end user of djinni it might not make a whole lot of diffference, since all of the Cx code is auto-generated, So…
(Also, I know I need to clean up the commit history a bit here! This was many months of effort, and there are some extraneous commits I need to remove from the PR)
I was actually about to start working on this but this looks pretty far along! I'm probably not the best person to fix the conflicts (I'm not even sure how since I definitely don't have write access) but I'd be happy to assist if possible. At the very least I could probably test this against our code base and see how that flies.
We'd love to see this as well and I offer to help. We use djinni a lot and our C++ parts run on Windows as well - can try this branch with our setup as a larger test case once it's rebased - if that helps.
@steipete I've got this refactored so only the relevant contributions—and only my contributions—are included. I can't see what the conflicts are, curiously. Git is not cooperating today. Anyway, would absolutely love your feedback.
For anyone else trying this out here are a few hints to get the example generating code you can use in a Visual Studio project to build a WinRT component called MyComponent
that bridges your native C++ with the managed languages, C# etc.
I added this to run_djinni.sh
cxcpp_out="$base_dir/generated-src/cxcpp"
cx_out="$base_dir/generated-src/cx"
...
--cpp-namespace MyComponent_CPP \
...
--cxcpp-out "$temp_out/cxcpp" \
--cx-out "$temp_out/cx" \
--cx-namespace MyComponent \
--cxcpp-namespace MyComponent_CXCPP \
--cpp-include-prefix "generated-src/cpp/" \
--cx-include-prefix "generated-src/cx/" \
--cxcpp-include-prefix "generated-src/cxcpp/" \
--cxcpp-include-cpp-prefix "generated-src/cpp/" \
...
mirror "cxcpp" "$temp_out/cxcpp" "$cxcpp_out"
mirror "cx" "$temp_out/cx" "$cx_out"
You need different namespaces for cx
, cpp
and cppcx
or you will have problems in your WinRT component. The cx
namespace should be the same as the name of your component.
In example.djinni
textbox_listener = interface +x {
In handwritten-src/cpp/sort_items_impl.hpp
#include "generated-src/cpp/sort_items.hpp"
#include "generated-src/cpp/textbox_listener.hpp"
namespace MyComponent_CPP {
In handwritten-src/cpp/sort_items_impl.cpp
namespace MyComponent_CPP {