From 93daec43d3a0b81fb4cd60ff0687fa08eca26ecc Mon Sep 17 00:00:00 2001 From: TSC21 Date: Wed, 12 Sep 2018 12:24:16 +0100 Subject: [PATCH] generate_microRTPS_bridge: add option to set preprocessor include paths of fastrtpsgen --- msg/tools/generate_microRTPS_bridge.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/msg/tools/generate_microRTPS_bridge.py b/msg/tools/generate_microRTPS_bridge.py index 0696294713..a78565e26c 100644 --- a/msg/tools/generate_microRTPS_bridge.py +++ b/msg/tools/generate_microRTPS_bridge.py @@ -100,9 +100,13 @@ parser.add_argument("-u", "--client-outdir", dest='clientdir', type=str, nargs=1 help="Client output dir, by default src/modules/micrortps_bridge/micrortps_client", default=default_client_out) parser.add_argument("-f", "--fastrtpsgen-dir", dest='fastrtpsgen', type=str, nargs='?', help="fastrtpsgen installation dir, only needed if fastrtpsgen is not in PATH, by default empty", default="") +parser.add_argument("-g", "--fastrtpsgen-include", dest='fastrtpsgen_include', type=str, nargs='?', + help="directory(ies) to add to preprocessor include paths of fastrtpsgen, by default empty", default="") parser.add_argument("--delete-tree", dest='del_tree', action="store_true", help="Delete dir tree output dir(s)") + + if len(sys.argv) <= 1: parser.print_usage() exit(-1) @@ -139,6 +143,7 @@ else: # Path to fastrtpsgen is explicitly specified fastrtpsgen_path = os.path.join( get_absolute_path(args.fastrtpsgen), "/fastrtpsgen") +fastrtpsgen_include = get_absolute_path(args.fastrtpsgen_include) # If nothing specified it's generated both if agent == False and client == False: @@ -230,7 +235,7 @@ def generate_agent(out_dir): raise Exception("No IDL files found in %s" % idl_dir) for idl_file in glob.glob(os.path.join(idl_dir, "*.idl")): ret = subprocess.call(fastrtpsgen_path + " -d " + out_dir + - "/fastrtpsgen -example x64Linux2.6gcc " + idl_file, shell=True) + "/fastrtpsgen -example x64Linux2.6gcc " + "-I " + fastrtpsgen_include + " " + idl_file, shell=True) if ret: raise Exception( "fastrtpsgen not found. Specify the location of fastrtpsgen with the -f flag")