diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index dadcaab0b1621..8fcc3967a4b38 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -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: @@ -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)' diff --git a/cmake/DARTFindurdfdom.cmake b/cmake/DARTFindurdfdom.cmake index 458f72b3fcfe0..524389198a86f 100644 --- a/cmake/DARTFindurdfdom.cmake +++ b/cmake/DARTFindurdfdom.cmake @@ -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 diff --git a/cmake/FindTinyXML.cmake b/cmake/FindTinyXML.cmake new file mode 100644 index 0000000000000..c0af61c8280db --- /dev/null +++ b/cmake/FindTinyXML.cmake @@ -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 +)