Windows build & Azure CI (#1103)

master
Juraj Oršulić 2018-12-17 20:47:57 +01:00 committed by Alexander Belyaev
parent 91fd8feb62
commit 35ad459bd9
8 changed files with 110 additions and 9 deletions

70
azure-pipelines.yml Normal file
View File

@ -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()

View File

@ -35,9 +35,18 @@ set(PACKAGE_DEPENDENCIES
visualization_msgs 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) find_package(cartographer REQUIRED)
include("${CARTOGRAPHER_CMAKE_DIR}/functions.cmake") include("${CARTOGRAPHER_CMAKE_DIR}/functions.cmake")
set(BUILD_SHARED_LIBS OFF)
option(BUILD_GRPC "build features that require Cartographer gRPC support" false) option(BUILD_GRPC "build features that require Cartographer gRPC support" false)
google_initialize_cartographer_project() google_initialize_cartographer_project()
google_enable_testing() google_enable_testing()
@ -48,9 +57,7 @@ include(FindPkgConfig)
find_package(Abseil REQUIRED) find_package(Abseil REQUIRED)
find_package(LuaGoogle REQUIRED) find_package(LuaGoogle REQUIRED)
find_package(PCL REQUIRED COMPONENTS common)
find_package(Eigen3 REQUIRED) find_package(Eigen3 REQUIRED)
find_package(Boost REQUIRED COMPONENTS system iostreams)
find_package(urdfdom_headers REQUIRED) find_package(urdfdom_headers REQUIRED)
if(DEFINED urdfdom_headers_VERSION) 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_TESTS ${ALL_GRPC_FILES})
list(REMOVE_ITEM ALL_EXECUTABLES ${ALL_GRPC_FILES}) list(REMOVE_ITEM ALL_EXECUTABLES ${ALL_GRPC_FILES})
endif() endif()
add_library(${PROJECT_NAME} ${ALL_SRCS}) add_library(${PROJECT_NAME} STATIC ${ALL_SRCS})
add_subdirectory("cartographer_ros") add_subdirectory("cartographer_ros")
target_link_libraries(${PROJECT_NAME} PUBLIC cartographer) 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} cartographer)
target_link_libraries(${TEST_NAME} ${PROJECT_NAME}) target_link_libraries(${TEST_NAME} ${PROJECT_NAME})
set_target_properties(${TEST_NAME} PROPERTIES COMPILE_FLAGS ${TARGET_COMPILE_FLAGS}) 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() endforeach()
endif() endif()

View File

@ -35,6 +35,12 @@
#include "cartographer_ros_msgs/SubmapList.h" #include "cartographer_ros_msgs/SubmapList.h"
#include "cartographer_ros_msgs/SubmapQuery.h" #include "cartographer_ros_msgs/SubmapQuery.h"
#include "nav_msgs/OccupancyGrid.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" #include "visualization_msgs/MarkerArray.h"
namespace cartographer_ros { namespace cartographer_ros {

View File

@ -18,7 +18,9 @@
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
#ifndef WIN32
#include <sys/resource.h> #include <sys/resource.h>
#endif
#include <time.h> #include <time.h>
#include <chrono> #include <chrono>

View File

@ -38,7 +38,6 @@
<build_depend>git</build_depend> <build_depend>git</build_depend>
<build_depend>google-mock</build_depend> <build_depend>google-mock</build_depend>
<build_depend>g++-static</build_depend>
<build_depend>protobuf-dev</build_depend> <build_depend>protobuf-dev</build_depend>
<build_depend>python-sphinx</build_depend> <build_depend>python-sphinx</build_depend>

View File

@ -26,13 +26,16 @@ set(PACKAGE_DEPENDENCIES
rviz rviz
) )
if(WIN32)
set(Boost_USE_STATIC_LIBS FALSE)
endif()
find_package(Boost REQUIRED COMPONENTS system iostreams)
find_package(cartographer REQUIRED) find_package(cartographer REQUIRED)
include("${CARTOGRAPHER_CMAKE_DIR}/functions.cmake") include("${CARTOGRAPHER_CMAKE_DIR}/functions.cmake")
google_initialize_cartographer_project() google_initialize_cartographer_project()
find_package(Abseil REQUIRED) find_package(Abseil REQUIRED)
find_package(Eigen3 REQUIRED) find_package(Eigen3 REQUIRED)
find_package(Boost REQUIRED COMPONENTS system iostreams)
find_package(catkin REQUIRED COMPONENTS ${PACKAGE_DEPENDENCIES}) find_package(catkin REQUIRED COMPONENTS ${PACKAGE_DEPENDENCIES})
catkin_package( catkin_package(
@ -52,7 +55,7 @@ if(rviz_QT_VERSION VERSION_LESS "5")
else() else()
message(STATUS "Using Qt5 based on the rviz_QT_VERSION: ${rviz_QT_VERSION}") message(STATUS "Using Qt5 based on the rviz_QT_VERSION: ${rviz_QT_VERSION}")
find_package(Qt5 ${rviz_QT_VERSION} EXACT REQUIRED Core Widgets) 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}) include_directories(${Qt5Widgets_INCLUDE_DIRS})
endif() endif()
add_definitions(-DQT_NO_KEYWORDS) add_definitions(-DQT_NO_KEYWORDS)
@ -85,10 +88,18 @@ set_target_properties(${PROJECT_NAME} PROPERTIES
target_link_libraries(${PROJECT_NAME} PUBLIC cartographer) 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} install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY 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 install(FILES rviz_plugin_description.xml

View File

@ -21,6 +21,9 @@
#include "OgreGpuProgramParams.h" #include "OgreGpuProgramParams.h"
#include "OgreImage.h" #include "OgreImage.h"
#include "OgreMaterialManager.h"
#include "OgreTechnique.h"
#include "OgreTextureManager.h"
#include "cartographer/common/port.h" #include "cartographer/common/port.h"
namespace cartographer_rviz { namespace cartographer_rviz {

View File

@ -37,7 +37,6 @@
<buildtool_depend>catkin</buildtool_depend> <buildtool_depend>catkin</buildtool_depend>
<build_depend>git</build_depend> <build_depend>git</build_depend>
<build_depend>g++-static</build_depend>
<depend version_gte="1.0.0">cartographer</depend> <depend version_gte="1.0.0">cartographer</depend>
<depend version_gte="1.0.0">cartographer_ros</depend> <depend version_gte="1.0.0">cartographer_ros</depend>