Skip to content

Commit 8058c47

Browse files
authored
Add PDBs to Conan package (#35)
* Add debug information to linker flags for RelWithDebInfo * Implement PDB file copying for Windows builds Added functionality to copy PDB files for RelWithDebInfo builds on Windows. * Fix indentation for PDB copying on Windows
1 parent 75ecf1c commit 8058c47

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

cmake/MSVCSettings.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ if(MSVC)
33
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd")
44
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MD")
55
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD")
6-
6+
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /DEBUG")
77
set(CMAKE_CXX_FLAGS_RELEASE_INIT "/GL")
88
set(CMAKE_SHARED_LINKER_FLAGS_INIT "/LTCG:PGOptimize")
99

@@ -15,4 +15,4 @@ if(MSVC)
1515
else()
1616
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD")
1717
endif()
18-
endif(MSVC)
18+
endif(MSVC)

conanfile.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
import pathlib
66
import subprocess
77
from rules_support import PluginBranchInfo
8-
8+
from conans import tools
9+
import shutil
910

1011
class HDF5LoaderConan(ConanFile):
1112
"""Class to package the HDF5Loader plugin using conan
@@ -160,6 +161,19 @@ def package(self):
160161
release_dir,
161162
]
162163
)
164+
165+
# Add the pdb files next to the libs for RelWithDebInfo linking
166+
if self.settings.os == "Windows":
167+
print("Copying PDBs...")
168+
pdb_dest = pathlib.Path(package_dir, "RelWithDebInfo", "PDBs")
169+
pdb_dest.mkdir()
170+
171+
pdb_files = pdb_files = [p for p in pathlib.Path(self.build_folder).rglob('*') if p.is_file() and p.suffix.lower() == '.pdb']
172+
print("PDB(s): ", pdb_files)
173+
174+
for pfile in pdb_files:
175+
shutil.copy(pfile, pdb_dest)
176+
163177
self.copy(pattern="*", src=package_dir)
164178

165179
def package_info(self):
@@ -168,4 +182,4 @@ def package_info(self):
168182
self.cpp_info.relwithdebinfo.includedirs = ["RelWithDebInfo/include", "RelWithDebInfo"]
169183
self.cpp_info.release.libdirs = ["Release/lib"]
170184
self.cpp_info.release.bindirs = ["Release/Plugins", "Release"]
171-
self.cpp_info.release.includedirs = ["Release/include", "Release"]
185+
self.cpp_info.release.includedirs = ["Release/include", "Release"]

0 commit comments

Comments
 (0)