CMakeLists.txt 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. cmake_minimum_required(VERSION 2.8.3)
  2. project(glviewer)
  3. include(FindPkgConfig)
  4. find_package(autoware_build_flags REQUIRED)
  5. find_package(catkin REQUIRED COMPONENTS
  6. roscpp
  7. )
  8. find_package(Eigen3 QUIET)
  9. if(NOT EIGEN3_FOUND)
  10. # Fallback to cmake_modules
  11. find_package(cmake_modules REQUIRED)
  12. find_package(Eigen REQUIRED)
  13. set(EIGEN3_INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS})
  14. set(EIGEN3_LIBRARIES ${EIGEN_LIBRARIES}) # Not strictly necessary as Eigen is head only
  15. # Possibly map additional variables to the EIGEN3_ prefix.
  16. else()
  17. set(EIGEN3_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR})
  18. endif()
  19. set(CMAKE_AUTOMOC ON)
  20. #set(CMAKE_AUTOUIC ON)
  21. #set(CMAKE_AUTORCC ON)
  22. set(CMAKE_INCLUDE_CURRENT_DIR ON)
  23. SET(CMAKE_CXX_FLAGS "-O2 -g -Wall ${CMAKE_CXX_FLAGS}")
  24. find_package(Qt5Core REQUIRED)
  25. find_package(Qt5Widgets REQUIRED)
  26. find_package(Qt5OpenGL REQUIRED)
  27. find_package(Qt5Gui REQUIRED)
  28. find_package(OpenGL REQUIRED)
  29. catkin_package(
  30. INCLUDE_DIRS include
  31. LIBRARIES glviewer
  32. )
  33. if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i686" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64")
  34. include_directories(
  35. include
  36. ${catkin_INCLUDE_DIRS}
  37. ${CMAKE_CURRENT_SOURCE_DIR}
  38. ${CMAKE_CURRENT_BINARY_DIR}
  39. ${EIGEN3_INCLUDE_DIRS}
  40. )
  41. qt5_wrap_cpp(glviewer_SRC
  42. include/glviewer/glviewer.h
  43. )
  44. add_library(glviewer
  45. GLViewer/glviewer.cpp
  46. ${glviewer_SRC}
  47. )
  48. target_link_libraries(glviewer
  49. ${catkin_LIBRARIES}
  50. ${EIGEN3_LIBRARIES}
  51. Qt5::Core
  52. Qt5::Widgets
  53. Qt5::OpenGL
  54. Qt5::Gui
  55. ${OPENGL_LIBRARIES}
  56. )
  57. install(DIRECTORY include/${PROJECT_NAME}/
  58. DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
  59. FILES_MATCHING PATTERN "*.h"
  60. )
  61. install(TARGETS glviewer
  62. ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  63. LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  64. RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
  65. )
  66. endif()