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:
authorSergiy Kuryata <sergeyk@microsoft.com>2015-09-17 22:28:49 +0300
committerSergiy Kuryata <sergeyk@microsoft.com>2015-09-18 02:56:53 +0300
commit47f7f0e34f7d31826575f2f3c97b32deaef2f3a6 (patch)
treecde4f941fb87dab0edc5ba19c2148f0c47dab2d8 /src/Native/CMakeLists.txt
parent6806edab7df3fef089806a73547496530e7094ad (diff)
Make GC and GCSample compile and run on Linux
:# Please enter the commit message for your changes. Lines starting
Diffstat (limited to 'src/Native/CMakeLists.txt')
-rw-r--r--src/Native/CMakeLists.txt72
1 files changed, 64 insertions, 8 deletions
diff --git a/src/Native/CMakeLists.txt b/src/Native/CMakeLists.txt
index 7d26d88fe..f3fc58549 100644
--- a/src/Native/CMakeLists.txt
+++ b/src/Native/CMakeLists.txt
@@ -8,14 +8,13 @@ set(CMAKE_C_FLAGS "-std=c11")
set(CMAKE_CXX_FLAGS "-std=c++11")
set(CMAKE_SHARED_LIBRARY_PREFIX "")
-add_compile_options(-Weverything)
-add_compile_options(-Wno-format-nonliteral)
-add_compile_options(-Wno-missing-prototypes)
-add_compile_options(-Wno-disabled-macro-expansion)
-add_compile_options(-Wno-c++98-compat)
-add_compile_options(-Wno-c++98-compat-pedantic)
-add_compile_options(-Werror)
-add_compile_options(-fPIC)
+function(clr_unknown_arch)
+ if (WIN32)
+ message(FATAL_ERROR "Only AMD64 and I386 are supported")
+ else()
+ message(FATAL_ERROR "Only AMD64, ARM64 and ARM are supported")
+ endif()
+endfunction()
if (CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL amd64)
add_definitions(-DBIT64=1)
@@ -28,10 +27,66 @@ elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l)
add_compile_options(-mfpu=vfpv3)
endif ()
+if(CMAKE_SYSTEM_NAME STREQUAL Linux)
+ set(CLR_CMAKE_PLATFORM_UNIX 1)
+ if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64)
+ set(CLR_CMAKE_PLATFORM_UNIX_TARGET_AMD64 1)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l)
+ set(CLR_CMAKE_PLATFORM_UNIX_TARGET_ARM 1)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64)
+ set(CLR_CMAKE_PLATFORM_UNIX_TARGET_ARM64 1)
+ else()
+ clr_unknown_arch()
+ endif()
+ set(CLR_CMAKE_PLATFORM_LINUX 1)
+endif(CMAKE_SYSTEM_NAME STREQUAL Linux)
+
+if (CLR_CMAKE_PLATFORM_UNIX)
+ add_definitions(-DPLATFORM_UNIX=1)
+
+ # All warnings that are not explicitly disabled are reported as errors
+ add_compile_options(-Wall)
+ add_compile_options(-Werror)
+
+ add_compile_options(-Wno-format-nonliteral)
+ add_compile_options(-Wno-missing-prototypes)
+ add_compile_options(-Wno-disabled-macro-expansion)
+ add_compile_options(-Wno-c++98-compat)
+ add_compile_options(-Wno-c++98-compat-pedantic)
+
+ add_compile_options(-Wno-null-conversion)
+ add_compile_options(-Wno-invalid-offsetof)
+ add_compile_options(-Wno-null-arithmetic)
+
+ # The -fms-extensions enable the stuff like __if_exists, __declspec(uuid()), etc.
+ add_compile_options(-fms-extensions )
+
+ add_compile_options(-fPIC)
+endif(CLR_CMAKE_PLATFORM_UNIX)
+
+if(CLR_CMAKE_PLATFORM_UNIX_TARGET_ARM)
+ set(CLR_CMAKE_PLATFORM_ARCH_ARM 1)
+elseif(CLR_CMAKE_PLATFORM_UNIX_TARGET_ARM64)
+ set(CLR_CMAKE_PLATFORM_ARCH_ARM64 1)
+elseif(CLR_CMAKE_PLATFORM_UNIX_TARGET_AMD64)
+ set(CLR_CMAKE_PLATFORM_ARCH_AMD64 1)
+elseif(WIN32)
+ if (CLR_CMAKE_TARGET_ARCH STREQUAL x64)
+ set(CLR_CMAKE_PLATFORM_ARCH_AMD64 1)
+ set(IS_64BIT_BUILD 1)
+ elseif(CLR_CMAKE_TARGET_ARCH STREQUAL x86)
+ set(CLR_CMAKE_PLATFORM_ARCH_I386 1)
+ set(IS_64BIT_BUILD 0)
+ else()
+ clr_unknown_arch()
+ endif()
+endif()
+
string(TOUPPER ${CMAKE_BUILD_TYPE} UPPERCASE_CMAKE_BUILD_TYPE)
if (UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG)
add_compile_options(-g -O0)
add_definitions(-DDEBUG)
+ add_definitions(-D_DEBUG)
elseif (UPPERCASE_CMAKE_BUILD_TYPE STREQUAL RELEASE)
add_compile_options (-O3)
add_definitions(-DNDEBUG)
@@ -41,3 +96,4 @@ endif ()
include(configure.cmake)
+add_subdirectory(gc)