Greg Hartman | 8527e47 | 2015-11-02 13:08:12 -0800 | [diff] [blame] | 1 | # |
| 2 | # Copyright 2015 The Android Open-Source Project |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | # |
| 16 | |
Nicolas Capens | 352e56c | 2017-08-10 16:57:25 -0400 | [diff] [blame] | 17 | LOCAL_PATH := $(call my-dir) |
Merck Hung | 90c0c55 | 2018-09-28 16:08:14 +0800 | [diff] [blame] | 18 | swiftshader_root := $(LOCAL_PATH) |
Greg Hartman | 8527e47 | 2015-11-02 13:08:12 -0800 | [diff] [blame] | 19 | |
Nicolas Capens | fde88d9 | 2018-10-15 12:55:02 -0400 | [diff] [blame] | 20 | # Default LLVM version for SwiftShader's JIT compiler (Reactor). |
| 21 | REACTOR_LLVM_VERSION ?= 7 |
Logan Chien | 17b7589 | 2018-08-27 10:49:24 +0800 | [diff] [blame] | 22 | |
Nicolas Capens | fde88d9 | 2018-10-15 12:55:02 -0400 | [diff] [blame] | 23 | # Subzero is an alternative JIT compiler. It is smaller and generally slower. |
| 24 | REACTOR_USE_SUBZERO := false |
Logan Chien | 17b7589 | 2018-08-27 10:49:24 +0800 | [diff] [blame] | 25 | |
Nicolas Capens | f417d9d | 2018-10-10 10:49:30 -0400 | [diff] [blame] | 26 | ifeq ($(REACTOR_LLVM_VERSION),3) |
Logan Chien | 17b7589 | 2018-08-27 10:49:24 +0800 | [diff] [blame] | 27 | # Reactor with LLVM 3.0 doesn't support ARM. Use Subzero as the Reactor JIT |
| 28 | # back-end on ARM. |
Nicolas Capens | 352e56c | 2017-08-10 16:57:25 -0400 | [diff] [blame] | 29 | ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm)) |
Nicolas Capens | fde88d9 | 2018-10-15 12:55:02 -0400 | [diff] [blame] | 30 | REACTOR_USE_SUBZERO := true |
Nicolas Capens | 352e56c | 2017-08-10 16:57:25 -0400 | [diff] [blame] | 31 | endif |
Logan Chien | 17b7589 | 2018-08-27 10:49:24 +0800 | [diff] [blame] | 32 | endif |
Nicolas Capens | 352e56c | 2017-08-10 16:57:25 -0400 | [diff] [blame] | 33 | |
Nicolas Capens | fde88d9 | 2018-10-15 12:55:02 -0400 | [diff] [blame] | 34 | # Subzero and LLVM 7.0 require C++11. |
| 35 | # Full C++11 support is only available from Marshmallow and up. |
Nicolas Capens | 352e56c | 2017-08-10 16:57:25 -0400 | [diff] [blame] | 36 | ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23 && echo PreMarshmallow),PreMarshmallow) |
Nicolas Capens | fde88d9 | 2018-10-15 12:55:02 -0400 | [diff] [blame] | 37 | # Fall back to LLVM 3.0. |
| 38 | REACTOR_USE_SUBZERO := false |
| 39 | REACTOR_LLVM_VERSION := 3 |
Nicolas Capens | 352e56c | 2017-08-10 16:57:25 -0400 | [diff] [blame] | 40 | endif |
Logan Chien | 17b7589 | 2018-08-27 10:49:24 +0800 | [diff] [blame] | 41 | |
| 42 | # Check whether $(TARGET_ARCH) is supported. |
Nicolas Capens | f417d9d | 2018-10-10 10:49:30 -0400 | [diff] [blame] | 43 | ifeq ($(REACTOR_LLVM_VERSION),3) |
Logan Chien | 17b7589 | 2018-08-27 10:49:24 +0800 | [diff] [blame] | 44 | ifneq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64 arm)) |
Logan Chien | 6aad6a7 | 2018-09-25 17:59:20 +0800 | [diff] [blame] | 45 | swiftshader_unsupported_build := true |
Logan Chien | 17b7589 | 2018-08-27 10:49:24 +0800 | [diff] [blame] | 46 | endif |
| 47 | endif |
| 48 | |
Nicolas Capens | f417d9d | 2018-10-10 10:49:30 -0400 | [diff] [blame] | 49 | ifeq ($(REACTOR_LLVM_VERSION),7) |
Logan Chien | 17b7589 | 2018-08-27 10:49:24 +0800 | [diff] [blame] | 50 | ifneq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64 arm arm64)) |
Logan Chien | 6aad6a7 | 2018-09-25 17:59:20 +0800 | [diff] [blame] | 51 | swiftshader_unsupported_build := true |
Logan Chien | 17b7589 | 2018-08-27 10:49:24 +0800 | [diff] [blame] | 52 | endif |
| 53 | endif |
| 54 | |
Merck Hung | 90c0c55 | 2018-09-28 16:08:14 +0800 | [diff] [blame] | 55 | ifneq ($(swiftshader_unsupported_build),true) |
| 56 | include $(swiftshader_root)/src/Android.mk |
Alexis Hetu | d16a504 | 2018-10-17 10:10:23 -0400 | [diff] [blame] | 57 | include $(swiftshader_root)/tests/GLESUnitTests/Android.mk |
Nicolas Capens | f417d9d | 2018-10-10 10:49:30 -0400 | [diff] [blame] | 58 | ifeq ($(REACTOR_LLVM_VERSION),3) |
Merck Hung | 90c0c55 | 2018-09-28 16:08:14 +0800 | [diff] [blame] | 59 | include $(swiftshader_root)/third_party/LLVM/Android.mk |
| 60 | else |
| 61 | include $(swiftshader_root)/third_party/llvm-7.0/Android.mk |
| 62 | endif |
Greg Hartman | 8527e47 | 2015-11-02 13:08:12 -0800 | [diff] [blame] | 63 | endif |