Skip to content

Commit

Permalink
Fix cmake scripts to work with new VS dogfood (dotnet#873)
Browse files Browse the repository at this point in the history
The default layout have changed and so the hardcoding *.dir for the location of .pdb for static libraries does not work anymore
  • Loading branch information
jkotas authored Mar 29, 2021
1 parent 8fe0f54 commit 1e27105
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 26 deletions.
11 changes: 11 additions & 0 deletions eng/native/functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,17 @@ function(install_symbols symbol_file destination_path)
endif()
endfunction()

function(install_static_library targetName destination)
install (TARGETS ${targetName} DESTINATION ${destination})
if (WIN32)
set_target_properties(${targetName} PROPERTIES
COMPILE_PDB_NAME "${targetName}"
COMPILE_PDB_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}"
)
install (FILES "$<TARGET_FILE_DIR:${targetName}>/${targetName}.pdb" DESTINATION ${destination})
endif()
endfunction()

# install_clr(TARGETS TARGETS targetName [targetName2 ...] [ADDITIONAL_DESTINATIONS destination])
function(install_clr)
set(multiValueArgs TARGETS ADDITIONAL_DESTINATIONS)
Expand Down
6 changes: 1 addition & 5 deletions src/coreclr/nativeaot/Bootstrap/base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,4 @@ set(SOURCES

add_library(bootstrapper STATIC ${SOURCES})

# Install the static bootstrapper library
install (TARGETS bootstrapper DESTINATION aotsdk)
if(WIN32)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/bootstrapper.dir/$<CONFIG>/bootstrapper.pdb DESTINATION aotsdk)
endif()
install_static_library(bootstrapper aotsdk)
6 changes: 1 addition & 5 deletions src/coreclr/nativeaot/Bootstrap/dll/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,4 @@ set(SOURCES

add_library(bootstrapperdll STATIC ${SOURCES})

# Install the static bootstrapperdll library
install (TARGETS bootstrapperdll DESTINATION aotsdk)
if(WIN32)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/bootstrapperdll.dir/$<CONFIG>/bootstrapperdll.pdb DESTINATION aotsdk)
endif()
install_static_library(bootstrapperdll aotsdk)
3 changes: 3 additions & 0 deletions src/coreclr/nativeaot/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
<DisableImplicitConfigurationDefines>true</DisableImplicitConfigurationDefines>

<DocumentationFile>$(OutputPath)$(MSBuildProjectName).xml</DocumentationFile>

<!-- Send .deps.json to intermediate directory to avoid polluting published package -->
<ProjectDepsFilePath>$(IntermediateOutputPath)$(MSBuildProjectName).deps.json</ProjectDepsFilePath>
</PropertyGroup>

<PropertyGroup>
Expand Down
8 changes: 2 additions & 6 deletions src/coreclr/nativeaot/Runtime/Full/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,5 @@ add_custom_target(
add_dependencies(Runtime RuntimeAsmHelpers)
add_dependencies(Runtime.ServerGC RuntimeAsmHelpers)

# Install the static Runtime library
install (TARGETS Runtime Runtime.ServerGC DESTINATION aotsdk)
if(WIN32)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/Runtime.dir/$<CONFIG>/Runtime.pdb DESTINATION aotsdk)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/Runtime.ServerGC.dir/$<CONFIG>/Runtime.ServerGC.pdb DESTINATION aotsdk)
endif()
install_static_library(Runtime aotsdk)
install_static_library(Runtime.ServerGC aotsdk)
7 changes: 1 addition & 6 deletions src/coreclr/nativeaot/Runtime/Portable/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,4 @@ add_custom_command(
DEPENDS "${RUNTIME_DIR}/AsmOffsets.cpp" "${RUNTIME_DIR}/AsmOffsets.h"
)

# Install the static Runtime library
install (TARGETS PortableRuntime DESTINATION aotsdk)

if(WIN32)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/PortableRuntime.dir/$<CONFIG>/PortableRuntime.pdb DESTINATION aotsdk)
endif()
install_static_library(PortableRuntime aotsdk)
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
project(System.IO.Compression.Native)

include(../../../../../eng/native/functions.cmake)

if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message(FATAL_ERROR "Binary directory isn't being correctly set before calling Cmake. Tree must be built in separate directory from source.")
endif()
Expand Down Expand Up @@ -122,7 +124,4 @@ if (GEN_SHARED_LIB)
install (FILES $<TARGET_PDB_FILE:System.IO.Compression.Native> DESTINATION .)
endif()

install (TARGETS System.IO.Compression.Native-Static DESTINATION ${STATIC_LIB_DESTINATION})
if(WIN32)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/System.IO.Compression.Native-Static.dir/$<CONFIG>/System.IO.Compression.Native-Static.pdb DESTINATION ${STATIC_LIB_DESTINATION})
endif()
install_static_library(System.IO.Compression.Native-Static ${STATIC_LIB_DESTINATION})

0 comments on commit 1e27105

Please sign in to comment.