Ongoing work on the cmake build system. (#43264)
authorZoltan Varga <vargaz@gmail.com>
Sun, 11 Oct 2020 07:22:44 +0000 (03:22 -0400)
committerGitHub <noreply@github.com>
Sun, 11 Oct 2020 07:22:44 +0000 (03:22 -0400)
* Update source lists.

* Add android support.

src/mono/CMakeLists.txt
src/mono/cmake/config.h.in
src/mono/mono/eglib/CMakeLists.txt
src/mono/mono/eventpipe/CMakeLists.txt
src/mono/mono/metadata/CMakeLists.txt
src/mono/mono/mini/CMakeLists.txt
src/mono/mono/utils/CMakeLists.txt

index e8b8f7a..cf1c6ac 100644 (file)
@@ -237,6 +237,22 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "tvOS")
 elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
   set(HOST_LINUX 1)
   add_definitions(-D_GNU_SOURCE -D_REENTRANT)
+elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
+  set(HOST_LINUX 1)
+  add_definitions(-D_GNU_SOURCE -D_REENTRANT)
+  # The normal check fails because it uses --isystem <ndk root>/sysroot/usr/include
+  set(HAVE_USR_INCLUDE_MALLOC_H 1)
+  set(HOST_ANDROID 1)
+  set(ANDROID_UNIFIED_HEADERS 1)
+  set(ENABLE_MONODROID 1)
+  set(DISABLE_EXECUTABLES 1)
+  set(GC_SUSPEND "hybrid")
+  add_definitions(-DNO_GLOBALIZATION_SHIM)
+  # Force some defines
+  set(HAVE_SCHED_GETAFFINITY 0)
+  set(HAVE_SCHED_SETAFFINITY 0)
+  set(MONO_DL_NEED_USCORE 1)
+  # FIXME: Rest of the flags from configure.ac
 elseif(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
   set(HOST_WASM 1)
   set(TARGET_ARCH "wasm")
@@ -264,6 +280,8 @@ elseif(TARGET_SYSTEM_NAME STREQUAL "iOS" OR TARGET_SYSTEM_NAME STREQUAL "tvOS")
   set(TARGET_MACH 1)
   set(TARGET_IOS 1)
 elseif(TARGET_SYSTEM_NAME STREQUAL "Linux")
+elseif(TARGET_SYSTEM_NAME STREQUAL "Android")
+  set(TARGET_ANDROID 1)
 elseif(TARGET_SYSTEM_NAME STREQUAL "Emscripten")
   set(TARGET_WASM 1)
   if (CMAKE_BUILD_TYPE STREQUAL "Release")
@@ -286,11 +304,12 @@ endif()
 
 if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
   set(HOST_AMD64 1)
-elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86")
+elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "i686")
+  # i686 is used on android
   set(HOST_X86 1)
-elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
+elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
   set(HOST_ARM64 1)
-elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7s")
+elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
   set(HOST_ARM 1)
 elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "wasm")
 else()
@@ -308,16 +327,17 @@ endif()
 if(TARGET_ARCH STREQUAL "x86_64")
   set(TARGET_AMD64 1)
   set(MONO_ARCHITECTURE "\"amd64\"")
-elseif(TARGET_ARCH STREQUAL "x86")
+elseif(TARGET_ARCH STREQUAL "x86" OR TARGET_ARCH STREQUAL "i686")
   set(TARGET_X86 1)
   set(MONO_ARCHITECTURE "\"x86\"")
-elseif(TARGET_ARCH STREQUAL "arm64")
+elseif(TARGET_ARCH STREQUAL "arm64" OR TARGET_ARCH STREQUAL "aarch64")
   set(TARGET_ARM64 1)
   set(MONO_ARCHITECTURE "\"arm64\"")
-elseif(TARGET_ARCH STREQUAL "arm" OR TARGET_ARCH STREQUAL "armv7s")
+elseif(TARGET_ARCH MATCHES "arm")
   set(TARGET_ARM 1)
   set(MONO_ARCHITECTURE "\"arm\"")
-  if(TARGET_IOS)
+  # FIXME:
+  if(TARGET_IOS OR TARGET_ANDROID)
     add_definitions("-DARM_FPU_VFP=1")
   endif()
 elseif(TARGET_ARCH STREQUAL "wasm")
@@ -396,6 +416,8 @@ elseif(TARGET_WASM)
   set(ICU_LIBS "icucore")
 elseif(TARGET_IOS)
   # FIXME:
+elseif(TARGET_ANDROID)
+  # FIXME:
 elseif(HOST_LINUX)
   pkg_check_modules(ICU icu-uc)
   set(ICU_FLAGS "-DTARGET_UNIX -DU_DISABLE_RENAMING -Wno-reserved-id-macro -Wno-documentation -Wno-documentation-unknown-command -Wno-switch-enum -Wno-covered-switch-default -Wno-extra-semi-stmt -Wno-unknown-warning-option -Wno-deprecated-declarations")
index 7a8dcef..2353084 100644 (file)
 /* inotify_rm_watch with unsigned wd */
 #cmakedefine INOTIFY_RM_WATCH_WD_UNSIGNED 1
 
-/* shm_open that works well enough with mmap */
-#cmakedefine HAVE_SHM_OPEN_THAT_WORKS_WELL_ENOUGH_WITH_MMAP 1
-
 /* getpriority with int who */
 #cmakedefine PRIORITY_REQUIRES_INT_WHO 1
 
index 6748b74..520359c 100644 (file)
@@ -2,7 +2,7 @@
 set(eglib_win32_sources
     eglib-config.hw
     gdate-win32.c gdir-win32.c gfile-win32.c gmisc-win32.c
-    gmodule-win32.c gmodule-win32-internals.h gtimer-win32.c gunicode-win32.c)
+    gmodule-win32.c gtimer-win32.c gunicode-win32.c)
 
 set(eglib_unix_sources
     gdate-unix.c  gdir-unix.c  gfile-unix.c  gmisc-unix.c
index b9bc46a..88b72f1 100644 (file)
@@ -1,5 +1,29 @@
 
 set(eventpipe_sources_base
+       ds-dump-protocol.c
+       ds-dump-protocol.h
+       ds-eventpipe-protocol.c
+       ds-eventpipe-protocol.h
+       ds-getter-setter.h
+       ds-ipc.c
+       ds-ipc.h
+       ds-ipc-posix.c
+       ds-ipc-posix.h
+       ds-process-protocol.c
+       ds-process-protocol.h
+       ds-profiler-protocol.c
+       ds-profiler-protocol.h
+       ds-protocol.c
+       ds-protocol.h
+       ds-rt.h
+       ds-rt-config.h
+       ds-rt-mono.c
+       ds-rt-mono.h
+       ds-rt-types.h
+       ds-rt-types-mono.h
+       ds-server.c
+       ds-server.h
+       ds-types.h
        ep.c
        ep.h
        ep-block.c
index 5ae1e14..c7c9cfd 100644 (file)
@@ -31,24 +31,16 @@ endif()
 
 set(metadata_win32_sources
     console-win32.c
-    console-win32-internals.h
-    cominterop-win32-internals.h
     w32file-win32.c
-    w32file-win32-internals.h
     icall-windows.c
-    icall-windows-internals.h
     marshal-windows.c
-    marshal-windows-internals.h
     mono-security-windows.c
-    mono-security-windows-internals.h
     w32mutex-win32.c
     w32semaphore-win32.c
     w32event-win32.c
     w32process-win32.c
-    w32process-win32-internals.h
     w32socket-win32.c
-    w32error-win32.c
-    w32subset.h)
+    w32error-win32.c)
 
 set(metadata_unix_sources
     console-unix.c
@@ -288,7 +280,7 @@ set(reloc_libdir "${CMAKE_INSTALL_LIBDIR}")
 
 set_source_files_properties(../metadata/mono-config-dirs.c PROPERTIES COMPILE_DEFINITIONS "MONO_BINDIR=\"${bindir}\";MONO_ASSEMBLIES=\"${assembliesdir}\";MONO_CFG_DIR=\"${confdir}\";MONO_RELOC_LIBDIR=\"../${reloc_libdir}\"")
 
-addprefix(metadata_sources ../metadata/ "${metadata_platform_sources};${metadata_common_sources};${metadata_gc_dependent_sources};${metadata_sgen_sources};${ilgen_real_sources}")
+addprefix(metadata_sources ../metadata/ "${metadata_platform_sources};${metadata_common_sources};${metadata_gc_dependent_sources};${metadata_sgen_sources};${ilgen_sources}")
 
 set(metadata_public_headers_base
        appdomain.h
index 5931c87..b18866f 100644 (file)
@@ -281,6 +281,8 @@ if(HOST_DARWIN)
 set(OS_LIBS "-framework CoreFoundation" "-framework Foundation")
 elseif(HOST_IOS)
 set(OS_LIBS "-framework CoreFoundation" "-lobjc" "-lc++")
+elseif(HOST_ANDROID)
+set(OS_LIBS m dl)
 elseif(HOST_LINUX)
 set(OS_LIBS pthread m dl)
 endif()
index d724eaa..8b57108 100644 (file)
@@ -51,7 +51,6 @@ set(utils_common_sources
     mono-mmap-windows.c
     mono-mmap.h
     mono-mmap-internals.h
-    mono-mmap-windows-internals.h
     mono-os-mutex.h
     mono-os-mutex.c
     mono-flight-recorder.h