Commit 18b8d68e by Nicolas Capens Committed by Nicolas Capens

Default to Subzero for ARM CMake build.

Change-Id: I4eaee73caca1e2552cd63901a6c9107efbeaa2f8 Reviewed-on: https://swiftshader-review.googlesource.com/10930Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 2d8c370e
...@@ -2,6 +2,38 @@ cmake_minimum_required(VERSION 2.8) ...@@ -2,6 +2,38 @@ cmake_minimum_required(VERSION 2.8)
project(SwiftShader C CXX) project(SwiftShader C CXX)
###########################################################
# Detect system
###########################################################
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(LINUX ON)
elseif(WIN32)
elseif(APPLE)
else()
message(FATAL_ERROR "Platform is not supported")
endif()
if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm" OR CMAKE_SYSTEM_PROCESSOR MATCHES "aarch")
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(ARCH "aarch64")
else()
set(ARCH "arm")
endif()
else()
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(ARCH "x86_64")
else()
set(ARCH "x86")
endif()
endif()
set(CMAKE_MACOSX_RPATH ON)
###########################################################
# Options
###########################################################
if(NOT CMAKE_BUILD_TYPE) if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "The type of build: Debug Release MinSizeRel RelWithDebInfo." FORCE) set(CMAKE_BUILD_TYPE "Release" CACHE STRING "The type of build: Debug Release MinSizeRel RelWithDebInfo." FORCE)
endif() endif()
...@@ -19,7 +51,13 @@ option(USE_GROUP_SOURCES "Group the source files in a folder tree for Visual Stu ...@@ -19,7 +51,13 @@ option(USE_GROUP_SOURCES "Group the source files in a folder tree for Visual Stu
option(BUILD_SAMPLES "Build sample programs" 1) option(BUILD_SAMPLES "Build sample programs" 1)
option(BUILD_TESTS "Build test programs" 1) option(BUILD_TESTS "Build test programs" 1)
set(REACTOR_BACKEND "LLVM" CACHE STRING "JIT compiler back-end used by Reactor") if(ARCH STREQUAL "arm")
set(DEFAULT_REACTOR_BACKEND "Subzero")
else()
set(DEFAULT_REACTOR_BACKEND "LLVM")
endif()
set(REACTOR_BACKEND DEFAULT_REACTOR_BACKEND CACHE STRING "JIT compiler back-end used by Reactor")
set_property(CACHE REACTOR_BACKEND PROPERTY STRINGS LLVM Subzero) set_property(CACHE REACTOR_BACKEND PROPERTY STRINGS LLVM Subzero)
# LLVM disallows calling cmake . from the main LLVM dir, the reason is that # LLVM disallows calling cmake . from the main LLVM dir, the reason is that
...@@ -38,34 +76,6 @@ endif() ...@@ -38,34 +76,6 @@ endif()
set_property(GLOBAL PROPERTY USE_FOLDERS ON) set_property(GLOBAL PROPERTY USE_FOLDERS ON)
########################################################### ###########################################################
# Detect system
###########################################################
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(LINUX ON)
elseif(WIN32)
elseif(APPLE)
else()
message(FATAL_ERROR "Platform is not supported")
endif()
if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm" OR CMAKE_SYSTEM_PROCESSOR MATCHES "aarch")
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(ARCH "aarch64")
else()
set(ARCH "arm")
endif()
else()
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(ARCH "x86_64")
else()
set(ARCH "x86")
endif()
endif()
set(CMAKE_MACOSX_RPATH ON)
###########################################################
# Convenience macros # Convenience macros
########################################################### ###########################################################
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment