From 3ea03e70183c854945bc20c3111f2af090512af1 Mon Sep 17 00:00:00 2001 From: Sean Yen Date: Thu, 25 Jul 2019 23:26:37 -0700 Subject: [PATCH] Windows bring up. (#116) --- CMakeLists.txt | 22 ++++++++++++------- include/rviz_visual_tools/rviz_visual_tools.h | 14 +++++++++++- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ef16e84..e6f7b2f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,17 +1,18 @@ cmake_minimum_required(VERSION 2.8.6) project(rviz_visual_tools) -add_definitions(-std=c++11) +if(NOT MSVC) + add_compile_options(-std=c++11) + # Warnings + add_definitions(-W -Wall -Wextra + #-Wcast-qual + -Wwrite-strings -Wunreachable-code -Wpointer-arith + -Winit-self -Wredundant-decls + -Wno-unused-parameter -Wno-unused-function) +endif() set(CMAKE_EXPORT_COMPILE_COMMANDS ON) -# Warnings -add_definitions(-W -Wall -Wextra - #-Wcast-qual - -Wwrite-strings -Wunreachable-code -Wpointer-arith - -Winit-self -Wredundant-decls - -Wno-unused-parameter -Wno-unused-function) - find_package(catkin REQUIRED COMPONENTS eigen_conversions eigen_stl_containers @@ -170,6 +171,10 @@ install( ${PROJECT_NAME}_remote_control LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + ARCHIVE DESTINATION + ${CATKIN_PACKAGE_LIB_DESTINATION} + RUNTIME DESTINATION + ${CATKIN_GLOBAL_BIN_DESTINATION} ) # Install header files @@ -188,5 +193,6 @@ install(FILES # Install executables install(TARGETS ${PROJECT_NAME}_demo ${PROJECT_NAME}_imarker_simple_demo LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} ) diff --git a/include/rviz_visual_tools/rviz_visual_tools.h b/include/rviz_visual_tools/rviz_visual_tools.h index 1ab08c9..1babe89 100644 --- a/include/rviz_visual_tools/rviz_visual_tools.h +++ b/include/rviz_visual_tools/rviz_visual_tools.h @@ -69,6 +69,18 @@ #include #include +// Import/export for windows dll's and visibility for gcc shared libraries. + +#ifdef ROS_BUILD_SHARED_LIBS // ros is being built around shared libraries + #ifdef rviz_visual_tools_EXPORTS // we are building a shared lib/dll + #define RVIZ_VISUAL_TOOLS_DECL ROS_HELPER_EXPORT + #else // we are using shared lib/dll + #define RVIZ_VISUAL_TOOLS_DECL ROS_HELPER_IMPORT + #endif +#else // ros is being built around static libraries + #define RVIZ_VISUAL_TOOLS_DECL +#endif + namespace rviz_visual_tools { // Default constants @@ -1079,7 +1091,7 @@ class RvizVisualTools ros::NodeHandle nh_; // Short name for this class - static const std::string name_; + static RVIZ_VISUAL_TOOLS_DECL const std::string name_; // Optional remote control RemoteControlPtr remote_control_;