1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870
|
include (${gazebo_cmake_dir}/GazeboUtils.cmake)
include (CheckCXXSourceCompiles)
include (${gazebo_cmake_dir}/FindOS.cmake)
include (FindPkgConfig)
include (${gazebo_cmake_dir}/FindFreeimage.cmake)
execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --modversion protobuf
OUTPUT_VARIABLE PROTOBUF_VERSION
RESULT_VARIABLE protobuf_modversion_failed)
########################################
# 1. can not use GAZEBO_BUILD_TYPE_PROFILE is defined after include this module
# 2. TODO: TOUPPER is a hack until we fix the build system to support standard build names
if (CMAKE_BUILD_TYPE)
string(TOUPPER ${CMAKE_BUILD_TYPE} TMP_CMAKE_BUILD_TYPE)
if ("${TMP_CMAKE_BUILD_TYPE}" STREQUAL "PROFILE")
include (${gazebo_cmake_dir}/FindGooglePerfTools.cmake)
if (GOOGLE_PERFTOOLS_FOUND)
message(STATUS "Include google-perftools")
else()
BUILD_ERROR("Need google/heap-profiler.h (libgoogle-perftools-dev) tools to compile in Profile mode")
endif()
endif()
endif()
########################################
if (PROTOBUF_VERSION LESS 2.3.0)
BUILD_ERROR("Incorrect version: Gazebo requires protobuf version 2.3.0 or greater")
endif()
########################################
# The Google Protobuf library for message generation + serialization
find_package(Protobuf REQUIRED)
if (NOT PROTOBUF_FOUND)
BUILD_ERROR ("Missing: Google Protobuf (libprotobuf-dev)")
endif()
if (NOT PROTOBUF_PROTOC_EXECUTABLE)
BUILD_ERROR ("Missing: Google Protobuf Compiler (protobuf-compiler)")
endif()
if (NOT PROTOBUF_PROTOC_LIBRARY)
BUILD_ERROR ("Missing: Google Protobuf Compiler Library (libprotoc-dev)")
endif()
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set (GZ_PROTOBUF_LIBRARY ${PROTOBUF_LIBRARY_DEBUG})
set (GZ_PROTOBUF_PROTOC_LIBRARY ${PROTOBUF_PROTOC_LIBRARY_DEBUG})
else()
set (GZ_PROTOBUF_LIBRARY ${PROTOBUF_LIBRARY})
set (GZ_PROTOBUF_PROTOC_LIBRARY ${PROTOBUF_PROTOC_LIBRARY})
endif()
########################################
include (FindOpenGL)
if (NOT OPENGL_FOUND)
BUILD_ERROR ("Missing: OpenGL")
set (HAVE_OPENGL FALSE)
else ()
if (OPENGL_INCLUDE_DIR)
APPEND_TO_CACHED_LIST(gazeboserver_include_dirs
${gazeboserver_include_dirs_desc}
${OPENGL_INCLUDE_DIR})
set (HAVE_OPENGL TRUE)
add_definitions(-DHAVE_OPENGL)
endif()
if (OPENGL_LIBRARIES)
APPEND_TO_CACHED_LIST(gazeboserver_link_libs
${gazeboserver_link_libs_desc}
${OPENGL_LIBRARIES})
endif()
endif ()
########################################
include (FindOpenAL)
if (NOT OPENAL_FOUND)
BUILD_WARNING ("OpenAL not found, audio support will be disabled.")
set (HAVE_OPENAL OFF CACHE BOOL "HAVE OpenAL" FORCE)
else ()
set (HAVE_OPENAL ON CACHE BOOL "HAVE OpenAL" FORCE)
endif ()
########################################
find_package(HDF5 COMPONENTS C CXX)
if (NOT HDF5_FOUND)
BUILD_WARNING("HDF5 not found")
else ()
message(STATUS "HDF5 Found")
endif ()
########################################
# Find packages
find_package(CURL)
if (CURL_FOUND)
# FindCURL.cmake distributed with CMake exports
# the CURL_INCLUDE_DIRS variable, while the pkg_check_modules
# function exports the CURL_INCLUDEDIR variable.
# TODO: once the configure.bat VS2013 based script has been removed,
# remove the call pkg_check_modules(CURL libcurl) and all the uses of
# CURL_LIBDIR and CURL_INCLUDEDIR and use directly the variables
# CURL_INCLUDE_DIRS and CURL_LIBRARIES provided by FindCURL.cmake
set(CURL_INCLUDEDIR ${CURL_INCLUDE_DIRS})
endif ()
# In Visual Studio we use configure.bat to trick all path cmake
# variables so let's consider that as a replacement for pkgconfig
if (MSVC)
set (PKG_CONFIG_FOUND TRUE)
endif()
if (PKG_CONFIG_FOUND)
if (NOT CURL_FOUND)
pkg_check_modules(CURL libcurl)
endif ()
if (NOT CURL_FOUND)
BUILD_ERROR ("Missing: libcurl. Required for connection to model database.")
endif()
pkg_check_modules(PROFILER libprofiler)
if (PROFILER_FOUND)
set (CMAKE_LINK_FLAGS_PROFILE "-Wl,--no-as-needed -lprofiler -Wl,--as-needed ${CMAKE_LINK_FLAGS_PROFILE}" CACHE INTERNAL "Link flags for profile")
else ()
find_library(PROFILER profiler)
if (PROFILER)
message (STATUS "Looking for libprofiler - found")
set (CMAKE_LINK_FLAGS_PROFILE "-Wl,--no-as-needed -lprofiler -Wl,--as-needed ${CMAKE_LINK_FLAGS_PROFILE}" CACHE INTERNAL "Link flags for profile")
else()
message (STATUS "Looking for libprofiler - not found")
endif()
endif()
pkg_check_modules(TCMALLOC libtcmalloc)
if (TCMALLOC_FOUND)
set (CMAKE_LINK_FLAGS_PROFILE "${CMAKE_LINK_FLAGS_PROFILE} -Wl,--no-as-needed -ltcmalloc -Wl,--no-as-needed"
CACHE INTERNAL "Link flags for profile" FORCE)
else ()
find_library(TCMALLOC tcmalloc)
if (TCMALLOC)
message (STATUS "Looking for libtcmalloc - found")
set (CMAKE_LINK_FLAGS_PROFILE "${CMAKE_LINK_FLAGS_PROFILE} -ltcmalloc"
CACHE INTERNAL "Link flags for profile" FORCE)
else ()
message (STATUS "Looking for libtcmalloc - not found")
endif()
endif ()
#################################################
# Find Simbody
set(SimTK_INSTALL_DIR ${SimTK_INSTALL_PREFIX})
#list(APPEND CMAKE_MODULE_PATH ${SimTK_INSTALL_PREFIX}/share/cmake)
find_package(Simbody)
if (Simbody_FOUND)
message (STATUS "Looking for Simbody - found")
set (HAVE_SIMBODY TRUE)
else()
message (STATUS "Looking for Simbody - not found")
BUILD_WARNING ("Simbody not found, for simbody physics engine option, please install libsimbody-dev.")
set (HAVE_SIMBODY FALSE)
endif()
#################################################
# Find DART
set(DART_MIN_REQUIRED_VERSION 6.6)
find_package(DART ${DART_MIN_REQUIRED_VERSION} CONFIG OPTIONAL_COMPONENTS collision-bullet collision-ode utils-urdf)
if (DART_FOUND)
message (STATUS "Looking for DART - found")
set (HAVE_DART TRUE)
if (DART_utils-urdf_FOUND)
set (HAVE_DART_URDF TRUE)
endif()
if (DART_collision-bullet_FOUND)
set (HAVE_DART_BULLET TRUE)
endif()
else()
message (STATUS "Looking for DART - not found")
BUILD_WARNING ("DART ${DART_MIN_REQUIRED_VERSION} not found, for dart physics engine option, please install libdart${DART_MIN_REQUIRED_VERSION}-dev.")
set (HAVE_DART FALSE)
endif()
#################################################
# Find tinyxml. Only debian distributions package tinyxml with a pkg-config
# Use pkg_check_modules and fallback to manual detection
# (needed, at least, for MacOS)
# Use system installation on UNIX and Apple, and internal copy on Windows
if (UNIX OR APPLE)
message (STATUS "Using system tinyxml.")
set (USE_EXTERNAL_TINYXML True)
elseif(WIN32)
message (STATUS "Using internal tinyxml.")
set (USE_EXTERNAL_TINYXML False)
add_definitions(-DTIXML_USE_STL)
else()
message (STATUS "Unknown platform, unable to configure tinyxml.")
BUILD_ERROR("Unknown platform")
endif()
if (USE_EXTERNAL_TINYXML)
pkg_check_modules(tinyxml tinyxml)
if (NOT tinyxml_FOUND)
find_path (tinyxml_INCLUDE_DIRS tinyxml.h ${tinyxml_INCLUDE_DIRS} ENV CPATH)
find_library(tinyxml_LIBRARIES NAMES tinyxml)
set (tinyxml_FAIL False)
if (NOT tinyxml_INCLUDE_DIRS)
message (STATUS "Looking for tinyxml headers - not found")
set (tinyxml_FAIL True)
endif()
if (NOT tinyxml_LIBRARIES)
message (STATUS "Looking for tinyxml library - not found")
set (tinyxml_FAIL True)
endif()
endif()
if (tinyxml_FAIL)
message (STATUS "Looking for tinyxml.h - not found")
BUILD_ERROR("Missing: tinyxml")
endif()
else()
# Needed in WIN32 since in UNIX the flag is added in the code installed
message (STATUS "Skipping search for tinyxml")
set (tinyxml_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/deps/win/tinyxml")
set (tinyxml_LIBRARIES "")
set (tinyxml_LIBRARY_DIRS "")
endif()
#################################################
# Find tinyxml2. Only debian distributions package tinyxml with a pkg-config
# Use pkg_check_modules and fallback to manual detection
# (needed, at least, for MacOS)
# Use system installation on UNIX and Apple, and internal copy on Windows
if (UNIX OR APPLE)
message (STATUS "Using system tinyxml2.")
set (USE_EXTERNAL_TINYXML2 True)
elseif(WIN32)
message (STATUS "Using internal tinyxml2.")
set (USE_EXTERNAL_TINYXML2 False)
else()
message (STATUS "Unknown platform, unable to configure tinyxml2.")
BUILD_ERROR("Unknown platform")
endif()
if (USE_EXTERNAL_TINYXML2)
pkg_check_modules(tinyxml2 tinyxml2)
if (NOT tinyxml2_FOUND)
find_path (tinyxml2_INCLUDE_DIRS tinyxml2.h ${tinyxml2_INCLUDE_DIRS} ENV CPATH)
find_library(tinyxml2_LIBRARIES NAMES tinyxml2)
set (tinyxml2_FAIL False)
if (NOT tinyxml2_INCLUDE_DIRS)
message (STATUS "Looking for tinyxml2 headers - not found")
set (tinyxml2_FAIL True)
endif()
if (NOT tinyxml2_LIBRARIES)
message (STATUS "Looking for tinyxml2 library - not found")
set (tinyxml2_FAIL True)
endif()
if (NOT tinyxml2_LIBRARY_DIRS)
message (STATUS "Looking for tinyxml2 library dirs - not found")
set (tinyxml2_FAIL True)
endif()
endif()
if (tinyxml2_FAIL)
message (STATUS "Looking for tinyxml2.h - not found")
BUILD_ERROR("Missing: tinyxml2")
else()
include_directories(${tinyxml2_INCLUDE_DIRS})
link_directories(${tinyxml2_LIBRARY_DIRS})
endif()
else()
# Needed in WIN32 since in UNIX the flag is added in the code installed
message (STATUS "Skipping search for tinyxml2")
set (tinyxml2_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/deps/tinyxml2")
set (tinyxml2_LIBRARIES "")
set (tinyxml2_LIBRARY_DIRS "")
endif()
if (NOT WIN32)
#################################################
# Find libtar.
find_path (libtar_INCLUDE_DIRS libtar.h)
find_library(libtar_LIBRARIES tar)
set (LIBTAR_FOUND True)
if (NOT libtar_INCLUDE_DIRS)
message (STATUS "Looking for libtar.h - not found")
set (LIBTAR_FOUND False)
else ()
message (STATUS "Looking for libtar.h - found")
include_directories(${libtar_INCLUDE_DIRS})
endif ()
if (NOT libtar_LIBRARIES)
message (STATUS "Looking for libtar.so - not found")
set (LIBTAR_FOUND False)
else ()
message (STATUS "Looking for libtar.so - found")
endif ()
if (NOT LIBTAR_FOUND)
BUILD_ERROR("Missing: libtar")
endif()
else()
set(libtar_LIBRARIES "")
endif()
#################################################
# Find TBB
pkg_check_modules(TBB tbb)
set (TBB_PKG_CONFIG "tbb")
if (NOT TBB_FOUND)
message(STATUS "TBB not found, attempting to detect manually")
set (TBB_PKG_CONFIG "")
# Workaround for CMake bug https://gitlab.kitware.com/cmake/cmake/issues/17135
unset(TBB_FOUND CACHE)
find_package(TBB CONFIG)
if (TBB_FOUND)
set(TBB_LIBRARIES TBB::tbb)
endif()
if (NOT TBB_FOUND)
find_library(tbb_library tbb ENV LD_LIBRARY_PATH)
if (tbb_library)
set(TBB_FOUND true)
set(TBB_LIBRARIES ${tbb_library})
else (tbb_library)
BUILD_ERROR ("Missing: TBB - Threading Building Blocks")
endif(tbb_library)
endif (NOT TBB_FOUND)
endif (NOT TBB_FOUND)
#################################################
# Find OGRE
if (PKG_CONFIG_EXECUTABLE AND NOT DEFINED OGRE_VERSION)
execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --modversion OGRE
OUTPUT_VARIABLE OGRE_VERSION)
string(REPLACE "\n" "" OGRE_VERSION ${OGRE_VERSION})
string (REGEX REPLACE "^([0-9]+).*" "\\1"
OGRE_MAJOR_VERSION "${OGRE_VERSION}")
string (REGEX REPLACE "^[0-9]+\\.([0-9]+).*" "\\1"
OGRE_MINOR_VERSION "${OGRE_VERSION}")
string (REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1"
OGRE_PATCH_VERSION ${OGRE_VERSION})
set(OGRE_VERSION
${OGRE_MAJOR_VERSION}.${OGRE_MINOR_VERSION}.${OGRE_PATCH_VERSION})
endif()
pkg_check_modules(OGRE-RTShaderSystem
OGRE-RTShaderSystem>=${MIN_OGRE_VERSION})
if (OGRE-RTShaderSystem_FOUND)
set(ogre_ldflags ${OGRE-RTShaderSystem_LDFLAGS})
set(ogre_include_dirs ${OGRE-RTShaderSystem_INCLUDE_DIRS})
set(ogre_libraries ${OGRE-RTShaderSystem_LIBRARIES})
set(ogre_library_dirs ${OGRE-RTShaderSystem_LIBRARY_DIRS})
set(ogre_cflags ${OGRE-RTShaderSystem_CFLAGS})
set (INCLUDE_RTSHADER ON CACHE BOOL "Enable GPU shaders")
else ()
set (INCLUDE_RTSHADER OFF CACHE BOOL "Enable GPU shaders")
endif ()
pkg_check_modules(OGRE OGRE>=${MIN_OGRE_VERSION})
if (NOT OGRE_FOUND)
# Workaround for CMake bug https://gitlab.kitware.com/cmake/cmake/issues/17135,
# that prevents to successfully run a find_package(<package>) call if before there
# was a failed call to pkg_check_modules(<package> <package>)
unset(OGRE_FOUND CACHE)
# If OGRE was not found, try with the standard find_package(OGRE)
find_package(OGRE COMPONENTS RTShaderSystem Terrain Overlay Paging)
# Add each component include directories to OGRE_INCLUDE_DIRS because
# some OGRE components headers include without prefix headers contained
# in other components (see http://www.ogre3d.org/forums/viewtopic.php?f=2&t=73222)
list(APPEND OGRE_INCLUDE_DIRS ${OGRE_RTShaderSystem_INCLUDE_DIRS})
list(APPEND OGRE_INCLUDE_DIRS ${OGRE_Terrain_INCLUDE_DIRS})
list(APPEND OGRE_INCLUDE_DIRS ${OGRE_Overlay_INCLUDE_DIRS})
list(APPEND OGRE_INCLUDE_DIRS ${OGRE_Paging_INCLUDE_DIRS})
list(APPEND OGRE_LIBRARIES ${OGRE_RTShaderSystem_LIBRARIES})
list(APPEND OGRE_LIBRARIES ${OGRE_Terrain_LIBRARIES})
list(APPEND OGRE_LIBRARIES ${OGRE_Overlay_LIBRARIES})
list(APPEND OGRE_LIBRARIES ${OGRE_Paging_LIBRARIES})
# Workaround for https://github.com/OGRECave/ogre/issues/1499
# On Ogre < 1.13, the definition of OGRE_PLUGIN_DIR in the OGRE CMake
# configuration file on Windows is wrong. To avoid problem, on Windows
# we set OGRE_PLUGINDIR manually
if (WIN32)
set(OGRE_PLUGINDIR ${OGRE_PREFIX_DIR}/bin)
else ()
set(OGRE_PLUGINDIR ${OGRE_PLUGIN_DIR})
endif ()
endif ()
if (NOT OGRE_FOUND)
BUILD_ERROR("Missing: Ogre3d version >=${MIN_OGRE_VERSION}(http://www.orge3d.org)")
else ()
set(ogre_ldflags ${ogre_ldflags} ${OGRE_LDFLAGS})
set(ogre_include_dirs ${ogre_include_dirs} ${OGRE_INCLUDE_DIRS})
set(ogre_libraries ${ogre_libraries};${OGRE_LIBRARIES})
set(ogre_library_dirs ${ogre_library_dirs} ${OGRE_LIBRARY_DIRS})
set(ogre_cflags ${ogre_cflags} ${OGRE_CFLAGS})
endif ()
pkg_check_modules(OGRE-Terrain OGRE-Terrain)
if (OGRE-Terrain_FOUND)
set(ogre_ldflags ${ogre_ldflags} ${OGRE-Terrain_LDFLAGS})
set(ogre_include_dirs ${ogre_include_dirs} ${OGRE-Terrain_INCLUDE_DIRS})
set(ogre_libraries ${ogre_libraries};${OGRE-Terrain_LIBRARIES})
set(ogre_library_dirs ${ogre_library_dirs} ${OGRE-Terrain_LIBRARY_DIRS})
set(ogre_cflags ${ogre_cflags} ${OGRE-Terrain_CFLAGS})
endif()
pkg_check_modules(OGRE-Overlay OGRE-Overlay)
if (OGRE-Overlay_FOUND)
set(ogre_ldflags ${ogre_ldflags} ${OGRE-Overlay_LDFLAGS})
set(ogre_include_dirs ${ogre_include_dirs} ${OGRE-Overlay_INCLUDE_DIRS})
set(ogre_libraries ${ogre_libraries};${OGRE-Overlay_LIBRARIES})
set(ogre_library_dirs ${ogre_library_dirs} ${OGRE-Overlay_LIBRARY_DIRS})
set(ogre_cflags ${ogre_cflags} ${OGRE-Overlay_CFLAGS})
endif()
set (OGRE_INCLUDE_DIRS ${ogre_include_dirs}
CACHE INTERNAL "Ogre include path")
# Also find OGRE's plugin directory, which is provided in its .pc file as the
# `plugindir` variable. We have to call pkg-config manually to get it.
if (PKG_CONFIG_EXECUTABLE)
execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=plugindir OGRE
OUTPUT_VARIABLE _pkgconfig_invoke_result
RESULT_VARIABLE _pkgconfig_failed)
if(_pkgconfig_failed)
BUILD_WARNING ("Failed to find OGRE's plugin directory. The build will succeed, but gazebo will likely fail to run.")
else()
# This variable will be substituted into cmake/setup.sh.in
set (OGRE_PLUGINDIR ${_pkgconfig_invoke_result})
endif()
endif()
########################################
# Check and find libccd (if needed)
pkg_check_modules(CCD ccd>=1.4)
if (NOT CCD_FOUND)
message(STATUS "Using internal copy of libccd")
set(CCD_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/deps/libccd/include")
set(CCD_LIBRARY_DIRS "${CMAKE_BINARY_DIR}/deps/libccd")
set(CCD_LIBRARIES gazebo_ccd)
endif()
########################################
# Find OpenAL
# pkg_check_modules(OAL openal)
# if (NOT OAL_FOUND)
# BUILD_WARNING ("Openal not found. Audio capabilities will be disabled.")
# set (HAVE_OPENAL FALSE)
# else (NOT OAL_FOUND)
# set (HAVE_OPENAL TRUE)
# endif ()
########################################
# Find libswscale format
pkg_check_modules(libswscale libswscale)
if (NOT libswscale_FOUND)
BUILD_WARNING ("libswscale not found. Audio-video capabilities will be disabled.")
else()
include_directories(${libswscale_INCLUDE_DIRS})
link_directories(${libswscale_LIBRARY_DIRS})
endif ()
########################################
# Find AV device. Only check for this on linux.
if (UNIX)
pkg_check_modules(libavdevice libavdevice>=56.4.100)
if (NOT libavdevice_FOUND)
BUILD_WARNING ("libavdevice not found. Recording to a video device will be disabled.")
else()
include_directories(${libavdevice_INCLUDE_DIRS})
link_directories(${libavdevice_LIBRARY_DIRS})
endif ()
endif ()
if (NOT libavdevice_FOUND)
set (HAVE_AVDEVICE False)
else()
set (HAVE_AVDEVICE True)
endif()
########################################
# Find AV format
pkg_check_modules(libavformat libavformat)
if (NOT libavformat_FOUND)
BUILD_WARNING ("libavformat not found. Audio-video capabilities will be disabled.")
else()
include_directories(${libavformat_INCLUDE_DIRS})
link_directories(${libavformat_LIBRARY_DIRS})
endif ()
########################################
# Find avcodec
pkg_check_modules(libavcodec libavcodec)
if (NOT libavcodec_FOUND)
BUILD_WARNING ("libavcodec not found. Audio-video capabilities will be disabled.")
else()
include_directories(${libavcodec_INCLUDE_DIRS})
link_directories(${libavcodec_LIBRARY_DIRS})
endif ()
########################################
# Find avutil
pkg_check_modules(libavutil libavutil)
if (NOT libavutil_FOUND)
BUILD_WARNING ("libavutil not found. Audio-video capabilities will be disabled.")
endif ()
if (libavutil_FOUND AND libavformat_FOUND AND libavcodec_FOUND AND
libswscale_FOUND)
set (HAVE_FFMPEG TRUE)
else ()
set (HAVE_FFMPEG FALSE)
endif ()
########################################
# Find Player
pkg_check_modules(PLAYER playercore>=3.0 playerc++ playerwkb)
if (NOT PLAYER_FOUND)
set (INCLUDE_PLAYER OFF CACHE BOOL "Build gazebo plugin for player")
BUILD_WARNING ("Player not found, gazebo plugin for player will not be built.")
else (NOT PLAYER_FOUND)
set (INCLUDE_PLAYER ON CACHE BOOL "Build gazebo plugin for player")
set (PLAYER_INCLUDE_DIRS ${PLAYER_INCLUDE_DIRS} CACHE INTERNAL
"Player include directory")
set (PLAYER_LINK_DIRS ${PLAYER_LINK_DIRS} CACHE INTERNAL
"Player link directory")
set (PLAYER_LINK_LIBS ${PLAYER_LIBRARIES} CACHE INTERNAL
"Player libraries")
endif ()
########################################
# Find GNU Triangulation Surface Library
pkg_check_modules(gts gts)
if (gts_FOUND)
message (STATUS "Looking for GTS - found")
set (HAVE_GTS TRUE)
else ()
set (HAVE_GTS FALSE)
BUILD_WARNING ("GNU Triangulation Surface library not found - Gazebo will not have CSG support.")
endif ()
#################################################
# Find bullet
# First and preferred option is to look for bullet standard pkgconfig,
# so check it first. if it is not present, check for the OSRF
# custom bullet2.82.pc file
pkg_check_modules(BULLET bullet>=2.82)
if (NOT BULLET_FOUND)
pkg_check_modules(BULLET bullet2.82>=2.82)
endif()
if (BULLET_FOUND)
set (HAVE_BULLET TRUE)
add_definitions( -DLIBBULLET_VERSION=${BULLET_VERSION} )
else()
set (HAVE_BULLET FALSE)
add_definitions( -DLIBBULLET_VERSION=0.0 )
BUILD_WARNING ("Bullet > 2.82 not found, for bullet physics engine option, please install libbullet2.82-dev.")
endif()
if (BULLET_VERSION VERSION_GREATER 2.82)
add_definitions( -DLIBBULLET_VERSION_GT_282 )
endif()
########################################
# Find libusb
pkg_check_modules(libusb-1.0 libusb-1.0)
if (NOT libusb-1.0_FOUND)
BUILD_WARNING ("libusb-1.0 not found. USB peripherals support will be disabled.")
set (HAVE_USB OFF CACHE BOOL "HAVE USB" FORCE)
else()
message (STATUS "Looking for libusb-1.0 - found. USB peripherals support enabled.")
set (HAVE_USB ON CACHE BOOL "HAVE USB" FORCE)
include_directories(${libusb-1.0_INCLUDE_DIRS})
link_directories(${libusb-1.0_LIBRARY_DIRS})
endif ()
#################################################
# Find Oculus SDK.
pkg_check_modules(OculusVR OculusVR)
if (HAVE_USB AND OculusVR_FOUND)
message (STATUS "Oculus Rift support enabled.")
set (HAVE_OCULUS ON CACHE BOOL "HAVE OCULUS" FORCE)
include_directories(SYSTEM ${OculusVR_INCLUDE_DIRS})
link_directories(${OculusVR_LIBRARY_DIRS})
else ()
BUILD_WARNING ("Oculus Rift support will be disabled.")
set (HAVE_OCULUS OFF CACHE BOOL "HAVE OCULUS" FORCE)
endif()
else (PKG_CONFIG_FOUND)
set (BUILD_GAZEBO OFF CACHE INTERNAL "Build Gazebo" FORCE)
BUILD_ERROR ("Error: pkg-config not found")
endif ()
########################################
# Find SDFormat
set(SDF_MIN_REQUIRED_VERSION 9.1)
find_package(sdformat9 ${SDF_MIN_REQUIRED_VERSION} REQUIRED)
if (sdformat9_FOUND)
message (STATUS "Looking for SDFormat9 - found")
else ()
message (STATUS "Looking for SDFormat9 - not found")
BUILD_ERROR ("Missing: SDF version >=${SDF_MIN_REQUIRED_VERSION}. Required for reading and writing SDF files.")
endif()
########################################
# Find QT
find_package(Qt5 COMPONENTS Core Widgets OpenGL Test REQUIRED)
########################################
# Find tinyobjloader
find_package(tinyobjloader REQUIRED)
########################################
# Find Boost, if not specified manually
include(FindBoost)
find_package(Boost ${MIN_BOOST_VERSION} REQUIRED thread system filesystem program_options regex iostreams date_time)
if (NOT Boost_FOUND)
set (BUILD_GAZEBO OFF CACHE INTERNAL "Build Gazebo" FORCE)
BUILD_ERROR ("Boost not found. Please install thread system filesystem program_options regex iostreams date_time boost version ${MIN_BOOST_VERSION} or higher.")
endif()
########################################
# Find libdl
find_path(libdl_include_dir dlfcn.h /usr/include /usr/local/include)
if (NOT libdl_include_dir)
message (STATUS "Looking for dlfcn.h - not found")
BUILD_ERROR ("Missing libdl: Required for plugins.")
set (libdl_include_dir /usr/include)
else (NOT libdl_include_dir)
message (STATUS "Looking for dlfcn.h - found")
endif ()
find_library(libdl_library dl /usr/lib /usr/local/lib)
if (NOT libdl_library)
message (STATUS "Looking for libdl - not found")
BUILD_ERROR ("Missing libdl: Required for plugins.")
set(libdl_library "")
else (NOT libdl_library)
message (STATUS "Looking for libdl - found")
endif ()
########################################
# Find gdal
include (FindGDAL)
if (NOT GDAL_FOUND)
message (STATUS "Looking for libgdal - not found")
BUILD_WARNING ("GDAL not found, Digital elevation terrains support will be disabled.")
set (HAVE_GDAL OFF CACHE BOOL "HAVE GDAL" FORCE)
else ()
message (STATUS "Looking for libgdal - found")
set (HAVE_GDAL ON CACHE BOOL "HAVE GDAL" FORCE)
endif ()
########################################
# Include man pages stuff
include (${gazebo_cmake_dir}/Ronn2Man.cmake)
include (${gazebo_cmake_dir}/Man.cmake)
add_manpage_target()
########################################
# Find Space Navigator header and library
find_library(SPNAV_LIBRARY NAMES spnav)
find_file(SPNAV_HEADER NAMES spnav.h)
if (SPNAV_LIBRARY AND SPNAV_HEADER)
message(STATUS "Looking for libspnav and spnav.h - found")
set(HAVE_SPNAV TRUE)
else()
message(STATUS "Looking for libspnav and spnav.h - not found")
set(HAVE_SPNAV FALSE)
endif()
########################################
# Find xsltproc, which is used by tools/check_test_ran.py
find_program(XSLTPROC xsltproc)
if (NOT EXISTS ${XSLTPROC})
BUILD_WARNING("xsltproc not found. The check_test_ran.py script will cause tests to fail.")
endif()
########################################
# Find uuid-dev Library
#pkg_check_modules(uuid uuid)
#if (uuid_FOUND)
# message (STATUS "Looking for uuid - found")
# set (HAVE_UUID TRUE)
#else ()
# set (HAVE_UUID FALSE)
# BUILD_WARNING ("uuid-dev library not found - Gazebo will not have uuid support.")
#endif ()
########################################
# Find uuid
# - In UNIX we use uuid library.
# - In Windows the native RPC call, no dependency needed.
if (UNIX)
pkg_check_modules(uuid uuid)
if (uuid_FOUND)
message (STATUS "Looking for uuid - found")
set (HAVE_UUID TRUE)
else ()
set (HAVE_UUID FALSE)
BUILD_WARNING ("uuid-dev library not found - Gazebo will not have uuid support.")
endif ()
else()
message (STATUS "Using Windows RPC UuidCreate function")
set (HAVE_UUID TRUE)
endif()
########################################
# Find graphviz
include (${gazebo_cmake_dir}/FindGraphviz.cmake)
if (NOT GRAPHVIZ_FOUND)
message (STATUS "Looking for libgraphviz-dev - not found")
BUILD_WARNING ("Graphviz not found, Model editor's schematic view will be disabled.")
set (HAVE_GRAPHVIZ OFF CACHE BOOL "HAVE GRAPHVIZ" FORCE)
else ()
message (STATUS "Looking for libgraphviz-dev - found")
set (HAVE_GRAPHVIZ ON CACHE BOOL "HAVE GRAPHVIZ" FORCE)
endif ()
########################################
# Find ignition msgs
find_package(ignition-msgs5 5.1 QUIET)
if (NOT ignition-msgs5_FOUND)
message(STATUS "Looking for ignition-msgs5-config.cmake - not found")
BUILD_ERROR ("Missing: Ignition msgs5 library (libignition-msgs5-dev).")
else()
message(STATUS "Looking for ignition-msgs5-config.cmake - found")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ignition-msgs5_CXX_FLAGS}")
include_directories(${ignition-msgs5_INCLUDE_DIRS})
link_directories(${ignition-msgs5_LIBRARY_DIRS})
endif()
########################################
# Find ignition math library
find_package(ignition-math6 QUIET)
if (NOT ignition-math6_FOUND)
message(STATUS "Looking for ignition-math6-config.cmake - not found")
BUILD_ERROR ("Missing: Ignition math (libignition-math6-dev)")
else()
message(STATUS "Looking for ignition-math6-config.cmake - found")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ignition-math6_CXX_FLAGS}")
include_directories(${ignition-math6_INCLUDE_DIRS})
link_directories(${ignition-math6_LIBRARY_DIRS})
endif()
########################################
# Find the Ignition_Transport library
find_package(ignition-transport8 QUIET)
if (NOT ignition-transport8_FOUND)
message(STATUS "Looking for ignition-transport8 - not found")
BUILD_ERROR ("Missing: Ignition Transport (libignition-transport8-dev)")
else()
message(STATUS "Looking for ignition-transport8-config.cmake - found")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ignition-transport8_CXX_FLAGS}")
include_directories(${ignition-transport8_INCLUDE_DIRS})
link_directories(${ignition-transport8_LIBRARY_DIRS})
endif()
################################################################################
# Find the Ignition Common library
find_package(ignition-common3 QUIET
COMPONENTS
graphics
profiler)
if (NOT ignition-common3_FOUND)
message(STATUS "Looking for ignition-common3 - not found")
BUILD_ERROR ("Missing: Ignition Common (libignition-common3-dev")
else()
message (STATUS "Looking for libignition-common3 - found")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ignition-common3_CXX_FLAGS}")
include_directories(${ignition-common3_INCLUDE_DIRS})
link_directories(${ignition-common3_LIBRARY_DIRS})
endif()
################################################################################
# Find the Ignition Fuel Tools library
find_package(ignition-fuel_tools4 QUIET)
if (NOT ignition-fuel_tools4_FOUND)
message (STATUS "Looking for libignition-fuel_tools4 - not found")
BUILD_ERROR ("Missing: Ignition Fuel Tools (libignition-fuel-tools4-dev")
else()
message (STATUS "Looking for libignition-fuel_tools4 - found")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ignition-fuel_tools4_CXX_FLAGS}")
include_directories(${ignition-fuel_tools4_INCLUDE_DIRS})
link_directories(${ignition-fuel_tools4_LIBRARY_DIRS})
endif()
################################################
# Find Valgrind for checking memory leaks in the
# tests
find_program(VALGRIND_PROGRAM NAMES valgrind PATH ${VALGRIND_ROOT}/bin)
option(GAZEBO_RUN_VALGRIND_TESTS "Run gazebo tests with Valgrind" FALSE)
mark_as_advanced(GAZEBO_RUN_VALGRIND_TESTS)
if (GAZEBO_RUN_VALGRIND_TESTS AND NOT VALGRIND_PROGRAM)
BUILD_WARNING("valgrind not found. Memory check tests will be skipped.")
endif()
########################################
# Find OSVR SDK
find_library(OSVR_CLIENTKIT_LIBRARY NAMES osvrClientKit)
find_file(OSVR_CLIENTKIT_HEADER NAMES osvr/ClientKit/ClientKit.h)
if (OSVR_CLIENTKIT_LIBRARY AND OSVR_CLIENTKIT_HEADER)
message(STATUS "Looking for libosvrClientKit and ClientKit.h - found")
set(HAVE_OSVR TRUE)
else()
message(STATUS "Looking for libosvrClientKit and ClientKit.h - not found")
BUILD_WARNING("OpenSource Virtual Reality (OSVR) support will be disabled.")
set(HAVE_OSVR FALSE)
endif()
########################################
# Find QWT (QT graphing library)
find_path(QWT_INCLUDE_DIR NAMES qwt.h PATHS
/usr/include
/usr/local/include
/usr/local/lib/qwt.framework/Headers
${QWT_WIN_INCLUDE_DIR}
PATH_SUFFIXES qwt qwt5
)
find_library(QWT_LIBRARY NAMES qwt-qt5 qwt PATHS
/usr/lib
/usr/local/lib
/usr/local/lib/qwt.framework
${QWT_WIN_LIBRARY_DIR}
)
# version
set ( _VERSION_FILE ${QWT_INCLUDE_DIR}/qwt_global.h )
file ( STRINGS ${_VERSION_FILE} _VERSION_LINE REGEX "define[ ]+QWT_VERSION_STR" )
if ( _VERSION_LINE )
string ( REGEX REPLACE ".*define[ ]+QWT_VERSION_STR[ ]+\"(.*)\".*" "\\1"
QWT_VERSION_STRING "${_VERSION_LINE}" )
string ( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+).*" "\\1"
QWT_MAJOR_VERSION "${QWT_VERSION_STRING}" )
string ( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+).*" "\\2"
QWT_MINOR_VERSION "${QWT_VERSION_STRING}" )
string ( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+).*" "\\3"
QWT_PATCH_VERSION "${QWT_VERSION_STRING}" )
set(QWT_VERSION
${QWT_MAJOR_VERSION}.${QWT_MINOR_VERSION}.${QWT_PATCH_VERSION})
endif ()
# in Windows, the path need to point to the parent to get correct qwt/foo headers
if (WIN32)
SET(QWT_INCLUDE_DIR "${QWT_INCLUDE_DIR}\\..")
endif()
if (QWT_INCLUDE_DIR AND QWT_LIBRARY AND (NOT ${QWT_VERSION} VERSION_LESS 6.1.0))
message (STATUS "Looking for qwt - found: version ${QWT_VERSION}")
else()
message (STATUS "Looking for qwt >= 6.1.0 - not found")
BUILD_ERROR ("Missing: libqwt-dev. Required for plotting.")
endif ()
|