-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[cmake] add AddBipedalYARPDevice cmake macro
- Loading branch information
1 parent
2b370c9
commit ebe68e4
Showing
3 changed files
with
74 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Copyright (C) 2020 Istituto Italiano di Tecnologia (IIT). All rights reserved. | ||
# This software may be modified and distributed under the terms of the | ||
# GNU Lesser General Public License v2.1 or any later version. | ||
|
||
function(add_bipedal_yarp_device) | ||
set(options ) | ||
set(oneValueArgs NAME) | ||
set(multiValueArgs | ||
SOURCES | ||
PUBLIC_HEADERS | ||
PRIVATE_HEADERS | ||
PUBLIC_LINK_LIBRARIES | ||
PRIVATE_LINK_LIBRARIES | ||
DEFAULT | ||
TYPE | ||
INI) | ||
|
||
set(prefix "bipedal_yarp") | ||
|
||
cmake_parse_arguments(${prefix} | ||
"${options}" | ||
"${oneValueArgs}" | ||
"${multiValueArgs}" | ||
${ARGN}) | ||
|
||
set(name ${${prefix}_NAME}) | ||
set(type ${${prefix}_TYPE}) | ||
set(default ${${prefix}_DEFAULT}) | ||
set(ini ${${prefix}_INI}) | ||
set(sources ${${prefix}_SOURCES}) | ||
set(public_headers ${${prefix}_PUBLIC_HEADERS}) | ||
set(public_link_libraries ${${prefix}_PUBLIC_LINK_LIBRARIES}) | ||
|
||
yarp_prepare_plugin(${name} CATEGORY device | ||
TYPE ${type} | ||
INCLUDE ${public_headers} | ||
DEFAULT ${default}) | ||
|
||
yarp_add_plugin(${name} ${sources} ${public_headers}) | ||
|
||
target_link_libraries(${name} PUBLIC ${public_link_libraries}) | ||
target_compile_features(${name} PUBLIC cxx_std_17) | ||
|
||
# Specify include directories for both compilation and installation process. | ||
# The $<INSTALL_PREFIX> generator expression is useful to ensure to create | ||
# relocatable configuration files, see https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html#creating-relocatable-packages | ||
target_include_directories(${name} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>" | ||
"<INSTALLINTERFACE:<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}>") | ||
|
||
# Specify installation targets, typology and destination folders. | ||
yarp_install(TARGETS ${name} | ||
COMPONENT runtime | ||
LIBRARY DESTINATION ${YARP_DYNAMIC_PLUGINS_INSTALL_DIR}/ | ||
ARCHIVE DESTINATION ${YARP_STATIC_PLUGINS_INSTALL_DIR}/) | ||
yarp_install(FILES ${ini} | ||
COMPONENT runtime | ||
DESTINATION ${YARP_PLUGIN_MANIFESTS_INSTALL_DIR}/) | ||
|
||
add_subdirectory(app) | ||
|
||
|
||
message(STATUS "Created device ${name}.") | ||
|
||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters