blob: d79f23cce0f7a9d337efbdf3725ef5997c8906bb [file] [log] [blame]
Colin Cross3f40fa42015-01-30 17:27:36 -08001// Copyright 2015 Google Inc. All rights reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package cc
16
17import (
18 "android/soong/common"
19)
20
21type toolchainFactory func(archVariant string, cpuVariant string) toolchain
22
23var toolchainFactories = map[common.HostOrDevice]map[common.ArchType]toolchainFactory{
24 common.Host: make(map[common.ArchType]toolchainFactory),
25 common.Device: make(map[common.ArchType]toolchainFactory),
26}
27
28func registerToolchainFactory(hod common.HostOrDevice, arch common.ArchType,
29 factory toolchainFactory) {
30
31 toolchainFactories[hod][arch] = factory
32}
33
34type toolchain interface {
35 GccRoot() string
36 GccTriple() string
37 Cflags() string
38 Cppflags() string
39 Ldflags() string
40 IncludeFlags() string
41
42 ClangTriple() string
43 ClangCflags() string
44 ClangCppflags() string
45 ClangLdflags() string
46
47 Is64Bit() bool
48}
49
50type toolchain64Bit struct {
51}
52
53func (toolchain64Bit) Is64Bit() bool {
54 return true
55}
56
57type toolchain32Bit struct {
58}
59
60func (toolchain32Bit) Is64Bit() bool {
61 return false
62}