| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- cmake_minimum_required(VERSION 3.2)
- project (CHAKRACORE)
- function(clr_unknown_arch)
- if (WIN32)
- message(FATAL_ERROR "Only AMD64, ARM and I386 are supported")
- else()
- message(FATAL_ERROR "Only AMD64 and ARM are supported")
- endif()
- endfunction()
- 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)
- else()
- clr_unknown_arch()
- endif()
- set(CLR_CMAKE_PLATFORM_LINUX 1)
- elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
- set(CLR_CMAKE_PLATFORM_UNIX 1)
- if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64)
- set(CLR_CMAKE_PLATFORM_UNIX_TARGET_AMD64 1)
- else()
- clr_unknown_arch()
- endif()
- set(CLR_CMAKE_PLATFORM_DARWIN 1)
- else()
- clr_unknown_arch()
- endif()
- if(CLR_CMAKE_PLATFORM_UNIX_TARGET_AMD64)
- set(CLR_CMAKE_PLATFORM_ARCH_AMD64 1)
- endif()
- if (CMAKE_CXX_COMPILER_ID STREQUAL AppleClang
- OR CMAKE_CXX_COMPILER_ID STREQUAL Clang
- OR CMAKE_CXX_COMPILER_ID STREQUAL GNU)
- # Color diagnostics for g++ and clang++
- add_definitions("-fdiagnostics-color=always")
- endif()
- if(CLR_CMAKE_PLATFORM_UNIX)
- add_definitions(-DPLATFORM_UNIX=1)
- if(CLR_CMAKE_PLATFORM_LINUX)
- add_definitions(-D__LINUX__=1)
- if(CLR_CMAKE_PLATFORM_UNIX_TARGET_AMD64)
- message("Detected Linux x86_64")
- add_definitions(-DLINUX64)
- else()
- clr_unknown_arch()
- endif(CLR_CMAKE_PLATFORM_UNIX_TARGET_AMD64)
- endif(CLR_CMAKE_PLATFORM_LINUX)
- if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL amd64)
- set(IS_64BIT_BUILD 1)
- add_definitions(-D_M_X64 -D_M_AMD64)
- endif(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL amd64)
- add_definitions("-D__STDC_WANT_LIB_EXT1__=1")
- add_definitions(
- -DUNICODE
- -D_SAFECRT_USE_CPP_OVERLOADS=1
- )
- add_compile_options(-fms-extensions)
- # Disable some warnings
- add_compile_options(-Wno-tautological-constant-out-of-range-compare)
- set(CMAKE_CXX_STANDARD 11)
- # xplat-todo: enable the JIT for Linux
- add_definitions(
- -DDISABLE_JIT=1
- )
-
- # xplat-todo: revisit these
- # also, we should change this from add_definitions- the intent of that
- # is to just add -D flags
- add_definitions(
- -fdelayed-template-parsing
- -Wno-microsoft
- -Wno-unused-value
- -Wno-int-to-void-pointer-cast
- -Wno-invalid-offsetof
- -Wno-undefined-inline
- -Wno-inconsistent-missing-override
- -Wno-c++14-extensions
- -Wno-macro-redefined
- -Wno-ignored-pragmas
- -Wno-invalid-token-paste
- -Wno-format
- -Wno-invalid-noreturn
- -Wno-null-arithmetic
- -Wno-tautological-undefined-compare
- -Wno-address-of-temporary # vtinfo.h, VirtualTableInfo<T>::RegisterVirtualTable
- -Wno-null-conversion # Check shmemory.cpp and cs.cpp here...
- )
- endif(CLR_CMAKE_PLATFORM_UNIX)
- if(CMAKE_BUILD_TYPE STREQUAL Debug)
- add_definitions(
- -DDBG=1
- -DDEBUG=1
- -DDBG_DUMP=1
- )
- # xplat-todo: reenable this warning
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-writable-strings")
- endif(CMAKE_BUILD_TYPE STREQUAL Debug)
- if(IS_64BIT_BUILD)
- add_definitions(
- -DBIT64=1
- -DSTACK_ALIGN=16
- )
- endif(IS_64BIT_BUILD)
- if(CLR_CMAKE_PLATFORM_UNIX)
- add_definitions(-DFEATURE_PAL)
- endif(CLR_CMAKE_PLATFORM_UNIX)
- enable_language(ASM)
- include_directories(
- .
- lib/Common
- lib/Common/PlaceHolder
- pal
- pal/inc
- pal/inc/rt
- )
- add_subdirectory (lib)
- add_subdirectory (bin)
- add_subdirectory (pal)
|