0

I recently used Neopixel's library provided by Adafruit's (here) on a Raspberry Pi 3 with Raspbian Jessie with Pixel. Adafruit used a Scons script file to manage build:

SConscript File:

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 File:

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');

My problem is that I currently use gcc, to link wiringPi library I'm using "-lwiringPi" option during compiling.

How can I add the link to wiringPi inside my scons script file?

Thank you very much for your help, and have a good day !

Hugo.

Balette
  • 1
  • 1
  • 1
    Have you checked the existing documentation e.g. at http://scons.org/doc/production/HTML/scons-user.html , especially sect 4.2 "Linking with Libraries"? It tells you pretty straight-forward what yo have to do. ;) – dirkbaechle Dec 02 '16 at 09:54
  • Yes, I did, but I still get my WiringPi source not found. I'm a newbie with scons and the structure of examples at http://scons.org/doc/production/HTML/scons-user.html is a bit different next to the scons script file provided by Adafruit. I'm adding following dependencies into CPPATH -I/usr/local/include LINKFLAGS -L/usr/local/lib LIBS -lwiringPi Thank you for your advise :) – Balette Dec 02 '16 at 12:07
  • 1
    There's plenty of issues with the SConscript. But regardless of that you haven't shown us what you've tried or what you want to link wiringPi library into? Can you add more information? – bdbaddog Dec 04 '16 at 01:23

0 Answers0