Skip to content

Commit 6a98281

Browse files
authored
Fix SCons interface (#10)
* Fix SCons interface Signed-off-by: Pablo Garrido <pablogs9@gmail.com> * Update CPPDEFINES Signed-off-by: Pablo Garrido <pablogs9@gmail.com>
1 parent b38ec50 commit 6a98281

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

extra_script.py

+14-12
Original file line numberDiff line numberDiff line change
@@ -83,36 +83,38 @@
8383
# This solves a problem with duplicated symbols in Galactic
8484
global_env["_LIBFLAGS"] = "-Wl,--start-group " + global_env["_LIBFLAGS"] + " -l{} -Wl,--end-group".format(builder.library_name)
8585
else:
86-
global_env['LIBS'].append(builder.library_name)
86+
global_env.Append(LIBS=[builder.library_name])
8787

8888
# Add library path
89-
global_env['LIBPATH'].append(builder.library_path)
89+
global_env.Append(LIBPATH=[builder.library_path])
9090

9191
# Add required defines
92-
global_env['_CPPDEFFLAGS'] += ' -DCLOCK_MONOTONIC=0 '
92+
global_env.Append(CPPDEFINES=[("CLOCK_MONOTONIC", 1)])
9393

9494
# Add micro-ROS include path
95-
global_env['_CPPDEFFLAGS'] += ' -I{}/build/libmicroros/include '.format(main_path)
95+
global_env.Append(CPPPATH=[main_path + "/build/libmicroros/include"])
9696

9797
# Add micro-ROS include path to library include path
98-
env['_CPPDEFFLAGS'] += ' -I{}/build/libmicroros/include '.format(main_path)
98+
env.Append(CPPPATH=[main_path + "/build/libmicroros/include"])
9999

100100
# Add platformio library general include path
101-
global_env['_CPPDEFFLAGS'] += ' -I{}/platform_code '.format(main_path)
102-
global_env['_CPPDEFFLAGS'] += ' -I{}/platform_code/{}/{} '.format(main_path, framework, microros_transport)
101+
global_env.Append(CPPPATH=[
102+
main_path + "/platform_code",
103+
main_path + "/platform_code/{}/{}".format(framework, microros_transport)])
103104

104105
# Add platformio library general to library include path
105-
env['_CPPDEFFLAGS'] += ' -I{}/platform_code '.format(main_path)
106-
env['_CPPDEFFLAGS'] += ' -I{}/platform_code/{}/{} '.format(main_path, framework, microros_transport)
106+
env.Append(CPPPATH=[
107+
main_path + "/platform_code",
108+
main_path + "/platform_code/{}/{}".format(framework, microros_transport)])
107109

108110
# Add micro-ROS defines to user application
109-
global_env['_CPPDEFFLAGS'] += ' -DMICRO_ROS_TRANSPORT_{}_{} '.format(framework.upper(), microros_transport.upper())
110-
global_env['_CPPDEFFLAGS'] += ' -DMICRO_ROS_DISTRO_ '.format(microros_distro.upper())
111+
global_env.Append(CPPDEFINES=[('MICRO_ROS_TRANSPORT_{}_{}'.format(framework.upper(), microros_transport.upper()), 1)])
112+
global_env.Append(CPPDEFINES=[('MICRO_ROS_DISTRO_ {} '.format(microros_distro.upper()), 1)])
111113

112114
# Add platformio library for Arduino framework
113115
if 'arduino' == framework:
114116
# Include path for Arduino framework
115-
global_env['_CPPDEFFLAGS'] += ' -I{}/arduino'.format(main_path)
117+
global_env.Append(CPPPATH=[main_path + "/arduino"])
116118
# Clock implementation for Arduino framework
117119
env['SRC_FILTER'] += ' +<platform_code/arduino/clock_gettime.cpp>'
118120

0 commit comments

Comments
 (0)