From e8fd711a5c721230ac829db0904bc3d4f00ab455 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Mon, 12 Oct 2015 10:47:09 -0400 Subject: [PATCH] uorb generate interally set required paths --- Tools/px_generate_uorb_topic_headers.py | 5 +++++ cmake/common/px4_base.cmake | 7 +++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Tools/px_generate_uorb_topic_headers.py b/Tools/px_generate_uorb_topic_headers.py index 3c9f5379c6..7ed0b3af19 100755 --- a/Tools/px_generate_uorb_topic_headers.py +++ b/Tools/px_generate_uorb_topic_headers.py @@ -43,6 +43,11 @@ import shutil import filecmp import argparse +import sys +px4_tools_dir = os.path.dirname(os.path.abspath(__file__)) +sys.path.append(px4_tools_dir + "/genmsg/src") +sys.path.append(px4_tools_dir + "/gencpp/src") + try: import genmsg.template_tools except ImportError as e: diff --git a/cmake/common/px4_base.cmake b/cmake/common/px4_base.cmake index 257254ba43..65e96055a7 100644 --- a/cmake/common/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -330,7 +330,6 @@ function(px4_generate_messages) if(NOT VERBOSE) set(QUIET "-q") endif() - set(PYTHONPATH "${CMAKE_SOURCE_DIR}/Tools/genmsg/src:${CMAKE_SOURCE_DIR}/Tools/gencpp/src:$ENV{PYTHONPATH}") set(msg_out_path ${CMAKE_BINARY_DIR}/src/modules/uORB/topics) set(msg_list) foreach(msg_file ${MSG_FILES}) @@ -342,7 +341,7 @@ function(px4_generate_messages) list(APPEND msg_files_out ${msg_out_path}/${msg}.h) endforeach() add_custom_command(OUTPUT ${msg_files_out} - COMMAND PYTHONPATH=${PYTHONPATH} ${PYTHON_EXECUTABLE} + COMMAND ${PYTHON_EXECUTABLE} Tools/px_generate_uorb_topic_headers.py ${QUIET} -d msg @@ -363,7 +362,7 @@ function(px4_generate_messages) list(APPEND msg_multi_files_out ${msg_multi_out_path}/px4_${msg}.h) endforeach() add_custom_command(OUTPUT ${msg_multi_files_out} - COMMAND PYTHONPATH=${PYTHONPATH} ${PYTHON_EXECUTABLE} + COMMAND ${PYTHON_EXECUTABLE} Tools/px_generate_uorb_topic_headers.py ${QUIET} -d msg @@ -425,7 +424,7 @@ function(px4_add_upload) endif() px4_join(OUT serial_ports LIST "${serial_ports}" GLUE ",") add_custom_target(${OUT} - COMMAND PYTHONPATH=${PYTHONPATH} ${PYTHON_EXECUTABLE} + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/px_uploader.py --port ${serial_ports} ${BUNDLE} DEPENDS ${BUNDLE} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}