Alessandro Angelino / mbed-tools

Fork of mbed-tools by Morpheus

Revision:
8:c317ab6dabc4
Parent:
4:395a265b9cd4
--- a/project.py	Thu Mar 31 10:19:38 2016 +0000
+++ b/project.py	Thu Mar 31 23:40:06 2016 +0100
@@ -82,6 +82,11 @@
                       default=None,
                       help="The source (input) directory")
 
+    parser.add_option("-D", "",
+                      action="append",
+                      dest="macros",
+                      help="Add a macro definition")
+
     (options, args) = parser.parse_args()
 
     # Print available tests in order and exit
@@ -140,7 +145,7 @@
             project_dir = options.source_dir
             project_name = basename(project_dir)
             project_temp = project_dir
-            lib_symbols = []
+            lib_symbols = [] + options.macros
             zip = False   # don't create zip
             clean = False # don't cleanup because we use the actual source tree to generate IDE files
         else:
@@ -174,7 +179,7 @@
             # Some libraries have extra macros (called by exporter symbols) to we need to pass
             # them to maintain compilation macros integrity between compiled library and
             # header files we might use with it
-            lib_symbols = []
+            lib_symbols = [] + options.macros
             for lib in LIBRARIES:
                 if lib['build_dir'] in test.dependencies:
                     lib_macros = lib.get('macros', None)