summaryrefslogtreecommitdiff
path: root/src/ToolBox
diff options
context:
space:
mode:
authorJeremy Koritzinsky <jkoritzinsky@gmail.com>2019-06-06 14:43:54 -0700
committerGitHub <noreply@github.com>2019-06-06 14:43:54 -0700
commit4c82068adb046eee3573984392a0d1e774062ae0 (patch)
treec94ee1b120f165f121101b7dc368fa2c57dd5f0a /src/ToolBox
parent2e9cd827b0db60ad42f7df1f34ee1fada1951e5f (diff)
downloadcoreclr-4c82068adb046eee3573984392a0d1e774062ae0.tar.gz
coreclr-4c82068adb046eee3573984392a0d1e774062ae0.tar.bz2
coreclr-4c82068adb046eee3573984392a0d1e774062ae0.zip
Use CMake's C# support to build DacTableGen instead of manually invoking csc.exe ourselves. (#24342)
* Use CMake's C# support to build DacTableGen instead of manually invoking csc.exe ourselves. * Fix x86 failures. * Disable DAC generation when building with NMake Makefiles and issue an error since the CMake C# support is VS-only. We don't actually support building with NMake (only configure) so this is ok. * Clean up rest of the macro=1's PR Feedback. * Fix Visual Studio generator matching. * Explicitly specify anycpu32bitpreferred for DacTableGen so the ARM64 build doesn't accidentally make it 64-bit * Fix bad merge
Diffstat (limited to 'src/ToolBox')
-rw-r--r--src/ToolBox/SOS/CMakeLists.txt4
-rw-r--r--src/ToolBox/SOS/DacTableGen/CMakeLists.txt26
-rw-r--r--src/ToolBox/SOS/DacTableGen/DacTableGen.csproj55
-rw-r--r--src/ToolBox/SOS/Strike/CMakeLists.txt30
-rw-r--r--src/ToolBox/SOS/lldbplugin/CMakeLists.txt28
5 files changed, 43 insertions, 100 deletions
diff --git a/src/ToolBox/SOS/CMakeLists.txt b/src/ToolBox/SOS/CMakeLists.txt
index 212f4eebd7..5ecf76089c 100644
--- a/src/ToolBox/SOS/CMakeLists.txt
+++ b/src/ToolBox/SOS/CMakeLists.txt
@@ -1,4 +1,6 @@
if(WIN32)
+ if (CMAKE_GENERATOR MATCHES "Visual Studio .*")
add_subdirectory(DacTableGen)
- add_subdirectory(Strike)
+ endif()
+ add_subdirectory(Strike)
endif(WIN32)
diff --git a/src/ToolBox/SOS/DacTableGen/CMakeLists.txt b/src/ToolBox/SOS/DacTableGen/CMakeLists.txt
index e58fcafce3..39597ce243 100644
--- a/src/ToolBox/SOS/DacTableGen/CMakeLists.txt
+++ b/src/ToolBox/SOS/DacTableGen/CMakeLists.txt
@@ -1,23 +1,19 @@
+cmake_minimum_required(VERSION 3.8) # This project is only included on Win32 platforms so we can have a higher CMake version requirement since we already require a newer CMake version on Windows for various reasons.
+# Quick note: The CMake C# support is using the CSC bundled with the MSBuild that the native build runs on, not the one supplied by the local .NET SDK.
+
+project(DacTableGen LANGUAGES CSharp)
+
set(DACTABLEGEN_SOURCES
cvconst.cs
diautil.cs
main.cs
MapSymbolProvider.cs
)
+# DacTableGen doesn't use the defines from the rest of the build tree, so clear all of the compile definitions
+set_directory_properties(PROPERTIES COMPILE_DEFINITIONS "")
-# Cmake does not support C# sources so add custom command
-# Disable:
-# warning CS1668: Invalid search path 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.14.26428\atlmfc\lib\ARM64' specified in 'LIB environment variable' -- 'The system cannot find the path specified. '
-# There are several problems here: (1) the C++ project files are adding non-existent directories to the LIB path, especially for ARM and ARM64,
-# (2) This CSC is invoking the desktop .NET Framework CSC, not the buildtools version.
-add_custom_target(dactablegen ALL
- COMMAND csc.exe /t:exe /platform:anycpu32bitpreferred /r:System.dll /r:DiaLib.dll /nowarn:1668 /out:${CMAKE_CURRENT_BINARY_DIR}/dactablegen.exe ${DACTABLEGEN_SOURCES}
- COMMAND ${CMAKE_COMMAND} -E copy DIAlib.dll ${CMAKE_CURRENT_BINARY_DIR}
- DEPENDS ${DACTABLEGEN_SOURCES} DIAlib.dll
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-)
+set(CMAKE_CSharp_FLAGS "/platform:anycpu32bitpreferred")
+add_executable(dactablegen ${DACTABLEGEN_SOURCES})
-# In order to use dactablegen as an executable target it needs to be imported.
-# Target is used in dll/mscoree/coreclr/cmakelists.txt
-add_executable(dactablegen_exe IMPORTED GLOBAL)
-set_property(TARGET dactablegen_exe PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/dactablegen.exe)
+set_target_properties(dactablegen PROPERTIES VS_DOTNET_REFERENCES "System")
+set_target_properties(dactablegen PROPERTIES VS_DOTNET_REFERENCE_DIALib ${CMAKE_CURRENT_SOURCE_DIR}/DIALib.dll)
diff --git a/src/ToolBox/SOS/DacTableGen/DacTableGen.csproj b/src/ToolBox/SOS/DacTableGen/DacTableGen.csproj
deleted file mode 100644
index 064780e326..0000000000
--- a/src/ToolBox/SOS/DacTableGen/DacTableGen.csproj
+++ /dev/null
@@ -1,55 +0,0 @@
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="dogfood">
- <!--*****************************************************-->
- <!--This MSBuild project file was automatically generated-->
- <!--from the original SOURCES/DIRS file by the KBC tool.-->
- <!--*****************************************************-->
- <!--Import the settings-->
- <Import Project="$(_NTDRIVE)$(_NTROOT)\ndp\clr\clr.props" />
- <!--Leaf project Properties-->
- <PropertyGroup>
- <AssemblyName>DacTableGen</AssemblyName>
- <OutputType>EXE</OutputType>
- <DefineConstants>VERBOSE;DEBUG</DefineConstants>
- <!--
- # We define /platform:x86 because
- # 1) this is a build tool, only used in building
- # 2) In all the places we check this tool into the build system, we
- # make sure to run it under the WOW if built on an AMD64 machine.
- #
- # Checking in /platform:x86 will prevent bugs that occur when this DLL
- # needs to be updated in the build tools directory, but the person
- # forgot to rebuild with that flag (happened several times).
- -->
- <PlatformTarget>x86</PlatformTarget>
- <AssemblyAttributeClsCompliant>false</AssemblyAttributeClsCompliant>
- <SignAssemblyAttribute>false</SignAssemblyAttribute>
- <!--
- # We don't want a generated embedded manifest, because we use an explicit
- # .manifest file in tools\devdiv\x86 to do reg-free COM activation of
- # msdia80.dll
- -->
- <NoWin32Manifest>true</NoWin32Manifest>
- </PropertyGroup>
- <!--Leaf Project Items-->
- <ItemGroup>
- <Compile Include="cvconst.cs" />
- <Compile Include="diautil.cs" />
- <Compile Include="mapsymbolprovider.cs" />
- <Compile Include="main.cs" />
- </ItemGroup>
-
- <ItemGroup>
- <ProjectReference Include="$(ClrSrcDirectory)toolbox\sos\diasdk\diasdk.nativeproj" />
- <Reference Include="DiaLib">
- <HintPath>$(ClrIntraLibPath)\DiaLib.dll</HintPath>
- </Reference>
- </ItemGroup>
-
- <ItemGroup>
- <Reference Include="System">
- <HintPath>$(NDP_FXRefPath)\System.dll</HintPath>
- </Reference>
- </ItemGroup>
- <!--Import the targets-->
- <Import Project="$(_NTDRIVE)$(_NTROOT)\ndp\clr\clr.targets" />
-</Project>
diff --git a/src/ToolBox/SOS/Strike/CMakeLists.txt b/src/ToolBox/SOS/Strike/CMakeLists.txt
index 7047e3291c..bff50df14e 100644
--- a/src/ToolBox/SOS/Strike/CMakeLists.txt
+++ b/src/ToolBox/SOS/Strike/CMakeLists.txt
@@ -10,33 +10,33 @@ if (CORECLR_SET_RPATH)
endif (CORECLR_SET_RPATH)
if(CLR_CMAKE_PLATFORM_ARCH_AMD64)
- add_definitions(-DSOS_TARGET_AMD64=1)
- add_definitions(-D_TARGET_WIN64_=1)
+ add_definitions(-DSOS_TARGET_AMD64)
+ add_definitions(-D_TARGET_WIN64_)
add_definitions(-DDBG_TARGET_64BIT)
- add_definitions(-DDBG_TARGET_WIN64=1)
+ add_definitions(-DDBG_TARGET_WIN64)
if(WIN32)
- add_definitions(-DSOS_TARGET_ARM64=1)
+ add_definitions(-DSOS_TARGET_ARM64)
endif(WIN32)
- remove_definitions(-D_TARGET_ARM64_=1)
+ remove_definitions(-D_TARGET_ARM64_)
add_definitions(-D_TARGET_AMD64_)
add_definitions(-DDBG_TARGET_AMD64)
elseif(CLR_CMAKE_PLATFORM_ARCH_I386)
- add_definitions(-DSOS_TARGET_X86=1)
- add_definitions(-D_TARGET_X86_=1)
+ add_definitions(-DSOS_TARGET_X86)
+ add_definitions(-D_TARGET_X86_)
add_definitions(-DDBG_TARGET_32BIT)
if(WIN32)
- add_definitions(-DSOS_TARGET_ARM=1)
+ add_definitions(-DSOS_TARGET_ARM)
endif(WIN32)
elseif(CLR_CMAKE_PLATFORM_ARCH_ARM)
- add_definitions(-DSOS_TARGET_ARM=1)
- add_definitions(-D_TARGET_WIN32_=1)
- add_definitions(-D_TARGET_ARM_=1)
+ add_definitions(-DSOS_TARGET_ARM)
+ add_definitions(-D_TARGET_WIN32_)
+ add_definitions(-D_TARGET_ARM_)
add_definitions(-DDBG_TARGET_32BIT)
elseif(CLR_CMAKE_PLATFORM_ARCH_ARM64)
- add_definitions(-DSOS_TARGET_ARM64=1)
- add_definitions(-D_TARGET_WIN64_=1)
+ add_definitions(-DSOS_TARGET_ARM64)
+ add_definitions(-D_TARGET_WIN64_)
add_definitions(-DDBG_TARGET_64BIT)
- add_definitions(-DDBG_TARGET_WIN64=1)
+ add_definitions(-DDBG_TARGET_WIN64)
endif()
add_definitions(-DSTRIKE)
@@ -105,7 +105,7 @@ if(WIN32)
ntdll.lib
)
else(WIN32)
- add_definitions(-DPAL_STDCPP_COMPAT=1)
+ add_definitions(-DPAL_STDCPP_COMPAT)
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wno-null-arithmetic)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
diff --git a/src/ToolBox/SOS/lldbplugin/CMakeLists.txt b/src/ToolBox/SOS/lldbplugin/CMakeLists.txt
index 2b65f52cba..fadb37469a 100644
--- a/src/ToolBox/SOS/lldbplugin/CMakeLists.txt
+++ b/src/ToolBox/SOS/lldbplugin/CMakeLists.txt
@@ -27,24 +27,24 @@ if(SKIP_LLDBPLUGIN)
endif()
if(CLR_CMAKE_PLATFORM_ARCH_AMD64)
- add_definitions(-D_TARGET_AMD64_=1)
- add_definitions(-DDBG_TARGET_64BIT=1)
- add_definitions(-DDBG_TARGET_AMD64=1)
- add_definitions(-DDBG_TARGET_WIN64=1)
+ add_definitions(-D_TARGET_AMD64_)
+ add_definitions(-DDBG_TARGET_64BIT)
+ add_definitions(-DDBG_TARGET_AMD64)
+ add_definitions(-DDBG_TARGET_WIN64)
add_definitions(-DBIT64)
elseif(CLR_CMAKE_PLATFORM_ARCH_I386)
- add_definitions(-D_TARGET_X86_=1)
- add_definitions(-DDBG_TARGET_32BIT=1)
- add_definitions(-DDBG_TARGET_X86=1)
+ add_definitions(-D_TARGET_X86_)
+ add_definitions(-DDBG_TARGET_32BIT)
+ add_definitions(-DDBG_TARGET_X86)
elseif(CLR_CMAKE_PLATFORM_ARCH_ARM)
- add_definitions(-D_TARGET_ARM_=1)
- add_definitions(-DDBG_TARGET_32BIT=1)
- add_definitions(-DDBG_TARGET_ARM=1)
+ add_definitions(-D_TARGET_ARM_)
+ add_definitions(-DDBG_TARGET_32BIT)
+ add_definitions(-DDBG_TARGET_ARM)
elseif(CLR_CMAKE_PLATFORM_ARCH_ARM64)
- add_definitions(-D_TARGET_ARM64_=1)
- add_definitions(-DDBG_TARGET_64BIT=1)
- add_definitions(-DDBG_TARGET_ARM64=1)
- add_definitions(-DDBG_TARGET_WIN64=1)
+ add_definitions(-D_TARGET_ARM64_)
+ add_definitions(-DDBG_TARGET_64BIT)
+ add_definitions(-DDBG_TARGET_ARM64)
+ add_definitions(-DDBG_TARGET_WIN64)
add_definitions(-DBIT64)
SET(REQUIRE_LLDBPLUGIN false)
endif()