mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-12 00:33:37 +08:00
uavcan_dsdlc renamed to libuavcan_dsdlc
This commit is contained in:
@@ -34,7 +34,7 @@ endif ()
|
||||
execute_process(COMMAND ./setup.py build WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/dsdl_compiler)
|
||||
set(DSDLC_INPUTS "test/dsdl_test/root_ns_a" "test/dsdl_test/root_ns_b" "${CMAKE_SOURCE_DIR}/../dsdl/uavcan")
|
||||
set(DSDLC_OUTPUT "include/dsdlc_generated")
|
||||
add_custom_target(dsdlc dsdl_compiler/uavcan_dsdlc ${DSDLC_INPUTS} -O${DSDLC_OUTPUT}
|
||||
add_custom_target(dsdlc dsdl_compiler/libuavcan_dsdlc ${DSDLC_INPUTS} -O${DSDLC_OUTPUT}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||
include_directories(${DSDLC_OUTPUT})
|
||||
|
||||
|
||||
@@ -1,13 +1,19 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# UAVCAN DSDL compiler
|
||||
# Probably it will be extended in future to add support for different programming languages.
|
||||
# UAVCAN DSDL compiler for libuavcan
|
||||
#
|
||||
# Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
|
||||
#
|
||||
|
||||
import os, sys, logging, argparse
|
||||
|
||||
RUNNING_FROM_SRC_DIR = os.path.abspath(__file__).endswith(os.path.join('libuavcan', 'dsdl_compiler', 'uavcan_dsdlc'))
|
||||
if RUNNING_FROM_SRC_DIR:
|
||||
print('Running from the source directory')
|
||||
scriptdir = os.path.dirname(os.path.abspath(__file__))
|
||||
sys.path.append(os.path.join(scriptdir, '..', '..', 'pyuavcan'))
|
||||
sys.path.append(os.path.join(scriptdir))
|
||||
|
||||
def configure_logging(verbosity):
|
||||
fmt = '%(message)s'
|
||||
level = { 0: logging.WARNING, 1: logging.INFO, 2: logging.DEBUG }.get(verbosity or 0, logging.DEBUG)
|
||||
@@ -17,13 +23,6 @@ def die(text):
|
||||
print(text, file=sys.stderr)
|
||||
exit(1)
|
||||
|
||||
RUNNING_FROM_SRC_DIR = os.path.abspath(__file__).endswith(os.path.join('libuavcan', 'dsdl_compiler', 'uavcan_dsdlc'))
|
||||
if RUNNING_FROM_SRC_DIR:
|
||||
print('Running from the source directory')
|
||||
scriptdir = os.path.dirname(os.path.abspath(__file__))
|
||||
sys.path.append(os.path.join(scriptdir, '..', '..', 'pyuavcan'))
|
||||
sys.path.append(os.path.join(scriptdir))
|
||||
|
||||
DEFAULT_OUTDIR = './dsdlc_generated'
|
||||
|
||||
DESCRIPTION = '''UAVCAN DSDL compiler. Takes an input directory that contains an hierarchy of DSDL
|
||||
@@ -38,9 +37,15 @@ args = argparser.parse_args()
|
||||
|
||||
configure_logging(args.verbose)
|
||||
|
||||
try:
|
||||
extra_incdir = os.environ['UAVCAN_DSDL_INCLUDE_PATH'].split(':')
|
||||
logging.info('Additional include directories: %s', extra_incdir)
|
||||
args.incdir += extra_incdir
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
from libuavcan_dsdl_compiler import run as dsdlc_run
|
||||
try:
|
||||
# TODO: collect include dirs from environment variable UAVCAN_DSDL_INCLUDE
|
||||
dsdlc_run(args.source_dir, args.incdir, args.outdir)
|
||||
except Exception as ex:
|
||||
logging.error('Compiler failure', exc_info=True)
|
||||
@@ -3,12 +3,12 @@
|
||||
from distutils.core import setup
|
||||
|
||||
args = dict(
|
||||
name='uavcan_dsdlc',
|
||||
name='libuavcan_dsdl_compiler',
|
||||
version='0.1',
|
||||
description='UAVCAN DSDL compiler for libuavcan',
|
||||
packages=['libuavcan_dsdl_compiler'],
|
||||
package_data={'libuavcan_dsdl_compiler': ['data_type_template.tmpl']},
|
||||
scripts=['uavcan_dsdlc'],
|
||||
scripts=['libuavcan_dsdlc'],
|
||||
requires=['mako', 'pyuavcan'],
|
||||
author='Pavel Kirienko',
|
||||
author_email='pavel.kirienko@gmail.com',
|
||||
|
||||
Reference in New Issue
Block a user