Skip to content

Commit

Permalink
[11498] updating scripts for CMake 3.17 (#1951)
Browse files Browse the repository at this point in the history
* [11498] updating scripts to CMake upgrade

* [11489] update package scripts for VS2019

* [11489] correcting CMake syntax

* [11489] completely qualify symbols file
  • Loading branch information
MiguelBarro authored May 13, 2021
1 parent 7e12e8f commit bf4bf7b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 12 deletions.
8 changes: 7 additions & 1 deletion cmake/packaging/windows/fastrtps-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,18 @@ if(MSVC_VERSION EQUAL 1900)
else()
include("${CMAKE_CURRENT_LIST_DIR}/../share/fastrtps-i86Win32VS2015/cmake/fastrtps-config.cmake")
endif()
elseif(MSVC_VERSION GREATER 1900)
elseif(MSVC_VERSION LESS 1920)
if(CMAKE_CL_64)
include("${CMAKE_CURRENT_LIST_DIR}/../share/fastrtps-x64Win64VS2017/cmake/fastrtps-config.cmake")
else()
include("${CMAKE_CURRENT_LIST_DIR}/../share/fastrtps-i86Win32VS2017/cmake/fastrtps-config.cmake")
endif()
elseif(MSVC_VERSION GREATER_EQUAL 1920)
if(CMAKE_CL_64)
include("${CMAKE_CURRENT_LIST_DIR}/../share/fastrtps-x64Win64VS2019/cmake/fastrtps-config.cmake")
else()
include("${CMAKE_CURRENT_LIST_DIR}/../share/fastrtps-i86Win32VS2019/cmake/fastrtps-config.cmake")
endif()
else()
message(FATAL_ERROR "Not supported version of Visual Studio")
endif()
37 changes: 26 additions & 11 deletions src/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -470,9 +470,17 @@ elseif(NOT EPROSIMA_INSTALLER)
if(TARGET_TYPE STREQUAL "SHARED_LIBRARY")
# Export symbols in DLL library
target_compile_definitions(${PROJECT_NAME} PUBLIC ${PROJECT_NAME_UPPER}_DYN_LINK)
set_target_properties(${PROJECT_NAME} PROPERTIES
PDB_NAME_DEBUG "${PROJECT_NAME}d-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}"
PDB_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_BINARY_DIR}/symbols"
)
else()
# Rename the library to have a "lib" before.
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME lib${PROJECT_NAME})
set_target_properties(${PROJECT_NAME} PROPERTIES
COMPILE_PDB_NAME_DEBUG "lib${PROJECT_NAME}d-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}"
COMPILE_PDB_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_BINARY_DIR}/symbols"
)
endif()

if("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore")
Expand Down Expand Up @@ -594,19 +602,26 @@ elseif(NOT EPROSIMA_INSTALLER)
)

if(MSVC OR MSVC_IDE)
if(TARGET_TYPE STREQUAL "SHARED_LIBRARY")
# Install pdb files
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Debug/
DESTINATION ${LIB_INSTALL_DIR}${MSVCARCH_DIR_EXTENSION}
COMPONENT libraries${MSVCARCH_EXTENSION}
CONFIGURATIONS Debug
FILES_MATCHING
PATTERN "*.pdb"
)

# first try dll symbols
get_target_property(PDB_FILE ${PROJECT_NAME} PDB_NAME_DEBUG)
if(PDB_FILE)
get_target_property(PDB_DIR ${PROJECT_NAME} PDB_OUTPUT_DIRECTORY_DEBUG)
set(PDB_FILE "${PDB_DIR}/${PDB_FILE}.pdb")
else()
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.dir/Debug/${PROJECT_NAME}.pdb
# fallback to static lib symbols
get_target_property(PDB_FILE ${PROJECT_NAME} COMPILE_PDB_NAME_DEBUG)
if(PDB_FILE)
get_target_property(PDB_DIR ${PROJECT_NAME} COMPILE_PDB_OUTPUT_DIRECTORY_DEBUG)
set(PDB_FILE "${PDB_DIR}/${PDB_FILE}.pdb")
endif()
endif()

# install symbols if any
if(PDB_FILE)
install(FILES ${PDB_FILE}
DESTINATION ${LIB_INSTALL_DIR}${MSVCARCH_DIR_EXTENSION}
COMPONENT libraries${MSVCARCH_EXTENSION}
COMPONENT symbols
CONFIGURATIONS Debug
)
endif()
Expand Down

0 comments on commit bf4bf7b

Please sign in to comment.