Development sources in project
See original GitHub issueVisual Studio project files, and likely others, can potentially include sources and PDBs for dependencies. While some packages have PDBs, none have sources. This is understandable, since typically if you are building a package you do not need sources or documentation, but for people using conan packages during development the requirements are different. I am a fan of #1377, which helps in this regard. It is also ideal to have the sources automatically linked to, in this case, the VS Project file after running conan build
.
One example is that I had to debug an application which used Qt, and the package I was using was from a repository rather than a local build where I could grab the source. If there was a source component linked to the same package version I could optionally download as a developer and link into the build projects or use a generator to make a text file with the source directory, it would definitely improve my quality of life and efficiency as a developer. I understand that C++ has always had issues with things like this, especially on windows, and that Conan is novel, but other languages often already have solved this in various ways. Obviously, no alternative exists that can do this for C++ on Windows, but it is definitely a concerning issue from my perspective.
TL;DR
- Need components which live on repositories that are linked to their versioned package counterparts.
- Need source component which provides the exact source used to produce the package for debugging purposes.
- Need a generator to output the source directories of all dependencies to a text file.
- Need to hook the source directories, if used, into Visual Studio project files and others if the capability exists.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:25 (17 by maintainers)
Here are some helper functions that I include in all my recipes. The usage is very simple: just invoke
patch_pdb(self)
in thepackage
method or your recipe. In your project’s conanfile, you should import all the pdb files, so that they end up located next to their respective dlls. If the sources of a Conan package exist in the standard location (~/.conan/data/MyLib/1.0/me/stable/source
), then Visual Studio will be able to step into the library code showing the source files.This code relies on the Microsoft tools
pdbstr.exe
andsrctool.exe
.I’d like to do the same for GDB at some point. It seems that this could be achieved by creating a
.gdbinit
file, contaning multipleset substitute-path
commands.No, sorry for the confusion. This quote was not about your comment, but about the original request by @vadixidav, or at least as I understand it. My comprehension of his proposal is the introduction of a “source package” alongside the existing “binary package”, that could be optionally installed by a developer (“If there was a source component linked to the same package version I could optionally download as a developer…”). This “source package” would certainly be created by a recipe method similar to
package
, maybepackage_sources
, that would produce an independant artifact uploadable to a Conan server.I tried to understand the proposal in your comment, reading the content of the zip, but I fail to understand the approach. I don’t know anything to CMake, so maybe that’s the problem 😃