Skip to content

Commit

Permalink
Merge pull request #7 from traversaro/master
Browse files Browse the repository at this point in the history
Fixes for compiling in Windows
  • Loading branch information
isucan committed Oct 2, 2015
2 parents 54d70bf + cdf8ac9 commit fa15fc2
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 6 deletions.
16 changes: 11 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,22 @@ add_subdirectory(urdf_model_state)
add_subdirectory(urdf_world)
add_subdirectory(urdf_exception)

if(WIN32 AND NOT CYGWIN)
set(CMAKE_CONFIG_INSTALL_DIR CMake)
else()
set(CMAKE_CONFIG_INSTALL_DIR share/${PROJECT_NAME}/cmake/)
endif()

set(PACKAGE_NAME ${PROJECT_NAME})
set(cmake_conf_file "${CMAKE_CURRENT_SOURCE_DIR}/cmake/${PROJECT_NAME}-config.cmake")
configure_file("${cmake_conf_file}.in" "${CMAKE_BINARY_DIR}/${cmake_conf_file}" @ONLY)
install(FILES "${CMAKE_BINARY_DIR}/${cmake_conf_file}" DESTINATION share/${PROJECT_NAME}/cmake/ COMPONENT cmake)
set(cmake_conf_file "${PROJECT_NAME}-config.cmake")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/${cmake_conf_file}.in" "${CMAKE_BINARY_DIR}/${cmake_conf_file}" @ONLY)
install(FILES "${CMAKE_BINARY_DIR}/${cmake_conf_file}" DESTINATION ${CMAKE_CONFIG_INSTALL_DIR} COMPONENT cmake)

# Make the package config file
if (NOT MSVC)
set(PACKAGE_DESC "Unified Robot Description Format")
set(pkg_conf_file "${CMAKE_CURRENT_SOURCE_DIR}/cmake/pkgconfig/urdfdom_headers.pc")
configure_file("${pkg_conf_file}.in" "${CMAKE_BINARY_DIR}/${pkg_conf_file}" @ONLY)
set(pkg_conf_file "urdfdom_headers.pc")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/pkgconfig/${pkg_conf_file}.in" "${CMAKE_BINARY_DIR}/${pkg_conf_file}" @ONLY)
install(FILES "${CMAKE_BINARY_DIR}/${pkg_conf_file}" DESTINATION lib/pkgconfig/ COMPONENT pkgconfig)
endif()

Expand Down
11 changes: 10 additions & 1 deletion urdf_model/include/urdf_model/pose.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,19 @@
#ifndef URDF_INTERFACE_POSE_H
#define URDF_INTERFACE_POSE_H

//For using the M_PI macro in visual studio it
//is necessary to define _USE_MATH_DEFINES
#ifdef _MSC_VER
#ifndef _USE_MATH_DEFINES
#define _USE_MATH_DEFINES
#endif
#endif

#include <cmath>
#include <string>
#include <sstream>
#include <vector>
#include <cmath>

#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
#include <urdf_exception/exception.h>
Expand Down
11 changes: 11 additions & 0 deletions urdf_model_state/include/urdf_model_state/model_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@

namespace urdf{

//round is not defined in C++98
//So in Visual Studio <= 2012 is necessary to define it
#ifdef _MSC_VER
#if (_MSC_VER <= 1700)
double round(double value)
{
return (value >= 0.0f)?(floor(value + 0.5f)):(ceil(value - 0.5f));
}
#endif
#endif

class Time
{
public:
Expand Down

0 comments on commit fa15fc2

Please sign in to comment.