/cmake.man/CMakeLists.txt

https://github.com/nglennon/nao-man · CMake · 312 lines · 187 code · 60 blank · 65 comment · 2 complexity · 77a7ed26f0e8e49698a803b06b094183 MD5 · raw file

  1. ##############################
  2. #
  3. # WELCOME
  4. #
  5. # This is the main cmake configuration file
  6. # associate to your projects
  7. # You can define here specific compilation options
  8. #
  9. # More about cmake : www.cmake.org
  10. #
  11. # Using cmake command line :
  12. # 1. Create a build directory : mkdir build
  13. # 2. Configure cmake project : cd build; cmake ..
  14. # You can also generate project with your favorite IDE :
  15. # Example : Under Mac osx use "cmake .. -G XCode"
  16. # see cmake help for more information
  17. # 3. Edit project option : ccmake .
  18. # 4. Build it : make
  19. ############################ PROJECT NAME
  20. # The name of this cmake project
  21. PROJECT( MAN )
  22. ############################ VERSION
  23. CMAKE_POLICY(SET CMP0011 OLD)
  24. # Check cMake version
  25. CMAKE_MINIMUM_REQUIRED( VERSION 2.6.0 )
  26. ############################ COLORIZE MAKEFILE
  27. # Colorized output
  28. SET( CMAKE_COLOR_MAKEFILE TRUE )
  29. ############################ NBCOMMON
  30. # Ensure the TRUNK_PATH variable is set
  31. IF ("x$ENV{TRUNK_PATH}x" STREQUAL "xx")
  32. GET_FILENAME_COMPONENT( TRUNK_PATH ../ ABSOLUTE)
  33. SET( ENV{TRUNK_PATH} ${TRUNK_PATH} )
  34. MESSAGE( STATUS
  35. "Environment variable TRUNK_PATH was not set, reseting to default ${TRUNK_PATH}!" )
  36. ELSE ("x$ENV{TRUNK_PATH}x" STREQUAL "xx")
  37. SET( TRUNK_PATH $ENV{TRUNK_PATH} )
  38. ENDIF ("x$ENV{TRUNK_PATH}x" STREQUAL "xx")
  39. ############################ BUILDCONFIG
  40. # Include the config file for this build
  41. INCLUDE( buildconfig.cmake )
  42. ############################ BASE DEFINITIONS
  43. # Include the basic definitions accross all projects
  44. INCLUDE( ${TRUNK_PATH}/cmake/base_definitions.cmake )
  45. ############################ DEFAULT BUILD TYPE
  46. # Set which build type will be used by default, if none is set
  47. #IF( "x${CMAKE_BUILD_TYPE}x" STREQUAL "xx" )
  48. SET( CMAKE_BUILD_TYPE CACHE FORCE "Release")
  49. #ENDIF( "x${CMAKE_BUILD_TYPE}x" STREQUAL "xx" )
  50. ############################ DISPLAY
  51. # Display summary of options
  52. MESSAGE( STATUS "" )
  53. MESSAGE( STATUS "...:::: Configuration - MAN ::::..." )
  54. MESSAGE( STATUS "" )
  55. ############################ FIND PACKAGE
  56. # Libraries specifics. Define here cmake packages
  57. # usefull to your project
  58. INCLUDE(FindBoost)
  59. set(Boost_USE_MULTITHREADED ON)
  60. set(Boost_USE_STATIC_LIBS OFF)
  61. FIND_PACKAGE( NBCOMMON REQUIRED )
  62. FIND_PACKAGE( PYTHON REQUIRED )
  63. FIND_PACKAGE( PTHREAD REQUIRED )
  64. IF ( OE_CROSS_BUILD )
  65. FIND_PACKAGE( BOOST_PYTHON REQUIRED )
  66. FIND_PACKAGE( BOOST_SIGNALS REQUIRED )
  67. ELSE ( OE_CROSS_BUILD )
  68. find_package( Boost 1.35 COMPONENTS python signals)
  69. ENDIF ( OE_CROSS_BUILD )
  70. IF(APPLE)
  71. FIND_PACKAGE( FINK )
  72. ENDIF(APPLE)
  73. IF(WEBOTS_BACKEND)
  74. FIND_PACKAGE(WEBOTS)
  75. ELSE(WEBOTS_BACKEND)
  76. IF( APPLE )
  77. MESSAGE( STATUS "WARNING - Apple OS, some compilation may fail")
  78. #On MAC OS X, we need to build w/o linking against non-existant ALCOMMON libs
  79. #when we want to compile just the vision/sensors libraries for the TOOL
  80. FIND_PACKAGE( ALCOMMON )
  81. ELSE( APPLE )
  82. FIND_PACKAGE( ALCOMMON REQUIRED )
  83. ENDIF( APPLE )
  84. ENDIF(WEBOTS_BACKEND)
  85. ############################ CONFIG.H GENERATION
  86. CONFIGURE_FILE(
  87. ${MAN_CMAKE_DIR}/manconfig.in
  88. ${MAN_INCLUDE_DIR}/manconfig.h
  89. ESCAPE_QUOTES
  90. )
  91. ############################ OFFLINE
  92. SET( OFFLINE_NAOQI_PATH
  93. $ENV{AL_DIR}
  94. CACHE STRING
  95. "The local path of the naoqi distribution to use with Webots"
  96. )
  97. ############################ REMOTE INSTALLATION
  98. # Define this to remotely install the binary or library on the robot.
  99. # Cannot be selected unless OE_CROSS_BUILD is set to ON.
  100. IF(WEBOTS_BACKEND)
  101. OPTION( REMOTE_INSTALL
  102. "Remotely install the libary or binary on the robot."
  103. OFF
  104. )
  105. ELSE(WEBOTS_BACKEND)
  106. OPTION( REMOTE_INSTALL
  107. "Remotely install the libary or binary on the robot."
  108. ON
  109. )
  110. ENDIF(WEBOTS_BACKEND)
  111. SET( @REMOTE_ADDRESS@
  112. "192.168.0.5"
  113. CACHE STRING
  114. "The remote address of the robot"
  115. )
  116. SET( REMOTE_ADDRESS ${@REMOTE_ADDRESS@} )
  117. ############################ REMOTE INSTALLATION
  118. # Define this to remotely install the binary or library on the robot.
  119. # Cannot be selected unless OE_CROSS_BUILD is set to ON.
  120. SET( @ROBOT_NAME@
  121. "zaphod"
  122. CACHE STRING
  123. "The NAME of the robot"
  124. )
  125. SET( ROBOT_NAME ${@ROBOT_NAME@} )
  126. ############################ COLOR TABLE SELECTION
  127. # Set the path to the color table you wish to be loaded into install/etc
  128. SET( COLOR_TABLE
  129. "tables/watson/chownfarball.mtb"
  130. CACHE STRING
  131. "Path relative to man directory for the desired color table"
  132. )
  133. #upload.sh needs to get generated after REMOTE and OFFLINE stuff is set
  134. CONFIGURE_FILE(
  135. ${MAN_CMAKE_DIR}/upload.sh.in
  136. ${MAN_INCLUDE_DIR}/upload.sh
  137. ESCAPE_QUOTES
  138. )
  139. CONFIGURE_FILE(
  140. ${MAN_CMAKE_DIR}/nameconfig.in
  141. ${NBCOMMON_INCLUDE_DIR}/nameconfig.h
  142. ESCAPE_QUOTES
  143. )
  144. ############################ DEFINITIONS
  145. # Add here definition needed.
  146. ADD_DEFINITIONS( ${NBCOMMON_DEFINITIONS}
  147. ${ALCOMMON_DEFINITIONS}
  148. ${PTHREAD_DEFINITIONS}
  149. ${PYTHON_DEFINITIONS}
  150. ${WEBOTS_DEFINITIONS}
  151. )
  152. ############################ INCLUDE DIRECTORY
  153. # Define include directories
  154. INCLUDE_DIRECTORIES( ${NBCOMMON_INCLUDE_DIR}
  155. ${PTHREAD_INCLUDE_DIR}
  156. ${PYTHON_INCLUDE_DIR}
  157. ${ALCOMMON_INCLUDE_DIR}
  158. ${FINK_INCLUDE_DIR}
  159. ${COMM_INCLUDE_DIR}
  160. ${CORPUS_INCLUDE_DIR}
  161. ${MOTION_INCLUDE_DIR}
  162. ${NOGGIN_INCLUDE_DIR}
  163. ${VISION_INCLUDE_DIR}
  164. ${MAN_INCLUDE_DIR}
  165. ${WEBOTS_INCLUDE_DIR}
  166. )
  167. ############################ PROJECT SOURCES FILES
  168. # Add here source files needed to compile this project
  169. SET( MAN_SRCS ${MAN_INCLUDE_DIR}/Man
  170. ${MAN_INCLUDE_DIR}/TMan
  171. ${MAN_INCLUDE_DIR}/TTMan
  172. )
  173. IF(WEBOTS_BACKEND)
  174. LIST(APPEND MAN_SRCS ${MAN_INCLUDE_DIR}/nao_soccer_player
  175. )
  176. ELSE(WEBOTS_BACKEND)
  177. LIST(APPEND MAN_SRCS ${MAN_INCLUDE_DIR}/manmodule
  178. )
  179. ENDIF(WEBOTS_BACKEND)
  180. SET( MAN_PYTHON_SRCS ${MAN_INCLUDE_DIR}/__init__.py )
  181. ############################ CHECK LIBRARY / EXECUTABLE OPTION
  182. # Configure the output execuatable or shared library, and the install
  183. # commands
  184. GET_TARGET_PROPERTY( MAN_LOCATION ${MAN_TARGET} LOCATION )
  185. IF( MAN_IS_REMOTE )
  186. ADD_EXECUTABLE(
  187. ${MAN_TARGET}
  188. ${MAN_SRCS}
  189. )
  190. ELSE( MAN_IS_REMOTE )
  191. ADD_LIBRARY(
  192. ${MAN_TARGET}
  193. SHARED
  194. ${MAN_SRCS}
  195. )
  196. ENDIF( MAN_IS_REMOTE )
  197. INSTALL(
  198. TARGETS ${MAN_TARGET}
  199. RUNTIME DESTINATION ${OUTPUT_ROOT_DIR_BIN}
  200. LIBRARY DESTINATION ${OUTPUT_ROOT_DIR_LIB}
  201. CONFIGURATIONS "" Debug Release
  202. )
  203. INSTALL(
  204. FILES ${MAN_PYTHON_SRCS}
  205. DESTINATION ${MAN_PYTHON_TARGET_DIR}
  206. CONFIGURATIONS "" Debug Release
  207. )
  208. ############################ SET LIBRARIES TO LINK WITH
  209. TARGET_LINK_LIBRARIES(
  210. ${MAN_TARGET}
  211. ${NBCOMMON_LIBRARIES}
  212. ${PTHREAD_LIBRARIES}
  213. ${PYTHON_LIBRARIES}
  214. ${ALCOMMON_LIBRARIES}
  215. ${COMM_TARGET}
  216. ${SENSORS_TARGET}
  217. ${SYNCHRO_TARGET}
  218. ${ROBOT_CONNECT_TARGET}
  219. ${NBINCLUDE_TARGET}
  220. ${MOTION_TARGET}
  221. ${NOGGIN_TARGET}
  222. ${VISION_TARGET}
  223. ${WEBOTS_LIBRARIES}
  224. )
  225. IF ( OE_CROSS_BUILD )
  226. TARGET_LINK_LIBRARIES(
  227. ${MAN_TARGET}
  228. ${BOOST_PYTHON_LIBRARIES}
  229. ${BOOST_SIGNALS_LIBRARIES}
  230. )
  231. INCLUDE_DIRECTORIES(
  232. ${BOOST_PYTHON_INCLUDE_DIR}
  233. ${BOOST_SIGNALS_INCLUDE_DIR}
  234. )
  235. ELSE ( OE_CROSS_BUILD )
  236. if(Boost_FOUND)
  237. include_directories(${Boost_INCLUDE_DIRS})
  238. target_link_libraries(${MAN_TARGET} ${Boost_LIBRARIES})
  239. else(Boost_FOUND)
  240. MESSAGE( FATAL_ERROR "Could not find a Boost Library")
  241. endif()
  242. ENDIF ( OE_CROSS_BUILD )
  243. ############################ (SUB)DIRECTORY COMPILATION
  244. # Set the sudirectories (some may not actually be subdirectories) to
  245. # include in this package
  246. SUBDIRS(
  247. ${COMM_CMAKE_DIR}
  248. ${CORPUS_CMAKE_DIR}
  249. ${MOTION_CMAKE_DIR}
  250. ${NOGGIN_CMAKE_DIR}
  251. ${VISION_CMAKE_DIR}
  252. )