mirror of https://github.com/ARMmbed/mbed-os.git
parent
3ea625c8eb
commit
f80b62ed00
|
@ -23,6 +23,14 @@ class OldLibrariesException(Exception): pass
|
||||||
|
|
||||||
class FailedBuildException(Exception) : pass
|
class FailedBuildException(Exception) : pass
|
||||||
|
|
||||||
|
# Exporter descriptor for TARGETS
|
||||||
|
# TARGETS as class attribute for backward compatibility (allows: if in Exporter.TARGETS)
|
||||||
|
class ExporterTargetsProperty(object):
|
||||||
|
def __init__(self, func):
|
||||||
|
self.func = func
|
||||||
|
def __get__(self, inst, cls):
|
||||||
|
return self.func(cls)
|
||||||
|
|
||||||
class Exporter(object):
|
class Exporter(object):
|
||||||
TEMPLATE_DIR = dirname(__file__)
|
TEMPLATE_DIR = dirname(__file__)
|
||||||
DOT_IN_RELATIVE_PATH = False
|
DOT_IN_RELATIVE_PATH = False
|
||||||
|
|
|
@ -18,7 +18,7 @@ import re
|
||||||
import os
|
import os
|
||||||
from project_generator_definitions.definitions import ProGenDef
|
from project_generator_definitions.definitions import ProGenDef
|
||||||
|
|
||||||
from tools.export.exporters import Exporter
|
from tools.export.exporters import Exporter, ExporterTargetsProperty
|
||||||
from tools.targets import TARGET_MAP, TARGET_NAMES
|
from tools.targets import TARGET_MAP, TARGET_NAMES
|
||||||
|
|
||||||
# If you wish to add a new target, add it to project_generator_definitions, and then
|
# If you wish to add a new target, add it to project_generator_definitions, and then
|
||||||
|
@ -35,19 +35,19 @@ class IAREmbeddedWorkbench(Exporter):
|
||||||
|
|
||||||
MBED_CONFIG_HEADER_SUPPORTED = True
|
MBED_CONFIG_HEADER_SUPPORTED = True
|
||||||
|
|
||||||
@property
|
@ExporterTargetsProperty
|
||||||
def TARGETS(self):
|
def TARGETS(cls):
|
||||||
if not hasattr(self, "_targets_supported"):
|
if not hasattr(cls, "_targets_supported"):
|
||||||
self._targets_supported = []
|
cls._targets_supported = []
|
||||||
for target in TARGET_NAMES:
|
for target in TARGET_NAMES:
|
||||||
try:
|
try:
|
||||||
if (ProGenDef('iar').is_supported(str(TARGET_MAP[target])) or
|
if (ProGenDef('iar').is_supported(str(TARGET_MAP[target])) or
|
||||||
ProGenDef('iar').is_supported(TARGET_MAP[target].progen['target'])):
|
ProGenDef('iar').is_supported(TARGET_MAP[target].progen['target'])):
|
||||||
self._targets_supported.append(target)
|
cls._targets_supported.append(target)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
# target is not supported yet
|
# target is not supported yet
|
||||||
continue
|
continue
|
||||||
return self._targets_supported
|
return cls._targets_supported
|
||||||
|
|
||||||
def generate(self, progen_build=False):
|
def generate(self, progen_build=False):
|
||||||
""" Generates the project files """
|
""" Generates the project files """
|
||||||
|
|
|
@ -17,7 +17,7 @@ limitations under the License.
|
||||||
from os.path import basename, join, dirname
|
from os.path import basename, join, dirname
|
||||||
from project_generator_definitions.definitions import ProGenDef
|
from project_generator_definitions.definitions import ProGenDef
|
||||||
|
|
||||||
from tools.export.exporters import Exporter
|
from tools.export.exporters import Exporter, ExporterTargetsProperty
|
||||||
from tools.targets import TARGET_MAP, TARGET_NAMES
|
from tools.targets import TARGET_MAP, TARGET_NAMES
|
||||||
from tools.settings import ARM_INC
|
from tools.settings import ARM_INC
|
||||||
|
|
||||||
|
@ -36,19 +36,19 @@ class Uvision4(Exporter):
|
||||||
|
|
||||||
MBED_CONFIG_HEADER_SUPPORTED = True
|
MBED_CONFIG_HEADER_SUPPORTED = True
|
||||||
|
|
||||||
@property
|
@ExporterTargetsProperty
|
||||||
def TARGETS(self):
|
def TARGETS(cls):
|
||||||
if not hasattr(self, "_targets_supported"):
|
if not hasattr(cls, "_targets_supported"):
|
||||||
self._targets_supported = []
|
cls._targets_supported = []
|
||||||
for target in TARGET_NAMES:
|
for target in TARGET_NAMES:
|
||||||
try:
|
try:
|
||||||
if (ProGenDef('uvision').is_supported(str(TARGET_MAP[target])) or
|
if (ProGenDef('uvision').is_supported(str(TARGET_MAP[target])) or
|
||||||
ProGenDef('uvision').is_supported(TARGET_MAP[target].progen['target'])):
|
ProGenDef('uvision').is_supported(TARGET_MAP[target].progen['target'])):
|
||||||
self._targets_supported.append(target)
|
cls._targets_supported.append(target)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
# target is not supported yet
|
# target is not supported yet
|
||||||
continue
|
continue
|
||||||
return self._targets_supported
|
return cls._targets_supported
|
||||||
|
|
||||||
def get_toolchain(self):
|
def get_toolchain(self):
|
||||||
return TARGET_MAP[self.target].default_toolchain
|
return TARGET_MAP[self.target].default_toolchain
|
||||||
|
|
|
@ -17,7 +17,7 @@ limitations under the License.
|
||||||
from os.path import basename, join, dirname
|
from os.path import basename, join, dirname
|
||||||
from project_generator_definitions.definitions import ProGenDef
|
from project_generator_definitions.definitions import ProGenDef
|
||||||
|
|
||||||
from tools.export.exporters import Exporter
|
from tools.export.exporters import Exporter, ExporterTargetsProperty
|
||||||
from tools.targets import TARGET_MAP, TARGET_NAMES
|
from tools.targets import TARGET_MAP, TARGET_NAMES
|
||||||
from tools.settings import ARM_INC
|
from tools.settings import ARM_INC
|
||||||
|
|
||||||
|
@ -40,19 +40,19 @@ class Uvision5(Exporter):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._targets = []
|
self._targets = []
|
||||||
|
|
||||||
@property
|
@ExporterTargetsProperty
|
||||||
def TARGETS(self):
|
def TARGETS(cls):
|
||||||
if not hasattr(self, "_targets_supported"):
|
if not hasattr(cls, "_targets_supported"):
|
||||||
self._targets_supported = []
|
cls._targets_supported = []
|
||||||
for target in TARGET_NAMES:
|
for target in TARGET_NAMES:
|
||||||
try:
|
try:
|
||||||
if (ProGenDef('uvision5').is_supported(str(TARGET_MAP[target])) or
|
if (ProGenDef('uvision5').is_supported(str(TARGET_MAP[target])) or
|
||||||
ProGenDef('uvision5').is_supported(TARGET_MAP[target].progen['target'])):
|
ProGenDef('uvision5').is_supported(TARGET_MAP[target].progen['target'])):
|
||||||
self._targets_supported.append(target)
|
cls._targets_supported.append(target)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
# target is not supported yet
|
# target is not supported yet
|
||||||
continue
|
continue
|
||||||
return self._targets_supported
|
return cls._targets_supported
|
||||||
|
|
||||||
def get_toolchain(self):
|
def get_toolchain(self):
|
||||||
return TARGET_MAP[self.target].default_toolchain
|
return TARGET_MAP[self.target].default_toolchain
|
||||||
|
|
Loading…
Reference in New Issue