forked from ros-industrial/abb_egm_rws_managers
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
3,930 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,222 @@ | ||
cmake_minimum_required(VERSION 3.9.1) | ||
|
||
######################################################################################################################## | ||
# Metadata | ||
######################################################################################################################## | ||
# Read the package manifest. | ||
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/package.xml" package_xml_str) | ||
|
||
# Extract project name. | ||
if(NOT package_xml_str MATCHES "<name>([A-Za-z0-9_]+)</name>") | ||
message(FATAL_ERROR "Could not parse project name from package manifest (aborting)") | ||
else() | ||
set(extracted_name ${CMAKE_MATCH_1}) | ||
endif() | ||
|
||
# Extract project version. | ||
if(NOT package_xml_str MATCHES "<version>([0-9]+.[0-9]+.[0-9]+)</version>") | ||
message(FATAL_ERROR "Could not parse project version from package manifest (aborting)") | ||
else() | ||
set(extracted_version ${CMAKE_MATCH_1}) | ||
endif() | ||
|
||
######################################################################################################################## | ||
# CMake project | ||
######################################################################################################################## | ||
project(${extracted_name} VERSION ${extracted_version} LANGUAGES CXX) | ||
|
||
#=========================================================== | ||
# Dependencies | ||
#=========================================================== | ||
#----------------------------- | ||
# RWS and EGM (interfaces to | ||
# ABB robot controllers) | ||
#----------------------------- | ||
find_package(abb_libegm REQUIRED) | ||
find_package(abb_librws REQUIRED) | ||
|
||
#----------------------------- | ||
# Threads (determines the | ||
# system's thread library) | ||
#----------------------------- | ||
find_package(Threads REQUIRED) | ||
|
||
#----------------------------- | ||
# Google protocol buffers | ||
#----------------------------- | ||
# Temporary workaround for https://github.com/ms-iot/ROSOnWindows/issues/218. | ||
if(WIN32) | ||
foreach(prefix IN ITEMS $ENV{CMAKE_PREFIX_PATH}) | ||
if(${prefix} STREQUAL "C:/opt/rosdeps/x64") | ||
list(APPEND CMAKE_PROGRAM_PATH "C:/opt/rosdeps/x64/tools/protobuf") | ||
endif() | ||
endforeach() | ||
endif() | ||
|
||
find_package(Protobuf REQUIRED) | ||
|
||
# Workaround Protobuf exporting 'lpthread' as a library, the | ||
# Threads package determines the system's thread library. | ||
list(REMOVE_ITEM PROTOBUF_LIBRARIES -lpthread) | ||
|
||
# Verify that the Protobuf compiler 'protoc' is present, since | ||
# the above find_package() doesn't appear to check that. | ||
if(NOT PROTOBUF_PROTOC_EXECUTABLE) | ||
message(FATAL_ERROR "Cannot find required 'protoc', cannot process Protobuf files without it (aborting)") | ||
endif() | ||
|
||
set(proto_files proto/robot_controller_description.proto) | ||
|
||
if(NOT QUIET) | ||
message(STATUS "Generating protobuf C++ for: ${proto_files}") | ||
endif() | ||
|
||
# Generate C++ files for Protobuf message definitions, C++ headers and | ||
# sources are written to the CMAKE_CURRENT_BINARY_DIR location. | ||
if(MSVC) | ||
# Add export macro when using Microsoft Visual C++ compiler. | ||
protobuf_generate_cpp(proto_sources proto_headers EXPORT_MACRO ABB_EGM_RWS_MANAGERS_EXPORT ${proto_files}) | ||
else() | ||
protobuf_generate_cpp(proto_sources proto_headers ${proto_files}) | ||
endif() | ||
|
||
#=========================================================== | ||
# Settings | ||
#=========================================================== | ||
if(NOT DEFINED BUILD_SHARED_LIBS) | ||
set(BUILD_SHARED_LIBS ON) | ||
endif() | ||
|
||
if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) | ||
message(STATUS "${PROJECT_NAME}: Defaulting build type to RelWithDebInfo") | ||
set(CMAKE_BUILD_TYPE RelWithDebInfo) | ||
endif() | ||
|
||
if(WIN32) | ||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) | ||
endif() | ||
|
||
#=========================================================== | ||
# Build targets | ||
#=========================================================== | ||
include(GenerateExportHeader) | ||
|
||
#----------------------------- | ||
# Library target | ||
#----------------------------- | ||
set( | ||
src_files | ||
src/egm_manager.cpp | ||
src/rws_manager.cpp | ||
src/system_data_parser.cpp | ||
src/utilities.cpp | ||
"${proto_sources}" | ||
) | ||
|
||
add_library(${PROJECT_NAME} ${src_files}) | ||
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) | ||
|
||
# Generate a header with export macros, which is written | ||
# to the CMAKE_CURRENT_BINARY_DIR location. | ||
generate_export_header(${PROJECT_NAME}) | ||
|
||
target_include_directories(${PROJECT_NAME} PUBLIC | ||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>" | ||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>" | ||
"$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" | ||
) | ||
|
||
target_link_libraries(${PROJECT_NAME} PUBLIC | ||
abb_libegm::abb_libegm | ||
abb_librws::abb_librws | ||
protobuf::libprotobuf | ||
Threads::Threads | ||
) | ||
|
||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) | ||
|
||
target_compile_definitions(${PROJECT_NAME} PRIVATE -D_USE_MATH_DEFINES) | ||
|
||
if(NOT BUILD_SHARED_LIBS) | ||
target_compile_definitions(${PROJECT_NAME} PUBLIC "ABB_EGM_RWS_MANAGERS_STATIC_DEFINE") | ||
endif() | ||
|
||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic) | ||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") | ||
target_compile_options(${PROJECT_NAME} PRIVATE /W4) | ||
endif() | ||
|
||
if(MSVC) | ||
# Force include the export header when using Microsoft Visual C++ compiler. | ||
target_compile_options(${PROJECT_NAME} PUBLIC "/FI${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_export.h") | ||
endif() | ||
|
||
#=========================================================== | ||
# CMake package configurations | ||
#=========================================================== | ||
include(CMakePackageConfigHelpers) | ||
|
||
# Create the ${PROJECT_NAME}Config.cmake file, which is used by | ||
# other packages to find this package and its dependencies. | ||
configure_file( | ||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Config.cmake.in" | ||
"${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}Config.cmake" | ||
@ONLY | ||
) | ||
|
||
# Create the ${PROJECT_NAME}ConfigVersion.cmake. | ||
write_basic_package_version_file( | ||
"${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}ConfigVersion.cmake" | ||
COMPATIBILITY AnyNewerVersion | ||
) | ||
|
||
#=========================================================== | ||
# Install | ||
#=========================================================== | ||
include(GNUInstallDirs) | ||
|
||
install( | ||
DIRECTORY include/ | ||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" | ||
) | ||
|
||
install( | ||
FILES | ||
"${proto_files}" | ||
"${proto_headers}" | ||
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_export.h" | ||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}" | ||
) | ||
|
||
install( | ||
FILES | ||
"${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}Config.cmake" | ||
"${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}ConfigVersion.cmake" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/package.xml" | ||
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}" | ||
) | ||
|
||
install( | ||
TARGETS ${PROJECT_NAME} | ||
EXPORT EXPORT_${PROJECT_NAME} | ||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" | ||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" | ||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" | ||
) | ||
|
||
install( | ||
EXPORT EXPORT_${PROJECT_NAME} | ||
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}" | ||
NAMESPACE ${PROJECT_NAME}:: | ||
FILE ${PROJECT_NAME}Targets.cmake | ||
) | ||
|
||
#=========================================================== | ||
# Export targets | ||
#=========================================================== | ||
export( | ||
EXPORT EXPORT_${PROJECT_NAME} | ||
NAMESPACE ${PROJECT_NAME}:: | ||
FILE "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake" | ||
) |
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,30 @@ | ||
Copyright (c) 2020, ABB Schweiz AG | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with | ||
or without modification, are permitted provided that | ||
the following conditions are met: | ||
|
||
* Redistributions of source code must retain the | ||
above copyright notice, this list of conditions | ||
and the following disclaimer. | ||
* 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. | ||
* Neither the name of ABB 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 HOLDER 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. |
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,47 @@ | ||
# abb_egm_rws_managers | ||
|
||
[](http://github.com/ros-industrial/abb_egm_rws_managers/issues) | ||
|
||
[](https://opensource.org/licenses/BSD-3-Clause) | ||
[](http://rosindustrial.org/news/2016/10/7/better-supporting-a-growing-ros-industrial-software-platform) | ||
|
||
**Please note that this package has not been productized, and that academia is the intended audience.**\ | ||
**The package is provided "as-is", and as such no more than limited support can be expected.** | ||
|
||
## Overview | ||
|
||
C++ library intended for use with [abb_robot_driver](https://github.com/ros-industrial/abb_robot_driver), with the purpose of encapsulating *ROS agnostic* components. | ||
|
||
The *ROS agnostic* components are primarily: | ||
|
||
- Higher level management of *Externally Guided Motion* (`EGM`) communication sessions. | ||
- Higher level management of *Robot Web Services* (`RWS`) communication sessions. | ||
- Structured description definitions of an ABB robot controller (*i.e. see the (robot_controller_description.proto)[proto/robot_controller_description.proto] file*). | ||
|
||
Please see [abb_robot_driver](https://github.com/ros-industrial/abb_robot_driver) for more details. | ||
|
||
### Requirements | ||
|
||
- `RobotWare` version `6.07.01` or higher (less than `7.0`). | ||
|
||
Please see the underlying [abb_libegm](https://github.com/ros-industrial/abb_libegm) and [abb_librws](https://github.com/ros-industrial/abb_librws) packages for more details. | ||
|
||
## Acknowledgements | ||
|
||
### ROSIN Project | ||
|
||
<p> | ||
<a href="http://rosin-project.eu"> | ||
<img src="http://rosin-project.eu/wp-content/uploads/rosin_ack_logo_wide.png" alt="rosin_logo" height="50" align="left"> | ||
</a> | ||
The core development has been made within the European Union's Horizon 2020 project: ROSIN - ROS-Industrial Quality-Assured Robot Software Components (see http://rosin-project.eu for more info). | ||
<br><br> | ||
<img src="http://rosin-project.eu/wp-content/uploads/rosin_eu_flag.jpg" alt="eu_flag" height="50" align="left"> | ||
The ROSIN project has received funding from the European Union's Horizon 2020 research and innovation programme under grant agreement no. 732287. | ||
</p> | ||
|
||
*The opinions expressed here reflects only the author's view and reflects in no way the European Commission's opinions. The European Commission is not responsible for any use that may be made of the contained information.* | ||
|
||
### Special Thanks | ||
|
||
Special thanks to [gavanderhoorn](https://github.com/gavanderhoorn) for guidance with open-source practices and conventions. |
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,20 @@ | ||
######################################################################################################################## | ||
## Configuration file for '@PROJECT_NAME@' | ||
######################################################################################################################## | ||
include(CMakeFindDependencyMacro) | ||
|
||
#=========================================================== | ||
# Dependencies | ||
#=========================================================== | ||
find_dependency(abb_libegm REQUIRED) | ||
find_dependency(abb_librws REQUIRED) | ||
find_dependency(Protobuf REQUIRED) | ||
find_dependency(Threads REQUIRED) | ||
|
||
# Our library dependencies (contains definitions for IMPORTED targets). | ||
include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]") | ||
|
||
# Set legacy _LIBRARIES variable (e.g. due to that 'ament_cmake' | ||
# seems to need it), however it should not be required with | ||
# modern CMake (i.e. targets and properties). | ||
set(@PROJECT_NAME@_LIBRARIES @PROJECT_NAME@::@PROJECT_NAME@) |
Oops, something went wrong.