Skip to content

Commit

Permalink
Ongoing work on the cmake build system. (#43264)
Browse files Browse the repository at this point in the history
* Update source lists.

* Add android support.
  • Loading branch information
vargaz authored Oct 11, 2020
1 parent 4820a57 commit 61d444a
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 22 deletions.
36 changes: 29 additions & 7 deletions src/mono/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand All @@ -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()
Expand All @@ -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")
Expand Down Expand Up @@ -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")
Expand Down
3 changes: 0 additions & 3 deletions src/mono/cmake/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -1302,9 +1302,6 @@
/* 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

Expand Down
2 changes: 1 addition & 1 deletion src/mono/mono/eglib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 24 additions & 0 deletions src/mono/mono/eventpipe/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 2 additions & 10 deletions src/mono/mono/metadata/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/mono/mono/mini/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 0 additions & 1 deletion src/mono/mono/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 61d444a

Please sign in to comment.