Build the GC as part of its own CMake target (dotnet/coreclr#5932)
authorSean Gillespie <sean.william.g@gmail.com>
Thu, 23 Jun 2016 06:40:41 +0000 (23:40 -0700)
committerJan Vorlicek <janvorli@microsoft.com>
Thu, 23 Jun 2016 06:40:41 +0000 (08:40 +0200)
Commit migrated from https://github.com/dotnet/coreclr/commit/0dbc3f62bd3ce5184cc27884e3239e3deae3cc9a

src/coreclr/src/CMakeLists.txt
src/coreclr/src/dlls/mscordac/CMakeLists.txt
src/coreclr/src/dlls/mscoree/coreclr/CMakeLists.txt
src/coreclr/src/gc/CMakeLists.txt
src/coreclr/src/gc/dac/CMakeLists.txt [new file with mode: 0644]
src/coreclr/src/gc/env/common.h
src/coreclr/src/gc/wks/CMakeLists.txt [new file with mode: 0644]
src/coreclr/src/vm/CMakeLists.txt

index 70f436c..d13e8f9 100644 (file)
@@ -148,6 +148,7 @@ if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/jit32")
   add_subdirectory(jit32)
 endif()
 
+add_subdirectory(gc)
 add_subdirectory(vm)
 add_subdirectory(md)
 add_subdirectory(debug)
index 8ef0a54..02bba4a 100644 (file)
@@ -81,6 +81,7 @@ set(COREDAC_LIBRARIES
     strongname_dac
     utilcode_dac
     unwinder_dac
+    gc_dac
     ${END_LIBRARY_GROUP} # End group of libraries that have circular references
 )
 
index a51e841..cc14f9c 100644 (file)
@@ -79,6 +79,7 @@ set(CORECLR_LIBRARIES
     debug-pal
     ${LIB_UNWINDER}
     cee_wks
+    gc_wks
     ${END_LIBRARY_GROUP} # End group of libraries that have circular references
     mdcompiler_wks
     mdruntime_wks
index 71dd46f..61e1ced 100644 (file)
@@ -1 +1,45 @@
-add_subdirectory(sample)
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}) 
+include_directories(BEFORE ${CLR_DIR}/src/vm)
+include_directories(BEFORE ${CLR_DIR}/src/vm/${ARCH_SOURCES_DIR})
+
+if(CLR_CMAKE_PLATFORM_UNIX)
+  add_compile_options(-fPIC)
+endif(CLR_CMAKE_PLATFORM_UNIX)
+
+if(CMAKE_CONFIGURATION_TYPES)
+  foreach (Config DEBUG CHECKED)  
+     set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:${Config}>:WRITE_BARRIER_CHECK=1>)
+  endforeach (Config)
+else()
+  if(UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG OR UPPERCASE_CMAKE_BUILD_TYPE STREQUAL CHECKED)
+    add_definitions(-DWRITE_BARRIER_CHECK=1)
+  endif(UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG OR UPPERCASE_CMAKE_BUILD_TYPE STREQUAL CHECKED)
+endif(CMAKE_CONFIGURATION_TYPES)
+
+set( GC_SOURCES_DAC_AND_WKS_COMMON
+  gccommon.cpp
+  gcscan.cpp
+  gcsvr.cpp
+  gcwks.cpp
+  handletable.cpp
+  handletablecore.cpp
+  handletablescan.cpp
+  objecthandle.cpp
+  softwarewritewatch.cpp)
+
+set( GC_SOURCES_WKS
+  ${GC_SOURCES_DAC_AND_WKS_COMMON}
+  gceesvr.cpp
+  gceewks.cpp
+  handletablecache.cpp)
+
+set( GC_SOURCES_DAC
+  ${GC_SOURCES_DAC_AND_WKS_COMMON})
+
+convert_to_absolute_path(GC_SOURCES_WKS ${GC_SOURCES_WKS})
+convert_to_absolute_path(GC_SOURCES_DAC ${GC_SOURCES_DAC})
+
+add_subdirectory(wks)
+add_subdirectory(dac)
diff --git a/src/coreclr/src/gc/dac/CMakeLists.txt b/src/coreclr/src/gc/dac/CMakeLists.txt
new file mode 100644 (file)
index 0000000..1f1c9eb
--- /dev/null
@@ -0,0 +1,2 @@
+include(${CLR_DIR}/dac.cmake)
+add_library_clr(gc_dac STATIC ${GC_SOURCES_DAC})
index 759d57b..32c0d93 100644 (file)
@@ -9,7 +9,9 @@
 
 #pragma once
 
-#define _CRT_SECURE_NO_WARNINGS
+#ifndef _CRT_SECURE_NO_WARNINGS
+ #define _CRT_SECURE_NO_WARNINGS
+#endif // _CRT_SECURE_NO_WARNINGS
 
 #include <stdint.h>
 #include <stddef.h>
diff --git a/src/coreclr/src/gc/wks/CMakeLists.txt b/src/coreclr/src/gc/wks/CMakeLists.txt
new file mode 100644 (file)
index 0000000..fcb95a3
--- /dev/null
@@ -0,0 +1 @@
+add_library_clr(gc_wks STATIC ${GC_SOURCES_WKS})
index 8b95b65..b24a150 100644 (file)
@@ -63,15 +63,8 @@ set(VM_SOURCES_DAC_AND_WKS_COMMON
     formattype.cpp
     fptrstubs.cpp
     frames.cpp
-    ../gc/gccommon.cpp
-    ../gc/gcscan.cpp
-    ../gc/gcsvr.cpp
-    ../gc/gcwks.cpp
     genericdict.cpp
     generics.cpp
-    ../gc/handletable.cpp
-    ../gc/handletablecore.cpp
-    ../gc/handletablescan.cpp
     hash.cpp
     hillclimbing.cpp
     ilstubcache.cpp
@@ -86,7 +79,6 @@ set(VM_SOURCES_DAC_AND_WKS_COMMON
     methoditer.cpp
     methodtable.cpp
     object.cpp
-    ../gc/objecthandle.cpp
     pefile.cpp
     peimage.cpp
     peimagelayout.cpp
@@ -99,7 +91,6 @@ set(VM_SOURCES_DAC_AND_WKS_COMMON
     securitydescriptorassembly.cpp
     sigformat.cpp
     siginfo.cpp
-    ../gc/softwarewritewatch.cpp
     stackwalk.cpp
     stublink.cpp
     stubmgr.cpp
@@ -177,9 +168,6 @@ set(VM_SOURCES_WKS
     gcenv.os.cpp
     gchelpers.cpp
     genmeth.cpp
-    ../gc/gceesvr.cpp
-    ../gc/gceewks.cpp
-    ../gc/handletablecache.cpp
     hosting.cpp
     ibclogger.cpp
     ilmarshalers.cpp