From a095884c496bf77ff8d2b3f30a567a5cb448873b Mon Sep 17 00:00:00 2001 From: Rahul Kumar Date: Wed, 13 Jan 2016 14:14:46 -0800 Subject: [PATCH] Use coreclr buildtools nuget package instead of compiling the tools used during build. This only applies to windows build. --- CMakeLists.txt | 4 +++ src/.nuget/packages.Windows_NT.config | 1 + src/ToolBox/SOS/CMakeLists.txt | 2 -- src/dlls/mscoree/coreclr/CMakeLists.txt | 50 +++++++++++---------------- src/scripts/buildtools/restorebuildtools.bat | 11 ++++++ src/scripts/buildtools/restorebuildtools.proj | 8 +++++ src/tools/CMakeLists.txt | 5 --- 7 files changed, 44 insertions(+), 37 deletions(-) create mode 100644 src/scripts/buildtools/restorebuildtools.bat create mode 100644 src/scripts/buildtools/restorebuildtools.proj diff --git a/CMakeLists.txt b/CMakeLists.txt index 561c4dc..98d3b76 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -794,4 +794,8 @@ if(WIN32) add_compile_options(/Zl) # omit default library name in .OBJ endif(WIN32) +# TODO change version +set(BuildToolsVersion "1.0.4-prerelease") +set(BuildToolsDir "${CLR_DIR}/packages/Microsoft.DotNet.BuildTools.CoreCLR.${BuildToolsVersion}") + add_subdirectory(src) diff --git a/src/.nuget/packages.Windows_NT.config b/src/.nuget/packages.Windows_NT.config index 8e4b319..d2c4cf5 100644 --- a/src/.nuget/packages.Windows_NT.config +++ b/src/.nuget/packages.Windows_NT.config @@ -1,5 +1,6 @@ + diff --git a/src/ToolBox/SOS/CMakeLists.txt b/src/ToolBox/SOS/CMakeLists.txt index 8cc9757..f48f3a7 100644 --- a/src/ToolBox/SOS/CMakeLists.txt +++ b/src/ToolBox/SOS/CMakeLists.txt @@ -1,7 +1,5 @@ if(WIN32) if(NOT DEFINED CLR_CMAKE_PLATFORM_ARCH_ARM64) add_subdirectory(Strike) - add_subdirectory(DacTableGen) - add_subdirectory(diasdk) endif(NOT DEFINED CLR_CMAKE_PLATFORM_ARCH_ARM64) endif(WIN32) diff --git a/src/dlls/mscoree/coreclr/CMakeLists.txt b/src/dlls/mscoree/coreclr/CMakeLists.txt index 777165c..36bc129 100644 --- a/src/dlls/mscoree/coreclr/CMakeLists.txt +++ b/src/dlls/mscoree/coreclr/CMakeLists.txt @@ -130,38 +130,28 @@ if(WIN32) list(APPEND INC_DIR -I${CLR_DIR}/src/vm -I${CLR_DIR}/src/vm/${ARCH_SOURCES_DIR} -I${CLR_DIR}/src/debug/ee -I${CLR_DIR}/src/gc) list(APPEND PREPROCESS_DEFINITIONS -DDACCESS_COMPILE -DDBG_TARGET_64BIT=1 -DDBG_TARGET_WIN64=1) - - if(CLR_CMAKE_PLATFORM_ARCH_ARM64) - # TODO package these tools into a new buildtool nuget package to get cross compilation support. - - #list(APPEND PREPROCESS_DEFINITIONS -DDBG_TARGET_ARM64=1) - #add_custom_command(TARGET coreclr - # POST_BUILD - # COMMAND cl.exe /P /EP /TP ${PREPROCESS_DEFINITIONS} ${INC_DIR} /Fi${CMAKE_CURRENT_BINARY_DIR}/daccess.i ${CLR_DIR}/src/debug/daccess/daccess.cpp - # COMMAND dactablegen.exe /dac:${CMAKE_CURRENT_BINARY_DIR}/daccess.i /pdb:${CMAKE_CURRENT_BINARY_DIR}/$/coreclr.pdb /dll:$ /bin:${CMAKE_CURRENT_BINARY_DIR}/wks.bin - # COMMAND InjectResource.exe /bin:${CMAKE_CURRENT_BINARY_DIR}/wks.bin /dll:$ - # COMMAND GenClrDebugResource.exe /dac:$ /dbi:$ /sku:onecoreclr /out:${CMAKE_CURRENT_BINARY_DIR}/clrDebugResource.bin - # COMMAND InjectResource.exe /bin:${CMAKE_CURRENT_BINARY_DIR}/clrDebugResource.bin /dll:$ /name:CLRDEBUGINFO - # COMMENT Add dactable & debug resources to coreclr - #) - - else() + if (CLR_CMAKE_PLATFORM_ARCH_AMD64) list(APPEND PREPROCESS_DEFINITIONS -DDBG_TARGET_AMD64=1) + elseif (CLR_CMAKE_PLATFORM_ARCH_ARM64) + list(APPEND PREPROCESS_DEFINITIONS -DDBG_TARGET_ARM64=1) + elseif (CLR_CMAKE_PLATFORM_ARCH_ARM) + list(APPEND PREPROCESS_DEFINITIONS -DDBG_TARGET_ARM=1) + elseif (CLR_CMAKE_PLATFORM_ARCH_I386) + list(APPEND PREPROCESS_DEFINITIONS -DDBG_TARGET_X86=1) + else() + clr_unknown_arch() + endif() - add_dependencies(coreclr dactablegen) - - add_custom_command(TARGET coreclr - POST_BUILD - COMMAND ${CMAKE_CXX_COMPILER} /P /EP /TP ${PREPROCESS_DEFINITIONS} ${INC_DIR} /Fi${CMAKE_CURRENT_BINARY_DIR}/daccess.i ${CLR_DIR}/src/debug/daccess/daccess.cpp - COMMAND $ /dac:${CMAKE_CURRENT_BINARY_DIR}/daccess.i /pdb:${CMAKE_CURRENT_BINARY_DIR}/$/coreclr.pdb /dll:$ /bin:${CMAKE_CURRENT_BINARY_DIR}/wks.bin - COMMAND $ /bin:${CMAKE_CURRENT_BINARY_DIR}/wks.bin /dll:$ - COMMAND $ /dac:$ /dbi:$ /sku:onecoreclr /out:${CMAKE_CURRENT_BINARY_DIR}/clrDebugResource.bin - COMMAND $ /bin:${CMAKE_CURRENT_BINARY_DIR}/clrDebugResource.bin /dll:$ /name:CLRDEBUGINFO - COMMENT Add dactable & debug resources to coreclr - ) - - endif(CLR_CMAKE_PLATFORM_ARCH_ARM64) - + add_custom_command(TARGET coreclr + POST_BUILD + COMMAND ${CLR_DIR}/src/scripts/buildtools/restorebuildtools.bat + COMMAND ${CMAKE_CXX_COMPILER} /P /EP /TP ${PREPROCESS_DEFINITIONS} ${INC_DIR} /Fi${CMAKE_CURRENT_BINARY_DIR}/daccess.i ${CLR_DIR}/src/debug/daccess/daccess.cpp + COMMAND ${BuildToolsDir}/dactablegen.exe /dac:${CMAKE_CURRENT_BINARY_DIR}/daccess.i /pdb:${CMAKE_CURRENT_BINARY_DIR}/$/coreclr.pdb /dll:$ /bin:${CMAKE_CURRENT_BINARY_DIR}/wks.bin + COMMAND ${BuildToolsDir}/InjectResource.exe /bin:${CMAKE_CURRENT_BINARY_DIR}/wks.bin /dll:$ + COMMAND ${BuildToolsDir}/GenClrDebugResource.exe /dac:$ /dbi:$ /sku:onecoreclr /out:${CMAKE_CURRENT_BINARY_DIR}/clrDebugResource.bin + COMMAND ${BuildToolsDir}/InjectResource.exe /bin:${CMAKE_CURRENT_BINARY_DIR}/clrDebugResource.bin /dll:$ /name:CLRDEBUGINFO + COMMENT Add dactable & debug resources to coreclr + ) else() add_custom_command( TARGET coreclr diff --git a/src/scripts/buildtools/restorebuildtools.bat b/src/scripts/buildtools/restorebuildtools.bat new file mode 100644 index 0000000..a07e817 --- /dev/null +++ b/src/scripts/buildtools/restorebuildtools.bat @@ -0,0 +1,11 @@ +REM ========================================================================================= +REM === +REM === Restore build tools required for native build +REM === +REM ========================================================================================= +echo Restore coreclr build tools nuget package +setlocal +:: Set the environment for the managed build +call "%__VSToolsRoot%\VsDevCmd.bat" +%_msbuildexe% "%~dp0restorebuildtools.proj" /p:OutputPath="%__IntermediatesDir%" /nodeReuse:false +endlocal \ No newline at end of file diff --git a/src/scripts/buildtools/restorebuildtools.proj b/src/scripts/buildtools/restorebuildtools.proj new file mode 100644 index 0000000..cc6c6d2 --- /dev/null +++ b/src/scripts/buildtools/restorebuildtools.proj @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt index 87c3eae..5443e0d 100644 --- a/src/tools/CMakeLists.txt +++ b/src/tools/CMakeLists.txt @@ -1,6 +1 @@ add_subdirectory(crossgen) - -if(WIN32) - add_subdirectory(GenClrDebugResource) - add_subdirectory(InjectResource) -endif(WIN32) -- 2.7.4