Closed diegoferigo closed 5 years ago
What's still puzzling me that in Windows everything works only if BUILD_SHARED_LIBS
is turned on. @traversaro any clue?
What's still puzzling me that in Windows everything works only if BUILD_SHARED_LIBS is turned on. @traversaro any clue?
What is strange about that?
You are exporting all symbols in https://github.com/robotology/blockfactory/pull/32/files#diff-af3b638bc2a3e6c650974192a53c7291L92 , so that should work fine with shared libraries unless you have some static variables to export.
For all the file path stuff did you considered to use std:::filesystem
/std::experimental::filesystem
?
For all the file path stuff did you considered to use
std:::filesystem
/std::experimental::filesystem
?
Yes but I was not 100% sure that it would work on all compilers. Do you have any experience?
Yet but I was not 100% sure that it would work on all compilers. Do you have any experience?
Yes, but just in Ubuntu, see https://github.com/robotology/gazebo-fmi/blob/master/.travis.yml . It works fine (with the proper flags, see https://github.com/robotology/gazebo-fmi/blob/733ef7c66cdf8241ab8c91c83fb34148f4716ed7/libraries/private-utils/CMakeLists.txt#L24). Apparently there could be problems on macOS, see https://stackoverflow.com/questions/49577343/filesystem-with-c17-doesnt-work-on-my-mac-os-x-high-sierra/49600206 . It is probably indeed better to avoid it for now.
You are exporting all symbols in https://github.com/robotology/blockfactory/pull/32/files#diff-af3b638bc2a3e6c650974192a53c7291L92 , so that should work fine with shared libraries unless you have some static variables to export.
I didn't get it entirely. The factory test fails on Windows if BUILD_SHARED_LIBS=OFF
, and this means that the plugin is not found / fails to load. But it is something not related to the plugin library itself since it is forced to get compiled as SHARED
:
I still have to figure out what can be the problem.
I didn't get it entirely.
Sorry, I was confused and thought you were surprised that it worked with BUILD_SHARED_LIBS to ON, not that it was not working with BUILD_SHARED_LIBS set to OFF.
Do you think if would be safe setting by default BUILD_SHARED_LIBS=ON
as a non-cache variable, at least on windows?
Do you think if would be safe setting by default BUILD_SHARED_LIBS=ON as a non-cache variable, at least on windows?
Not sure, I would probably just print a clear error if BUILD_SHARED_LIBS set to OFF is used with Windows, setting BUILD_SHARED_LIBS
without the possibility to change it may be counterintuitive w.r.t. to the typical CMake user experience.
@traversaro Addressed all the requested changes
shlibpp
to extend plugin search pathSHLIBPP_PLUGIN_PATH
environment variable insideshlibpp
BLOCKFACTORY_PLUGIN_PATH
environment variable for finding pluginsFactoryUnitTest.cpp
P.s. for the time being I will keep the
shlibpp
changes local to this project. I will open a PR upstream in the future.