Skip to content

Commit 1d871cb

Browse files
committed
Add PDBs to Conan package (#31)
* Add linker flags for RelWithDebInfo configuration [skip_ci] * Copy PDB files to Conan package on Windows Added functionality to copy PDB files to the Conan package for Windows builds.
1 parent 79b2176 commit 1d871cb

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
2929
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd")
3030
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MD")
3131
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD")
32+
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /DEBUG")
3233
endif()
3334

3435
# wrapper for cmake fetch utils

conanfile.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import pathlib
77
import subprocess
88
from rules_support import PluginBranchInfo
9+
from conans import tools
10+
import shutil
911

1012
class PcaPluginConan(ConanFile):
1113
"""Class to package the PcaPluginPlugin using conan
@@ -151,6 +153,17 @@ def package(self):
151153
release_dir,
152154
]
153155
)
156+
157+
# Add the PDB files to the Conan package
158+
if self.settings.os == "Windows":
159+
print("Copying PDBs...")
160+
pdb_dest = pathlib.Path(package_dir, "RelWithDebInfo", "PDBs")
161+
pdb_dest.mkdir()
162+
pdb_files = pdb_files = [p for p in pathlib.Path(self.build_folder).rglob('*') if p.is_file() and p.suffix.lower() == '.pdb']
163+
print("PDB(s): ", pdb_files)
164+
for pfile in pdb_files:
165+
shutil.copy(pfile, pdb_dest)
166+
154167
self.copy(pattern="*", src=package_dir)
155168

156169
def package_info(self):
@@ -159,4 +172,4 @@ def package_info(self):
159172
self.cpp_info.relwithdebinfo.includedirs = ["RelWithDebInfo/include", "RelWithDebInfo"]
160173
self.cpp_info.release.libdirs = ["Release/lib"]
161174
self.cpp_info.release.bindirs = ["Release/Plugins", "Release"]
162-
self.cpp_info.release.includedirs = ["Release/include", "Release"]
175+
self.cpp_info.release.includedirs = ["Release/include", "Release"]

0 commit comments

Comments
 (0)