diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..e359dd0 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,70 @@ +# Copyright 2018 The Cartographer Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +jobs: +- job: Build + pool: + vmImage: 'vs2017-win2016' + timeoutInMinutes: 360 + steps: + - script: | + choco sources add -n=roswin -s https://roswin.azurewebsites.net/api/v2/ --priority 1 + rem Azure VM runs out of space on C:, so use D: for ros and rosdeps + mkdir D:\opt && mklink /J C:\opt D:\opt + choco upgrade %ROS_METAPACKAGE% -y + choco upgrade ros-melodic-perception -y + robocopy "." ".\src\cartographer_ros" /E /MOVE /XD "src" > NUL + git clone https://github.com/googlecartographer/cartographer src\cartographer + call "C:\opt\ros\melodic\x64\env.bat" rosdep install --from-paths src --ignore-src -r -y + env: + ROS_METAPACKAGE: 'ros-melodic-desktop' + displayName: Install prerequisites + + - script: | + call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars64.bat" + call "C:\opt\ros\melodic\x64\setup.bat" + call src\cartographer\scripts\remove_mingw_cygwin_from_path.bat + catkin_make_isolated --use-ninja --install --cmake-args -DCMAKE_BUILD_TYPE=Release + displayName: Build + + - script: | + call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars64.bat" + call "C:\opt\ros\melodic\x64\setup.bat" + call src\cartographer\scripts\remove_mingw_cygwin_from_path.bat + cd build_isolated\cartographer\install && ctest --no-compress-output -T Test + displayName: Run cartographer tests + + - script: | + call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars64.bat" + call "C:\opt\ros\melodic\x64\setup.bat" + call src\cartographer\scripts\remove_mingw_cygwin_from_path.bat + cd build_isolated\cartographer_ros && ninja tests && ctest --no-compress-output -T Test + displayName: Build and run cartographer_ros tests + condition: always() + + - script: | + call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars64.bat" + call "C:\opt\ros\melodic\x64\setup.bat" + call src\cartographer\scripts\remove_mingw_cygwin_from_path.bat + python src\cartographer\scripts\ctest_to_junit.py build_isolated\cartographer_ros + displayName: Convert tests to jUnit + condition: always() + + - task: PublishTestResults@2 + displayName: Publish test results + inputs: + testRunner: 'jUnit' + testResultsFiles: '**\jUnit.xml' + searchFolder: '$(Build.SourcesDirectory)\build_isolated\cartographer_ros\Testing' + condition: always() diff --git a/cartographer_ros/CMakeLists.txt b/cartographer_ros/CMakeLists.txt index 43aa861..a379726 100644 --- a/cartographer_ros/CMakeLists.txt +++ b/cartographer_ros/CMakeLists.txt @@ -35,9 +35,18 @@ set(PACKAGE_DEPENDENCIES visualization_msgs ) +if(WIN32) + set(Boost_USE_STATIC_LIBS FALSE) +endif() +# For yet unknown reason, if Boost is find_packaged() after find_package(cartographer), +# some Boost libraries including Thread are set to static, despite Boost_USE_STATIC_LIBS, +# which causes linking problems on windows due to shared/static Thread clashing. +# PCL also finds Boost. Work around by moving before find_package(cartographer). +find_package(Boost REQUIRED COMPONENTS system iostreams) +find_package(PCL REQUIRED COMPONENTS common) + find_package(cartographer REQUIRED) include("${CARTOGRAPHER_CMAKE_DIR}/functions.cmake") -set(BUILD_SHARED_LIBS OFF) option(BUILD_GRPC "build features that require Cartographer gRPC support" false) google_initialize_cartographer_project() google_enable_testing() @@ -48,9 +57,7 @@ include(FindPkgConfig) find_package(Abseil REQUIRED) find_package(LuaGoogle REQUIRED) -find_package(PCL REQUIRED COMPONENTS common) find_package(Eigen3 REQUIRED) -find_package(Boost REQUIRED COMPONENTS system iostreams) find_package(urdfdom_headers REQUIRED) if(DEFINED urdfdom_headers_VERSION) @@ -94,7 +101,7 @@ if (NOT ${BUILD_GRPC}) list(REMOVE_ITEM ALL_TESTS ${ALL_GRPC_FILES}) list(REMOVE_ITEM ALL_EXECUTABLES ${ALL_GRPC_FILES}) endif() -add_library(${PROJECT_NAME} ${ALL_SRCS}) +add_library(${PROJECT_NAME} STATIC ${ALL_SRCS}) add_subdirectory("cartographer_ros") target_link_libraries(${PROJECT_NAME} PUBLIC cartographer) @@ -154,6 +161,10 @@ if (CATKIN_ENABLE_TESTING) target_link_libraries(${TEST_NAME} cartographer) target_link_libraries(${TEST_NAME} ${PROJECT_NAME}) set_target_properties(${TEST_NAME} PROPERTIES COMPILE_FLAGS ${TARGET_COMPILE_FLAGS}) + # Needed for dynamically linked GTest on Windows. + if (WIN32) + target_compile_definitions(${TEST_NAME} PUBLIC -DGTEST_LINKED_AS_SHARED_LIBRARY) + endif() endforeach() endif() diff --git a/cartographer_ros/cartographer_ros/map_builder_bridge.h b/cartographer_ros/cartographer_ros/map_builder_bridge.h index b5f4240..a9ede0a 100644 --- a/cartographer_ros/cartographer_ros/map_builder_bridge.h +++ b/cartographer_ros/cartographer_ros/map_builder_bridge.h @@ -35,6 +35,12 @@ #include "cartographer_ros_msgs/SubmapList.h" #include "cartographer_ros_msgs/SubmapQuery.h" #include "nav_msgs/OccupancyGrid.h" + +// Abseil unfortunately pulls in winnt.h, which #defines DELETE. +// Clean up to unbreak visualization_msgs::Marker::DELETE. +#ifdef DELETE +#undef DELETE +#endif #include "visualization_msgs/MarkerArray.h" namespace cartographer_ros { diff --git a/cartographer_ros/cartographer_ros/offline_node.cc b/cartographer_ros/cartographer_ros/offline_node.cc index 691b039..b2cf205 100644 --- a/cartographer_ros/cartographer_ros/offline_node.cc +++ b/cartographer_ros/cartographer_ros/offline_node.cc @@ -18,7 +18,9 @@ #include #include +#ifndef WIN32 #include +#endif #include #include diff --git a/cartographer_ros/package.xml b/cartographer_ros/package.xml index f06920f..6902669 100644 --- a/cartographer_ros/package.xml +++ b/cartographer_ros/package.xml @@ -38,7 +38,6 @@ git google-mock - g++-static protobuf-dev python-sphinx diff --git a/cartographer_rviz/CMakeLists.txt b/cartographer_rviz/CMakeLists.txt index 24bbdd7..c19c986 100644 --- a/cartographer_rviz/CMakeLists.txt +++ b/cartographer_rviz/CMakeLists.txt @@ -26,13 +26,16 @@ set(PACKAGE_DEPENDENCIES rviz ) +if(WIN32) + set(Boost_USE_STATIC_LIBS FALSE) +endif() +find_package(Boost REQUIRED COMPONENTS system iostreams) find_package(cartographer REQUIRED) include("${CARTOGRAPHER_CMAKE_DIR}/functions.cmake") google_initialize_cartographer_project() find_package(Abseil REQUIRED) find_package(Eigen3 REQUIRED) -find_package(Boost REQUIRED COMPONENTS system iostreams) find_package(catkin REQUIRED COMPONENTS ${PACKAGE_DEPENDENCIES}) catkin_package( @@ -52,7 +55,7 @@ if(rviz_QT_VERSION VERSION_LESS "5") else() message(STATUS "Using Qt5 based on the rviz_QT_VERSION: ${rviz_QT_VERSION}") find_package(Qt5 ${rviz_QT_VERSION} EXACT REQUIRED Core Widgets) - set(QT_LIBRARIES Qt5::Widgets) + set(QT_LIBRARIES Qt5::Core Qt5::Widgets) include_directories(${Qt5Widgets_INCLUDE_DIRS}) endif() add_definitions(-DQT_NO_KEYWORDS) @@ -85,10 +88,18 @@ set_target_properties(${PROJECT_NAME} PROPERTIES target_link_libraries(${PROJECT_NAME} PUBLIC cartographer) +# On windows, rviz won't find the DLL in CATKIN_PACKAGE_BIN_DESTINATION, +# but it will in CATKIN_PACKAGE_LIB_DESTINATION? +if(WIN32) + set(RUNTIME_DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}) +else() + set(RUNTIME_DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}) +endif() + install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} - RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} + RUNTIME DESTINATION ${RUNTIME_DESTINATION} ) install(FILES rviz_plugin_description.xml diff --git a/cartographer_rviz/cartographer_rviz/ogre_slice.cc b/cartographer_rviz/cartographer_rviz/ogre_slice.cc index 6f1c9f1..b944018 100644 --- a/cartographer_rviz/cartographer_rviz/ogre_slice.cc +++ b/cartographer_rviz/cartographer_rviz/ogre_slice.cc @@ -21,6 +21,9 @@ #include "OgreGpuProgramParams.h" #include "OgreImage.h" +#include "OgreMaterialManager.h" +#include "OgreTechnique.h" +#include "OgreTextureManager.h" #include "cartographer/common/port.h" namespace cartographer_rviz { diff --git a/cartographer_rviz/package.xml b/cartographer_rviz/package.xml index a6f6b2d..9b8bdcc 100644 --- a/cartographer_rviz/package.xml +++ b/cartographer_rviz/package.xml @@ -37,7 +37,6 @@ catkin git - g++-static cartographer cartographer_ros