Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor and add license #30

Open
wants to merge 3 commits into
base: mavlink
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 31 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,26 +1,41 @@
# Copyright 2024 Anton Bredenbeck, Till Blaha (Delft University of Technology)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <https://www.gnu.org/licenses/>.

cmake_minimum_required(VERSION 3.14)

# project and executables
project(optitrack_clients LANGUAGES CXX)

# ADD YOUR NEW CLIENT TO THIS SEMICOLON-SEPARATED LIST!
if(NOT DEFINED CLIENTS)
message(STATUS "CLIENTS is not set. Continuing with all clients")
set(CLIENTS "console;ivy;mavlink;udp;log;ros2;ros2px4" CACHE STRING "Clients to build into the binary")
endif(NOT DEFINED CLIENTS)
# ADD YOUR NEW AGENT TO THIS SEMICOLON-SEPARATED LIST!
if(NOT DEFINED AGENTS)
message(STATUS "AGENTS is not set. Continuing with all agents")
set(AGENTS "console;ivy;mavlink;udp;log;ros2;ros2px4" CACHE STRING "Agents to build into the binary")
endif(NOT DEFINED AGENTS)

add_executable(client src/main.cpp src/pose_calculations.cpp src/unified_mocap_client.cpp)

foreach(x ${CLIENTS})
foreach(x ${AGENTS})
string(TOUPPER ${x} uppercase)
add_definitions(-DUSE_CLIENT_${uppercase})
add_definitions(-DUSE_AGENT_${uppercase})
ADD_CUSTOM_TARGET(${x}_symlink ALL
COMMAND ${CMAKE_COMMAND} -E create_symlink client mocap2${x}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endforeach()

include_directories(include)
include_directories(clients)
include_directories(agents)
include_directories(scripts)

# compiler
Expand All @@ -31,7 +46,7 @@ else()
add_compile_options(-Wall -Wextra -Wpedantic -Werror)
endif()

# find external libraries and include for all clients
# find external libraries and include for all agents
find_package(Boost REQUIRED COMPONENTS program_options filesystem)
include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(client ${Boost_LIBRARIES})
Expand All @@ -48,7 +63,7 @@ target_include_directories(natnet_sdk INTERFACE ${natnet_sdk_content_SOURCE_DIR}
target_link_libraries(client natnet_sdk)

# Client-specific stuff
if ("ivy" IN_LIST CLIENTS)
if ("ivy" IN_LIST AGENTS)
find_library(IVY_LIB NAMES ivy)
target_link_libraries(client ivy)

Expand All @@ -62,19 +77,20 @@ if ("ivy" IN_LIST CLIENTS)
target_link_libraries(client ${GLIB_LIBRARIES})
endif()

if ("udp" IN_LIST CLIENTS)
if ("udp" IN_LIST AGENTS)
find_package(Boost REQUIRED COMPONENTS system)
endif()

if ("ros2" IN_LIST CLIENTS)
if ("ros2" IN_LIST AGENTS)
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(geometry_msgs REQUIRED)

ament_target_dependencies(client rclcpp geometry_msgs)
endif()

if ("ros2px4" IN_LIST CLIENTS)
if ("ros2px4" IN_LIST AGENTS)
# px4msgs is BSD 3 clause licensed
FetchContent_Declare(
px4_msgs
GIT_REPOSITORY https://github.com/PX4/px4_msgs
Expand All @@ -92,7 +108,8 @@ if ("ros2px4" IN_LIST CLIENTS)
target_include_directories(client PUBLIC ./build/_deps/px4_msgs-build/rosidl_generator_cpp)
endif()

if ("mavlink" IN_LIST CLIENTS)
if ("mavlink" IN_LIST AGENTS)
# mavlink generator output is MIT licensed
include(ExternalProject)
ExternalProject_Add(mavlink
GIT_REPOSITORY https://github.com/mavlink/mavlink
Expand Down
Loading