Skip to content

Commit

Permalink
Fix build on Windows
Browse files Browse the repository at this point in the history
Windows native shell doesn't understand shebangs. Also, make sure the Python
scripts are run by the same interpreter.
  • Loading branch information
guludo committed Aug 24, 2016
1 parent 919a794 commit 1e04e6b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions libuavcan/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ endif ()

project(libuavcan)

find_program(PYTHON python)

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(COMPILER_IS_GCC_COMPATIBLE 1)
else ()
Expand All @@ -31,7 +33,7 @@ endif ()
# DSDL compiler invocation
# Probably output files should be saved into CMake output dir?
#
execute_process(COMMAND ./setup.py build WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/dsdl_compiler OUTPUT_QUIET)
execute_process(COMMAND ${PYTHON} setup.py build WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/dsdl_compiler OUTPUT_QUIET)
set(DSDLC_INPUTS "test/dsdl_test/root_ns_a" "test/dsdl_test/root_ns_b" "${CMAKE_CURRENT_SOURCE_DIR}/../dsdl/uavcan")
set(DSDLC_OUTPUT "include/dsdlc_generated")

Expand All @@ -41,7 +43,7 @@ foreach(DSDLC_INPUT ${DSDLC_INPUTS})
set(DSDLC_INPUT_FILES ${DSDLC_INPUT_FILES} ${DSDLC_NEW_INPUT_FILES})
endforeach(DSDLC_INPUT)
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/libuavcan_dsdlc_run.stamp
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/dsdl_compiler/libuavcan_dsdlc ${DSDLC_INPUTS} -O${DSDLC_OUTPUT}
COMMAND ${PYTHON} ${CMAKE_CURRENT_SOURCE_DIR}/dsdl_compiler/libuavcan_dsdlc ${DSDLC_INPUTS} -O${DSDLC_OUTPUT}
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_BINARY_DIR}/libuavcan_dsdlc_run.stamp
DEPENDS ${DSDLC_INPUT_FILES}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
Expand Down Expand Up @@ -79,7 +81,7 @@ add_dependencies(uavcan libuavcan_dsdlc)
install(TARGETS uavcan DESTINATION lib)
install(DIRECTORY include/uavcan DESTINATION include)
install(DIRECTORY include/dsdlc_generated/uavcan DESTINATION include) # Generated and lib's .hpp
install(CODE "execute_process(COMMAND ./setup.py install --record installed_files.log
install(CODE "execute_process(COMMAND ${PYTHON} setup.py install --record installed_files.log
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/dsdl_compiler)")

#
Expand Down

0 comments on commit 1e04e6b

Please sign in to comment.