]> git.gir.st - tmk_keyboard.git/blob - tool/mbed/mbed-sdk/workspace_tools/libraries.py
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[tmk_keyboard.git] / tool / mbed / mbed-sdk / workspace_tools / libraries.py
1 """
2 mbed SDK
3 Copyright (c) 2011-2013 ARM Limited
4
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8
9 http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16 """
17 from workspace_tools.paths import *
18 from workspace_tools.data.support import *
19 from workspace_tools.tests import TEST_MBED_LIB
20
21
22 LIBRARIES = [
23 # RTOS libraries
24 {
25 "id": "rtx",
26 "source_dir": MBED_RTX,
27 "build_dir": RTOS_LIBRARIES,
28 "dependencies": [MBED_LIBRARIES],
29 },
30 {
31 "id": "rtos",
32 "source_dir": RTOS_ABSTRACTION,
33 "build_dir": RTOS_LIBRARIES,
34 "dependencies": [MBED_LIBRARIES, MBED_RTX],
35 },
36
37 # USB Device libraries
38 {
39 "id": "usb",
40 "source_dir": USB,
41 "build_dir": USB_LIBRARIES,
42 "dependencies": [MBED_LIBRARIES],
43 },
44
45 # USB Host libraries
46 {
47 "id": "usb_host",
48 "source_dir": USB_HOST,
49 "build_dir": USB_HOST_LIBRARIES,
50 "dependencies": [MBED_LIBRARIES, FAT_FS, MBED_RTX, RTOS_ABSTRACTION],
51 },
52
53 # DSP libraries
54 {
55 "id": "cmsis_dsp",
56 "source_dir": DSP_CMSIS,
57 "build_dir": DSP_LIBRARIES,
58 "dependencies": [MBED_LIBRARIES],
59 },
60 {
61 "id": "dsp",
62 "source_dir": DSP_ABSTRACTION,
63 "build_dir": DSP_LIBRARIES,
64 "dependencies": [MBED_LIBRARIES, DSP_CMSIS],
65 },
66
67 # File system libraries
68 {
69 "id": "fat",
70 "source_dir": [FAT_FS, SD_FS],
71 "build_dir": FS_LIBRARY,
72 "dependencies": [MBED_LIBRARIES]
73 },
74
75 # Network libraries
76 {
77 "id": "eth",
78 "source_dir": [ETH_SOURCES, LWIP_SOURCES],
79 "build_dir": ETH_LIBRARY,
80 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES]
81 },
82
83 {
84 "id": "ublox",
85 "source_dir": [UBLOX_SOURCES, CELLULAR_SOURCES, CELLULAR_USB_SOURCES, LWIP_SOURCES],
86 "build_dir": UBLOX_LIBRARY,
87 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, USB_HOST_LIBRARIES],
88 },
89
90 # Unit Testing library
91 {
92 "id": "cpputest",
93 "source_dir": [CPPUTEST_SRC, CPPUTEST_PLATFORM_SRC, CPPUTEST_TESTRUNNER_SCR],
94 "build_dir": CPPUTEST_LIBRARY,
95 "dependencies": [MBED_LIBRARIES],
96 'inc_dirs': [CPPUTEST_INC, CPPUTEST_PLATFORM_INC, CPPUTEST_TESTRUNNER_INC, TEST_MBED_LIB],
97 'inc_dirs_ext': [CPPUTEST_INC_EXT],
98 'macros': ["CPPUTEST_USE_MEM_LEAK_DETECTION=0", "CPPUTEST_USE_STD_CPP_LIB=0", "CPPUTEST=1"],
99 },
100 ]
101
102
103 LIBRARY_MAP = dict([(library['id'], library) for library in LIBRARIES])
104
105
106 class Library:
107 DEFAULTS = {
108 "supported": DEFAULT_SUPPORT,
109 'dependencies': None,
110 'inc_dirs': None, # Include dirs required by library build
111 'inc_dirs_ext': None, # Include dirs required by others to use with this library
112 'macros': None, # Additional macros you want to define when building library
113 }
114 def __init__(self, lib_id):
115 self.__dict__.update(Library.DEFAULTS)
116 self.__dict__.update(LIBRARY_MAP[lib_id])
117
118 def is_supported(self, target, toolchain):
119 if not hasattr(self, 'supported'):
120 return True
121 return (target.name in self.supported) and (toolchain in self.supported[target.name])
Imprint / Impressum