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

[Windows][melodic-devel] Windows\MSVC port #239

Open
wants to merge 1 commit into
base: melodic-devel
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
8 changes: 6 additions & 2 deletions descartes_core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
cmake_minimum_required(VERSION 2.8.11)
project(descartes_core)

add_compile_options(-std=c++11 -Wall -Wextra)
if(NOT MSVC)
add_compile_options(-std=c++11 -Wall -Wextra)
endif()

find_package(catkin REQUIRED COMPONENTS
cmake_modules
Expand Down Expand Up @@ -54,7 +56,9 @@ target_link_libraries(${PROJECT_NAME}

install(
TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION})
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION})

install(
DIRECTORY include/${PROJECT_NAME}/
Expand Down
16 changes: 16 additions & 0 deletions descartes_core/include/descartes_core/export.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef DESCARTES_CORE_EXPORT_H_
#define DESCARTES_CORE_EXPORT_H_

#include <ros/macros.h>

#ifdef ROS_BUILD_SHARED_LIBS // ros is being built around shared libraries
#ifdef descartes_core_EXPORTS // we are building a shared lib/dll
#define DESCARTES_CORE_DECL ROS_HELPER_EXPORT
#else // we are using shared lib/dll
#define DESCARTES_CORE_DECL ROS_HELPER_IMPORT
#endif
#else // ros is being built around static libraries
#define DESCARTES_CORE_DECL
#endif

#endif
6 changes: 3 additions & 3 deletions descartes_core/include/descartes_core/pretty_print.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <iterator>
#include <set>

#ifndef NO_TR1
#if !defined(NO_TR1) && (__cplusplus <= 199711L)
#include <tr1/tuple>
#include <tr1/unordered_set>
#endif
Expand Down Expand Up @@ -199,7 +199,7 @@ template <typename T, typename TComp, typename TAllocator>
const delimiters_values<wchar_t> delimiters< ::std::multiset<T, TComp, TAllocator>, wchar_t>::values = { L"{", L", ",
L"}" };

#ifndef NO_TR1
#if !defined(NO_TR1) && (__cplusplus <= 199711L)
template <typename T, typename THash, typename TEqual, typename TAllocator>
struct delimiters< ::std::tr1::unordered_set<T, THash, TEqual, TAllocator>, char>
{
Expand Down Expand Up @@ -444,7 +444,7 @@ inline basic_ostream<TChar, TCharTraits> &operator<<(basic_ostream<TChar, TCharT
}
} // namespace std

#ifndef NO_TR1
#if !defined(NO_TR1) && (__cplusplus <= 199711L)

// Prints a tuple to the stream using delimiters from delimiters<std::pair<tuple_dummy_t, tuple_dummy_t>>.

Expand Down
4 changes: 3 additions & 1 deletion descartes_core/include/descartes_core/trajectory_id.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

#include <boost/thread/mutex.hpp>

#include "descartes_core/export.h"

namespace descartes_core
{
namespace detail
Expand All @@ -26,7 +28,7 @@ struct IdGenerator;
* for the unique 'state'. Zero is reserved as a special value
*/
template <>
struct IdGenerator<uint64_t>
struct DESCARTES_CORE_DECL IdGenerator<uint64_t>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not too familiar with MSVC toolchains so could you explain why this is needed?

{
typedef uint64_t value_type;

Expand Down
4 changes: 2 additions & 2 deletions descartes_core/include/descartes_core/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ typedef EulerConventions::EulerConvention EulerConvention;

// Use a function declaration so that we can add the 'unused' attribute, which prevents compiler warnings
static Eigen::Isometry3d toFrame(double tx, double ty, double tz, double rx, double ry, double rz,
int convention = int(EulerConventions::ZYX)) __attribute__((unused));
int convention = int(EulerConventions::ZYX)) [[gnu::unused]];

static Eigen::Isometry3d toFrame(double tx, double ty, double tz, double rx, double ry, double rz, int convention)
{
Expand Down Expand Up @@ -97,7 +97,7 @@ static Eigen::Isometry3d toFrame(double tx, double ty, double tz, double rx, dou

// Use a function declaration so that we can add the 'unused' attribute, which prevents compiler warnings
static bool equal(const std::vector<double> &lhs, const std::vector<double> &rhs, const double tol)
__attribute__((unused));
[[gnu::unused]];

static bool equal(const std::vector<double> &lhs, const std::vector<double> &rhs, const double tol)
{
Expand Down
9 changes: 7 additions & 2 deletions descartes_moveit/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
cmake_minimum_required(VERSION 2.8.11)
project(descartes_moveit)

add_compile_options(-std=c++11 -Wall -Wextra)
if(NOT MSVC)
add_compile_options(-std=c++11 -Wall -Wextra)
endif()

find_package(catkin REQUIRED COMPONENTS
cmake_modules
Expand All @@ -12,6 +14,7 @@ find_package(catkin REQUIRED COMPONENTS
pluginlib
rosconsole_bridge
tf
eigen_conversions
)

find_package(Boost REQUIRED)
Expand Down Expand Up @@ -65,7 +68,9 @@ target_link_libraries(${PROJECT_NAME}

install(
TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION})
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION})

install(
FILES moveit_adapter_plugins.xml
Expand Down
1 change: 1 addition & 0 deletions descartes_moveit/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<depend>moveit_ros_planning</depend>
<depend>pluginlib</depend>
<build_depend>eigen</build_depend>
<build_depend>eigen_conversions</build_depend>

<export>
<descartes_core plugin="${prefix}/moveit_adapter_plugins.xml"/>
Expand Down
4 changes: 3 additions & 1 deletion descartes_planner/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ add_dependencies(${PROJECT_NAME} ${catkin_EXPORTED_TARGETS})
#############
install(
TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION})
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION})

install(
FILES ${PROJECT_NAME}_plugins.xml
Expand Down
8 changes: 7 additions & 1 deletion descartes_planner/include/descartes_planner/ladder_graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,16 @@
#include "descartes_core/trajectory_id.h"
#include "descartes_core/trajectory_timing_constraint.h"

#ifndef _MSC_VER
#define COMPILER_PACKED __attribute__ ((__packed__))
#else
#define COMPILER_PACKED
#endif

namespace descartes_planner
{

struct __attribute__ ((__packed__)) Edge
struct COMPILER_PACKED Edge
{
double cost; // transition cost from vertex who owns this object to 'idx' in next rung
unsigned idx; // from THIS rung to 'idx' into the NEXT rung
Expand Down
4 changes: 2 additions & 2 deletions descartes_planner/src/planning_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ bool PlanningGraph::insertGraph(const std::vector<TrajectoryPtPtr>& points)

// now we have a graph with data in the 'rungs' and we need to compute the edges
#pragma omp parallel for
for (std::size_t i = 0; i < graph_.size() - 1; ++i)
for (int i = 0; i < graph_.size() - 1; ++i)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change the iterator type?

{
computeAndAssignEdges(i, i + 1);
}
Expand Down Expand Up @@ -190,7 +190,7 @@ bool PlanningGraph::calculateJointSolutions(const TrajectoryPtPtr* points, const
bool success = true;

#pragma omp parallel for shared(success)
for (std::size_t i = 0; i < count; ++i)
for (int i = 0; i < count; ++i)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change the iterator datatype here?

{
if (success)
{
Expand Down
11 changes: 6 additions & 5 deletions descartes_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
cmake_minimum_required(VERSION 2.8.3)
project(descartes_tests)

add_compile_options(-std=c++11 -Wall -Wextra)
if(NOT MSVC)
add_compile_options(-std=c++11 -Wall -Wextra)
endif()

find_package(catkin REQUIRED COMPONENTS
descartes_moveit
Expand Down Expand Up @@ -38,10 +40,9 @@ target_link_libraries(${PROJECT_NAME}
)

install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION})

install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
Expand Down
10 changes: 8 additions & 2 deletions descartes_trajectory/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
cmake_minimum_required(VERSION 2.8.11)
project(descartes_trajectory)

add_compile_options(-std=c++11 -Wall -Wextra)
if(NOT MSVC)
add_compile_options(-std=c++11 -Wall -Wextra)
else()
add_definitions(-D__PRETTY_FUNCTION__=__FUNCTION__)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this definition do?

endif()

find_package(catkin REQUIRED COMPONENTS
cmake_modules
Expand Down Expand Up @@ -63,7 +67,9 @@ target_link_libraries(${PROJECT_NAME}

install(
TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION})
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION})

install(
DIRECTORY include/${PROJECT_NAME}/
Expand Down
11 changes: 6 additions & 5 deletions descartes_utilities/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
cmake_minimum_required(VERSION 2.8.11)
project(descartes_utilities)

add_compile_options(-std=c++11 -Wall -Wextra)
if(NOT MSVC)
add_compile_options(-std=c++11 -Wall -Wextra)
endif()

find_package(catkin REQUIRED COMPONENTS
descartes_core
Expand Down Expand Up @@ -33,10 +35,9 @@ target_link_libraries(${PROJECT_NAME}
)

install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION})

install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
Expand Down