Merge pull request #5 from sergiy-k/gcbuild
Make GC and GCSample compile and run on Linux
This commit is contained in:
Коммит
6763d16387
|
@ -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)
|
||||
|
|
|
@ -47,3 +47,7 @@ add_compile_options(-Wno-tautological-undefined-compare)
|
|||
|
||||
add_library(clrgc STATIC ${SOURCES})
|
||||
|
||||
# Install the static clrgc library
|
||||
install (TARGETS clrgc DESTINATION lib)
|
||||
|
||||
add_subdirectory(sample)
|
||||
|
|
|
@ -30,3 +30,6 @@ endif()
|
|||
target_link_libraries(gcsample
|
||||
clrgc
|
||||
)
|
||||
|
||||
# Install gcsample
|
||||
install (TARGETS gcsample DESTINATION .)
|
||||
|
|
Загрузка…
Ссылка в новой задаче