Skip to content

Commit

Permalink
Add workaround for invalid path in finding urdfdom on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jslee02 committed May 2, 2020
1 parent 4f9b738 commit 63ce390
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ jobs:
VCPKG_PACKAGES: 'assimp boost-system boost-filesystem ccd eigen3 fcl'
# 'dart-utils' needs tinyxml2 and boost algorithm/lexical-cast
# and also boost-math to resolve a circular dependency with lexical-cast
VCPKG_OPTIONAL_PACKAGES: 'boost-algorithm boost-lexical-cast boost-math bullet3 ode tinyxml2'
# VCPKG_OPTIONAL_PACKAGES_NOT_WORKING: 'flann ipopt nlopt osg urdfdom'
VCPKG_OPTIONAL_PACKAGES: 'boost-algorithm boost-lexical-cast boost-math bullet3 freeglut ode opengl tinyxml2 urdfdom'
VCPKG_OPTIONAL_PACKAGES_NOT_WORKING: 'flann ipopt nlopt osg'
BUILD_TOOLSET_VERSION: '142'
CMAKE_GENERATOR: 'Visual Studio 16 2019'
steps:
Expand All @@ -98,7 +98,7 @@ jobs:
cmake --version
mkdir build
cd build
cmake .. -G "$(CMAKE_GENERATOR)" -A x64 -DCMAKE_BUILD_TYPE=$(CONFIGURATION) -Wno-dev -T "v$(BUILD_TOOLSET_VERSION),host=x64" -DVCPKG_TARGET_TRIPLET=$(VCPKG_ARCH) -DCMAKE_TOOLCHAIN_FILE="$(VCPKG_INSTALL_ROOT)/scripts/buildsystems/vcpkg.cmake" -DCMAKE_INSTALL_PREFIX="$(Build.BinariesDirectory)/$(REPO_NAME)" -DDART_MSVC_DEFAULT_OPTIONS=ON
cmake .. -G "$(CMAKE_GENERATOR)" -A x64 -DCMAKE_BUILD_TYPE=$(CONFIGURATION) -Wno-dev -T "v$(BUILD_TOOLSET_VERSION),host=x64" -DVCPKG_TARGET_TRIPLET=$(VCPKG_ARCH) -DCMAKE_TOOLCHAIN_FILE="$(VCPKG_INSTALL_ROOT)/scripts/buildsystems/vcpkg.cmake" -DCMAKE_INSTALL_PREFIX="$(Build.BinariesDirectory)/$(REPO_NAME)" -DDART_MSVC_DEFAULT_OPTIONS=ON -DDART_VERBOSE=ON
cmake --build . --target ALL_BUILD --config $(CONFIGURATION) -- /maxcpucount:4
displayName: 'Build'
workingDirectory: '$(Build.SourcesDirectory)'
12 changes: 12 additions & 0 deletions cmake/DARTFindurdfdom.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@

find_package(urdfdom QUIET CONFIG)

if(MSVC)
# Remove invalid path (i.e., /include) from urdfdom_INCLUDE_DIRS. This happens
# when it's installed by vcpkg on Windows. See:
# - https://github.com/dartsim/dart/issues/1365
# - https://github.com/ros/urdfdom/issues/140
if ("/include" IN_LIST urdfdom_INCLUDE_DIRS)
list(REMOVE_ITEM urdfdom_INCLUDE_DIRS "/include")
find_package(TinyXML REQUIRED MODULE)
list(APPEND urdfdom_INCLUDE_DIRS ${TinyXML_INCLUDE_DIRS})
endif()
endif()

if(urdfdom_FOUND AND NOT TARGET urdfdom)
add_library(urdfdom INTERFACE IMPORTED)
set_target_properties(urdfdom PROPERTIES
Expand Down
41 changes: 41 additions & 0 deletions cmake/FindTinyXML.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright (c) 2011-2019, The DART development contributors
# All rights reserved.
#
# The list of contributors can be found at:
# https://github.com/dartsim/dart/blob/master/LICENSE
#
# This file is provided under the "BSD-style" License

# Find TinyXML
#
# This sets the following variables:
# TinyXML_FOUND
# TinyXML_INCLUDE_DIRS
# TinyXML_LIBRARIES
# TinyXML_VERSION

find_package(PkgConfig QUIET)

# Check to see if pkgconfig is installed.
pkg_check_modules(PC_TinyXML tinyxml QUIET)

# Include directories
find_path(TinyXML_INCLUDE_DIRS
NAMES tinyxml.h
HINTS ${PC_TinyXML_INCLUDEDIR}
PATHS "${CMAKE_INSTALL_PREFIX}/include"
)

# Libraries
find_library(TinyXML_LIBRARIES NAMES tinyxml HINTS ${PC_TinyXML_LIBDIR})

# Version
set(TinyXML_VERSION ${PC_TinyXML_VERSION})

# Set (NAME)_FOUND if all the variables and the version are satisfied.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(TinyXML
FAIL_MESSAGE DEFAULT_MSG
REQUIRED_VARS TinyXML_INCLUDE_DIRS TinyXML_LIBRARIES
VERSION_VAR TinyXML_VERSION
)

0 comments on commit 63ce390

Please sign in to comment.