Closed pthom closed 4 years ago
Good news that BabylonStudio runs correctly again under emscripten! Thanks for the PR and the extra information!
Hello Pascal,
The changes that were made related to the exports inside the CMake files were not compatible with recent CMake versions (like you can see in the CI for Linux/OSX and Windows).
I could not quickly resolve the issues so I had to restore the CMake files to their previous version to get a functional master branch. I can have a look at them later if needed.
Cheers, Sam
This PR fixes the emscripten build. BabylonStudio now runs correctly again under emscripten.
It should also fix the CI error in SamplesTest.
Notes:
New dependencies
It adds 2 new dependencies:
FunctionalPlus: a header only C++ Functional Programming Library, for which I am a contributor It is not used for now, but can greatly simplify the code to manipulate vector and containers.
fmt: a modern C++ formatting library, which was will be part of C++20. It greatly simplifies string formatting (and replaces printf + iostream::<<)
CMake exports
I disabled the exports inside BabylonCpp/CMakeLists. The original implementation was using old cmake style variables and made it impossible to use transitive dependencies.
We will need to study this subject later, but the current implementation was making it difficult to write concise cmake files.
See commit https://github.com/samdauwe/BabylonCpp/commit/f13bfa4abb06e6ddd174af226c0f2714463d4406
babylon/core/log_trace.h:
It enables to add traces to a cpp file: this is expecially useful for emscripten where debugging via trace is often the most efficient way to debug (alas...)
It is activated manually per cpp file.
In order to use it in a cpp file, you need to 1/
#define BABYLON_LOG_TRACE_ON
and 2/#include <babylon/core/log_trace.h:>
in this file. Then you can use the macrosIn order to disable it for this file, just comment out
#define BABYLON_LOG_TRACE_ON
in this fileWindows dll linking
I had to fight some more in order to solve some dll linking errors under windows.