blob: 09141b329dd3ea312f3db8ba9bc7c22dbefe85f0 [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
Logan Chien17b75892018-08-27 10:49:24 +080020# LLVM version for SwiftShader
21SWIFTSHADER_LLVM_VERSION ?= 3
22
23
24ifeq ($(SWIFTSHADER_LLVM_VERSION),3)
25# Reactor with LLVM 3.0 doesn't support ARM. Use Subzero as the Reactor JIT
26# back-end on ARM.
Nicolas Capens352e56c2017-08-10 16:57:25 -040027ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm))
Logan Chien2ecc8b72018-09-10 22:14:20 +080028SWIFTSHADER_USE_SUBZERO := true
Nicolas Capens352e56c2017-08-10 16:57:25 -040029endif
Logan Chien17b75892018-08-27 10:49:24 +080030endif
Nicolas Capens352e56c2017-08-10 16:57:25 -040031
Logan Chien17b75892018-08-27 10:49:24 +080032
33# Check whether SwiftShader requires full C++ 11 support.
Logan Chien2ecc8b72018-09-10 22:14:20 +080034ifdef SWIFTSHADER_USE_SUBZERO
Logan Chien6aad6a72018-09-25 17:59:20 +080035swiftshader_requires_cxx11 := true
Logan Chien17b75892018-08-27 10:49:24 +080036endif
37
38ifeq ($(SWIFTSHADER_LLVM_VERSION),7)
Logan Chien6aad6a72018-09-25 17:59:20 +080039swiftshader_requires_cxx11 := true
Logan Chien17b75892018-08-27 10:49:24 +080040endif
41
Logan Chien6aad6a72018-09-25 17:59:20 +080042ifeq ($(swiftshader_requires_cxx11),true)
Logan Chien17b75892018-08-27 10:49:24 +080043# Full C++ 11 support is only available from Marshmallow and up.
Nicolas Capens352e56c2017-08-10 16:57:25 -040044ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23 && echo PreMarshmallow),PreMarshmallow)
Logan Chien6aad6a72018-09-25 17:59:20 +080045swiftshader_unsupported_build := true
Nicolas Capens352e56c2017-08-10 16:57:25 -040046endif
47endif
48
Logan Chien17b75892018-08-27 10:49:24 +080049
50# Check whether $(TARGET_ARCH) is supported.
51ifeq ($(SWIFTSHADER_LLVM_VERSION),3)
52ifneq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64 arm))
Logan Chien6aad6a72018-09-25 17:59:20 +080053swiftshader_unsupported_build := true
Logan Chien17b75892018-08-27 10:49:24 +080054endif
55endif
56
57ifeq ($(SWIFTSHADER_LLVM_VERSION),7)
58ifneq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64 arm arm64))
Logan Chien6aad6a72018-09-25 17:59:20 +080059swiftshader_unsupported_build := true
Logan Chien17b75892018-08-27 10:49:24 +080060endif
61endif
62
63
Merck Hung90c0c552018-09-28 16:08:14 +080064ifneq ($(swiftshader_unsupported_build),true)
65include $(swiftshader_root)/src/Android.mk
66include $(swiftshader_root)/tests/unittests/Android.mk
67ifeq ($(SWIFTSHADER_LLVM_VERSION),3)
68include $(swiftshader_root)/third_party/LLVM/Android.mk
69else
70include $(swiftshader_root)/third_party/llvm-7.0/Android.mk
71endif
Greg Hartman8527e472015-11-02 13:08:12 -080072endif