1# Copyright 2013 The Chromium Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5"""A module for the basic architectures supported by cr.""" 6 7import cr 8 9DEFAULT = cr.Config.From( 10 CR_ENVSETUP_ARCH='{CR_ARCH}', 11) 12 13 14class Arch(cr.Plugin, cr.Plugin.Type): 15 """Base class for implementing cr architecture targets.""" 16 17 SELECTOR = 'CR_ARCH' 18 19 @classmethod 20 def AddArguments(cls, parser): 21 parser.add_argument( 22 '--architecture', dest=cls.SELECTOR, 23 choices=cls.Choices(), 24 default=None, 25 help='Sets the target architecture to use. Overrides ' + cls.SELECTOR 26 ) 27 28 29class IA32Arch(Arch): 30 31 ACTIVE = cr.Config.From( 32 CR_ENVSETUP_ARCH='ia32', 33 ) 34 35 36class Mips32Arch(Arch): 37 38 ACTIVE = cr.Config.From( 39 CR_ENVSETUP_ARCH='mipsel', 40 ) 41 42 @property 43 def enabled(self): 44 return cr.AndroidPlatform.GetInstance().is_active 45 46 47class X64Arch(Arch): 48 49 ACTIVE = cr.Config.From( 50 CR_ENVSETUP_ARCH='x64', 51 ) 52 53 @property 54 def priority(self): 55 return super(X64Arch, self).priority + 1 56 57 58class Arm32Arch(Arch): 59 60 ACTIVE = cr.Config.From( 61 CR_ENVSETUP_ARCH='arm', 62 ) 63 64 @property 65 def priority(self): 66 return super(Arm32Arch, self).priority + 2 67 68 @property 69 def enabled(self): 70 return cr.AndroidPlatform.GetInstance().is_active 71 72 73class Arm64Arch(Arch): 74 75 ACTIVE = cr.Config.From( 76 CR_ENVSETUP_ARCH='arm64', 77 ) 78 79 @property 80 def enabled(self): 81 return cr.AndroidPlatform.GetInstance().is_active 82