Comments (8)
Hi, thanks for the detailed report, now I finally understand why this is needed. Personally, on Linux, I did not come across such linking issues, thus I did not have any need for distinction between debug and release libs.
Related to #20.
from magnum.
Done in 1e6e4c3 and 5101e3a and similarly also in Corrade and other projects. Debug libraries are installed with -d
suffix, plugins are slightly more complicated, but hopefully I explained it in the docs clearly enough :-) As with all other build system changes, you need to update FindCorrade.cmake
and FindMagnum.cmake
CMake modules in your projects in order to properly find the renamed libraries. Other than that, from user perspective the usage is still the same and everything is done automagically by CMake behind the scenes.
These changes are now also merged into compatibility
branch to make them usable with MSVC. I did some testing and the debug/release distinction seems to work flawlessly, please report if you find any issues.
from magnum.
Thanks it now seems to work.
Although i still had a problem while doing "textured triangle" tutorial: configure.h was generated only once at the beginning, so MAGNUM_PLUGINS_DIR define always pointed to the same directory. I think it would be better to write both release and debug plugin directories to the configure.h file and choose one of them via C preprocessor.
from magnum.
Yeah, dynamic plugins are still an issue, I failed to find any acceptable solution. The easiest (but still annoying) one is to specify the plugin directory at runtime (e.g. via command-line parameter).
The problem is (as far as I know) that CMake by default doesn't provide any usable information which could be handled via preprocessor -- the CMAKE_INTDIR
preprocessor token (which, to make everything even worse, is defined only when Visual Studio or XCode is used) is set to string containing "Debug"
or "Release"
, thus I would still need to decide on it at runtime, which is definitely not something I would want to have in example code:
#ifdef CMAKE_INTDIR
std::string pluginDir;
if(std::string{CMAKE_INTDIR}.find("Debug") != std::string::npos)
pluginDir = MAGNUM_PLUGINS_IMPORTER_DEBUG_DIR;
else
pluginDir = MAGNUM_PLUGINS_IMPORTER_RELEASE_DIR;
#else
const std::string pluginDir{MAGNUM_PLUGINS_IMPORTER_DIR};
#endif
I'll try to look deeper into this, maybe it would be possible to create some CMake macro which would produce actually usable preprocessor information.
from magnum.
Oh, apparently there is COMPILE_DEFINITIONS_<CONFIG>
per-target property, which could be used to do exactly what we need, in a cross-platform way:
add_executable(myexe main.cpp)
set_target_properties(myexe PROPERTIES COMPILE_DEFINITIONS_DEBUG "-DOH_YEAH_WE_HAVE_DEBUG_BUILD")
and then, as you suggested, in the configuration file decide about that using preprocessor:
#ifdef OH_YEAH_WE_HAVE_DEBUG_BUILD
#define MAGNUM_PLUGINS_IMPORTER_DIR "${MAGNUM_PLUGINS_IMPORTER_DEBUG_DIR}"
#else
#define MAGNUM_PLUGINS_IMPORTER_DIR "${MAGNUM_PLUGINS_IMPORTER_RELEASE_DIR}"
#endif
But I still find this slightly annoying and not exactly intuitive and straightforward. Actually, it would be excellent if CMake provided something like OH_YEAH_WE_HAVE_DEBUG_BUILD
by default, but I can't find any documentation on preprocessor macros provided by CMake.
from magnum.
i would think there are already some things that compiler defines automatically like _DEBUG in VS(i don't know if gcc has them), so i guess one could use it.
from magnum.
GCC has NDEBUG
, which is not defined automatically by the compiler, but rather by the build system. Thus it is possible to have build with debug info and NDEBUG
defined, so it is unreliable. Other than that there are apparently no differences in preprocessor symbols when building with or without debug info, the same goes for Clang.
If I won't find anything better I'll probably settle for global preprocessor definition set by Corrade (similarly as it now sets global compiler flags), which could be then used in depending projects instead of setting the property manually every time:
set_property(GLOBAL APPEND COMPILE_DEFINITIONS_DEBUG "-DCORRADE_DEBUG_BUILD")
from magnum.
Completed in mosra/corrade@5f49374, e41f4c4 and mosra/magnum-examples@79532ed. Plugin-using examples should now just work in both Debug and Release builds.
from magnum.
Related Issues (20)
- few compile warnings HOT 1
- How to point to a local installation of `corrade` without using the bootstrap project? HOT 3
- undefined symbol: flextGLInit HOT 4
- Image rendered in gray since 1847c72 HOT 18
- Emscripten 3.1.21+ crashes EmscriptenApplication: "AsciiToString is not defined" HOT 4
- How to build from source on MSYS2 MINGW64? HOT 1
- keyReleaseEvent not triggered after printscreen on OSX HOT 6
- Conversion from CubicHermite to Bezier is wrong
- Mixing with raw openGL calls and Context::current().resetState() HOT 3
- C Bindings HOT 5
- WebGPU backend HOT 2
- Parallel rendering with glb files HOT 5
- Conflict with near and far Macros When Including WinSock2.h After Matrix4.h HOT 2
- emsdk compile error: typedef redefinition with different types HOT 4
- Memory leak when destroying GL::Mesh HOT 3
- Linking in Emscripten >= 3.1.52 doesn't work HOT 4
- Some trouble with LineGL3D shader when camera is close HOT 1
- Segmentation fault with nullptr instruction in AbstractShaderProgram at Cross-Compile HOT 21
- Apply MAGNUM_BUILD_STATIC_UNIQUE_GLOBALS for the flextGL globals as well HOT 4
- EmscriptenApplication keyboard handler doesn't send key event corresponding to text input events HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from magnum.