From cf0508a1bbfb8966c397d271320266c1d9ba0345 Mon Sep 17 00:00:00 2001 From: Sergiy Kuryata Date: Wed, 4 Feb 2015 13:59:44 -0800 Subject: [PATCH] Enable binplacing of native CoreCLR binaries on Linux This change adds support for binplacing native CoreCLR binaries on Linux to "$__RootBinDir/Product/$__BuildArch/$__BuildType". It reuses the mechanism that we currently have in place for Windows. Similarly to binplace implementation for Windows, it sets an environment variable (__CMakeBinDir) in build.sh and then uses its value in clang-compiler-override.txt to set CMAKE_INSTALL_PREFIX to the desired target location. --- build.sh | 8 ++++++-- src/coreclr/hosts/unixcorerun/CMakeLists.txt | 2 ++ src/dlls/mscordac/CMakeLists.txt | 4 +++- src/dlls/mscoree/coreclr/CMakeLists.txt | 4 +++- src/pal/tools/clang-compiler-override.txt | 1 + 5 files changed, 15 insertions(+), 4 deletions(-) diff --git a/build.sh b/build.sh index 2fc0a634c303..8321316b21bc 100755 --- a/build.sh +++ b/build.sh @@ -64,7 +64,7 @@ build_coreclr() { # All set to commence the build - echo Commencing build of native components for %__BuildArch%/%__BuildType% + echo Commencing build of native components for $__BuildArch/$__BuildType cd $__CMakeSlnDir # Regenerate the CMake solution @@ -81,7 +81,7 @@ build_coreclr() # Build CoreCLR echo Executing make $__UnprocessedBuildArgs - make -j `nproc` $__UnprocessedBuildArgs + make install -j `nproc` $__UnprocessedBuildArgs if [ $? != 0 ]; then echo Failed to build coreclr components. exit 1 @@ -148,6 +148,10 @@ __ToolsDir="$__RootBinDir/tools" __TestWorkingDir="$__RootBinDir/tests/$__BuildArch/$__BuildType" __IntermediatesDir="$__RootBinDir/intermediates/$__BuildArch/$__BuildType" +# Specify path to be set for CMAKE_INSTALL_PREFIX. +# This is where all built CoreClr libraries will copied to. +export __CMakeBinDir="$__BinDir" + # Switch to clean build mode if the binaries output folder does not exist if [ ! -d "$__RootBinDir" ]; then __CleanBuild=1 diff --git a/src/coreclr/hosts/unixcorerun/CMakeLists.txt b/src/coreclr/hosts/unixcorerun/CMakeLists.txt index a9ad723eb58f..47b15dc51063 100644 --- a/src/coreclr/hosts/unixcorerun/CMakeLists.txt +++ b/src/coreclr/hosts/unixcorerun/CMakeLists.txt @@ -15,3 +15,5 @@ target_link_libraries(corerun add_dependencies(corerun coreclr ) + +install (TARGETS corerun DESTINATION .) diff --git a/src/dlls/mscordac/CMakeLists.txt b/src/dlls/mscordac/CMakeLists.txt index 527cf341b5aa..4e012058fb2d 100644 --- a/src/dlls/mscordac/CMakeLists.txt +++ b/src/dlls/mscordac/CMakeLists.txt @@ -75,4 +75,6 @@ target_link_libraries(mscordaccore ${COREDAC_LIBRARIES}) # add the install targets install (TARGETS mscordaccore DESTINATION .) -install (FILES ${CMAKE_CURRENT_BINARY_DIR}/$/mscordaccore.pdb DESTINATION PDB) \ No newline at end of file +if(WIN32) + install (FILES ${CMAKE_CURRENT_BINARY_DIR}/$/mscordaccore.pdb DESTINATION PDB) +endif(WIN32) diff --git a/src/dlls/mscoree/coreclr/CMakeLists.txt b/src/dlls/mscoree/coreclr/CMakeLists.txt index ba983ce86ed9..d17df90ffb13 100644 --- a/src/dlls/mscoree/coreclr/CMakeLists.txt +++ b/src/dlls/mscoree/coreclr/CMakeLists.txt @@ -106,5 +106,7 @@ endif(WIN32) # add the install targets install (TARGETS coreclr DESTINATION .) -install (FILES ${CMAKE_CURRENT_BINARY_DIR}/$/coreclr.pdb DESTINATION PDB) +if(WIN32) + install (FILES ${CMAKE_CURRENT_BINARY_DIR}/$/coreclr.pdb DESTINATION PDB) +endif(WIN32) diff --git a/src/pal/tools/clang-compiler-override.txt b/src/pal/tools/clang-compiler-override.txt index 52a53efaa29c..7d99902be5ae 100644 --- a/src/pal/tools/clang-compiler-override.txt +++ b/src/pal/tools/clang-compiler-override.txt @@ -12,3 +12,4 @@ SET (CLR_DEFINES_DEBUG_INIT DEBUG _DEBUG _DBG URTBLDENV_FRIENDLY=Ch SET (CLR_DEFINES_RELEASE_INIT NDEBUG URTBLDENV_FRIENDLY=Retail) SET (CLR_DEFINES_RELWITHDEBINFO_INIT NDEBUG URTBLDENV_FRIENDLY=Retail) +SET (CMAKE_INSTALL_PREFIX $ENV{__CMakeBinDir})