From: Jeremy Koritzinsky Date: Wed, 13 Nov 2019 00:18:18 +0000 (-0800) Subject: Install binaries that are part of shared framework into separa… (dotnet/coreclr#27841) X-Git-Tag: submit/tizen/20210909.063632~11030^2~23 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e6d3afb98d4a690c2cfe4afecfc8f998c499d864;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Install binaries that are part of shared framework into separa… (dotnet/coreclr#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. Commit migrated from https://github.com/dotnet/coreclr/commit/03b7b318ab6641c20baeb37f963c4599a97d9276 --- diff --git a/src/coreclr/functions.cmake b/src/coreclr/functions.cmake index 14d376d..ed2961d 100644 --- a/src/coreclr/functions.cmake +++ b/src/coreclr/functions.cmake @@ -285,27 +285,43 @@ function(strip_symbols targetName outputFilename) endif(CLR_CMAKE_PLATFORM_UNIX) endfunction() -function(install_clr targetName) - list(FIND CLR_CROSS_COMPONENTS_LIST ${targetName} INDEX) - if (NOT DEFINED CLR_CROSS_COMPONENTS_LIST OR NOT ${INDEX} EQUAL -1) - strip_symbols(${targetName} strip_destination_file) - - # We don't need to install the export libraries for our DLLs - # since they won't be directly linked against. - install(PROGRAMS $ DESTINATION .) - if(WIN32) - # We can't use the $ generator expression here since - # the generator expression isn't supported on resource DLLs. - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$/${targetName}.pdb DESTINATION PDB) - else() - install(FILES ${strip_destination_file} DESTINATION .) - endif() - if(CLR_CMAKE_PGO_INSTRUMENT) +# install_clr(TARGETS TARGETS targetName [targetName2 ...] [DESTINATION destination]) +function(install_clr) + set(options "") + set(oneValueArgs DESTINATION) + set(multiValueArgs TARGETS) + cmake_parse_arguments(PARSE_ARGV 0 INSTALL_CLR "${options}" "${oneValueArgs}" "${multiValueArgs}") + + if ("${INSTALL_CLR_TARGETS}" STREQUAL "") + message(FATAL_ERROR "At least one target must be passed to install_clr(TARGETS )") + endif() + + if ("${INSTALL_CLR_DESTINATION}" STREQUAL "") + set(INSTALL_CLR_DESTINATION ".") + endif() + + foreach(targetName ${INSTALL_CLR_TARGETS}) + list(FIND CLR_CROSS_COMPONENTS_LIST ${targetName} INDEX) + if (NOT DEFINED CLR_CROSS_COMPONENTS_LIST OR NOT ${INDEX} EQUAL -1) + strip_symbols(${targetName} strip_destination_file) + + # We don't need to install the export libraries for our DLLs + # since they won't be directly linked against. + install(PROGRAMS $ DESTINATION ${INSTALL_CLR_DESTINATION}) if(WIN32) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$/${targetName}.pgd DESTINATION PGD OPTIONAL) + # We can't use the $ generator expression here since + # the generator expression isn't supported on resource DLLs. + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$/${targetName}.pdb DESTINATION ${INSTALL_CLR_DESTINATION}/PDB) + else() + install(FILES ${strip_destination_file} DESTINATION ${INSTALL_CLR_DESTINATION}) + endif() + if(CLR_CMAKE_PGO_INSTRUMENT) + if(WIN32) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$/${targetName}.pgd DESTINATION ${INSTALL_CLR_DESTINATION}/PGD OPTIONAL) + endif() endif() endif() - endif() + endforeach() endfunction() # Disable PAX mprotect that would prevent JIT and other codegen in coreclr from working. diff --git a/src/coreclr/src/ToolBox/SOS/CMakeLists.txt b/src/coreclr/src/ToolBox/SOS/CMakeLists.txt index af190db..e9c1be8 100644 --- a/src/coreclr/src/ToolBox/SOS/CMakeLists.txt +++ b/src/coreclr/src/ToolBox/SOS/CMakeLists.txt @@ -5,3 +5,4 @@ if(WIN32) endif(WIN32) _install(FILES SOS_README.md DESTINATION .) +_install(FILES SOS_README.md DESTINATION sharedFramework) diff --git a/src/coreclr/src/coreclr/hosts/coreconsole/CMakeLists.txt b/src/coreclr/src/coreclr/hosts/coreconsole/CMakeLists.txt index c51f287..092d8e3 100644 --- a/src/coreclr/src/coreclr/hosts/coreconsole/CMakeLists.txt +++ b/src/coreclr/src/coreclr/hosts/coreconsole/CMakeLists.txt @@ -28,6 +28,6 @@ else() ) # Can't compile on linux yet so only add for windows - install_clr(CoreConsole) + install_clr(TARGETS CoreConsole) -endif(CLR_CMAKE_PLATFORM_UNIX) \ No newline at end of file +endif(CLR_CMAKE_PLATFORM_UNIX) diff --git a/src/coreclr/src/coreclr/hosts/corerun/CMakeLists.txt b/src/coreclr/src/coreclr/hosts/corerun/CMakeLists.txt index eec4815..e180302 100644 --- a/src/coreclr/src/coreclr/hosts/corerun/CMakeLists.txt +++ b/src/coreclr/src/coreclr/hosts/corerun/CMakeLists.txt @@ -33,6 +33,6 @@ else() ) # Can't compile on linux yet so only add for windows - install_clr(CoreRun) + install_clr(TARGETS CoreRun) -endif(CLR_CMAKE_PLATFORM_UNIX) \ No newline at end of file +endif(CLR_CMAKE_PLATFORM_UNIX) diff --git a/src/coreclr/src/coreclr/hosts/coreshim/CMakeLists.txt b/src/coreclr/src/coreclr/hosts/coreshim/CMakeLists.txt index 828b91c..51061e1 100644 --- a/src/coreclr/src/coreclr/hosts/coreshim/CMakeLists.txt +++ b/src/coreclr/src/coreclr/hosts/coreshim/CMakeLists.txt @@ -22,4 +22,4 @@ target_link_libraries(CoreShim ${STATIC_MT_VCRT_LIB} ) -install_clr(CoreShim) \ No newline at end of file +install_clr(TARGETS CoreShim) diff --git a/src/coreclr/src/coreclr/hosts/osxbundlerun/CMakeLists.txt b/src/coreclr/src/coreclr/hosts/osxbundlerun/CMakeLists.txt index 40fab3c..a09c3f3 100644 --- a/src/coreclr/src/coreclr/hosts/osxbundlerun/CMakeLists.txt +++ b/src/coreclr/src/coreclr/hosts/osxbundlerun/CMakeLists.txt @@ -19,4 +19,4 @@ add_dependencies(osxbundlerun coreclr ) -install_clr(osxbundlerun) +install_clr(TARGETS osxbundlerun) diff --git a/src/coreclr/src/coreclr/hosts/unixcoreconsole/CMakeLists.txt b/src/coreclr/src/coreclr/hosts/unixcoreconsole/CMakeLists.txt index fbd7c8e..23546c6 100644 --- a/src/coreclr/src/coreclr/hosts/unixcoreconsole/CMakeLists.txt +++ b/src/coreclr/src/coreclr/hosts/unixcoreconsole/CMakeLists.txt @@ -29,4 +29,4 @@ if(NOT CLR_CMAKE_PLATFORM_ANDROID) ) endif() -install_clr(coreconsole) +install_clr(TARGETS coreconsole) diff --git a/src/coreclr/src/coreclr/hosts/unixcorerun/CMakeLists.txt b/src/coreclr/src/coreclr/hosts/unixcorerun/CMakeLists.txt index cb5e778..eff7a9a 100644 --- a/src/coreclr/src/coreclr/hosts/unixcorerun/CMakeLists.txt +++ b/src/coreclr/src/coreclr/hosts/unixcorerun/CMakeLists.txt @@ -30,4 +30,4 @@ if(NOT CLR_CMAKE_PLATFORM_ANDROID) ) endif() -install_clr(corerun) +install_clr(TARGETS corerun) diff --git a/src/coreclr/src/corefx/System.Globalization.Native/CMakeLists.txt b/src/coreclr/src/corefx/System.Globalization.Native/CMakeLists.txt index 86709d7..71e1533 100644 --- a/src/coreclr/src/corefx/System.Globalization.Native/CMakeLists.txt +++ b/src/coreclr/src/corefx/System.Globalization.Native/CMakeLists.txt @@ -92,5 +92,6 @@ verify_dependencies( ) # add the install targets -install_clr(System.Globalization.Native) +install_clr(TARGETS System.Globalization.Native) +install_clr(TARGETS System.Globalization.Native DESTINATION sharedFramework) install(TARGETS System.Globalization.Native_Static DESTINATION .) diff --git a/src/coreclr/src/debug/createdump/CMakeLists.txt b/src/coreclr/src/debug/createdump/CMakeLists.txt index 061051b..674fe23 100644 --- a/src/coreclr/src/debug/createdump/CMakeLists.txt +++ b/src/coreclr/src/debug/createdump/CMakeLists.txt @@ -48,4 +48,4 @@ target_link_libraries(createdump add_dependencies(createdump mscordaccore) -install_clr(createdump) +install_clr(TARGETS createdump) diff --git a/src/coreclr/src/dlls/clretwrc/CMakeLists.txt b/src/coreclr/src/dlls/clretwrc/CMakeLists.txt index d59279b..8598baf 100644 --- a/src/coreclr/src/dlls/clretwrc/CMakeLists.txt +++ b/src/coreclr/src/dlls/clretwrc/CMakeLists.txt @@ -20,6 +20,7 @@ add_library_clr(clretwrc SHARED ) # add the install targets -install_clr(clretwrc) +install_clr(TARGETS clretwrc) +install_clr(TARGETS clretwrc DESTINATION sharedFramework) add_dependencies(clretwrc eventing_headers) diff --git a/src/coreclr/src/dlls/dbgshim/CMakeLists.txt b/src/coreclr/src/dlls/dbgshim/CMakeLists.txt index b1463b6..d355f01 100644 --- a/src/coreclr/src/dlls/dbgshim/CMakeLists.txt +++ b/src/coreclr/src/dlls/dbgshim/CMakeLists.txt @@ -81,4 +81,5 @@ endif(WIN32) target_link_libraries(dbgshim ${DBGSHIM_LIBRARIES}) # add the install targets -install_clr(dbgshim) +install_clr(TARGETS dbgshim) +install_clr(TARGETS dbgshim DESTINATION sharedFramework) diff --git a/src/coreclr/src/dlls/mscordac/CMakeLists.txt b/src/coreclr/src/dlls/mscordac/CMakeLists.txt index 02cc30d..91af96d 100644 --- a/src/coreclr/src/dlls/mscordac/CMakeLists.txt +++ b/src/coreclr/src/dlls/mscordac/CMakeLists.txt @@ -184,4 +184,20 @@ endif(WIN32) target_link_libraries(mscordaccore PRIVATE ${COREDAC_LIBRARIES}) # add the install targets -install_clr(mscordaccore) +install_clr(TARGETS mscordaccore) +install_clr(TARGETS mscordaccore DESTINATION sharedFramework) +if(WIN32) + set(LONG_NAME_HOST_ARCH ${CLR_CMAKE_HOST_ARCH}) + set(LONG_NAME_TARGET_ARCH ${CLR_CMAKE_TARGET_ARCH}) + if (CLR_CMAKE_PLATFORM_ARCH_AMD64) + set(LONG_NAME_HOST_ARCH "amd64") + set(LONG_NAME_TARGET_ARCH "amd64") + endif() + set(NATIVE_VERSION_HEADER_FILE "${CLR_DIR}/bin/obj/_version.h") + message ("Read file version from native version header at '${NATIVE_VERSION_HEADER_FILE}'.") + file(READ "${NATIVE_VERSION_HEADER_FILE}" NATIVE_VERSION_HEADER) + string(REGEX MATCH "#define VER_FILEVERSION[ \t]+[0-9]+(,[0-9]+)+" FILE_VERSION_LINE "${NATIVE_VERSION_HEADER}") + string(REGEX MATCHALL "[0-9]+" FILE_VERSION_COMPONENTS "${FILE_VERSION_LINE}") + list(JOIN FILE_VERSION_COMPONENTS "." FILE_VERSION) + install(FILES $ RENAME mscordaccore_${LONG_NAME_HOST_ARCH}_${LONG_NAME_TARGET_ARCH}_${FILE_VERSION}.dll DESTINATION sharedFramework) +endif() diff --git a/src/coreclr/src/dlls/mscordbi/CMakeLists.txt b/src/coreclr/src/dlls/mscordbi/CMakeLists.txt index 13b8691..b586319 100644 --- a/src/coreclr/src/dlls/mscordbi/CMakeLists.txt +++ b/src/coreclr/src/dlls/mscordbi/CMakeLists.txt @@ -118,4 +118,5 @@ elseif(CLR_CMAKE_PLATFORM_UNIX) endif(WIN32) # add the install targets -install_clr(mscordbi) +install_clr(TARGETS mscordbi) +install_clr(TARGETS mscordbi DESTINATION sharedFramework) diff --git a/src/coreclr/src/dlls/mscoree/coreclr/CMakeLists.txt b/src/coreclr/src/dlls/mscoree/coreclr/CMakeLists.txt index 0b89ee0..04e48a4 100644 --- a/src/coreclr/src/dlls/mscoree/coreclr/CMakeLists.txt +++ b/src/coreclr/src/dlls/mscoree/coreclr/CMakeLists.txt @@ -202,7 +202,8 @@ if(WIN32) endif(WIN32) # add the install targets -install_clr(coreclr) +install_clr(TARGETS coreclr) +install_clr(TARGETS coreclr DESTINATION sharedFramework) # Enable profile guided optimization add_pgo(coreclr) diff --git a/src/coreclr/src/dlls/mscorrc/full/CMakeLists.txt b/src/coreclr/src/dlls/mscorrc/full/CMakeLists.txt index 50fe516..d3c2ea8 100644 --- a/src/coreclr/src/dlls/mscorrc/full/CMakeLists.txt +++ b/src/coreclr/src/dlls/mscorrc/full/CMakeLists.txt @@ -6,7 +6,8 @@ if(WIN32) ../include.rc ) - install_clr (mscorrc.debug) + install_clr(TARGETS mscorrc.debug) + install_clr(TARGETS mscorrc.debug DESTINATION sharedFramework) else() build_resources(${CMAKE_CURRENT_SOURCE_DIR}/../include.rc mscorrc_debug TARGET_CPP_FILE) diff --git a/src/coreclr/src/dlls/mscorrc/small/CMakeLists.txt b/src/coreclr/src/dlls/mscorrc/small/CMakeLists.txt index 7c359e0..d8ddc6a 100644 --- a/src/coreclr/src/dlls/mscorrc/small/CMakeLists.txt +++ b/src/coreclr/src/dlls/mscorrc/small/CMakeLists.txt @@ -4,5 +4,5 @@ add_library_clr(mscorrc SHARED ../mscorrc.small.rc ) -# add the install targets -install_clr (mscorrc) \ No newline at end of file +install_clr(TARGETS mscorrc) +install_clr(TARGETS mscorrc DESTINATION sharedFramework) diff --git a/src/coreclr/src/gc/CMakeLists.txt b/src/coreclr/src/gc/CMakeLists.txt index 17a774c..14bcea0 100644 --- a/src/coreclr/src/gc/CMakeLists.txt +++ b/src/coreclr/src/gc/CMakeLists.txt @@ -94,7 +94,7 @@ convert_to_absolute_path(GC_SOURCES ${GC_SOURCES}) add_library_clr(clrgc SHARED ${GC_SOURCES}) add_dependencies(clrgc eventing_headers) target_link_libraries(clrgc ${GC_LINK_LIBRARIES}) -install_clr(clrgc) +install_clr(TARGETS clrgc) if(CLR_CMAKE_PLATFORM_UNIX) # dprintf causes many warnings (https://github.com/dotnet/coreclr/issues/13367) diff --git a/src/coreclr/src/ilasm/CMakeLists.txt b/src/coreclr/src/ilasm/CMakeLists.txt index c2ad35a..bd66fd9 100644 --- a/src/coreclr/src/ilasm/CMakeLists.txt +++ b/src/coreclr/src/ilasm/CMakeLists.txt @@ -133,4 +133,4 @@ else() ) endif(CLR_CMAKE_PLATFORM_UNIX) -install_clr(ilasm) +install_clr(TARGETS ilasm) diff --git a/src/coreclr/src/ildasm/exe/CMakeLists.txt b/src/coreclr/src/ildasm/exe/CMakeLists.txt index 6deb8b9..15dd82b 100644 --- a/src/coreclr/src/ildasm/exe/CMakeLists.txt +++ b/src/coreclr/src/ildasm/exe/CMakeLists.txt @@ -123,4 +123,4 @@ else() ) endif(CLR_CMAKE_PLATFORM_UNIX) -install_clr(ildasm) +install_clr(TARGETS ildasm) diff --git a/src/coreclr/src/jit/armelnonjit/CMakeLists.txt b/src/coreclr/src/jit/armelnonjit/CMakeLists.txt index 341aff6..714800a 100644 --- a/src/coreclr/src/jit/armelnonjit/CMakeLists.txt +++ b/src/coreclr/src/jit/armelnonjit/CMakeLists.txt @@ -91,4 +91,4 @@ target_link_libraries(armelnonjit ) # add the install targets -install_clr(armelnonjit) +install_clr(TARGETS armelnonjit) diff --git a/src/coreclr/src/jit/linuxnonjit/CMakeLists.txt b/src/coreclr/src/jit/linuxnonjit/CMakeLists.txt index aeed8137..a86ac1f 100644 --- a/src/coreclr/src/jit/linuxnonjit/CMakeLists.txt +++ b/src/coreclr/src/jit/linuxnonjit/CMakeLists.txt @@ -75,4 +75,4 @@ target_link_libraries(linuxnonjit ) # add the install targets -install_clr(linuxnonjit) +install_clr(TARGETS linuxnonjit) diff --git a/src/coreclr/src/jit/protojit/CMakeLists.txt b/src/coreclr/src/jit/protojit/CMakeLists.txt index 533d541..3cfe839 100644 --- a/src/coreclr/src/jit/protojit/CMakeLists.txt +++ b/src/coreclr/src/jit/protojit/CMakeLists.txt @@ -62,4 +62,4 @@ target_link_libraries(protojit ) # add the install targets -install_clr(protojit) +install_clr(TARGETS protojit) diff --git a/src/coreclr/src/jit/protononjit/CMakeLists.txt b/src/coreclr/src/jit/protononjit/CMakeLists.txt index f7466a8..bab6994 100644 --- a/src/coreclr/src/jit/protononjit/CMakeLists.txt +++ b/src/coreclr/src/jit/protononjit/CMakeLists.txt @@ -89,4 +89,4 @@ target_link_libraries(protononjit ) # add the install targets -install_clr(protononjit) +install_clr(TARGETS protononjit) diff --git a/src/coreclr/src/jit/standalone/CMakeLists.txt b/src/coreclr/src/jit/standalone/CMakeLists.txt index 572bfc7..0c4e80c 100644 --- a/src/coreclr/src/jit/standalone/CMakeLists.txt +++ b/src/coreclr/src/jit/standalone/CMakeLists.txt @@ -32,7 +32,8 @@ target_link_libraries(clrjit ) # add the install targets -install_clr(clrjit) +install_clr(TARGETS clrjit) +install_clr(TARGETS clrjit DESTINATION sharedFramework) # Enable profile guided optimization add_pgo(clrjit) diff --git a/src/coreclr/src/pal/src/eventprovider/lttngprovider/CMakeLists.txt b/src/coreclr/src/pal/src/eventprovider/lttngprovider/CMakeLists.txt index b9e4f15..e3d20ab 100644 --- a/src/coreclr/src/pal/src/eventprovider/lttngprovider/CMakeLists.txt +++ b/src/coreclr/src/pal/src/eventprovider/lttngprovider/CMakeLists.txt @@ -73,4 +73,4 @@ set_target_properties(coreclrtraceptprovider PROPERTIES LINKER_LANGUAGE CXX) # Install the static eventprovider library _install(TARGETS eventprovider DESTINATION lib) # Install the static coreclrtraceptprovider library -install_clr(coreclrtraceptprovider) +install_clr(TARGETS coreclrtraceptprovider) diff --git a/src/coreclr/src/tools/crossgen/CMakeLists.txt b/src/coreclr/src/tools/crossgen/CMakeLists.txt index 0f33857..eb10882 100644 --- a/src/coreclr/src/tools/crossgen/CMakeLists.txt +++ b/src/coreclr/src/tools/crossgen/CMakeLists.txt @@ -70,4 +70,5 @@ add_subdirectory(../../zap ../../zap) add_subdirectory(../../vm/crossgen ../../vm/crossgen) # add the install targets -install_clr(crossgen) +install_clr(TARGETS crossgen) +install_clr(TARGETS crossgen DESTINATION sharedFramework) diff --git a/src/coreclr/src/tools/crossgen2/jitinterface/CMakeLists.txt b/src/coreclr/src/tools/crossgen2/jitinterface/CMakeLists.txt index 371f08d..db31bda 100644 --- a/src/coreclr/src/tools/crossgen2/jitinterface/CMakeLists.txt +++ b/src/coreclr/src/tools/crossgen2/jitinterface/CMakeLists.txt @@ -12,4 +12,4 @@ add_library_clr(jitinterface ${NATIVE_SOURCES} ) -install_clr(jitinterface) +install_clr(TARGETS jitinterface)