diff --git a/platforms/posix/CMakeLists.txt b/platforms/posix/CMakeLists.txt index 71c546b9ec..5b94634f57 100644 --- a/platforms/posix/CMakeLists.txt +++ b/platforms/posix/CMakeLists.txt @@ -87,7 +87,7 @@ install( DIRECTORY ${PROJECT_SOURCE_DIR}/posix-configs ${PROJECT_SOURCE_DIR}/test - ${CMAKE_BINARY_DIR}/etc + ${PX4_BINARY_DIR}/etc ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} DESTINATION ${PROJECT_NAME} @@ -201,6 +201,14 @@ elseif("${PX4_BOARD}" MATCHES "sitl") ${PROJECT_NAME}/build/px4_sitl_default ) + # gazebo files + install( + FILES + ${PROJECT_SOURCE_DIR}/Tools/simulation/gz/server.config + DESTINATION + ${PROJECT_NAME}/Tools/simulation/gz + ) + # gazebo dirs install( DIRECTORY diff --git a/src/modules/mavlink/CMakeLists.txt b/src/modules/mavlink/CMakeLists.txt index 45aa9b1cc8..4701863c07 100644 --- a/src/modules/mavlink/CMakeLists.txt +++ b/src/modules/mavlink/CMakeLists.txt @@ -92,6 +92,7 @@ target_sources(mavlink_c target_include_directories(mavlink_c INTERFACE ${MAVLINK_LIBRARY_DIR} + ${MAVLINK_LIBRARY_DIR}/../ ${MAVLINK_LIBRARY_DIR}/${CONFIG_MAVLINK_DIALECT} ${MAVLINK_LIBRARY_DIR}/${MAVLINK_DIALECT_UAVIONIX} ) diff --git a/src/modules/simulation/gz_plugins/gstreamer/CMakeLists.txt b/src/modules/simulation/gz_plugins/gstreamer/CMakeLists.txt index bb453df805..4397463b5c 100644 --- a/src/modules/simulation/gz_plugins/gstreamer/CMakeLists.txt +++ b/src/modules/simulation/gz_plugins/gstreamer/CMakeLists.txt @@ -67,4 +67,8 @@ else() PRIVATE ${GSTREAMER_CFLAGS} PRIVATE ${GSTREAMER_APP_CFLAGS} ) + + if (NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION lib/px4_gz_plugins) + endif() endif() diff --git a/src/modules/simulation/gz_plugins/moving_platform_controller/CMakeLists.txt b/src/modules/simulation/gz_plugins/moving_platform_controller/CMakeLists.txt index 88e2da59cb..243a92af53 100644 --- a/src/modules/simulation/gz_plugins/moving_platform_controller/CMakeLists.txt +++ b/src/modules/simulation/gz_plugins/moving_platform_controller/CMakeLists.txt @@ -50,3 +50,7 @@ target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_BINARY_DIR} PUBLIC px4_gz_msgs ) + +if (NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION lib/px4_gz_plugins) +endif() diff --git a/src/modules/simulation/gz_plugins/optical_flow/CMakeLists.txt b/src/modules/simulation/gz_plugins/optical_flow/CMakeLists.txt index a03ee39598..62d9c7c959 100644 --- a/src/modules/simulation/gz_plugins/optical_flow/CMakeLists.txt +++ b/src/modules/simulation/gz_plugins/optical_flow/CMakeLists.txt @@ -63,3 +63,7 @@ target_include_directories(${PROJECT_NAME} ) add_dependencies(${PROJECT_NAME} OpticalFlow) + +if (NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION lib/px4_gz_plugins) +endif() diff --git a/src/modules/simulation/gz_plugins/optical_flow/optical_flow.cmake b/src/modules/simulation/gz_plugins/optical_flow/optical_flow.cmake index 8ac1c1f649..2dcc7d074d 100644 --- a/src/modules/simulation/gz_plugins/optical_flow/optical_flow.cmake +++ b/src/modules/simulation/gz_plugins/optical_flow/optical_flow.cmake @@ -35,19 +35,24 @@ 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 ${CMAKE_BINARY_DIR}/OpticalFlow/install - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX= - BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/OpticalFlow/install/lib/libOpticalFlow.so + 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 ) - ExternalProject_Get_Property(OpticalFlow install_dir) - set(OpticalFlow_INCLUDE_DIRS ${install_dir}/include CACHE INTERNAL "") - set(OpticalFlow_LIBS ${install_dir}/lib/libOpticalFlow.so CACHE INTERNAL "") + set(OpticalFlow_INCLUDE_DIRS ${OPTICAL_FLOW_INSTALL_PREFIX}/include CACHE INTERNAL "") + set(OpticalFlow_LIBS ${OPTICAL_FLOW_INSTALL_PREFIX}/lib/libOpticalFlow.so CACHE INTERNAL "") endif() diff --git a/src/modules/simulation/gz_plugins/template_plugin/CMakeLists.txt b/src/modules/simulation/gz_plugins/template_plugin/CMakeLists.txt index a0caaf2b33..f948736523 100644 --- a/src/modules/simulation/gz_plugins/template_plugin/CMakeLists.txt +++ b/src/modules/simulation/gz_plugins/template_plugin/CMakeLists.txt @@ -66,3 +66,7 @@ target_include_directories(${PROJECT_NAME} # Add dependencies if needed # add_dependencies(${PROJECT_NAME} ExternalDependency) + +if (NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION lib/px4_gz_plugins) +endif() diff --git a/src/modules/uxrce_dds_client/CMakeLists.txt b/src/modules/uxrce_dds_client/CMakeLists.txt index e5fc481543..fba4ca45cf 100644 --- a/src/modules/uxrce_dds_client/CMakeLists.txt +++ b/src/modules/uxrce_dds_client/CMakeLists.txt @@ -63,7 +63,6 @@ else() endif() include(ExternalProject) - ExternalProject_Add( libmicroxrceddsclient_project PREFIX ${microxrceddsclient_build_dir} @@ -139,7 +138,6 @@ else() # -DDEBUG_BUILD ${MAX_CUSTOM_OPT_LEVEL} SRCS - ${CMAKE_CURRENT_BINARY_DIR}/dds_topics.h uxrce_dds_client.cpp uxrce_dds_client.h vehicle_command_srv.cpp