Issue
On Windows, debug information is not included as part of the
library/executable itself. It is in a separate pdb file and
is required to be deployed to support debugging for projects
dependent on it.
Resolution
Deploy teh PDB files along side the libraries and binaries.
MODIFY
CMakeLists.txt
CMakeLists.txt
@@ -88,6 +88,9 @@ if(MSVC)
set(CMAKE_CXX_FLAGS_DEBUG
"${CMAKE_CXX_FLAGS_DEBUG} ${TCMALLOC_COMPILE_OPTIONS} /Zc:__cplusplus /W0 /bigobj ${MY_CXX_WARNING_FLAGS}"
)
+ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO
+ "${CMAKE_CXX_FLAGS_RELEASE} ${TCMALLOC_COMPILE_OPTIONS} /Zc:__cplusplus /W0 /bigobj ${MY_CXX_WARNING_FLAGS}"
+ )
set(CMAKE_CXX_FLAGS_RELEASE
"${CMAKE_CXX_FLAGS_RELEASE} ${TCMALLOC_COMPILE_OPTIONS} /Zc:__cplusplus /W0 /bigobj ${MY_CXX_WARNING_FLAGS}"
)
@@ -300,17 +303,20 @@ set_target_properties(surelog PROPERTIES PUBLIC_HEADER "${SURELOG_PUBLIC_HEADERS
add_executable(surelog-bin ${PROJECT_SOURCE_DIR}/src/main.cpp)
set_target_properties(surelog-bin PROPERTIES OUTPUT_NAME surelog)
+
+add_executable(hellosureworld ${PROJECT_SOURCE_DIR}/src/hellosureworld.cpp)
+add_executable(hellouhdm ${PROJECT_SOURCE_DIR}/src/hellouhdm.cpp)
+
if(MSVC)
# We have two files named "surelog.lib" and both getting generated in the lib folder
# One is the surelog.lib generated by the surelog target and the other is the one generated
# becaues of /IMPLIB option when linking the executable. Unfortunately, there is no documented
# way to disable the latter in CMake. So, moving the library to the bin directory (right next to the exe)
set_target_properties(surelog-bin PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
+ set_target_properties(hellouhdm PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
+ set_target_properties(hellosureworld PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
endif()
-add_executable(hellosureworld ${PROJECT_SOURCE_DIR}/src/hellosureworld.cpp)
-add_executable(hellouhdm ${PROJECT_SOURCE_DIR}/src/hellouhdm.cpp)
-
target_link_libraries(surelog-bin PUBLIC surelog)
target_link_libraries(surelog PUBLIC antlr4_static)
target_link_libraries(surelog PUBLIC flatbuffers)
@@ -518,3 +524,20 @@ install(
${PROJECT_SOURCE_DIR}/src/Expression/Expr.h
${PROJECT_SOURCE_DIR}/src/Expression/Value.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/surelog/Expression)
+
+if (WIN32)
+ install(
+ FILES $<TARGET_PDB_FILE:surelog-bin>
+ ${Python3_RUNTIME_LIBRARY_DIRS}/python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}$<$<CONFIG:Debug>:_d>.dll
+ DESTINATION ${CMAKE_INSTALL_BINDIR})
+ install(
+ FILES ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/surelog.dir/surelog.pdb
+ ${FlatBuffers_BINARY_DIR}/CMakeFiles/flatbuffers.dir/flatbuffers.pdb
+ ${LIBANTLR4_BINARY_DIR}/runtime/CMakeFiles/antlr4_static.dir/antlr4_static.pdb
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/surelog)
+ install(
+ FILES ${UHDM_BINARY_DIR}/CMakeFiles/uhdm.dir/uhdm.pdb
+ ${UHDM_BINARY_DIR}/third_party/capnproto/c++/src/capnp/CMakeFiles/capnp.dir/capnp.pdb
+ ${UHDM_BINARY_DIR}/third_party/capnproto/c++/src/kj/CMakeFiles/kj.dir/kj.pdb
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/uhdm)
+endif()

Issue
On Windows, debug information is not included as part of the
library/executable itself. It is in a separate pdb file and
is required to be deployed to support debugging for projects
dependent on it.

Resolution
Deploy teh PDB files along side the libraries and binaries.