mirror of https://github.com/ArduPilot/ardupilot
HAL_ESP32: allow for building of examples and tool firmware on ESP32
use waf build target to find the right library name
This commit is contained in:
parent
564041f592
commit
687c5887af
|
@ -34,25 +34,31 @@ if(NOT DEFINED ARDUPILOT_CMD)
|
|||
set(ARDUPILOT_CMD "none")
|
||||
endif()
|
||||
|
||||
IF(${ARDUPILOT_CMD} STREQUAL "plane")
|
||||
message("ARDUPILOT_CMD=${ARDUPILOT_CMD}")
|
||||
message("WAF_BUILD_TARGET=${WAF_BUILD_TARGET}")
|
||||
|
||||
string(REGEX MATCH "^(examples|tool)/" IS_EXAMPLE "${WAF_BUILD_TARGET}")
|
||||
|
||||
if (IS_EXAMPLE)
|
||||
string(REPLACE "/" ";" A ${WAF_BUILD_TARGET})
|
||||
list(GET A 0 EXAMPLE_BASE)
|
||||
list(GET A 1 EXAMPLE_NAME)
|
||||
message("Building ${EXAMPLE_BASE} ${EXAMPLE_NAME}")
|
||||
target_link_libraries(${elf_file} "${ARDUPILOT_LIB}/${EXAMPLE_BASE}/lib${EXAMPLE_NAME}.a")
|
||||
target_link_libraries(${elf_file} "${ARDUPILOT_LIB}/libap.a")
|
||||
ELSEIF(${ARDUPILOT_CMD} STREQUAL "plane")
|
||||
message("Building for plane")
|
||||
target_link_libraries(${elf_file} "${ARDUPILOT_BIN}/libarduplane.a")
|
||||
target_link_libraries(${elf_file} "${ARDUPILOT_LIB}/libArduPlane_libs.a")
|
||||
ENDIF()
|
||||
|
||||
IF(${ARDUPILOT_CMD} STREQUAL "copter")
|
||||
ELSEIF(${ARDUPILOT_CMD} STREQUAL "copter")
|
||||
message("Building for copter")
|
||||
target_link_libraries(${elf_file} "${ARDUPILOT_BIN}/libarducopter.a")
|
||||
target_link_libraries(${elf_file} "${ARDUPILOT_LIB}/libArduCopter_libs.a")
|
||||
ENDIF()
|
||||
|
||||
IF(${ARDUPILOT_CMD} STREQUAL "rover")
|
||||
ELSEIF(${ARDUPILOT_CMD} STREQUAL "rover")
|
||||
message("Building for rover")
|
||||
target_link_libraries(${elf_file} "${ARDUPILOT_BIN}/libardurover.a")
|
||||
target_link_libraries(${elf_file} "${ARDUPILOT_LIB}/libRover_libs.a")
|
||||
ENDIF()
|
||||
|
||||
IF(${ARDUPILOT_CMD} STREQUAL "sub")
|
||||
ELSEIF(${ARDUPILOT_CMD} STREQUAL "sub")
|
||||
message("Building for submarine")
|
||||
target_link_libraries(${elf_file} "${ARDUPILOT_BIN}/libardusub.a")
|
||||
target_link_libraries(${elf_file} "${ARDUPILOT_LIB}/libArduSub_libs.a")
|
||||
|
|
|
@ -34,35 +34,35 @@ if(NOT DEFINED ARDUPILOT_CMD)
|
|||
set(ARDUPILOT_CMD "none")
|
||||
endif()
|
||||
|
||||
IF(${ARDUPILOT_CMD} STREQUAL "plane")
|
||||
message("WAF_BUILD_TARGET=${WAF_BUILD_TARGET}")
|
||||
|
||||
string(REGEX MATCH "^(examples|tool)/" IS_EXAMPLE "${WAF_BUILD_TARGET}")
|
||||
|
||||
if (IS_EXAMPLE)
|
||||
string(REPLACE "/" ";" A ${WAF_BUILD_TARGET})
|
||||
list(GET A 0 EXAMPLE_BASE)
|
||||
list(GET A 1 EXAMPLE_NAME)
|
||||
message("Building ${EXAMPLE_BASE} ${EXAMPLE_NAME}")
|
||||
target_link_libraries(${elf_file} "${ARDUPILOT_LIB}/${EXAMPLE_BASE}/lib${EXAMPLE_NAME}.a")
|
||||
target_link_libraries(${elf_file} "${ARDUPILOT_LIB}/libap.a")
|
||||
ELSEIF(${ARDUPILOT_CMD} STREQUAL "plane")
|
||||
message("Building for plane")
|
||||
target_link_libraries(${elf_file} "${ARDUPILOT_BIN}/libarduplane.a")
|
||||
target_link_libraries(${elf_file} "${ARDUPILOT_LIB}/libArduPlane_libs.a")
|
||||
ENDIF()
|
||||
|
||||
IF(${ARDUPILOT_CMD} STREQUAL "copter")
|
||||
ELSEIF(${ARDUPILOT_CMD} STREQUAL "copter")
|
||||
message("Building for copter")
|
||||
target_link_libraries(${elf_file} "${ARDUPILOT_BIN}/libarducopter.a")
|
||||
target_link_libraries(${elf_file} "${ARDUPILOT_LIB}/libArduCopter_libs.a")
|
||||
ENDIF()
|
||||
|
||||
IF(${ARDUPILOT_CMD} STREQUAL "rover")
|
||||
ELSEIF(${ARDUPILOT_CMD} STREQUAL "rover")
|
||||
message("Building for rover")
|
||||
target_link_libraries(${elf_file} "${ARDUPILOT_BIN}/libardurover.a")
|
||||
target_link_libraries(${elf_file} "${ARDUPILOT_LIB}/libRover_libs.a")
|
||||
ENDIF()
|
||||
|
||||
IF(${ARDUPILOT_CMD} STREQUAL "sub")
|
||||
ELSEIF(${ARDUPILOT_CMD} STREQUAL "sub")
|
||||
message("Building for submarine")
|
||||
target_link_libraries(${elf_file} "${ARDUPILOT_BIN}/libardusub.a")
|
||||
target_link_libraries(${elf_file} "${ARDUPILOT_LIB}/libArduSub_libs.a")
|
||||
ENDIF()
|
||||
|
||||
IF(${ARDUPILOT_CMD} STREQUAL "antennatracker")
|
||||
message("Building AntennaTracker")
|
||||
target_link_libraries(${elf_file} "${ARDUPILOT_BIN}/libantennatracker.a")
|
||||
target_link_libraries(${elf_file} "${ARDUPILOT_LIB}/libAntennaTracker_libs.a")
|
||||
ENDIF()
|
||||
add_custom_target(showinc ALL
|
||||
COMMAND echo -e
|
||||
"$<TARGET_PROPERTY:${elf_file},INCLUDE_DIRECTORIES>"
|
||||
|
|
Loading…
Reference in New Issue