Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 03b7b31

Browse files
authored
Install binaries that are part of shared framework into separa… (#27841)
* Change the install_clr command to use cmake_parse_arguments to make it easier to extend and easier to read. Add additional install_clr commands to install the files that go into the shared framework into the sharedFramework folder. * Install SOS README. * Collapse conditions. Output message explaining that we're reading the native version out of the native version header so in the case that the header doesn't exist we get something actionable.
1 parent e40384b commit 03b7b31

File tree

28 files changed

+88
-47
lines changed

28 files changed

+88
-47
lines changed

functions.cmake

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -285,27 +285,43 @@ function(strip_symbols targetName outputFilename)
285285
endif(CLR_CMAKE_PLATFORM_UNIX)
286286
endfunction()
287287

288-
function(install_clr targetName)
289-
list(FIND CLR_CROSS_COMPONENTS_LIST ${targetName} INDEX)
290-
if (NOT DEFINED CLR_CROSS_COMPONENTS_LIST OR NOT ${INDEX} EQUAL -1)
291-
strip_symbols(${targetName} strip_destination_file)
292-
293-
# We don't need to install the export libraries for our DLLs
294-
# since they won't be directly linked against.
295-
install(PROGRAMS $<TARGET_FILE:${targetName}> DESTINATION .)
296-
if(WIN32)
297-
# We can't use the $<TARGET_PDB_FILE> generator expression here since
298-
# the generator expression isn't supported on resource DLLs.
299-
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/${targetName}.pdb DESTINATION PDB)
300-
else()
301-
install(FILES ${strip_destination_file} DESTINATION .)
302-
endif()
303-
if(CLR_CMAKE_PGO_INSTRUMENT)
288+
# install_clr(TARGETS TARGETS targetName [targetName2 ...] [DESTINATION destination])
289+
function(install_clr)
290+
set(options "")
291+
set(oneValueArgs DESTINATION)
292+
set(multiValueArgs TARGETS)
293+
cmake_parse_arguments(PARSE_ARGV 0 INSTALL_CLR "${options}" "${oneValueArgs}" "${multiValueArgs}")
294+
295+
if ("${INSTALL_CLR_TARGETS}" STREQUAL "")
296+
message(FATAL_ERROR "At least one target must be passed to install_clr(TARGETS )")
297+
endif()
298+
299+
if ("${INSTALL_CLR_DESTINATION}" STREQUAL "")
300+
set(INSTALL_CLR_DESTINATION ".")
301+
endif()
302+
303+
foreach(targetName ${INSTALL_CLR_TARGETS})
304+
list(FIND CLR_CROSS_COMPONENTS_LIST ${targetName} INDEX)
305+
if (NOT DEFINED CLR_CROSS_COMPONENTS_LIST OR NOT ${INDEX} EQUAL -1)
306+
strip_symbols(${targetName} strip_destination_file)
307+
308+
# We don't need to install the export libraries for our DLLs
309+
# since they won't be directly linked against.
310+
install(PROGRAMS $<TARGET_FILE:${targetName}> DESTINATION ${INSTALL_CLR_DESTINATION})
304311
if(WIN32)
305-
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/${targetName}.pgd DESTINATION PGD OPTIONAL)
312+
# We can't use the $<TARGET_PDB_FILE> generator expression here since
313+
# the generator expression isn't supported on resource DLLs.
314+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/${targetName}.pdb DESTINATION ${INSTALL_CLR_DESTINATION}/PDB)
315+
else()
316+
install(FILES ${strip_destination_file} DESTINATION ${INSTALL_CLR_DESTINATION})
317+
endif()
318+
if(CLR_CMAKE_PGO_INSTRUMENT)
319+
if(WIN32)
320+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/${targetName}.pgd DESTINATION ${INSTALL_CLR_DESTINATION}/PGD OPTIONAL)
321+
endif()
306322
endif()
307323
endif()
308-
endif()
324+
endforeach()
309325
endfunction()
310326

311327
# Disable PAX mprotect that would prevent JIT and other codegen in coreclr from working.

src/ToolBox/SOS/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ if(WIN32)
55
endif(WIN32)
66

77
_install(FILES SOS_README.md DESTINATION .)
8+
_install(FILES SOS_README.md DESTINATION sharedFramework)

src/coreclr/hosts/coreconsole/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ else()
2828
)
2929

3030
# Can't compile on linux yet so only add for windows
31-
install_clr(CoreConsole)
31+
install_clr(TARGETS CoreConsole)
3232

33-
endif(CLR_CMAKE_PLATFORM_UNIX)
33+
endif(CLR_CMAKE_PLATFORM_UNIX)

src/coreclr/hosts/corerun/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ else()
3333
)
3434

3535
# Can't compile on linux yet so only add for windows
36-
install_clr(CoreRun)
36+
install_clr(TARGETS CoreRun)
3737

38-
endif(CLR_CMAKE_PLATFORM_UNIX)
38+
endif(CLR_CMAKE_PLATFORM_UNIX)

src/coreclr/hosts/coreshim/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ target_link_libraries(CoreShim
2222
${STATIC_MT_VCRT_LIB}
2323
)
2424

25-
install_clr(CoreShim)
25+
install_clr(TARGETS CoreShim)

src/coreclr/hosts/osxbundlerun/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ add_dependencies(osxbundlerun
1919
coreclr
2020
)
2121

22-
install_clr(osxbundlerun)
22+
install_clr(TARGETS osxbundlerun)

src/coreclr/hosts/unixcoreconsole/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ if(NOT CLR_CMAKE_PLATFORM_ANDROID)
2929
)
3030
endif()
3131

32-
install_clr(coreconsole)
32+
install_clr(TARGETS coreconsole)

src/coreclr/hosts/unixcorerun/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ if(NOT CLR_CMAKE_PLATFORM_ANDROID)
3030
)
3131
endif()
3232

33-
install_clr(corerun)
33+
install_clr(TARGETS corerun)

src/corefx/System.Globalization.Native/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,6 @@ verify_dependencies(
9292
)
9393

9494
# add the install targets
95-
install_clr(System.Globalization.Native)
95+
install_clr(TARGETS System.Globalization.Native)
96+
install_clr(TARGETS System.Globalization.Native DESTINATION sharedFramework)
9697
install(TARGETS System.Globalization.Native_Static DESTINATION .)

src/debug/createdump/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ target_link_libraries(createdump
4848

4949
add_dependencies(createdump mscordaccore)
5050

51-
install_clr(createdump)
51+
install_clr(TARGETS createdump)

0 commit comments

Comments
 (0)