Skip to content

Commit 1f93ea7

Browse files
authored
Fix build with FEATURE_STANDALONE_GC disabled (#111682)
* Fix build with FEATURE_STANDALONE_GC disabled Currently, the build fails, because the gc_pal is built only when standalone GC is enabled, but it is used for the built-in GC as well. This change fixes it. * PR feedback
1 parent 41e2b8c commit 1f93ea7

File tree

2 files changed

+42
-45
lines changed

2 files changed

+42
-45
lines changed

src/coreclr/CMakeLists.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,7 @@ endif(CLR_CMAKE_HOST_WIN32)
170170
#----------------------------------
171171
include(clrdefinitions.cmake)
172172

173-
if(FEATURE_STANDALONE_GC)
174-
add_definitions(-DFEATURE_STANDALONE_GC)
175-
add_subdirectory(gc)
176-
endif(FEATURE_STANDALONE_GC)
173+
add_subdirectory(gc)
177174

178175
if (CLR_CMAKE_HOST_UNIX)
179176
include_directories("pal/inc")

src/coreclr/gc/CMakeLists.txt

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
set(CMAKE_INCLUDE_CURRENT_DIR ON)
22

3-
# Local GC meta-issue: https://github.com/dotnet/runtime/issues/8061
4-
5-
# https://github.com/dotnet/runtime/issues/8059
6-
remove_definitions(-DSTRESS_HEAP)
7-
8-
# https://github.com/dotnet/runtime/issues/8062
9-
remove_definitions(-DWRITE_BARRIER_CHECK)
3+
if(FEATURE_STANDALONE_GC)
4+
add_definitions(-DFEATURE_STANDALONE_GC)
5+
remove_definitions(-DSTRESS_HEAP)
6+
remove_definitions(-DWRITE_BARRIER_CHECK)
7+
endif(FEATURE_STANDALONE_GC)
108

119
set(GC_SOURCES
1210
gceventstatus.cpp
@@ -100,37 +98,39 @@ list(APPEND GC_SOURCES ${GC_HEADERS})
10098

10199
convert_to_absolute_path(GC_SOURCES ${GC_SOURCES})
102100

103-
# clrgcexp is build with standalone+regions
104-
if (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64)
105-
add_library_clr(clrgcexp SHARED ${GC_SOURCES})
106-
add_dependencies(clrgcexp eventing_headers)
107-
target_link_libraries(clrgcexp PRIVATE ${GC_LINK_LIBRARIES})
108-
target_compile_definitions(clrgcexp PRIVATE -DUSE_REGIONS)
109-
install_clr(TARGETS clrgcexp DESTINATIONS . COMPONENT runtime)
110-
endif (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64)
111-
112-
# clrgc is build with standalone+segments
113-
add_library_clr(clrgc SHARED ${GC_SOURCES})
114-
add_dependencies(clrgc eventing_headers)
115-
target_link_libraries(clrgc PRIVATE ${GC_LINK_LIBRARIES})
116-
install_clr(TARGETS clrgc DESTINATIONS . COMPONENT runtime)
117-
118-
add_definitions(-DBUILD_AS_STANDALONE)
119-
add_definitions(-DFEATURE_CONSERVATIVE_GC)
120-
121-
add_definitions(-DFX_VER_INTERNALNAME_STR=clrgc.dll)
122-
add_definitions(-DVERIFY_HEAP)
123-
if(CLR_CMAKE_HOST_APPLE)
124-
# The implementation of GCToOSInterface on Apple platforms makes use of non-POSIX
125-
# pthreads APIs, which by default are not included in the pthreads header
126-
# unless we define this macro.
127-
add_definitions(-D_DARWIN_C_SOURCE)
128-
endif(CLR_CMAKE_HOST_APPLE)
129-
130-
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
131-
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/env)
132-
133-
install_clr(TARGETS clrgc DESTINATIONS . sharedFramework COMPONENT runtime)
134-
if (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64)
135-
install_clr(TARGETS clrgcexp DESTINATIONS . sharedFramework COMPONENT runtime)
136-
endif (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64)
101+
if(FEATURE_STANDALONE_GC)
102+
# clrgcexp is build with standalone+regions
103+
if (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64)
104+
add_library_clr(clrgcexp SHARED ${GC_SOURCES})
105+
add_dependencies(clrgcexp eventing_headers)
106+
target_link_libraries(clrgcexp PRIVATE ${GC_LINK_LIBRARIES})
107+
target_compile_definitions(clrgcexp PRIVATE -DUSE_REGIONS)
108+
install_clr(TARGETS clrgcexp DESTINATIONS . COMPONENT runtime)
109+
endif (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64)
110+
111+
# clrgc is build with standalone+segments
112+
add_library_clr(clrgc SHARED ${GC_SOURCES})
113+
add_dependencies(clrgc eventing_headers)
114+
target_link_libraries(clrgc PRIVATE ${GC_LINK_LIBRARIES})
115+
install_clr(TARGETS clrgc DESTINATIONS . COMPONENT runtime)
116+
117+
add_definitions(-DBUILD_AS_STANDALONE)
118+
add_definitions(-DFEATURE_CONSERVATIVE_GC)
119+
120+
add_definitions(-DFX_VER_INTERNALNAME_STR=clrgc.dll)
121+
add_definitions(-DVERIFY_HEAP)
122+
if(CLR_CMAKE_HOST_APPLE)
123+
# The implementation of GCToOSInterface on Apple platforms makes use of non-POSIX
124+
# pthreads APIs, which by default are not included in the pthreads header
125+
# unless we define this macro.
126+
add_definitions(-D_DARWIN_C_SOURCE)
127+
endif(CLR_CMAKE_HOST_APPLE)
128+
129+
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
130+
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/env)
131+
132+
install_clr(TARGETS clrgc DESTINATIONS . sharedFramework COMPONENT runtime)
133+
if (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64)
134+
install_clr(TARGETS clrgcexp DESTINATIONS . sharedFramework COMPONENT runtime)
135+
endif (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64)
136+
endif(FEATURE_STANDALONE_GC)

0 commit comments

Comments
 (0)