After LuxCore got a more liberal license to also be integrated into commercial products I would like to give it a try.
Right now I use a modified version of yafaray to render photorealistic images which is quite closely integrated into my app.
My first idea was to use the LuxCore SDK but it was not what I expected to find inside a SDK. I was more looking for the 'classic' headers, libs and binaries style SDK.
Then I cloned the three repos named in the WindowCompile repo. This worked so far but I cannot use the created debug libraries because all project miss the _DEBUG define (by intension?) which leads to incompatible STL debug levels and CRTs in Visual Studio.
I started to fix all used packages but this is a lot of work which must be done again if a library is updated and more important many feature won't be used like reading images from disk. I have all of them in memory already.
So my questions are:
- Is there a reason why _DEBUG is missing (besides horribly slowing down the code)?
- Would it be possible or a good idea to extract the image handling to a separate library which can be 'injected' via an interface to minimize the dependencies of the rendering core code?
- What is the purpose behind the LuxCore SDK, how is it intended to be used?
- Are threre any experiences how to tightly integrate LuxCore into an application or recommendations how to proceed?
Any help is appreciated. Thanks in advance.
Adding LuxCore to own application
Re: Adding LuxCore to own application
I downloaded the SDK archive and I noticed is incorrectly packed, 2 files (include\luxcore\cfg.h and include\luxcore\luxcore.h) were missing. You can download a correctly packed SDK from the very latest sources from this link: https://drive.google.com/file/d/1iwu3uy ... sp=sharing
It is even better if you compile the SDK package on your own. It requires only 3 commands as described in https://github.com/LuxCoreRender/Window ... README.txt
Code: Select all
cd C:\Path\to\luxcorerender\WindowsCompile\
.\cmake-build-x64.bat /dll
create-sdk.bat
For an example of how use the API, check the samples directory, for instance: https://github.com/LuxCoreRender/LuxCor ... onsole.cpp
The API documentation is available in Doxygen format inside the luxcore.h: https://github.com/LuxCoreRender/LuxCor ... /luxcore.h
It is cmake to generate the VisualStudio Project. Once you have run the "cmake-build-x64.bat", you can directly open the VisualStudio project at "C:\Path\to\WindowsCompile\Build_CMake\LuxCore\LuxRays.sln"
You can than switch between "Release" and "Debug" configurations inside VS and build the version you are looking for. You can also compile the "Debug" version instead of the "Release" by using the "/debug" option of cmake-build-x64.bat script.
I assume, you were using the "Release" (i.e. the default version) so it was the reason why "_DEBUG" wasn't defined.
It is all packed inside the luxcore.dll (see below) so it shouldn't be a problem.
At the very core, it is just LuxCore compiled as DLL instead as static library so your app will not need to be linked again all libraries LuxCore needs. You have to link only with luxcore.lib and nothing else.
The only real and public application developed over LuxCore up to now is BlendLuxCore, the plugin for Blender (but it is written in python).
Re: Adding LuxCore to own application
Thanks for your help. Using a DLL is much easier.
I built luxcore myself again as you suggested with .\cmake-build-x64.bat luxcore /dll /debug but the define _DEBUG is still missing in debug config. Also the C++ runtime is set to ReleaseDynamic instead of DebugDynamic. I can of course fix this manually but this will not solve the problem with the external dependencies referenced from lux projects like boost. They are also build without _DEBUG setting and against Release CRT. This would imply to also build all dependencies myself which is quite some work to do. Is there an easier solution?
I also use boost in my project. Maybe I can switch the used boost libs to my debug build. At the moment I am not sure whether boost is the only affected lib.
Does none of the lux developers use a debug config on Windows?
I built luxcore myself again as you suggested with .\cmake-build-x64.bat luxcore /dll /debug but the define _DEBUG is still missing in debug config. Also the C++ runtime is set to ReleaseDynamic instead of DebugDynamic. I can of course fix this manually but this will not solve the problem with the external dependencies referenced from lux projects like boost. They are also build without _DEBUG setting and against Release CRT. This would imply to also build all dependencies myself which is quite some work to do. Is there an easier solution?
I also use boost in my project. Maybe I can switch the used boost libs to my debug build. At the moment I am not sure whether boost is the only affected lib.
Does none of the lux developers use a debug config on Windows?
Re: Adding LuxCore to own application
I'm a *nix user so I'm not very familiar with all Windows related intricacies but why do you need to compile LuxCore DLL in debug mode ?Ernest wrote: ↑Sun Mar 31, 2019 10:35 pm I built luxcore myself again as you suggested with .\cmake-build-x64.bat luxcore /dll /debug but the define _DEBUG is still missing in debug config. Also the C++ runtime is set to ReleaseDynamic instead of DebugDynamic. I can of course fix this manually but this will not solve the problem with the external dependencies referenced from lux projects like boost. They are also build without _DEBUG setting and against Release CRT. This would imply to also build all dependencies myself which is quite some work to do. Is there an easier solution?
Can't you link your app compiled in debug mode with a DLL compiled in release mode ?
We probably need some help from @Acasta69 for this Windows related stuff.
Re: Adding LuxCore to own application
I was also wondering about that...
Actually I never had the need to build LuxCore in debug mode.
There could be something to be modified in the cmake config, I remember I did that once for the old Luxrender, but it was long time ago. I'll try to look into that later.
But I also remember that building dependencies in debug mode was not needed at all, at least in that case...
If you need debug deps, you'll have to build them yourself. There are a couple of scripts in the WindowsCompile repo that could help you doing that: getdeps.bat downloads required deps and build-deps-x64.bat builds them in release mode.
Maybe you could try modifying build-deps-x64.bat to build only boost in debug mode.
Re: Adding LuxCore to own application
Just FYI:
Linking against release build succeeds but crashes at the first luxcore call with std::string as a parameter (as I expected).
Would be interesting to know how this can work for @Acasta69 except everything is compiled without _DEBUG and against release runtime.
I already created a debug build for boost but I think several other libs will follow (e.g Half.lib)
Linking against release build succeeds but crashes at the first luxcore call with std::string as a parameter (as I expected).
Would be interesting to know how this can work for @Acasta69 except everything is compiled without _DEBUG and against release runtime.
I already created a debug build for boost but I think several other libs will follow (e.g Half.lib)
Re: Adding LuxCore to own application
I've just built with
Code: Select all
cmake-build-x64.bat /dll /debug
create-sdk.bat
I'm not sure if this is enough to answer your question.