Пример #1
0
def ProcessProjectDeps(env):
    project_lib_builder = env.ConfigureProjectLibBuilder()

    # prepend project libs to the beginning of list
    env.Prepend(LIBS=project_lib_builder.build())
    # prepend extra linker related options from libs
    env.PrependUnique(
        **{
            key: project_lib_builder.env.get(key)
            for key in ("LIBS", "LIBPATH", "LINKFLAGS")
            if project_lib_builder.env.get(key)
        })

    projenv = env.Clone()

    # CPPPATH from dependencies
    projenv.PrependUnique(CPPPATH=project_lib_builder.env.get("CPPPATH"))
    # extra build flags from `platformio.ini`
    projenv.ProcessFlags(env.get("SRC_BUILD_FLAGS"))

    is_test = "__test" in COMMAND_LINE_TARGETS
    if is_test:
        projenv.BuildSources("$BUILD_TEST_DIR", "$PROJECT_TEST_DIR",
                             "$PIOTEST_SRC_FILTER")
    if not is_test or env.GetProjectOption("test_build_project_src"):
        projenv.BuildSources("$BUILD_SRC_DIR", "$PROJECT_SRC_DIR",
                             env.get("SRC_FILTER"))

    if not env.get("PIOBUILDFILES") and not COMMAND_LINE_TARGETS:
        sys.stderr.write(
            "Error: Nothing to build. Please put your source code files "
            "to '%s' folder\n" % env.subst("$PROJECT_SRC_DIR"))
        env.Exit(1)

    Export("projenv")
        if re.search(r'boost.*lib', p, re.I)
    ]
    if not boost_lib:
        raise ValueError('Boost libraries not found on PATH')
    boost_lib = path(boost_lib[0])
    boost_home = boost_lib.parent
    while not re.search(r'boost', boost_home.name):
        boost_home = boost_home.parent
    return boost_home, boost_lib


v = sys.version_info
if os.name == 'nt':
    PYTHON_LIB = 'python%(major)s%(minor)s' % dict(major=v[0], minor=v[1])
    boost_home, boost_lib_path = get_boost_paths()
    Export(BOOST_LIB_PATH=boost_lib_path, BOOST_HOME=boost_home)
else:
    PYTHON_LIB = 'python%(major)s.%(minor)s' % dict(major=v[0], minor=v[1])

PYTHON_PATH = get_python_path().parent
PYTHON_LIB_PATH = PYTHON_PATH / path('libs')
PYTHON_INC_PATH = PYTHON_PATH / path('include')
Export('PYTHON_LIB', 'PYTHON_LIB_PATH', 'PYTHON_INC_PATH')

if __name__ == '__main__':
    if os.name == 'nt':
        print get_boost_lib_path()

    print get_python_path()
    arduino_path, avrdude, avrdude_conf = get_arduino_paths()
    print 'found arduino path:', arduino_path
import os
import sys

from SCons.Script import Export

from path_helpers import path


def get_python_path():
    return path(os.__file__).parent


v = sys.version_info
if os.name == 'nt':
    PYTHON_LIB = 'python%(major)s%(minor)s' % dict(major=v[0], minor=v[1])
else:
    PYTHON_LIB = 'python%(major)s.%(minor)s' % dict(major=v[0], minor=v[1])

PYTHON_PATH = get_python_path().parent
PYTHON_LIB_PATH = PYTHON_PATH / path('libs')
PYTHON_INC_PATH = PYTHON_PATH / path('include')
Export('PYTHON_LIB', 'PYTHON_LIB_PATH', 'PYTHON_INC_PATH')

if __name__ == '__main__':
    print get_python_path()
Пример #4
0
env.Require(build_spatialdb)

sources = env.Split("""
   SpatiaLiteDB.cpp
""")

headers = env.Split("""
   SpatiaLiteDB.h
""")

toolname = 'spatialdb'

lib = env.Library(toolname, sources)
env.Default(lib)

doxref = env.Apidocs(sources + headers,
                     DOXYFILE_DICT={'PROJECT_NAME': toolname})

tooldir = env.Dir('.')


def spatialdb(env):
    "Setup to build against the spatialdb library."
    # Everything required to build it, plus the library itself and headers.
    env.AppendLibrary(toolname)
    build_spatialdb(env)
    env.AppendUnique(CPPPATH=tooldir.Dir('..'))


Export(toolname)