CMakeLists.txt 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. cmake_minimum_required(VERSION 2.8.3)
  2. project(citysim)
  3. set (CITYSIM_MAJOR_VERSION 0)
  4. set (CITYSIM_MINOR_VERSION 1)
  5. set (CITYSIM_PATCH_VERSION 0)
  6. set (CITYSIM_VERSION_FULL ${CITYSIM_MAJOR_VERSION}.${CITYSIM_MINOR_VERSION}.${CITYSIM_PATCH_VERSION})
  7. # Packaging configuration
  8. set (CPACK_PACKAGE_VERSION "${CITYSIM_VERSION_FULL}")
  9. set (CPACK_PACKAGE_VERSION_MAJOR "${CITYSIM_MAJOR_VERSION}")
  10. set (CPACK_PACKAGE_VERSION_MINOR "${CITYSIM_MINOR_VERSION}")
  11. set (CPACK_PACKAGE_VERSION_PATCH "${CITYSIM_PATCH_VERSION}")
  12. list (APPEND CPACK_SOURCE_GENERATOR "TBZ2")
  13. list (APPEND CPACK_SOURCE_IGNORE_FILES ";/.hg/;.hgignore;.swp$;/build/")
  14. set (CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${CITYSIM_VERSION_FULL}")
  15. include (CPack)
  16. #####################################
  17. # Set the default build type
  18. if (NOT CMAKE_BUILD_TYPE)
  19. set (CMAKE_BUILD_TYPE "Release" CACHE STRING
  20. "Choose the type of build, options are: Debug Release RelWithDebInfo" FORCE)
  21. message(STATUS "Build type not selected: Release selected by default")
  22. endif (NOT CMAKE_BUILD_TYPE)
  23. find_package(gazebo REQUIRED)
  24. if(GAZEBO_MAJOR_VERSION LESS 9)
  25. # build skip
  26. else()
  27. find_package (Qt5Widgets REQUIRED)
  28. find_package (Qt5Core REQUIRED)
  29. include(GNUInstallDirs)
  30. if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
  31. set(CMAKE_INSTALL_LIBDIR lib)
  32. endif(NOT DEFINED CMAKE_INSTALL_LIBDIR)
  33. set(CITYSIM_PLUGIN_INSTALL_DIR
  34. ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/citysim-${CITYSIM_MAJOR_VERSION}/plugins
  35. )
  36. # Generate the setup.sh file
  37. configure_file(${CMAKE_SOURCE_DIR}/cmake/setup.sh.in ${PROJECT_BINARY_DIR}/setup.sh @ONLY)
  38. install(FILES ${CMAKE_CURRENT_BINARY_DIR}/setup.sh DESTINATION ${CMAKE_INSTALL_PREFIX}/share/citysim-${CITYSIM_MAJOR_VERSION}/)
  39. # Also install the setup.sh in an unversioned location
  40. install(FILES ${CMAKE_CURRENT_BINARY_DIR}/setup.sh DESTINATION ${CMAKE_INSTALL_PREFIX}/share/citysim/)
  41. add_subdirectory(plugins)
  42. add_subdirectory(models)
  43. add_subdirectory(worlds)
  44. add_subdirectory(media)
  45. endif()
  46. # Warn : Running tests with colcon requires test targets.
  47. # However, actual tests are not implemented
  48. add_custom_target(tests
  49. COMMAND echo "Running tests with colcon requires test targets. However, actual tests are not implemented"
  50. )