blob: 1cc9690ff1e5593a957a0515e6019021e2e5d22f [file] [log] [blame]
Greg Hartman8527e472015-11-02 13:08:12 -08001#
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 Capens352e56c2017-08-10 16:57:25 -040017LOCAL_PATH := $(call my-dir)
Merck Hung90c0c552018-09-28 16:08:14 +080018swiftshader_root := $(LOCAL_PATH)
Greg Hartman8527e472015-11-02 13:08:12 -080019
Nicolas Capensfde88d92018-10-15 12:55:02 -040020# Default LLVM version for SwiftShader's JIT compiler (Reactor).
21REACTOR_LLVM_VERSION ?= 7
Logan Chien17b75892018-08-27 10:49:24 +080022
Nicolas Capensfde88d92018-10-15 12:55:02 -040023# Subzero is an alternative JIT compiler. It is smaller and generally slower.
24REACTOR_USE_SUBZERO := false
Logan Chien17b75892018-08-27 10:49:24 +080025
Nicolas Capensf417d9d2018-10-10 10:49:30 -040026ifeq ($(REACTOR_LLVM_VERSION),3)
Logan Chien17b75892018-08-27 10:49:24 +080027# Reactor with LLVM 3.0 doesn't support ARM. Use Subzero as the Reactor JIT
28# back-end on ARM.
Nicolas Capens352e56c2017-08-10 16:57:25 -040029ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm))
Nicolas Capensfde88d92018-10-15 12:55:02 -040030REACTOR_USE_SUBZERO := true
Nicolas Capens352e56c2017-08-10 16:57:25 -040031endif
Logan Chien17b75892018-08-27 10:49:24 +080032endif
Nicolas Capens352e56c2017-08-10 16:57:25 -040033
Nicolas Capensfde88d92018-10-15 12:55:02 -040034# Subzero and LLVM 7.0 require C++11.
35# Full C++11 support is only available from Marshmallow and up.
Nicolas Capens352e56c2017-08-10 16:57:25 -040036ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23 && echo PreMarshmallow),PreMarshmallow)
Nicolas Capensfde88d92018-10-15 12:55:02 -040037# Fall back to LLVM 3.0.
38REACTOR_USE_SUBZERO := false
39REACTOR_LLVM_VERSION := 3
Nicolas Capens352e56c2017-08-10 16:57:25 -040040endif
Logan Chien17b75892018-08-27 10:49:24 +080041
42# Check whether $(TARGET_ARCH) is supported.
Nicolas Capensf417d9d2018-10-10 10:49:30 -040043ifeq ($(REACTOR_LLVM_VERSION),3)
Logan Chien17b75892018-08-27 10:49:24 +080044ifneq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64 arm))
Logan Chien6aad6a72018-09-25 17:59:20 +080045swiftshader_unsupported_build := true
Logan Chien17b75892018-08-27 10:49:24 +080046endif
47endif
48
Nicolas Capensf417d9d2018-10-10 10:49:30 -040049ifeq ($(REACTOR_LLVM_VERSION),7)
Logan Chien17b75892018-08-27 10:49:24 +080050ifneq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64 arm arm64))
Logan Chien6aad6a72018-09-25 17:59:20 +080051swiftshader_unsupported_build := true
Logan Chien17b75892018-08-27 10:49:24 +080052endif
53endif
54
Merck Hung90c0c552018-09-28 16:08:14 +080055ifneq ($(swiftshader_unsupported_build),true)
56include $(swiftshader_root)/src/Android.mk
Alexis Hetud16a5042018-10-17 10:10:23 -040057include $(swiftshader_root)/tests/GLESUnitTests/Android.mk
Nicolas Capensf417d9d2018-10-10 10:49:30 -040058ifeq ($(REACTOR_LLVM_VERSION),3)
Merck Hung90c0c552018-09-28 16:08:14 +080059include $(swiftshader_root)/third_party/LLVM/Android.mk
60else
61include $(swiftshader_root)/third_party/llvm-7.0/Android.mk
62endif
Greg Hartman8527e472015-11-02 13:08:12 -080063endif