diff options
author | Jeremy Koritzinsky <jkoritzinsky@gmail.com> | 2019-06-06 14:43:54 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-06 14:43:54 -0700 |
commit | 4c82068adb046eee3573984392a0d1e774062ae0 (patch) | |
tree | c94ee1b120f165f121101b7dc368fa2c57dd5f0a | |
parent | 2e9cd827b0db60ad42f7df1f34ee1fada1951e5f (diff) | |
download | coreclr-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
24 files changed, 158 insertions, 210 deletions
diff --git a/clrdefinitions.cmake b/clrdefinitions.cmake index 255923693e..aacc2f053f 100644 --- a/clrdefinitions.cmake +++ b/clrdefinitions.cmake @@ -6,44 +6,44 @@ set(PRERELEASE 1) # Features we're currently flighting, but don't intend to ship in officially supported releases if (PRERELEASE) - add_definitions(-DFEATURE_UTF8STRING=1) - # add_definitions(-DFEATURE_XXX=1) + add_definitions(-DFEATURE_UTF8STRING) + # add_definitions(-DFEATURE_XXX) endif (PRERELEASE) if (CLR_CMAKE_TARGET_ARCH_AMD64) if (CLR_CMAKE_PLATFORM_UNIX) add_definitions(-DDBG_TARGET_AMD64_UNIX) endif() - add_definitions(-D_TARGET_AMD64_=1) - add_definitions(-D_TARGET_64BIT_=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(-D_TARGET_64BIT_) + add_definitions(-DDBG_TARGET_64BIT) + add_definitions(-DDBG_TARGET_AMD64) + add_definitions(-DDBG_TARGET_WIN64) elseif (CLR_CMAKE_TARGET_ARCH_ARM64) if (CLR_CMAKE_PLATFORM_UNIX) add_definitions(-DDBG_TARGET_ARM64_UNIX) endif() - add_definitions(-D_TARGET_ARM64_=1) - add_definitions(-D_TARGET_64BIT_=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(-D_TARGET_64BIT_) + add_definitions(-DDBG_TARGET_64BIT) + add_definitions(-DDBG_TARGET_ARM64) + add_definitions(-DDBG_TARGET_WIN64) add_definitions(-DFEATURE_MULTIREG_RETURN) elseif (CLR_CMAKE_TARGET_ARCH_ARM) if (CLR_CMAKE_PLATFORM_UNIX) add_definitions(-DDBG_TARGET_ARM_UNIX) elseif (WIN32 AND NOT DEFINED CLR_CROSS_COMPONENTS_BUILD) # Set this to ensure we can use Arm SDK for Desktop binary linkage when doing native (Arm32) build - add_definitions(-D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1) + add_definitions(-D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE) add_definitions(-D_ARM_WORKAROUND_) endif (CLR_CMAKE_PLATFORM_UNIX) - 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_TARGET_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) else () clr_unknown_arch() endif (CLR_CMAKE_TARGET_ARCH_AMD64) @@ -81,7 +81,7 @@ if(WIN32) add_definitions(-D_WIN32) add_definitions(-DWINVER=0x0602) add_definitions(-D_WIN32_WINNT=0x0602) - add_definitions(-DWIN32_LEAN_AND_MEAN=1) + add_definitions(-DWIN32_LEAN_AND_MEAN) add_definitions(-D_CRT_SECURE_NO_WARNINGS) if(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386) # Only enable edit and continue on windows x86 and x64 @@ -122,8 +122,8 @@ if(FEATURE_DBGIPC) endif(FEATURE_DBGIPC) add_definitions(-DFEATURE_DEFAULT_INTERFACES) if(FEATURE_EVENT_TRACE) - add_definitions(-DFEATURE_EVENT_TRACE=1) - add_definitions(-DFEATURE_PERFTRACING=1) + add_definitions(-DFEATURE_EVENT_TRACE) + add_definitions(-DFEATURE_PERFTRACING) endif(FEATURE_EVENT_TRACE) if(FEATURE_GDBJIT) add_definitions(-DFEATURE_GDBJIT) @@ -138,7 +138,7 @@ if(FEATURE_GDBJIT_SYMTAB) add_definitions(-DFEATURE_GDBJIT_SYMTAB) endif(FEATURE_GDBJIT_SYMTAB) if(CLR_CMAKE_PLATFORM_UNIX) - add_definitions(-DFEATURE_EVENTSOURCE_XPLAT=1) + add_definitions(-DFEATURE_EVENTSOURCE_XPLAT) endif(CLR_CMAKE_PLATFORM_UNIX) # NetBSD doesn't implement this feature if(NOT CMAKE_SYSTEM_NAME STREQUAL NetBSD) diff --git a/configurecompiler.cmake b/configurecompiler.cmake index a5e44bbc4e..41da56307b 100644 --- a/configurecompiler.cmake +++ b/configurecompiler.cmake @@ -366,7 +366,7 @@ if (CLR_CMAKE_PLATFORM_ARCH_AMD64) add_definitions(-D_AMD64_) add_definitions(-D_WIN64) add_definitions(-DAMD64) - add_definitions(-DBIT64=1) + add_definitions(-DBIT64) elseif (CLR_CMAKE_PLATFORM_ARCH_I386) add_definitions(-D_X86_) elseif (CLR_CMAKE_PLATFORM_ARCH_ARM) @@ -376,7 +376,7 @@ elseif (CLR_CMAKE_PLATFORM_ARCH_ARM64) add_definitions(-D_ARM64_) add_definitions(-DARM64) add_definitions(-D_WIN64) - add_definitions(-DBIT64=1) + add_definitions(-DBIT64) else () clr_unknown_arch() endif () @@ -402,7 +402,7 @@ if (CLR_CMAKE_PLATFORM_UNIX) endif(CLR_CMAKE_PLATFORM_UNIX) if (CLR_CMAKE_PLATFORM_UNIX) - add_definitions(-DPLATFORM_UNIX=1) + add_definitions(-DPLATFORM_UNIX) if(CLR_CMAKE_PLATFORM_DARWIN) message("Detected OSX x86_64") @@ -418,7 +418,7 @@ if (CLR_CMAKE_PLATFORM_UNIX) endif(CLR_CMAKE_PLATFORM_UNIX) if (WIN32) - add_definitions(-DPLATFORM_WINDOWS=1) + add_definitions(-DPLATFORM_WINDOWS) # Define the CRT lib references that link into Desktop imports set(STATIC_MT_CRT_LIB "libcmt$<$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>:d>.lib") diff --git a/crossgen.cmake b/crossgen.cmake index 27f4b7c922..6f416bf6cc 100644 --- a/crossgen.cmake +++ b/crossgen.cmake @@ -10,7 +10,7 @@ add_definitions( remove_definitions( -DFEATURE_CODE_VERSIONING -DEnC_SUPPORTED - -DFEATURE_EVENT_TRACE=1 + -DFEATURE_EVENT_TRACE -DFEATURE_INTERPRETER -DFEATURE_MULTICOREJIT -DFEATURE_PERFMAP 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() diff --git a/src/corefx/System.Globalization.Native/CMakeLists.txt b/src/corefx/System.Globalization.Native/CMakeLists.txt index 3d2518d45b..1d4c946f23 100644 --- a/src/corefx/System.Globalization.Native/CMakeLists.txt +++ b/src/corefx/System.Globalization.Native/CMakeLists.txt @@ -2,8 +2,8 @@ project(System.Globalization.Native C) set(CMAKE_INCLUDE_CURRENT_DIR ON) -add_definitions(-DPIC=1) -add_definitions(-DBIT64=1) +add_definitions(-DPIC) +add_definitions(-DBIT64) set(ICU_HOMEBREW_INC_PATH "/usr/local/opt/icu4c/include") @@ -85,7 +85,7 @@ else() dl ) - add_definitions(-DU_DISABLE_RENAMING=1) + add_definitions(-DU_DISABLE_RENAMING) endif() verify_dependencies( diff --git a/src/debug/createdump/CMakeLists.txt b/src/debug/createdump/CMakeLists.txt index 4e5b7a15f1..b44016c4d0 100644 --- a/src/debug/createdump/CMakeLists.txt +++ b/src/debug/createdump/CMakeLists.txt @@ -18,7 +18,7 @@ remove_definitions(-D_UNICODE) include_directories(BEFORE ${VM_DIR}) -add_definitions(-DPAL_STDCPP_COMPAT=1) +add_definitions(-DPAL_STDCPP_COMPAT) add_compile_options(-fPIE) diff --git a/src/debug/debug-pal/CMakeLists.txt b/src/debug/debug-pal/CMakeLists.txt index ac0f97e468..59ed63ea4f 100644 --- a/src/debug/debug-pal/CMakeLists.txt +++ b/src/debug/debug-pal/CMakeLists.txt @@ -2,7 +2,7 @@ include_directories(../inc) include_directories(../../pal/inc) -add_definitions(-DPAL_STDCPP_COMPAT=1) +add_definitions(-DPAL_STDCPP_COMPAT) if(WIN32) add_definitions(-DWIN32_LEAN_AND_MEAN) diff --git a/src/dlls/mscoree/coreclr/CMakeLists.txt b/src/dlls/mscoree/coreclr/CMakeLists.txt index 0e847c684b..215aad13a9 100644 --- a/src/dlls/mscoree/coreclr/CMakeLists.txt +++ b/src/dlls/mscoree/coreclr/CMakeLists.txt @@ -154,48 +154,53 @@ endif(FEATURE_EVENT_TRACE) target_link_libraries(coreclr ${CORECLR_LIBRARIES}) if(WIN32) - # Add dac table & debug resource to coreclr - get_include_directories(INC_DIR) - get_compile_definitions(PREPROCESS_DEFINITIONS) - 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_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) + if (NOT CMAKE_GENERATOR MATCHES "Visual Studio .*") + add_custom_target(inject_debug_resources ALL COMMAND UNABLE_TO_EMBED_DAC_ON_WINDOWS_NON_VS_GENERATOR) + add_dependencies(inject_debug_resources coreclr mscordaccore mscordbi) else() - clr_unknown_arch() - endif() - - set(DACTABLEGEN_EXE ${CMAKE_BINARY_DIR}/src/ToolBox/SOS/DacTableGen/dactablegen.exe) - - if (CLR_CMAKE_CROSS_ARCH) - include(${CMAKE_INSTALL_PREFIX}/${CLR_CMAKE_CROSS_HOST_ARCH}/dactabletools/dactabletools.cmake) - endif() - - set(INJECT_RESOURCE_EXE $<TARGET_FILE:InjectResource>) - set(GEN_CLR_DEBUG_RESOURCE_EXE $<TARGET_FILE:GenClrDebugResource>) - - add_custom_command( - DEPENDS coreclr mscordaccore mscordbi ${CLR_DIR}/src/debug/daccess/daccess.cpp - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/inject_debug_resources.timestamp - 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 ${DACTABLEGEN_EXE} /dac:${CMAKE_CURRENT_BINARY_DIR}/daccess.i /pdb:${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/coreclr.pdb /dll:$<TARGET_FILE:coreclr> /bin:${CMAKE_CURRENT_BINARY_DIR}/wks.bin - COMMAND ${INJECT_RESOURCE_EXE} /bin:${CMAKE_CURRENT_BINARY_DIR}/wks.bin /dll:$<TARGET_FILE:coreclr> - COMMAND ${GEN_CLR_DEBUG_RESOURCE_EXE} /dac:$<TARGET_FILE:mscordaccore> /dbi:$<TARGET_FILE:mscordbi> /sku:onecoreclr /out:${CMAKE_CURRENT_BINARY_DIR}/clrDebugResource.bin - COMMAND ${INJECT_RESOURCE_EXE} /bin:${CMAKE_CURRENT_BINARY_DIR}/clrDebugResource.bin /dll:$<TARGET_FILE:coreclr> /name:CLRDEBUGINFO - COMMAND ${INJECT_RESOURCE_EXE} /bin:${CMAKE_CURRENT_SOURCE_DIR}/dump_helper_resource.bin /dll:$<TARGET_FILE:coreclr> /name:MINIDUMP_AUXILIARY_PROVIDER - COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/inject_debug_resources.timestamp - COMMENT Add dactable, debug resources, and dump helper resources to coreclr - ) - - if(NOT DEFINED CLR_CROSS_COMPONENTS_BUILD) - add_custom_target(inject_debug_resources ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/inject_debug_resources.timestamp) + # Add dac table & debug resource to coreclr + get_include_directories(INC_DIR) + get_compile_definitions(PREPROCESS_DEFINITIONS) + 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 -DDBG_TARGET_WIN64) + + if (CLR_CMAKE_PLATFORM_ARCH_AMD64) + list(APPEND PREPROCESS_DEFINITIONS -DDBG_TARGET_AMD64) + elseif (CLR_CMAKE_PLATFORM_ARCH_ARM64) + list(APPEND PREPROCESS_DEFINITIONS -DDBG_TARGET_ARM64) + elseif (CLR_CMAKE_PLATFORM_ARCH_ARM) + list(APPEND PREPROCESS_DEFINITIONS -DDBG_TARGET_ARM) + elseif (CLR_CMAKE_PLATFORM_ARCH_I386) + list(APPEND PREPROCESS_DEFINITIONS -DDBG_TARGET_X86) + else() + clr_unknown_arch() + endif() + + + if (CLR_CMAKE_CROSS_ARCH) + include(${CMAKE_INSTALL_PREFIX}/${CLR_CMAKE_CROSS_HOST_ARCH}/dactabletools/dactabletools.cmake) + endif() + + set(DACTABLEGEN_EXE $<TARGET_FILE:dactablegen>) + set(INJECT_RESOURCE_EXE $<TARGET_FILE:InjectResource>) + set(GEN_CLR_DEBUG_RESOURCE_EXE $<TARGET_FILE:GenClrDebugResource>) + + add_custom_command( + DEPENDS coreclr mscordaccore mscordbi ${CLR_DIR}/src/debug/daccess/daccess.cpp + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/inject_debug_resources.timestamp + 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 ${DACTABLEGEN_EXE} /dac:${CMAKE_CURRENT_BINARY_DIR}/daccess.i /pdb:${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/coreclr.pdb /dll:$<TARGET_FILE:coreclr> /bin:${CMAKE_CURRENT_BINARY_DIR}/wks.bin + COMMAND ${INJECT_RESOURCE_EXE} /bin:${CMAKE_CURRENT_BINARY_DIR}/wks.bin /dll:$<TARGET_FILE:coreclr> + COMMAND ${GEN_CLR_DEBUG_RESOURCE_EXE} /dac:$<TARGET_FILE:mscordaccore> /dbi:$<TARGET_FILE:mscordbi> /sku:onecoreclr /out:${CMAKE_CURRENT_BINARY_DIR}/clrDebugResource.bin + COMMAND ${INJECT_RESOURCE_EXE} /bin:${CMAKE_CURRENT_BINARY_DIR}/clrDebugResource.bin /dll:$<TARGET_FILE:coreclr> /name:CLRDEBUGINFO + COMMAND ${INJECT_RESOURCE_EXE} /bin:${CMAKE_CURRENT_SOURCE_DIR}/dump_helper_resource.bin /dll:$<TARGET_FILE:coreclr> /name:MINIDUMP_AUXILIARY_PROVIDER + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/inject_debug_resources.timestamp + COMMENT Add dactable, debug resources, and dump helper resources to coreclr + ) + + if(NOT DEFINED CLR_CROSS_COMPONENTS_BUILD) + add_custom_target(inject_debug_resources ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/inject_debug_resources.timestamp) + endif() endif() endif(WIN32) diff --git a/src/gc/sample/CMakeLists.txt b/src/gc/sample/CMakeLists.txt index 6eb4b27f22..7dbb0540d1 100644 --- a/src/gc/sample/CMakeLists.txt +++ b/src/gc/sample/CMakeLists.txt @@ -35,7 +35,7 @@ endif(WIN32) if(WIN32) list(APPEND SOURCES ../windows/gcenv.windows.cpp) - add_definitions(-DUNICODE=1) + add_definitions(-DUNICODE) else() list(APPEND SOURCES ../gcenv.unix.cpp) @@ -47,4 +47,4 @@ _add_executable(gcsample if(WIN32) target_link_libraries(gcsample ${GC_LINK_LIBRARIES}) -endif()
\ No newline at end of file +endif() diff --git a/src/gcinfo/gcinfo_arm/CMakeLists.txt b/src/gcinfo/gcinfo_arm/CMakeLists.txt index 3617c97f3f..bcbe1a03c3 100644 --- a/src/gcinfo/gcinfo_arm/CMakeLists.txt +++ b/src/gcinfo/gcinfo_arm/CMakeLists.txt @@ -1,4 +1,4 @@ -remove_definitions(-D_TARGET_X86_=1) +remove_definitions(-D_TARGET_X86_) add_definitions(-D_TARGET_ARM_) add_library_clr(gcinfo_arm diff --git a/src/gcinfo/gcinfo_arm64/CMakeLists.txt b/src/gcinfo/gcinfo_arm64/CMakeLists.txt index 116ed7c1d6..cc0885d9e5 100644 --- a/src/gcinfo/gcinfo_arm64/CMakeLists.txt +++ b/src/gcinfo/gcinfo_arm64/CMakeLists.txt @@ -1,4 +1,4 @@ -remove_definitions(-D_TARGET_AMD64_=1) +remove_definitions(-D_TARGET_AMD64_) add_definitions(-D_TARGET_ARM64_) add_library_clr(gcinfo_arm64 diff --git a/src/jit/CMakeLists.txt b/src/jit/CMakeLists.txt index 8a3475605b..b2572a8e6b 100644 --- a/src/jit/CMakeLists.txt +++ b/src/jit/CMakeLists.txt @@ -14,7 +14,7 @@ if (CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64 OR (CLR_CMAKE_TAR endif () # JIT_BUILD disables certain PAL_TRY debugging features -add_definitions(-DJIT_BUILD=1) +add_definitions(-DJIT_BUILD) if(WIN32) set(JIT_RESOURCES Native.rc) diff --git a/src/jit/armelnonjit/CMakeLists.txt b/src/jit/armelnonjit/CMakeLists.txt index cccba304da..e6d1b2705e 100644 --- a/src/jit/armelnonjit/CMakeLists.txt +++ b/src/jit/armelnonjit/CMakeLists.txt @@ -13,13 +13,13 @@ if(FEATURE_READYTORUN) endif(FEATURE_READYTORUN) if (CLR_CMAKE_PLATFORM_ARCH_I386) - remove_definitions(-D_TARGET_X86_=1) + remove_definitions(-D_TARGET_X86_) add_definitions(-D_TARGET_ARM_) - add_definitions(-DARM_SOFTFP=1) + add_definitions(-DARM_SOFTFP) set(JIT_ARCH_ALTJIT_SOURCES ${JIT_ARM_SOURCES}) set(JIT_ARCH_LINK_LIBRARIES gcinfo_arm) elseif(CLR_CMAKE_PLATFORM_ARCH_AMD64) - remove_definitions(-D_TARGET_AMD64_=1) + remove_definitions(-D_TARGET_AMD64_) add_definitions(-D_TARGET_ARM64_) set(JIT_ARCH_ALTJIT_SOURCES ${JIT_ARM64_SOURCES}) set(JIT_ARCH_LINK_LIBRARIES gcinfo_arm64) diff --git a/src/jit/protononjit/CMakeLists.txt b/src/jit/protononjit/CMakeLists.txt index f921763e25..dfe67f5423 100644 --- a/src/jit/protononjit/CMakeLists.txt +++ b/src/jit/protononjit/CMakeLists.txt @@ -10,14 +10,14 @@ if(FEATURE_READYTORUN) endif(FEATURE_READYTORUN) if (CLR_CMAKE_PLATFORM_ARCH_I386) - remove_definitions(-D_TARGET_X86_=1) + remove_definitions(-D_TARGET_X86_) remove_definitions(-DFEATURE_SIMD) remove_definitions(-DFEATURE_HW_INTRINSICS) add_definitions(-D_TARGET_ARM_) set(JIT_ARCH_ALTJIT_SOURCES ${JIT_ARM_SOURCES}) set(JIT_ARCH_LINK_LIBRARIES gcinfo_arm) elseif(CLR_CMAKE_PLATFORM_ARCH_AMD64) - remove_definitions(-D_TARGET_AMD64_=1) + remove_definitions(-D_TARGET_AMD64_) add_definitions(-D_TARGET_ARM64_) set(JIT_ARCH_ALTJIT_SOURCES ${JIT_ARM64_SOURCES}) set(JIT_ARCH_LINK_LIBRARIES gcinfo_arm64) diff --git a/src/pal/src/CMakeLists.txt b/src/pal/src/CMakeLists.txt index 28f5bfb41d..6d8d92f0eb 100644 --- a/src/pal/src/CMakeLists.txt +++ b/src/pal/src/CMakeLists.txt @@ -123,25 +123,25 @@ if(CMAKE_SYSTEM_NAME STREQUAL Darwin) ) endif(CMAKE_SYSTEM_NAME STREQUAL Darwin) -add_definitions(-DPLATFORM_UNIX=1) -add_definitions(-DLP64COMPATIBLE=1) -add_definitions(-DFEATURE_PAL=1) -add_definitions(-DCORECLR=1) -add_definitions(-DPIC=1) +add_definitions(-DPLATFORM_UNIX) +add_definitions(-DLP64COMPATIBLE) +add_definitions(-DFEATURE_PAL) +add_definitions(-DCORECLR) +add_definitions(-DPIC) add_definitions(-D_FILE_OFFSET_BITS=64) if(PAL_CMAKE_PLATFORM_ARCH_AMD64) - add_definitions(-DBIT64=1) - add_definitions(-D_WIN64=1) + add_definitions(-DBIT64) + add_definitions(-D_WIN64) set(PAL_ARCH_SOURCES_DIR amd64) elseif(PAL_CMAKE_PLATFORM_ARCH_ARM) - add_definitions(-DBIT32=1) + add_definitions(-DBIT32) set(PAL_ARCH_SOURCES_DIR arm) elseif(PAL_CMAKE_PLATFORM_ARCH_ARM64) - add_definitions(-DBIT64=1) - add_definitions(-D_WIN64=1) + add_definitions(-DBIT64) + add_definitions(-D_WIN64) set(PAL_ARCH_SOURCES_DIR arm64) elseif(PAL_CMAKE_PLATFORM_ARCH_I386) - add_definitions(-DBIT32=1) + add_definitions(-DBIT32) set(PAL_ARCH_SOURCES_DIR i386) endif() diff --git a/src/pal/tests/CMakeLists.txt b/src/pal/tests/CMakeLists.txt index 0ec630df8c..24a9e7b74a 100644 --- a/src/pal/tests/CMakeLists.txt +++ b/src/pal/tests/CMakeLists.txt @@ -11,21 +11,21 @@ elseif(CLR_CMAKE_PLATFORM_ARCH_ARM64) endif() # Compile options -add_definitions(-DPLATFORM_UNIX=1) -add_definitions(-DLP64COMPATIBLE=1) -add_definitions(-DFEATURE_PAL=1) -add_definitions(-DCORECLR=1) -add_definitions(-DPIC=1) +add_definitions(-DPLATFORM_UNIX) +add_definitions(-DLP64COMPATIBLE) +add_definitions(-DFEATURE_PAL) +add_definitions(-DCORECLR) +add_definitions(-DPIC) if(PAL_CMAKE_PLATFORM_ARCH_I386) - add_definitions(-DBIT32=1) + add_definitions(-DBIT32) elseif(PAL_CMAKE_PLATFORM_ARCH_AMD64) - add_definitions(-DBIT64=1) - add_definitions(-D_WIN64=1) + add_definitions(-DBIT64) + add_definitions(-D_WIN64) elseif(PAL_CMAKE_PLATFORM_ARCH_ARM) - add_definitions(-DBIT32=1) + add_definitions(-DBIT32) elseif(PAL_CMAKE_PLATFORM_ARCH_ARM64) - add_definitions(-DBIT64=1) - add_definitions(-D_WIN64=1) + add_definitions(-DBIT64) + add_definitions(-D_WIN64) else() message(FATAL_ERROR "Only ARM, ARM64, I386, and AMD64 is supported") endif() diff --git a/src/pal/tests/palsuite/eventprovider/CMakeLists.txt b/src/pal/tests/palsuite/eventprovider/CMakeLists.txt index f74fc9b604..8b43aad633 100644 --- a/src/pal/tests/palsuite/eventprovider/CMakeLists.txt +++ b/src/pal/tests/palsuite/eventprovider/CMakeLists.txt @@ -26,7 +26,7 @@ add_executable(eventprovidertest ) set(EVENT_PROVIDER_DEPENDENCIES "") if(FEATURE_EVENT_TRACE) - add_definitions(-DFEATURE_EVENT_TRACE=1) + add_definitions(-DFEATURE_EVENT_TRACE) list(APPEND EVENT_PROVIDER_DEPENDENCIES eventprovider ) diff --git a/src/vm/CMakeLists.txt b/src/vm/CMakeLists.txt index f10b2e43ee..83975906dc 100644 --- a/src/vm/CMakeLists.txt +++ b/src/vm/CMakeLists.txt @@ -17,7 +17,7 @@ if(CMAKE_CONFIGURATION_TYPES) # multi-configuration generator? endforeach (Config) else() if(UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG OR UPPERCASE_CMAKE_BUILD_TYPE STREQUAL CHECKED) - add_definitions(-DWRITE_BARRIER_CHECK=1) + add_definitions(-DWRITE_BARRIER_CHECK) endif(UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG OR UPPERCASE_CMAKE_BUILD_TYPE STREQUAL CHECKED) endif(CMAKE_CONFIGURATION_TYPES) diff --git a/src/vm/crossgen_mscorlib/CMakeLists.txt b/src/vm/crossgen_mscorlib/CMakeLists.txt index 38756ecac2..b79a08ff9a 100644 --- a/src/vm/crossgen_mscorlib/CMakeLists.txt +++ b/src/vm/crossgen_mscorlib/CMakeLists.txt @@ -3,7 +3,7 @@ include(${CLR_DIR}/crossgen.cmake) # Add back some of the macro removed by crossgen.cmake. add_definitions( -DEnC_SUPPORTED - -DFEATURE_EVENT_TRACE=1 + -DFEATURE_EVENT_TRACE -DFEATURE_MULTICOREJIT -DFEATURE_VERSIONING_LOG ) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 937ecd30cc..665b368746 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -5,7 +5,7 @@ cmake_policy(SET CMP0042 NEW) set(INC_PLATFORM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/Common/Platform) if (WIN32) - add_definitions(-DWINDOWS=1) + add_definitions(-DWINDOWS) endif() # Verify that LTCG/LTO is available |