Files
PX4-Autopilot/src/modules/simulation/gz_plugins/optical_flow/optical_flow.cmake
T
Alexander Sherikov 6e8f61c551 various cmake fixes (#25748)
- enable building in a cmake subdirectory:
    - use consistent path to "etc" in build directory
    - add a quick fix for mavlink inclusion with
      `mavlink/<version>/mavlink.h`, presumably the problem does not
      appear normally since somewhere the build root directory is added
      to include paths.
- install gazebo config and plugins, the goal is to enable packaging of
  PX4 sitl binaries.
- fix dependency on dds_topics.h generation in uxrce_dds_client:
  *** No rule to make target 'PX4-Autopilot/src/modules/uxrce_dds_client/dds_topics.h', needed by 'PX4-Autopilot/events/px4.json'.  Stop.
  https://github.com/PX4/PX4-Autopilot/issues/21788

Co-authored-by: Jacob Dahl <37091262+dakejahl@users.noreply.github.com>
2025-10-17 11:11:00 -08:00

59 lines
2.6 KiB
CMake

############################################################################
#
# Copyright (c) 2025 PX4 Development Team. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name PX4 nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
include(ExternalProject)
find_package(OpenCV REQUIRED)
if(NOT TARGET OpticalFlow)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(OPTICAL_FLOW_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/OpticalFlow/install")
else()
set(OPTICAL_FLOW_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
endif()
ExternalProject_Add(OpticalFlow
GIT_REPOSITORY https://github.com/PX4/PX4-OpticalFlow.git
GIT_TAG master
PREFIX ${CMAKE_BINARY_DIR}/OpticalFlow
INSTALL_DIR ${OPTICAL_FLOW_INSTALL_PREFIX}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${OPTICAL_FLOW_INSTALL_PREFIX}
BUILD_BYPRODUCTS ${OPTICAL_FLOW_INSTALL_PREFIX}/lib/libOpticalFlow.so
UPDATE_DISCONNECTED ON
BUILD_ALWAYS OFF
STEP_TARGETS build
)
set(OpticalFlow_INCLUDE_DIRS ${OPTICAL_FLOW_INSTALL_PREFIX}/include CACHE INTERNAL "")
set(OpticalFlow_LIBS ${OPTICAL_FLOW_INSTALL_PREFIX}/lib/libOpticalFlow.so CACHE INTERNAL "")
endif()