Skip to content

Commit

Permalink
Integrate DNMD into the runtime repos build.
Browse files Browse the repository at this point in the history
Convert testing harness to C++11.
Convert DNMD PALs to use the minipal and the COM minipal.
Integrate DNMD testing into the CLR_Tools_Tests job.
Link ole32 to the minipal.
  • Loading branch information
jkoritzinsky committed Oct 31, 2024
1 parent 5ecd9ef commit c03b575
Show file tree
Hide file tree
Showing 87 changed files with 1,887 additions and 10,957 deletions.
6 changes: 6 additions & 0 deletions eng/Subsets.props
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@
<SubsetName Include="Tools.ILLinkTests" OnDemand="true" Description="Unit tests for the tools.illink subset." />

<SubsetName Include="Tools.CdacReaderTests" OnDemand="true" Description="Units tests for the cDAC reader." />
<SubsetName Include="Tools.NativeTests" OnDemand="true" Description="Native unit tests for native tools and libraries." />

<!-- Host -->
<SubsetName Include="Host" Description="The .NET hosts, packages, hosting libraries, and tests. Equivalent to: $(DefaultHostSubsets)" />
Expand Down Expand Up @@ -409,6 +410,11 @@
Test="true" Category="tools"/>
</ItemGroup>

<ItemGroup Condition="$(_subset.Contains('+tools.nativetests+'))">
<ProjectToBuild Include="$(RepoRoot)src\native\dnmd\dnmd.proj"
Test="true" Category="tools" Condition="'$(DotNetBuildSourceOnly)' != 'true'"/>
</ItemGroup>

<ItemGroup Condition="$(_subset.Contains('+clr.nativecorelib+'))">
<ProjectToBuild Include="$(CoreClrProjectRoot)crossgen-corelib.proj" Category="clr" />
</ItemGroup>
Expand Down
4 changes: 3 additions & 1 deletion eng/native/configurecompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ if (MSVC)
define_property(TARGET PROPERTY CLR_EH_CONTINUATION INHERITED BRIEF_DOCS "Controls the /guard:ehcont flag presence" FULL_DOCS "Set this property to ON or OFF to indicate if the /guard:ehcont compiler flag should be present")
define_property(TARGET PROPERTY CLR_EH_OPTION INHERITED BRIEF_DOCS "Defines the value of the /EH option" FULL_DOCS "Set this property to one of the valid /EHxx options (/EHa, /EHsc, /EHa-, ...)")
define_property(TARGET PROPERTY MSVC_WARNING_LEVEL INHERITED BRIEF_DOCS "Define the warning level for the /Wn option" FULL_DOCS "Set this property to one of the valid /Wn options (/W0, /W1, /W2, /W3, /W4)")
define_property(TARGET PROPERTY SET_SOURCE_CHARSET INHERITED BRIEF_DOCS "Add the /source-charset option" FULL_DOCS "Set this property to add the /source-charset:utf8 option")

set_property(GLOBAL PROPERTY CLR_CONTROL_FLOW_GUARD ON)

Expand Down Expand Up @@ -881,7 +882,8 @@ if (MSVC)

add_compile_options($<$<COMPILE_LANGUAGE:C,CXX,ASM_MASM>:/Zi>) # enable debugging information
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/ZH:SHA_256>) # use SHA256 for generating hashes of compiler processed source files.
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/source-charset:utf-8>) # Force MSVC to compile source as UTF-8.
set_property(GLOBAL PROPERTY SET_SOURCE_CHARSET ON)
add_compile_options($<$<AND:$<BOOL:$<TARGET_PROPERTY:SET_SOURCE_CHARSET>>,$<COMPILE_LANGUAGE:C,CXX>>:/source-charset:utf-8>) # Force MSVC to compile source as UTF-8.

if (CLR_CMAKE_HOST_ARCH_I386)
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/Gz>)
Expand Down
12 changes: 11 additions & 1 deletion eng/pipelines/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -692,9 +692,19 @@ extends:
jobParameters:
timeoutInMinutes: 120
nameSuffix: CLR_Tools_Tests
buildArgs: -s clr.aot+clr.iltools+libs.sfx+clr.toolstests+tools.cdacreadertests -c $(_BuildConfig) -test
buildArgs: -s clr.aot+clr.iltools+libs.sfx+clr.toolstests+tools.cdacreadertests+tools.nativetests -c $(_BuildConfig) -test
enablePublishTestResults: true
testResultsFormat: 'xunit'
postBuildSteps:
- task: PublishTestResults@2
displayName: 'Publish CTest Results'
inputs:
testResultsFormat: 'CTest'
testResultsFiles: '*.ctestxml'
searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)'
testRunTitle: 'CLR_Tools_Tests-$(_BuildConfig)-ctest'
continueOnError: true
condition: always()
# We want to run AOT tests when illink changes because there's share code and tests from illink which are used by AOT
condition: >-
or(
Expand Down
7 changes: 7 additions & 0 deletions src/coreclr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,17 @@ add_subdirectory(pal/prebuilt/inc)
set(EP_GENERATED_HEADER_PATH "${GENERATED_INCLUDE_DIR}")
include (${CLR_SRC_NATIVE_DIR}/eventpipe/configure.cmake)

#--------------------------------
# Include shared native libraries
#--------------------------------
add_subdirectory(${CLR_SRC_NATIVE_DIR}/containers containers)
add_subdirectory(${CLR_SRC_NATIVE_DIR}/eventpipe eventpipe)
add_subdirectory(${CLR_SRC_NATIVE_DIR}/minipal shared_minipal)

if (NOT CLR_CROSS_COMPONENTS_BUILD)
include(dnmd.cmake)
endif()

if(NOT CLR_CMAKE_HOST_MACCATALYST AND NOT CLR_CMAKE_HOST_IOS AND NOT CLR_CMAKE_HOST_TVOS)
add_subdirectory(debug/debug-pal)
endif()
Expand Down
3 changes: 3 additions & 0 deletions src/coreclr/build-runtime.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,9 @@ for /f "delims=" %%a in ("-%__RequestedBuildComponents%-") do (
if not "!string:-crosscomponents-=!"=="!string!" (
set __CMakeTarget=!__CMakeTarget! crosscomponents
)
if not "!string:-cdac-=!"=="!string!" (
set __CMakeTarget=!__CMakeTarget! cdac
)
if not "!string:-debug-=!"=="!string!" (
set __CMakeTarget=!__CMakeTarget! debug
)
Expand Down
3 changes: 3 additions & 0 deletions src/coreclr/components.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ add_dependencies(runtime hosts)

# The cross-components build is separate, so we don't need to add a dependency on coreclr_misc
add_component(crosscomponents)

# The cdac-components build is separate
add_component(cdac)
18 changes: 18 additions & 0 deletions src/coreclr/dnmd.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Include the dnmd project into the CoreCLR build
include(FetchContent)
FetchContent_Declare(
dnmd
SOURCE_DIR "${CLR_SRC_NATIVE_DIR}/dnmd"
)

set(DNMD_BUILD_TESTS OFF)
set(DNMD_INSTALL OFF)
FetchContent_MakeAvailable(dnmd)

set_property(DIRECTORY ${CLR_SRC_NATIVE_DIR}/dnmd PROPERTY CLR_CONTROL_FLOW_GUARD ON)

# Install dnmd for usage by the cdac.
install_static_library(dnmd cdac cdac)
install_static_library(dnmd_interfaces_static cdac cdac)
install(TARGETS dnmd_interfaces DESTINATION cdac COMPONENT cdac)
add_dependencies(cdac dnmd_interfaces)
4 changes: 4 additions & 0 deletions src/coreclr/inc/corhdr.h
Original file line number Diff line number Diff line change
Expand Up @@ -1752,7 +1752,11 @@ typedef enum NativeTypeArrayFlags
//
// Enum used for HFA type recognition.
// Supported across architectures, so that it can be used in altjits and cross-compilation.
#ifdef __cplusplus
typedef enum CorInfoHFAElemType : unsigned {
#else
typedef enum CorInfoHFAElemType {
#endif
CORINFO_HFA_ELEM_NONE,
CORINFO_HFA_ELEM_FLOAT,
CORINFO_HFA_ELEM_DOUBLE,
Expand Down
60 changes: 0 additions & 60 deletions src/native/dnmd/.github/workflows/main.yml

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions src/native/dnmd/.gitmodules

This file was deleted.

38 changes: 26 additions & 12 deletions src/native/dnmd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,37 @@
cmake_minimum_required(VERSION 3.10)
cmake_minimum_required(VERSION 3.20)
project(dnmd
LANGUAGES C CXX)
LANGUAGES C)

option(INCLUDE_VENDORED_LIBS "Include vendored libraries (submodules) instead of discovering dependencies through packages." ON)
# Always include our public headers
include_directories(src/inc)

# Include the metadata API headers provided by CoreCLR
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../coreclr/inc ${CMAKE_CURRENT_SOURCE_DIR}/../../coreclr/pal/prebuilt/inc)

set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR})
if ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
# This is our root CMakeList.txt, so we need to set up some global settings and include the minipal here.
include(../../../eng/native/configurepaths.cmake)
include(${CLR_ENG_NATIVE_DIR}/configurecompiler.cmake)

if (INCLUDE_VENDORED_LIBS)
add_subdirectory(external/dncp)
else()
find_package(dncp REQUIRED)
add_subdirectory(${CLR_SRC_NATIVE_DIR}/minipal minipal)
endif()

include_directories(src/inc)
include_directories(src/inc/external) # Hiding the "external" subdirectory due to uses of <...> in cor.h.
include_directories(${CLR_SRC_NATIVE_DIR})

option(DNMD_BUILD_TESTS "Build tests for dnmd" ON)
option(DNMD_INSTALL "Install dnmd targets" ON)
option(DNMD_BUILD_INTERFACES "Build implementations of the metadata interfaces for DNMD" ON)
option(DNMD_BUILD_TOOLS "Build tools for dnmd" ON)

if (DNMD_BUILD_INTERFACES OR DNMD_BUILD_TESTS OR DNMD_BUILD_TOOLS)
enable_language(CXX)
endif()

add_subdirectory(src/)

enable_testing()

add_subdirectory(test/)
if (DNMD_BUILD_TESTS)
enable_testing()

add_subdirectory(test/)
endif()
21 changes: 0 additions & 21 deletions src/native/dnmd/LICENSE.md

This file was deleted.

Loading

0 comments on commit c03b575

Please sign in to comment.