我最近使用了Adafruit' s(here)在Raspberry Pi 3上提供的Neopixel库,其中Raspbian Jessie和Pixel一起使用。 Adafruit使用Scons脚本文件来管理构建:
SConscript文件:
Import(['clean_envs'])
tools_env = clean_envs['userspace'].Clone()
# Build Library
lib_srcs = Split('''
mailbox.c
ws2811.c
pwm.c
dma.c
rpihw.c
''')
version_hdr = tools_env.Version('version')
ws2811_lib = tools_env.Library('libws2811', lib_srcs)
tools_env['LIBS'].append(ws2811_lib)
# Shared library (if required)
ws2811_slib = tools_env.SharedLibrary('libws2811', lib_srcs)
# Test Program
srcs = Split('''
main.c
''')
objs = []
for src in srcs:
objs.append(tools_env.Object(src))
test = tools_env.Program('test', objs + tools_env['LIBS'])
Default([test, ws2811_lib])
SConstruct文件:
import os
opts = Variables()
opts.Add(BoolVariable('V',
'Verbose build',
False))
platforms = [
[
'userspace', # Target Name
[ 'linux', 'version' ], # Scons tool (linux, avr, etc.)
{ # Special environment setup
'CPPPATH' : [
],
'LINKFLAGS' : [
],
},
],
]
clean_envs = {}
for platform, tool, flags in platforms:
env = Environment(
options = opts,
tools = tool,
toolpath = ['.'],
ENV = {'PATH' : os.environ['PATH']},
LIBS = [],
)
env.MergeFlags(flags)
clean_envs[platform] = env
Help(opts.GenerateHelpText(clean_envs))
Export(['clean_envs'])
SConscript('SConscript');
我的问题是我目前使用gcc,使用" -lwiringPi"来连接wiringPi库。编译期间的选项。
如何在scons脚本文件中添加指向wiringPi的链接?
非常感谢你的帮助,祝你有个美好的一天!
雨果。