Make Server GC component optional (#5565)
Make the Server GC an optional component by building two flavors of the runtime and selecting a specific one in the build via the `ServerGarbageCollection` MSBuild property. Don't build the Server GC flavor for Web Assembly. Fixes #5182, Fixes #5306.
This commit is contained in:
Родитель
828a35d585
Коммит
31651b1066
|
@ -46,6 +46,9 @@
|
|||
<File Condition="Exists('$(BaseOutputPath)\$(OSPlatformConfig)\sdk\PortableRuntime.pdb')" Include="$(BaseOutputPath)\$(OSPlatformConfig)\sdk\PortableRuntime.pdb">
|
||||
<TargetPath>sdk</TargetPath>
|
||||
</File>
|
||||
<File Condition="Exists('$(BaseOutputPath)\$(OSPlatformConfig)\sdk\Runtime.ServerGC.pdb')" Include="$(BaseOutputPath)\$(OSPlatformConfig)\sdk\Runtime.ServerGC.pdb">
|
||||
<TargetPath>sdk</TargetPath>
|
||||
</File>
|
||||
</ItemGroup>
|
||||
<Target Name="GetPackageDependencies"/>
|
||||
|
||||
|
|
|
@ -36,6 +36,8 @@ See the LICENSE file in the project root for more information.
|
|||
<PropertyGroup>
|
||||
<NativeLibraryExtension Condition="'$(NativeCodeGen)' != 'wasm'">.a</NativeLibraryExtension>
|
||||
<NativeLibraryExtension Condition="'$(NativeCodeGen)' == 'wasm'">.bc</NativeLibraryExtension>
|
||||
<FullRuntimeName>libRuntime</FullRuntimeName>
|
||||
<FullRuntimeName Condition="'$(ServerGarbageCollection)' != ''">libRuntime.ServerGC</FullRuntimeName>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -50,7 +52,7 @@ See the LICENSE file in the project root for more information.
|
|||
<NativeLibrary Condition="'$(IlcMultiModule)' == 'true' and $(NativeCodeGen) == ''" Include="$(SharedLibrary)" />
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == '' and $(NativeLib) == ''" Include="$(IlcPath)/sdk/libbootstrapper.a" />
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == '' and $(NativeLib) != ''" Include="$(IlcPath)/sdk/libbootstrapperdll.a" />
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == ''" Include="$(IlcPath)/sdk/libRuntime.a" />
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == ''" Include="$(IlcPath)/sdk/$(FullRuntimeName).a" />
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == 'cpp'" Include="$(IlcPath)/sdk/libbootstrappercpp.a" />
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == 'cpp'" Include="$(IlcPath)/sdk/libPortableRuntime.a" />
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == 'wasm'" Include="$(IlcPath)/sdk/libbootstrappercpp.bc" />
|
||||
|
|
|
@ -18,6 +18,8 @@ See the LICENSE file in the project root for more information.
|
|||
<CppCompiler>cl</CppCompiler>
|
||||
<CppLinker>link</CppLinker>
|
||||
<CppLibCreator>lib</CppLibCreator>
|
||||
<FullRuntimeName>Runtime</FullRuntimeName>
|
||||
<FullRuntimeName Condition="'$(ServerGarbageCollection)' != ''">Runtime.ServerGC</FullRuntimeName>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Part of workaround for lack of secondary build artifact import - https://github.com/Microsoft/msbuild/issues/2807 -->
|
||||
|
@ -36,7 +38,7 @@ See the LICENSE file in the project root for more information.
|
|||
<ItemGroup>
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == '' and $(NativeLib) == ''" Include="$(IlcPath)\sdk\bootstrapper.lib" />
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == '' and $(NativeLib) != ''" Include="$(IlcPath)\sdk\bootstrapperdll.lib" />
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == ''" Include="$(IlcPath)\sdk\Runtime.lib" />
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == ''" Include="$(IlcPath)\sdk\$(FullRuntimeName).lib" />
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == 'cpp'" Include="$(IlcPath)\sdk\bootstrappercpp.lib" />
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == 'cpp'" Include="$(IlcPath)\sdk\PortableRuntime.lib" />
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == 'wasm'" Include="$(IlcPath)\sdk\bootstrappercpp.lib" />
|
||||
|
|
|
@ -48,8 +48,6 @@ set(COMMON_RUNTIME_SOURCES
|
|||
../gc/gccommon.cpp
|
||||
../gc/gceewks.cpp
|
||||
../gc/gcwks.cpp
|
||||
../gc/gceesvr.cpp
|
||||
../gc/gcsvr.cpp
|
||||
../gc/gcscan.cpp
|
||||
../gc/handletable.cpp
|
||||
../gc/handletablecache.cpp
|
||||
|
@ -58,6 +56,11 @@ set(COMMON_RUNTIME_SOURCES
|
|||
../gc/objecthandle.cpp
|
||||
)
|
||||
|
||||
set(SERVER_GC_SOURCES
|
||||
../gc/gceesvr.cpp
|
||||
../gc/gcsvr.cpp
|
||||
)
|
||||
|
||||
set(FULL_RUNTIME_SOURCES
|
||||
AsmOffsetsVerify.cpp
|
||||
ThunksMapping.cpp
|
||||
|
@ -171,7 +174,6 @@ convert_to_absolute_path(ARCH_SOURCES_DIR ${ARCH_SOURCES_DIR})
|
|||
include_directories(${ARCH_SOURCES_DIR})
|
||||
|
||||
add_definitions(-DFEATURE_BACKGROUND_GC)
|
||||
add_definitions(-DFEATURE_SVR_GC)
|
||||
add_definitions(-DFEATURE_BASICFREEZE)
|
||||
add_definitions(-DFEATURE_CONSERVATIVE_GC)
|
||||
add_definitions(-DFEATURE_CUSTOM_IMPORTS)
|
||||
|
@ -221,6 +223,7 @@ convert_to_absolute_path(COMMON_RUNTIME_SOURCES ${COMMON_RUNTIME_SOURCES})
|
|||
|
||||
convert_to_absolute_path(FULL_RUNTIME_SOURCES ${FULL_RUNTIME_SOURCES})
|
||||
convert_to_absolute_path(PORTABLE_RUNTIME_SOURCES ${PORTABLE_RUNTIME_SOURCES})
|
||||
convert_to_absolute_path(SERVER_GC_SOURCES ${SERVER_GC_SOURCES})
|
||||
|
||||
convert_to_absolute_path(RUNTIME_SOURCES_ARCH_ASM ${RUNTIME_SOURCES_ARCH_ASM})
|
||||
|
||||
|
|
|
@ -11,6 +11,11 @@ add_definitions(-DFEATURE_RX_THUNKS)
|
|||
|
||||
add_library(Runtime STATIC ${COMMON_RUNTIME_SOURCES} ${FULL_RUNTIME_SOURCES} ${RUNTIME_SOURCES_ARCH_ASM})
|
||||
|
||||
add_library(Runtime.ServerGC STATIC ${COMMON_RUNTIME_SOURCES} ${FULL_RUNTIME_SOURCES} ${RUNTIME_SOURCES_ARCH_ASM} ${SERVER_GC_SOURCES})
|
||||
|
||||
target_compile_definitions(Runtime.ServerGC PRIVATE -DFEATURE_SVR_GC)
|
||||
|
||||
|
||||
# Get the current list of definitions
|
||||
get_compile_definitions(DEFINITIONS)
|
||||
|
||||
|
@ -72,7 +77,8 @@ foreach(CONFIG IN LISTS CMAKE_CONFIGURATION_TYPES)
|
|||
endforeach()
|
||||
|
||||
# Install the static Runtime library
|
||||
install (TARGETS Runtime DESTINATION sdk)
|
||||
install (TARGETS Runtime Runtime.ServerGC DESTINATION sdk)
|
||||
if(WIN32)
|
||||
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/Runtime.dir/$<CONFIG>/Runtime.pdb DESTINATION sdk)
|
||||
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/Runtime.ServerGC.dir/$<CONFIG>/Runtime.ServerGC.pdb DESTINATION sdk)
|
||||
endif()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
project(PortableRuntime)
|
||||
|
||||
# Portable version of the runtime is designed to be used with CppCodeGen only.
|
||||
# Portable version of the runtime is designed to be used with CppCodeGen or WASM.
|
||||
# It should be written in pure C/C++, with no assembly code.
|
||||
|
||||
include_directories(..)
|
||||
|
@ -34,6 +34,7 @@ add_custom_command(
|
|||
|
||||
# Install the static Runtime library
|
||||
install (TARGETS PortableRuntime DESTINATION sdk)
|
||||
|
||||
if(WIN32)
|
||||
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/PortableRuntime.dir/$<CONFIG>/PortableRuntime.pdb DESTINATION sdk)
|
||||
endif()
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ServerGarbageCollection>true</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="*.cs" />
|
||||
</ItemGroup>
|
||||
|
|
Загрузка…
Ссылка в новой задаче