Skip to content

Commit 63ce390

Browse files
committed
Add workaround for invalid path in finding urdfdom on Windows
1 parent 4f9b738 commit 63ce390

File tree

3 files changed

+56
-3
lines changed

3 files changed

+56
-3
lines changed

.azure-pipelines.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ jobs:
8181
VCPKG_PACKAGES: 'assimp boost-system boost-filesystem ccd eigen3 fcl'
8282
# 'dart-utils' needs tinyxml2 and boost algorithm/lexical-cast
8383
# and also boost-math to resolve a circular dependency with lexical-cast
84-
VCPKG_OPTIONAL_PACKAGES: 'boost-algorithm boost-lexical-cast boost-math bullet3 ode tinyxml2'
85-
# VCPKG_OPTIONAL_PACKAGES_NOT_WORKING: 'flann ipopt nlopt osg urdfdom'
84+
VCPKG_OPTIONAL_PACKAGES: 'boost-algorithm boost-lexical-cast boost-math bullet3 freeglut ode opengl tinyxml2 urdfdom'
85+
VCPKG_OPTIONAL_PACKAGES_NOT_WORKING: 'flann ipopt nlopt osg'
8686
BUILD_TOOLSET_VERSION: '142'
8787
CMAKE_GENERATOR: 'Visual Studio 16 2019'
8888
steps:
@@ -98,7 +98,7 @@ jobs:
9898
cmake --version
9999
mkdir build
100100
cd build
101-
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
101+
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
102102
cmake --build . --target ALL_BUILD --config $(CONFIGURATION) -- /maxcpucount:4
103103
displayName: 'Build'
104104
workingDirectory: '$(Build.SourcesDirectory)'

cmake/DARTFindurdfdom.cmake

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,18 @@
88

99
find_package(urdfdom QUIET CONFIG)
1010

11+
if(MSVC)
12+
# Remove invalid path (i.e., /include) from urdfdom_INCLUDE_DIRS. This happens
13+
# when it's installed by vcpkg on Windows. See:
14+
# - https://github.com/dartsim/dart/issues/1365
15+
# - https://github.com/ros/urdfdom/issues/140
16+
if ("/include" IN_LIST urdfdom_INCLUDE_DIRS)
17+
list(REMOVE_ITEM urdfdom_INCLUDE_DIRS "/include")
18+
find_package(TinyXML REQUIRED MODULE)
19+
list(APPEND urdfdom_INCLUDE_DIRS ${TinyXML_INCLUDE_DIRS})
20+
endif()
21+
endif()
22+
1123
if(urdfdom_FOUND AND NOT TARGET urdfdom)
1224
add_library(urdfdom INTERFACE IMPORTED)
1325
set_target_properties(urdfdom PROPERTIES

cmake/FindTinyXML.cmake

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Copyright (c) 2011-2019, The DART development contributors
2+
# All rights reserved.
3+
#
4+
# The list of contributors can be found at:
5+
# https://github.com/dartsim/dart/blob/master/LICENSE
6+
#
7+
# This file is provided under the "BSD-style" License
8+
9+
# Find TinyXML
10+
#
11+
# This sets the following variables:
12+
# TinyXML_FOUND
13+
# TinyXML_INCLUDE_DIRS
14+
# TinyXML_LIBRARIES
15+
# TinyXML_VERSION
16+
17+
find_package(PkgConfig QUIET)
18+
19+
# Check to see if pkgconfig is installed.
20+
pkg_check_modules(PC_TinyXML tinyxml QUIET)
21+
22+
# Include directories
23+
find_path(TinyXML_INCLUDE_DIRS
24+
NAMES tinyxml.h
25+
HINTS ${PC_TinyXML_INCLUDEDIR}
26+
PATHS "${CMAKE_INSTALL_PREFIX}/include"
27+
)
28+
29+
# Libraries
30+
find_library(TinyXML_LIBRARIES NAMES tinyxml HINTS ${PC_TinyXML_LIBDIR})
31+
32+
# Version
33+
set(TinyXML_VERSION ${PC_TinyXML_VERSION})
34+
35+
# Set (NAME)_FOUND if all the variables and the version are satisfied.
36+
include(FindPackageHandleStandardArgs)
37+
find_package_handle_standard_args(TinyXML
38+
FAIL_MESSAGE DEFAULT_MSG
39+
REQUIRED_VARS TinyXML_INCLUDE_DIRS TinyXML_LIBRARIES
40+
VERSION_VAR TinyXML_VERSION
41+
)

0 commit comments

Comments
 (0)