Support user compile/link options 06/135506/1
authorhyokeun <hyokeun.jeon@samsung.com>
Fri, 23 Jun 2017 00:01:33 +0000 (09:01 +0900)
committerhyokeun <hyokeun.jeon@samsung.com>
Fri, 23 Jun 2017 00:01:52 +0000 (09:01 +0900)
Change-Id: I73b64b7a065e0a44cace24754e9cc13d44760d25

abs

diff --git a/abs b/abs
index d2b5312..668453a 100755 (executable)
--- a/abs
+++ b/abs
@@ -566,6 +566,17 @@ class Source(object):
         mydict['path'] = path
         return mydict
 
+    def set_user_options(self, c_opts=None, cpp_opts=None, link_opts=None):
+        if c_opts is not None:
+            os.environ['USER_C_OPTS'] = c_opts
+            print 'Set USER_C_OPTS=[%s]' % os.getenv('USER_C_OPTS')
+        if cpp_opts is not None:
+            os.environ['USER_CPP_OPTS'] = cpp_opts
+            print 'Set USER_CPP_OPTS=[%s]' % os.getenv('USER_CPP_OPTS')
+        if link_opts is not None:
+            os.environ['USER_LINK_OPTS'] = link_opts
+            print 'Set USER_LINK_OPTS=[%s]' % os.getenv('USER_LINK_OPTS')
+
     def pre_process(self):
 
         if os.path.isfile(os.path.join(self.workspace, self.multi_conf_file)):
@@ -605,6 +616,12 @@ def argument_parsing(argv):
     build.add_argument('--sdkpath', action='store', dest='sdkpath', \
                         help='Specify Tizen SDK installation root (one time init).' \
                              ' ex) /home/yours/tizen-sdk/')
+    build.add_argument('--c-opts', action='store', dest='c_opts', \
+                        help='Extra compile options USER_C_OPTS')
+    build.add_argument('--cpp-opts', action='store', dest='cpp_opts', \
+                        help='Extra compile options USER_CPP_OPTS')
+    build.add_argument('--link-opts', action='store', dest='link_opts', \
+                        help='Extra linking options USER_LINK_OPTS')
 
     return parser.parse_args(argv[1:])
 
@@ -612,6 +629,7 @@ def build_main(args):
     """Command [build] entry point."""
 
     my_source = Source(src=args.workspace)
+    my_source.set_user_options(c_opts=args.c_opts, cpp_opts=args.cpp_opts, link_opts=args.link_opts)
     my_sdk = Sdk(sdkpath=args.sdkpath)
     my_sdk.clean(my_source)
     my_sdk.build_native(my_source, rootstrap=args.rootstrap, arch=args.arch, conf=args.conf, jobs=args.jobs)