Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Native/Bootstrap/CMakeLists.txt5
-rw-r--r--src/Native/CMakeLists.txt22
-rw-r--r--src/Native/Runtime/CMakeLists.txt7
-rw-r--r--src/Native/System.Private.CoreLib.Native/config.h.in2
-rw-r--r--src/Native/System.Private.CoreLib.Native/configure.cmake7
-rw-r--r--src/Native/System.Private.CoreLib.Native/pal_guid.cpp12
-rw-r--r--src/Native/gc/env/gcenv.base.h4
7 files changed, 45 insertions, 14 deletions
diff --git a/src/Native/Bootstrap/CMakeLists.txt b/src/Native/Bootstrap/CMakeLists.txt
index db9acf1ba..b4c98dac6 100644
--- a/src/Native/Bootstrap/CMakeLists.txt
+++ b/src/Native/Bootstrap/CMakeLists.txt
@@ -9,5 +9,8 @@ add_compile_options(-Wno-unused-private-field)
add_compile_options(-Wno-tautological-undefined-compare)
endif()
-add_subdirectory(base)
+if(NOT CLR_CMAKE_PLATFORM_WASM)
+ add_subdirectory(base)
+endif(NOT CLR_CMAKE_PLATFORM_WASM)
+
add_subdirectory(cpp)
diff --git a/src/Native/CMakeLists.txt b/src/Native/CMakeLists.txt
index f654cdd89..5aeb930a5 100644
--- a/src/Native/CMakeLists.txt
+++ b/src/Native/CMakeLists.txt
@@ -90,7 +90,11 @@ if(CMAKE_SYSTEM_NAME STREQUAL NetBSD)
set(CLR_CMAKE_PLATFORM_NETBSD 1)
endif(CMAKE_SYSTEM_NAME STREQUAL NetBSD)
-if (CLR_CMAKE_PLATFORM_UNIX)
+if(CMAKE_SYSTEM_NAME STREQUAL Emscripten)
+ set(CLR_CMAKE_PLATFORM_WASM 1)
+endif(CMAKE_SYSTEM_NAME STREQUAL Emscripten)
+
+if (CLR_CMAKE_PLATFORM_UNIX OR CLR_CMAKE_PLATFORM_WASM)
include_directories(inc/unix)
add_definitions(-DPLATFORM_UNIX=1)
@@ -133,7 +137,7 @@ if (CLR_CMAKE_PLATFORM_UNIX)
if(CLR_CMAKE_PLATFORM_LINUX)
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -Wa,--noexecstack")
endif(CLR_CMAKE_PLATFORM_LINUX)
-endif(CLR_CMAKE_PLATFORM_UNIX)
+endif(CLR_CMAKE_PLATFORM_UNIX OR CLR_CMAKE_PLATFORM_WASM)
if(CLR_CMAKE_PLATFORM_UNIX_TARGET_ARM)
set(CLR_CMAKE_PLATFORM_ARCH_ARM 1)
@@ -143,6 +147,8 @@ elseif(CLR_CMAKE_PLATFORM_UNIX_TARGET_AMD64)
set(CLR_CMAKE_PLATFORM_ARCH_AMD64 1)
elseif(CLR_CMAKE_PLATFORM_UNIX_TARGET_I386)
set(CLR_CMAKE_PLATFORM_ARCH_I386 1)
+elseif(CLR_CMAKE_PLATFORM_WASM)
+ set(CLR_CMAKE_PLATFORM_ARCH_WASM 1)
elseif(WIN32)
if (CLR_CMAKE_TARGET_ARCH STREQUAL x64)
set(CLR_CMAKE_PLATFORM_ARCH_AMD64 1)
@@ -195,6 +201,9 @@ elseif(CLR_CMAKE_PLATFORM_ARCH_ARM)
elseif(CLR_CMAKE_PLATFORM_ARCH_ARM64)
add_definitions(-D_TARGET_ARM64_=1)
add_definitions(-D_ARM64_)
+elseif(CLR_CMAKE_PLATFORM_ARCH_WASM)
+ add_definitions(-D_TARGET_WASM_=1)
+ add_definitions(-D_WASM_)
else()
clr_unknown_arch()
endif()
@@ -246,9 +255,12 @@ if(WIN32)
endif()
add_subdirectory(Runtime)
add_subdirectory(Bootstrap)
-add_subdirectory(jitinterface)
+
+if(NOT CLR_CMAKE_PLATFORM_WASM)
+ add_subdirectory(jitinterface)
+endif(NOT CLR_CMAKE_PLATFORM_WASM)
# We don't need the PAL on Windows.
-if(CLR_CMAKE_PLATFORM_UNIX)
+if(NOT WIN32)
add_subdirectory(System.Private.CoreLib.Native)
-endif()
+endif(NOT WIN32)
diff --git a/src/Native/Runtime/CMakeLists.txt b/src/Native/Runtime/CMakeLists.txt
index 24536e364..c80fd7c1e 100644
--- a/src/Native/Runtime/CMakeLists.txt
+++ b/src/Native/Runtime/CMakeLists.txt
@@ -133,6 +133,8 @@ else()
set(ARCH_SOURCES_DIR arm)
elseif(CLR_CMAKE_PLATFORM_ARCH_I386)
set(ARCH_SOURCES_DIR i386)
+ elseif(CLR_CMAKE_PLATFORM_ARCH_WASM)
+ set(ARCH_SOURCES_DIR wasm)
endif()
list(APPEND RUNTIME_SOURCES_ARCH_ASM
@@ -212,5 +214,8 @@ convert_to_absolute_path(PORTABLE_RUNTIME_SOURCES ${PORTABLE_RUNTIME_SOURCES})
convert_to_absolute_path(RUNTIME_SOURCES_ARCH_ASM ${RUNTIME_SOURCES_ARCH_ASM})
-add_subdirectory(Full)
+if(NOT CLR_CMAKE_PLATFORM_WASM)
+ add_subdirectory(Full)
+endif(NOT CLR_CMAKE_PLATFORM_WASM)
+
add_subdirectory(Portable)
diff --git a/src/Native/System.Private.CoreLib.Native/config.h.in b/src/Native/System.Private.CoreLib.Native/config.h.in
index 32f0d03a5..3d13262a2 100644
--- a/src/Native/System.Private.CoreLib.Native/config.h.in
+++ b/src/Native/System.Private.CoreLib.Native/config.h.in
@@ -6,3 +6,5 @@
#cmakedefine01 HAVE_MACH_ABSOLUTE_TIME
#cmakedefine01 HAVE_SCHED_GETCPU
#cmakedefine01 HAVE_LIBUUID_H
+#cmakedefine01 HAVE_UUID_GENERATE_RANDOM
+#cmakedefine01 HAVE_UUID_GENERATE
diff --git a/src/Native/System.Private.CoreLib.Native/configure.cmake b/src/Native/System.Private.CoreLib.Native/configure.cmake
index c8dca1b63..c84bf8971 100644
--- a/src/Native/System.Private.CoreLib.Native/configure.cmake
+++ b/src/Native/System.Private.CoreLib.Native/configure.cmake
@@ -6,6 +6,13 @@ check_library_exists(pthread pthread_condattr_setclock "" HAVE_PTHREAD_CONDATTR_
check_include_files(uuid/uuid.h HAVE_LIBUUID_H)
+if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
+ set(CMAKE_REQUIRED_LIBRARIES uuid)
+endif()
+check_function_exists(uuid_generate_random HAVE_UUID_GENERATE_RANDOM)
+check_function_exists(uuid_generate HAVE_UUID_GENERATE)
+set(CMAKE_REQUIRED_LIBRARIES)
+
check_cxx_source_runs("
#include <stdlib.h>
#include <time.h>
diff --git a/src/Native/System.Private.CoreLib.Native/pal_guid.cpp b/src/Native/System.Private.CoreLib.Native/pal_guid.cpp
index a4e40d7f1..8e35d089e 100644
--- a/src/Native/System.Private.CoreLib.Native/pal_guid.cpp
+++ b/src/Native/System.Private.CoreLib.Native/pal_guid.cpp
@@ -19,15 +19,17 @@ typedef struct _GUID {
extern "C" void CoreLibNative_CreateGuid(GUID* pGuid)
{
-#if HAVE_LIBUUID_H
+#if HAVE_UUID_GENERATE_RANDOM
uuid_generate_random(*(uuid_t*)pGuid);
+#elif HAVE_UUID_GENERATE
+ uuid_generate(*(uuid_t*)pGuid);
+#else
+#error Don't know how to generate UUID on this platform
+#endif
- // Change the byte order of the Data1, 2 and 3, since the uuid_generate_random
+ // Change the byte order of the Data1, 2 and 3, since uuid_generate_random and uuid_generate
// generates them with big endian while GUIDS need to have them in little endian.
pGuid->Data1 = SWAP32(pGuid->Data1);
pGuid->Data2 = SWAP16(pGuid->Data2);
pGuid->Data3 = SWAP16(pGuid->Data3);
-#else
-#error Don't know how to generate UUID on this platform
-#endif
}
diff --git a/src/Native/gc/env/gcenv.base.h b/src/Native/gc/env/gcenv.base.h
index 9fe583f9a..598e5b49c 100644
--- a/src/Native/gc/env/gcenv.base.h
+++ b/src/Native/gc/env/gcenv.base.h
@@ -355,8 +355,8 @@ typedef TADDR OBJECTHANDLE;
#error The Volatile type is currently only defined for Visual C++ and Clang
#endif
-#if defined(__clang__) && !defined(_X86_) && !defined(_AMD64_) && !defined(_ARM_) && !defined(_ARM64_)
-#error The Volatile type is currently only defined for Clang when targeting x86, AMD64, ARM or ARM64 CPUs
+#if defined(__clang__) && !defined(_X86_) && !defined(_AMD64_) && !defined(_ARM_) && !defined(_ARM64_) && !defined(_WASM_)
+#error The Volatile type is currently only defined for Clang when targeting x86, AMD64, ARM, ARM64 or WASM
#endif
#if defined(__clang__)