-
-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correcting Cmake files for Windows and Visual Studio, and adding d suffix for the generated library in debug mode #1395
Correcting Cmake files for Windows and Visual Studio, and adding d suffix for the generated library in debug mode #1395
Conversation
…g d suffix for the generated library in debug mode
Thanks @raphaellenain for the PR. Just a quick clarification: doc and dox are two specific targets in the cmake. (Not sure btw if the dox target is oftenly used...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for the PR, I have couple of pending questions concerning your edits. Let’s discsuss about them here ;)
I don't understand the error on Travis ... it's written "canceled", I don't know why ... Any idea ? |
Some admin stuff on Travis side. If you log in on Travis, you can restart the job |
cmake/Common.cmake
Outdated
# ----------------------------------------------------------------------------- | ||
# To distinguish between debug and release lib | ||
# ----------------------------------------------------------------------------- | ||
set(CMAKE_DEBUG_POSTFIX "d") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this also apply on linux/mac builds ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Linux, if we want the indicate the debug or release configuration, the "-DCMAKE_BUILD_TYPE" option has to be added :
- for Debug : "cmake -DCMAKE_BUILD_TYPE=Debug"
- for Release : "cmake -DCMAKE_BUILD_TYPE=Debug" (or "cmake", Release is the default configuration)
With this new line in Common.cmake(set(CMAKE_DEBUG_POSTFIX "d")) : - for Debug configuration, the generated file is libdgtald.so (on Windows : DGtald.lib)
- for Release configuration, the generated file is libdgtal.so (on Windows : DGtal.lib)
For Mac I cannot perform any test, but I imagine it's the same thing than on Linux.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know that but was just wondering if the "d" suffix would also be used by cmake on linux for the dynamic lib construction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which is not standard for me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(and would imply a tweak of the FindDGtal)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm doing some tests for an alternative solution (without changing DGtal Cmake file :-) ). But the 2 errors on Visual studio are "_ITERATOR_DEBUG_LEVEL" and "RuntimeLibrary" : "https://docs.microsoft.com/en-us/cpp/error-messages/tool-errors/linker-tools-error-lnk2038?view=vs-2017"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can edit the cmake if you want (only for MSVC). I don't undrestand why VC complains but not a big deal if that fixes the issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I succeeded compiling my project in Debug mode, referencing the Release version of DGtal.
When creating a new project on Visual Studio, the IDE automatically :
- for the Debug configuration : adds a preprocessor macro "_DEBUG" (--> _ITERATOR_DEBUG_LEVEL = 2), and sets the property "UseDebugLibraries" to true (--> RuntimeLibrary : Debug)
- for the Release configuration : adds a preprocessor macro "NDEBUG" (--> _ITERATOR_DEBUG_LEVEL = 0), and sets the property "UseDebugLibraries" to false (--> RuntimeLibrary : Release)
So compiling in Debug mode, linking to the Release version of DGtal, is possible, changing these configurations, but it's not the default configuration for Visual Studio.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I add the "MSVC" test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
Thanks for the edits. Could you please merge the master to this branch and fix the conflict in |
could you please update the |
👌 |
Thank you for the code review |
thanks to you for the PR. |
PR Description
Adding a debug version of Library (DGtald.lib)
Fixing CMake files for Visual Studio and Windows paths (adding quotes for paths with spaces like "C:/Program Files/DGtal")
Checklist
cmake
mode (otherwise, Travis C.I. will fail).