I’m experimenting with WebRTC in Defold using the libdatachannel library in a native extension. Its build process seems rather complicated, as far as I understand the Defold’s extender has no support for CMake or anything like that. So I’m trying to build libdatachannel as a static library.
Despite the conflicts with Defold’s version of mbedtls, I have a working prototype on Linux. Now I want to build it for Windows as well.
To achieve maximum portability, I believe it’s necessary to reproduce the extender’s build environment precisely. What compiler should I use? What MSVC version to target? Is it better to build on Windows or should cross-compilation on Linux work as well?
Any suggestions for a smooth portable compilation pipeline are much appreciated.
Regarding the mbedtls
conflict, I’ve opened a separate issue on Defold’s GitHub. The solution proposed there seems promising. I’ll post an update there once I try it out soon.
This is, however, only a small part of my initial question. Fundamentally, I’m still very interested in ways to portably compile a large C++ project as a Windows static library for a Native Extension.
What build environment and compiler should I choose? What build environment and compiler does Defold use when building a Defold project for Windows?
The engine versions included in each release are built using GitHub Actions:
For Windows builds we use windows-latest
which at the moment happens to be Windows Server 2022:
We build using a prepackaged tool chain from Visual-Studio 2022 14.37.32822:
For setting things up yourself also see instructions here:
@britzl thank you, this is very insightful! For some reason, I haven’t thought of checking the build instructions for the engine itself.
Is this essentially the same build environment that Defold’s Extender uses when compiling Native Extensions? Presumably, that one I should actually target.
Yes, they are indeed very similar. But remember that many native extensions comes with precompiled libraries and we have no control over how they were created. You do not have to be super strict about getting everything exactly the same.