diff --git a/README.md b/README.md index a4cfc8f..0f9e128 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ Makes a ZIP with all the licenses from the graph #### [PDBs](extensions/hooks/_hook_copy_pdbs_to_package.py) -Post pacakge hook that copies PDBs to the package folder. +Post package hook that copies PDBs to the package folder. ### Testing diff --git a/extensions/hooks/README.md b/extensions/hooks/README.md index 9c65168..e3da170 100644 --- a/extensions/hooks/README.md +++ b/extensions/hooks/README.md @@ -1,3 +1,16 @@ +## Installing hooks + +To install just the hooks from this repository, without the other extensions, use the command: + +`conan config install https://github.com/conan-io/conan-extensions.git -sf=extensions/hooks -tf=extensions/hooks` + +The hooks are named so they won't be run by default, so we need to change the name of the hook +we want to use to start with `hook_`. As explained in the +[hooks documentation](https://docs.conan.io/2/reference/extensions/hooks.html). +To locate the path where the hook was placed, run the command `conan config home` to find +your local cache path and go to the `extensions/hooks` folder to rename the desired hook. Be aware that +the hooks will run everytime they are called unless disabled, which can be done by renaming the hook back to start with `_hook_`. + ## PDBs hook This hook copies the PDBs from their original location in the build folder to the package folder. This is required for debugging libraries with Visual Studio when the original source files aren't present. @@ -9,8 +22,8 @@ A PDB has the information to link the source code of a debuggable object to the specific file (executable or library) and contains the source file name and line numbers to display in the IDE. When compiling shared libraries in Debug mode the created binary will contain the information of where the PDB will be -generated, which by default is the same path where the file is being compiled. The PDBs are created by the ``cl.exe`` -compiler with the ``/Zi`` flag, or by the ``link.exe`` when linking a DLL or executable. +generated, which by default is the same path where the file is being compiled. The PDBs are created by the `cl.exe` +compiler with the `/Zi` flag, or by the `link.exe` when linking a DLL or executable. PDBs are created when compiling a library or executable in Debug mode and are created by default in the same directory as the file it is associated with. This means that when using Conan they will be created in the build directory in the @@ -24,10 +37,9 @@ When using the Visual Studio debugger, it will look for PDBs to load in the foll ### Locating PDBs -To locate the PDB of a DLL we can use the ``dumpbin.exe`` tool, which comes with Visual by default and can be located -using the ``vswhere`` tool. PDBs will usually have the same name as it's -DLL, but it's not always the case, so checking with the ``dumpbin \PDBPATH`` command makes sure we are getting the PDB -corresponding to each DLL. +To locate the PDB of a DLL we can use the `dumpbin.exe` tool, which comes with Visual by default and can be located +using the `vswhere` tool. PDBs will usually have the same name as its DLL, but it's not always the case, so checking +with the `dumpbin \PDBPATH` command makes sure we are getting the PDB corresponding to each DLL. When a DLL is created it contains the information of the path where its corresponding PDB was generated. This can be manually checked by running the following commands: @@ -57,4 +69,4 @@ folder can be used instead by telling Visual where to find them, as it is explai PDBs can sometimes be generated for LIB files, but for now the feature only focuses on shared libraries and will only work with PDBs generated for DLLs. This is because the linking of PDBs and static libraries works differently than with shared libraries and the PDBs are generated differently, which doesn't allow us to get the name and path -of a PDB through the ``dumpbin`` tool and will require different methods. +of a PDB through the `dumpbin` tool and will require different methods. diff --git a/extensions/hooks/_hook_copy_pdbs_to_package.py b/extensions/hooks/_hook_copy_pdbs_to_package.py index 88238f5..15a0364 100644 --- a/extensions/hooks/_hook_copy_pdbs_to_package.py +++ b/extensions/hooks/_hook_copy_pdbs_to_package.py @@ -4,7 +4,7 @@ import os import re from io import StringIO -from conans.errors import ConanException +from conan.errors import ConanException def post_package(conanfile):