Add support for Linux on s390x as host and target build architecture.
usage()
{
echo "Common settings:"
- echo " --arch (-a) Target platform: x86, x64, arm, armel, arm64 or wasm."
+ echo " --arch (-a) Target platform: x86, x64, arm, armel, arm64, s390x or wasm."
echo " [Default: Your machine's architecture.]"
echo " --binaryLog (-bl) Output binary log."
echo " --cross Optional argument to signify cross compilation."
fi
passedArch="$(echo "$2" | tr "[:upper:]" "[:lower:]")"
case "$passedArch" in
- x64|x86|arm|armel|arm64|wasm)
+ x64|x86|arm|armel|arm64|s390x|wasm)
arch=$passedArch
;;
*)
echo "Unsupported target architecture '$2'."
- echo "The allowed values are x86, x64, arm, armel, arm64, and wasm."
+ echo "The allowed values are x86, x64, arm, armel, arm64, s390x, and wasm."
exit 1
;;
esac
__BuildArch=x64
;;
+ s390x|-s390x)
+ __BuildArch=s390x
+ ;;
+
wasm|-wasm)
__BuildArch=wasm
;;
set(ARCH_HOST_NAME arm64)
add_definitions(-DHOST_ARM64)
add_definitions(-DHOST_64BIT)
+elseif (CLR_CMAKE_HOST_ARCH_S390X)
+ set(ARCH_HOST_NAME s390x)
+ add_definitions(-DHOST_S390X)
+ add_definitions(-DHOST_64BIT)
else ()
clr_unknown_arch()
endif ()
message("Detected Linux ARM64")
elseif(CLR_CMAKE_HOST_UNIX_X86)
message("Detected Linux i686")
+ elseif(CLR_CMAKE_HOST_UNIX_S390X)
+ message("Detected Linux s390x")
else()
clr_unknown_arch()
endif()
set(ARCH_TARGET_NAME x86)
set(ARCH_SOURCES_DIR i386)
add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_ARCH>>>:TARGET_X86>)
+elseif (CLR_CMAKE_TARGET_ARCH_S390X)
+ set(ARCH_TARGET_NAME s390x)
+ set(ARCH_SOURCES_DIR s390x)
+ add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_ARCH>>>:TARGET_S390X>)
+ add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_ARCH>>>:TARGET_64BIT>)
else ()
clr_unknown_arch()
endif ()
set(CLR_CMAKE_HOST_UNIX_ARM64 1)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL i686 OR CMAKE_SYSTEM_PROCESSOR STREQUAL x86)
set(CLR_CMAKE_HOST_UNIX_X86 1)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL s390x)
+ set(CLR_CMAKE_HOST_UNIX_S390X 1)
else()
clr_unknown_arch()
endif()
elseif(CLR_CMAKE_HOST_UNIX_X86)
set(CLR_CMAKE_HOST_ARCH_I386 1)
set(CLR_CMAKE_HOST_ARCH "x86")
+elseif(CLR_CMAKE_HOST_UNIX_S390X)
+ set(CLR_CMAKE_HOST_ARCH_S390X 1)
+ set(CLR_CMAKE_HOST_ARCH "s390x")
elseif(CLR_CMAKE_HOST_UNIX_WASM)
set(CLR_CMAKE_HOST_ARCH_WASM 1)
set(CLR_CMAKE_HOST_ARCH "wasm")
set(CLR_CMAKE_TARGET_ARCH_ARM 1)
set(CLR_CMAKE_TARGET_ARCH_ARMV7L 1)
set(ARM_SOFTFP 1)
+ elseif(CLR_CMAKE_TARGET_ARCH STREQUAL s390x)
+ set(CLR_CMAKE_TARGET_ARCH_S390X 1)
elseif(CLR_CMAKE_TARGET_ARCH STREQUAL wasm)
set(CLR_CMAKE_TARGET_ARCH_WASM 1)
else()
set(CLR_CMAKE_TARGET_UNIX_ARM64 1)
elseif(CLR_CMAKE_TARGET_ARCH STREQUAL x86)
set(CLR_CMAKE_TARGET_UNIX_X86 1)
+ elseif(CLR_CMAKE_TARGET_ARCH STREQUAL s390x)
+ set(CLR_CMAKE_TARGET_UNIX_S390X 1)
elseif(CLR_CMAKE_TARGET_ARCH STREQUAL wasm)
set(CLR_CMAKE_TARGET_UNIX_WASM 1)
else()
if(CLR_CMAKE_TARGET_ANDROID)
set(TOOLSET_PREFIX ${ANDROID_TOOLCHAIN_PREFIX})
elseif(CMAKE_CROSSCOMPILING AND NOT DEFINED CLR_CROSS_COMPONENTS_BUILD AND (CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l OR
- CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL arm))
+ CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL arm OR CMAKE_SYSTEM_PROCESSOR STREQUAL s390x))
set(TOOLSET_PREFIX "${TOOLCHAIN}-")
else()
set(TOOLSET_PREFIX "")
arch=x86
;;
+ s390x)
+ arch=s390x
+ ;;
+
*)
echo "Unknown CPU $CPUName detected, configuring as if for x64"
arch=x64
else()
message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only arm64 or x64 is supported for OSX cross build!")
endif()
-elseif(TARGET_ARCH_NAME MATCHES "^(armel|arm|arm64|x86)$" OR FREEBSD OR ILLUMOS)
+elseif(TARGET_ARCH_NAME MATCHES "^(armel|arm|arm64|s390x|x86)$" OR FREEBSD OR ILLUMOS)
set_cache_value(FILE_OPS_CHECK_FERROR_OF_PREVIOUS_CALL_EXITCODE 1)
set_cache_value(GETPWUID_R_SETS_ERRNO_EXITCODE 0)
set_cache_value(HAS_POSIX_SEMAPHORES_EXITCODE 0)
set_cache_value(HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES_EXITCODE 0)
endif()
else()
- message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only armel, arm, arm64 and x86 are supported!")
+ message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only armel, arm, arm64, s390x and x86 are supported!")
endif()
if(TARGET_ARCH_NAME STREQUAL "x86")