CMakeLists.txt 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. cmake_minimum_required(VERSION 3.13)
  2. if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.12)
  3. cmake_policy(SET CMP0074 NEW)
  4. endif()
  5. set(ROTOR_LIGHT_VERSION "0.01")
  6. project (rotor_light LANGUAGES CXX VERSION ${ROTOR_LIGHT_VERSION})
  7. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
  8. if (NOT DEFINED CMAKE_CXX_VISIBILITY_PRESET AND
  9. NOT DEFINED CMAKE_VISIBILITY_INLINES_HIDDEN)
  10. set(CMAKE_CXX_VISIBILITY_PRESET hidden)
  11. set(CMAKE_VISIBILITY_INLINES_HIDDEN YES)
  12. endif ()
  13. set(ROTOR_LIGHT_TIMEPOINT "int64_t" CACHE STRING "TimePoint type [default: int64_t]")
  14. set(ROTOR_LIGHT_DURATION "int32_t" CACHE STRING "Duration type [default: int32_t]")
  15. include(CMakePrintHelpers)
  16. include(GenerateExportHeader)
  17. add_library(rotor_light
  18. src/rotor-light/actor.cpp
  19. src/rotor-light/queue.cpp
  20. src/rotor-light/planner.cpp
  21. src/rotor-light/supervisor.cpp
  22. )
  23. target_include_directories(rotor_light
  24. PUBLIC
  25. $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
  26. $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
  27. $<INSTALL_INTERFACE:include>
  28. )
  29. target_compile_features(rotor_light PUBLIC cxx_std_17)
  30. set_target_properties(rotor_light PROPERTIES
  31. CXX_STANDARD 17
  32. CXX_STANDARD_REQUIRED YES
  33. CXX_EXTENSIONS NO
  34. )
  35. target_compile_definitions(rotor_light PUBLIC
  36. "ROTOR_LIGHT_TIMEPOINT=${ROTOR_LIGHT_TIMEPOINT}"
  37. "ROTOR_LIGHT_DURATION=${ROTOR_LIGHT_DURATION}"
  38. )
  39. if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
  40. add_subdirectory("examples")
  41. if ("${TOOLCHAIN_PREFIX}" STREQUAL "")
  42. include(CTest)
  43. if (BUILD_TESTING)
  44. add_subdirectory("tests")
  45. endif()
  46. endif()
  47. find_package(Doxygen)
  48. if (DOXYGEN_FOUND)
  49. set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile.in)
  50. set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
  51. configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
  52. add_custom_target( doc_doxygen ALL
  53. COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
  54. WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
  55. COMMENT "Generating API documentation with Doxygen"
  56. VERBATIM)
  57. file(GLOB DOC_IMAGES CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/docs/*.png)
  58. file(COPY ${DOC_IMAGES} DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/doxygen)
  59. message("Doxygen need to be installed to generate the doxygen documentation")
  60. endif()
  61. endif()