CMakeLists.txt 16.5 KB
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
#=============================================================================
# CMakeLists.txt - Rules for sns-views target.
#
# Generated by coolbot-bundle version 1.0.0
#=============================================================================

MESSAGE("")
MESSAGE(STATUS "Generating sns-views target")

#
# NOTE: You have a file called cmake_targets.cmake in the directory resources/cmake
# Check to see that in this file, you have the following entry:
#
# ADD_SUBDIRECTORY(${PROJECT_SOURCE_DIR}/sns-views)
#
# In the event that the entry is not available, add the line in this file or in
# the main CMakeLists.txt file.
#

INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/sns-views)

#
# NOTE: It is preferable not to use the AUX_SOURCE_DIRECTORY command. It is
# recommended to manually specify the source files and header. For example:
#
# SET(SNS_VIEWS_SRCS
#     src/source.cpp
#     src/source1.cpp
#     ...
#     src/sourceN.cpp
# )
#
# SET(SNS_VIEWS_HDRS
#     src/header.h
#     src/header1.h
#     ...
#     src/headerN.h
# )
#
# SET(SNS_VIEWS_MAIN_SOURCE_FILES
#     ${SNS_VIEWS_SRCS}
#     ${SNS_VIEWS_HDRS})
#
AUX_SOURCE_DIRECTORY("${PROJECT_SOURCE_DIR}/sns-views"
                    SNS_VIEWS_MAIN_SOURCE_FILES)

IF(SHOW_DEBUG_INFO)
  MESSAGE(STATUS "Source code of sns-views target:")
  MESSAGE("${SNS_VIEWS_MAIN_SOURCE_FILES}")
ENDIF(SHOW_DEBUG_INFO)

#
# Flags for the construction of the target sns-views.
# By default, sets the CoolBOT framework flags.
# Here, you should add the flags you need. You can use the RUN_PKGCONFIG macro:
#
#     RUN_PKGCONFIG( <pkg-config option>
#                    <pkg-config file>
#                    <result of the execution>
#                    <output variable with the flags> )
#
# By default, searches for the file in the path established by the tool
# pkg-config.
#
# NOTE: The RUN_PKGCONFIG macro accepts an optional parameter that indicates
# the path where the file pkg-config:
#
#     RUN_PKGCONFIG( <pkg-config option>
#                    <pkg-config file>
#                    <result of the execution>
#                    <output variable with the flags>
#                    <pkg-config file path> )
#
# In this case, the pkg-config file must be extension ".pc".
#
# In addition, you can use the following macros:
#
#     FIND_PKGCONFIG_MODULE( <pkg-config module file name>
#                            <pkg-config module file is within bundle>
#                            <output variable with linker flags>
#                            <output variable with compiler flags>
#                            <output variable  with the result of the operation>
#                            <pkg-config file path> )
#
# This macro searches if the pkg-config module file exists. If the module exists
# gets flags for compiling and linked.
#
#     MY_FIND_PACKAGE( <CMake package name>
#                      <pkg-config module file name>
#                      <output variable with linker flags>
#                      <output variable with compiler flags> )
#
# This macro searches if the CMake module file exists. If the CMake module exists
# gets flags for compiling and linked.
#
#     LOAD_PKGCONFIG_MODULE( module_name
#                            module_is_within_bundle
#                            result
#                            output_module_linker_flags
#                            output_module_compiler_flags
#                            pkgconfig_directory_path )
#
# This macro calls the macro: FIND_PKGCONFIG_MODULE and displays messages about
# the operation performed.
#
#     LOAD_CMAKE_MODULE( module_name
#                        pkgconfig_module_name
#                        output_module_linker_flags
#                        output_module_compiler_flags )
#
# This macro calls the macro: MY_FIND_PACKAGE and displays messages about the
# operation performed.
#
# The SNS_VIEWS_TARGET_DEPENDENCIES variable indicates if the target
# dependencies are resolved:
#
# - TRUE: The target dependencies are resolved.
#
# - FALSE: Some of the dependencies could not be resolved.
#
# This variable is created in cmake_global_variables.cmake file with the FALSE
# value. It's a variable cache type. You can modify the cache value as follows:
#
# SET(SNS_VIEWS_TARGET_DEPENDENCIES <value> CACHE INTERNAL "")
#
# where <value> is the value to set.
#

#
# Here you must perform dependencies checking.
#
# NOTE: You have to ask if software dependencies have been resolved and, if so,
# assign the SNS_VIEWS_TARGET_DEPENDENCIES variable the value TRUE.
#
# For example: This CoolBOT module depends on the software A and B (both external
# bundle) and we have the pkg-config files. Also, this module has a internal
# dependency with C module. In this case, being an internal dependency, we have
# the variable: C_TARGET_DEPENDENCIES. Then:
#
# IF( C_TARGET_DEPENDENCIES )
#
#   SET(PKGCONFIG_FILE_IS_WITHIN_BUNDLE FALSE)
#
#   LOAD_PKGCONFIG_MODULE( "A"
#                          PKGCONFIG_FILE_IS_WITHIN_BUNDLE
#                          A_DEPENDENCIES_RESOLVED
#                          A_LINKER_FLAGS
#                          A_COMPILER_FLAGS
#                          "" )
#
#   LOAD_PKGCONFIG_MODULE( "B"
#                          PKGCONFIG_FILE_IS_WITHIN_BUNDLE
#                          B_DEPENDENCIES_RESOLVED
#                          B_LINKER_FLAGS
#                          B_COMPILER_FLAGS
#                          "" )
#
#   SET(PKGCONFIG_FILE_IS_WITHIN_BUNDLE TRUE)
#
#   LOAD_PKGCONFIG_MODULE( "C"
#                          PKGCONFIG_FILE_IS_WITHIN_BUNDLE
#                          C_DEPENDENCIES_RESOLVED
#                          C_LINKER_FLAGS
#                          C_COMPILER_FLAGS
#                          ${PKG_DIR} )
#
#   IF( A_DEPENDENCIES_RESOLVED AND B_DEPENDENCIES_RESOLVED AND C_DEPENDENCIES_RESOLVED )
#       SET(SNS_VIEWS_TARGET_DEPENDENCIES TRUE CACHE INTERNAL "")
#   ENDIF( A_DEPENDENCIES_RESOLVED AND B_DEPENDENCIES_RESOLVED AND C_DEPENDENCIES_RESOLVED )
#
# ENDIF( C_TARGET_DEPENDENCIES )
#

IF( 
  PLAYER_ROBOT_TARGET_DEPENDENCIES AND PLAYER_ROBOT_VIEW_TARGET_DEPENDENCIES AND SPHERE_VIEW_TARGET_DEPENDENCIES AND 
  GRID_VIEW_TARGET_DEPENDENCIES AND ND_TARGET_DEPENDENCIES AND ND_VIEW_TARGET_DEPENDENCIES AND RASTER_VIEW_TARGET_DEPENDENCIES AND 
  PLANNER_TARGET_DEPENDENCIES AND PLANNER_VIEW_TARGET_DEPENDENCIES
)

  SET(PKGCONFIG_FILE_IS_WITHIN_BUNDLE TRUE)
  LOAD_PKGCONFIG_MODULE( "player-robot"
                        PKGCONFIG_FILE_IS_WITHIN_BUNDLE
                        PLAYER_ROBOT_FOUND
                        PLAYER_ROBOT_LINKER_FLAGS
                        PLAYER_ROBOT_COMPILER_FLAGS
                        ${PKG_DIR} )

  SET(PKGCONFIG_FILE_IS_WITHIN_BUNDLE TRUE)
  LOAD_PKGCONFIG_MODULE( "player-robot-view"
                        PKGCONFIG_FILE_IS_WITHIN_BUNDLE
                        PLAYER_ROBOT_VIEW_FOUND
                        PLAYER_ROBOT_VIEW_LINKER_FLAGS
                        PLAYER_ROBOT_VIEW_COMPILER_FLAGS
                        ${PKG_DIR} )

  SET(PKGCONFIG_FILE_IS_WITHIN_BUNDLE TRUE)
  LOAD_PKGCONFIG_MODULE( "sphere-view"
                        PKGCONFIG_FILE_IS_WITHIN_BUNDLE
                        SPHERE_VIEW_FOUND
                        SPHERE_VIEW_LINKER_FLAGS
                        SPHERE_VIEW_COMPILER_FLAGS
                        ${PKG_DIR} )

  SET(PKGCONFIG_FILE_IS_WITHIN_BUNDLE TRUE)
  LOAD_PKGCONFIG_MODULE( "grid-view"
                        PKGCONFIG_FILE_IS_WITHIN_BUNDLE
                        GRID_VIEW_FOUND
                        GRID_VIEW_LINKER_FLAGS
                        GRID_VIEW_COMPILER_FLAGS
                        ${PKG_DIR} )

  SET(PKGCONFIG_FILE_IS_WITHIN_BUNDLE TRUE)
  LOAD_PKGCONFIG_MODULE( "nd"
                        PKGCONFIG_FILE_IS_WITHIN_BUNDLE
                        ND_FOUND
                        ND_LINKER_FLAGS
                        ND_COMPILER_FLAGS
                        ${PKG_DIR} )

  SET(PKGCONFIG_FILE_IS_WITHIN_BUNDLE TRUE)
  LOAD_PKGCONFIG_MODULE( "nd-view"
                        PKGCONFIG_FILE_IS_WITHIN_BUNDLE
                        ND_VIEW_FOUND
                        ND_VIEW_LINKER_FLAGS
                        ND_VIEW_COMPILER_FLAGS
                        ${PKG_DIR} )

  SET(PKGCONFIG_FILE_IS_WITHIN_BUNDLE TRUE)
  LOAD_PKGCONFIG_MODULE( "raster-view"
                        PKGCONFIG_FILE_IS_WITHIN_BUNDLE
                        RASTER_VIEW_FOUND
                        RASTER_VIEW_LINKER_FLAGS
                        RASTER_VIEW_COMPILER_FLAGS
                        ${PKG_DIR} )

  SET(PKGCONFIG_FILE_IS_WITHIN_BUNDLE TRUE)
  LOAD_PKGCONFIG_MODULE( "planner"
                        PKGCONFIG_FILE_IS_WITHIN_BUNDLE
                        PLANNER_FOUND
                        PLANNER_LINKER_FLAGS
                        PLANNER_COMPILER_FLAGS
                        ${PKG_DIR} )

  SET(PKGCONFIG_FILE_IS_WITHIN_BUNDLE TRUE)
  LOAD_PKGCONFIG_MODULE( "planner-view"
                        PKGCONFIG_FILE_IS_WITHIN_BUNDLE
                        PLANNER_VIEW_FOUND
                        PLANNER_VIEW_LINKER_FLAGS
                        PLANNER_VIEW_COMPILER_FLAGS
                        ${PKG_DIR} )

  IF( 
    PLAYER_ROBOT_FOUND AND PLAYER_ROBOT_VIEW_FOUND AND SPHERE_VIEW_FOUND AND GRID_VIEW_FOUND AND
    ND_FOUND AND ND_VIEW_FOUND AND RASTER_VIEW_FOUND AND PLANNER_FOUND AND PLANNER_VIEW_FOUND
  )

    SET(SNS_VIEWS_TARGET_DEPENDENCIES TRUE CACHE INTERNAL "")
  
  ENDIF( 
    PLAYER_ROBOT_FOUND AND PLAYER_ROBOT_VIEW_FOUND AND SPHERE_VIEW_FOUND AND GRID_VIEW_FOUND AND
    ND_FOUND AND ND_VIEW_FOUND AND RASTER_VIEW_FOUND AND PLANNER_FOUND AND PLANNER_VIEW_FOUND
  )

ENDIF( 
  PLAYER_ROBOT_TARGET_DEPENDENCIES AND PLAYER_ROBOT_VIEW_TARGET_DEPENDENCIES AND SPHERE_VIEW_TARGET_DEPENDENCIES AND 
  GRID_VIEW_TARGET_DEPENDENCIES AND ND_TARGET_DEPENDENCIES AND ND_VIEW_TARGET_DEPENDENCIES AND RASTER_VIEW_TARGET_DEPENDENCIES AND 
  PLANNER_TARGET_DEPENDENCIES AND PLANNER_VIEW_TARGET_DEPENDENCIES
)

IF(NOT SNS_VIEWS_TARGET_DEPENDENCIES)
  #
  # Show a information message to user. You can use the MESSAGE command:
  #
  #     MESSAGE([STATUS|WARNING|AUTHOR_WARNING|FATAL_ERROR|SEND_ERROR]
  #             "message to display" ...)
  #
  # The optional keyword determines the type of message:
  #
  # - (none): Important information
  # - STATUS: Incidental information
  # - WARNING: CMake Warning, continue processing
  # - AUTHOR_WARNING: CMake Warning (dev), continue processing
  # - SEND_ERROR: CMake Error, continue but skip generation
  # - FATAL_ERROR: CMake Error, stop all processing
  #

  MESSAGE(STATUS "sns-views target can not be generated:")
  IF(NOT PLAYER_ROBOT_FOUND)
    MESSAGE(STATUS "  *   player-robot is required.")
  ENDIF(NOT PLAYER_ROBOT_FOUND)
  IF(NOT PLAYER_ROBOT_VIEW_FOUND)
    MESSAGE(STATUS "  *   player-robot-view is required.")
  ENDIF(NOT PLAYER_ROBOT_VIEW_FOUND)
  IF(NOT SPHERE_VIEW_FOUND)
    MESSAGE(STATUS "  *   sphere-view is required.")
  ENDIF(NOT SPHERE_VIEW_FOUND)
  IF(NOT GRID_VIEW_FOUND)
    MESSAGE(STATUS "  *   grid-view is required.")
  ENDIF(NOT GRID_VIEW_FOUND)
  IF(NOT ND_FOUND)
    MESSAGE(STATUS "  *   nd is required.")
  ENDIF(NOT ND_FOUND)
  IF(NOT ND_VIEW_FOUND)
    MESSAGE(STATUS "  *   nd-view is required.")
  ENDIF(NOT ND_VIEW_FOUND)
  IF(NOT RASTER_VIEW_FOUND)
    MESSAGE(STATUS "  *   raster-view is required.")
  ENDIF(NOT RASTER_VIEW_FOUND)
  IF(NOT PLANNER_FOUND)
    MESSAGE(STATUS "  *   planner is required.")
  ENDIF(NOT PLANNER_FOUND)
  IF(NOT PLANNER_VIEW_FOUND)
    MESSAGE(STATUS "  *   planner-view is required.")
  ENDIF(NOT PLANNER_VIEW_FOUND)  
  
  REGISTER_TARGET_NOT_AVAILABLE("sns-views")

ELSE(NOT SNS_VIEWS_TARGET_DEPENDENCIES)
  #
  # Sets the compiler and linker flags.
  #
  SET(FLAGS_BIN_COMPILER "${COOLBOT_COMPILER_FLAGS}")
  SET(FLAGS_BIN_LINKER "${COOLBOT_LINKER_FLAGS}")
  
  SET(FLAGS_BIN_COMPILER "${FLAGS_BIN_COMPILER} ${PLAYER_ROBOT_COMPILER_FLAGS}")
  SET(FLAGS_BIN_LINKER "${FLAGS_BIN_LINKER} ${PLAYER_ROBOT_LINKER_FLAGS}")

  SET(FLAGS_BIN_COMPILER "${FLAGS_BIN_COMPILER} ${PLAYER_ROBOT_VIEW_COMPILER_FLAGS}")
  SET(FLAGS_BIN_LINKER "${FLAGS_BIN_LINKER} ${PLAYER_ROBOT_VIEW_LINKER_FLAGS}")

  SET(FLAGS_BIN_COMPILER "${FLAGS_BIN_COMPILER} ${SPHERE_VIEW_COMPILER_FLAGS}")
  SET(FLAGS_BIN_LINKER "${FLAGS_BIN_LINKER} ${SPHERE_VIEW_LINKER_FLAGS}")

  SET(FLAGS_BIN_COMPILER "${FLAGS_BIN_COMPILER} ${GRID_VIEW_COMPILER_FLAGS}")
  SET(FLAGS_BIN_LINKER "${FLAGS_BIN_LINKER} ${GRID_VIEW_LINKER_FLAGS}")

  SET(FLAGS_BIN_COMPILER "${FLAGS_BIN_COMPILER} ${ND_COMPILER_FLAGS}")
  SET(FLAGS_BIN_LINKER "${FLAGS_BIN_LINKER} ${ND_LINKER_FLAGS}")

  SET(FLAGS_BIN_COMPILER "${FLAGS_BIN_COMPILER} ${ND_VIEW_COMPILER_FLAGS}")
  SET(FLAGS_BIN_LINKER "${FLAGS_BIN_LINKER} ${ND_VIEW_LINKER_FLAGS}")

  SET(FLAGS_BIN_COMPILER "${FLAGS_BIN_COMPILER} ${RASTER_VIEW_COMPILER_FLAGS}")
  SET(FLAGS_BIN_LINKER "${FLAGS_BIN_LINKER} ${RASTER_VIEW_LINKER_FLAGS}")

  SET(FLAGS_BIN_COMPILER "${FLAGS_BIN_COMPILER} ${PLANNER_COMPILER_FLAGS}")
  SET(FLAGS_BIN_LINKER "${FLAGS_BIN_LINKER} ${PLANNER_LINKER_FLAGS}")

  SET(FLAGS_BIN_COMPILER "${FLAGS_BIN_COMPILER} ${PLANNER_VIEW_COMPILER_FLAGS}")
  SET(FLAGS_BIN_LINKER "${FLAGS_BIN_LINKER} ${PLANNER_VIEW_LINKER_FLAGS}")

  IF(SHOW_DEBUG_INFO)
    MESSAGE(STATUS "Linker flags of sns-views target:")
    MESSAGE("${FLAGS_BIN_LINKER}")
    MESSAGE(STATUS "Compiler flags of sns-views target:")
    MESSAGE("${FLAGS_BIN_COMPILER}")
  ENDIF(SHOW_DEBUG_INFO)

  #
  # You must add the INCLUDE_DIRS and TARGET_LINK_LIBRARIES who need your project:
  #
  #   INCLUDE_DIRECTORIES(${MY_INCLUDE_DIRS} ${MY_INCLUDE_DIRS_2} ...)
  #
  #   TARGET_LINK_LIBRARIES(sns-views ${MY_LIBRARY} ${MY_LIBRARY_2} ...)
  #
  # The MY_INCLUDE_DIRS contains the path where the headers file and the MY_LIBRARY
  # specifies the libraries to link or linker flags. This can also be specified
  # through the flags.
  #
  # You can also specify in the command TARGET_LINK_LIBRARIES the name of the target
  # defined in the bundle.
  #
  # NOTE: In addition, you can use the command find_package() or MY_FIND_PACKAGE
  # macro to obtain the information necessary for the required packages. In the
  # CMake modules directory you can use existing packages.
  #
  INCLUDE_DIRECTORIES(${COOLBOT_INCLUDE_DIRS})
  ADD_EXECUTABLE(sns-views ${SNS_VIEWS_MAIN_SOURCE_FILES})
  TARGET_LINK_LIBRARIES(sns-views
                        player-robot
                        player-robot-view
                        sphere-view
                        grid-view
                        nd
                        nd-view
                        raster-view
                        planner
                        planner-view
                        ${COOLBOT_LIBRARIES}
                        ${COOLBOT_LINKER_FLAGS}
                        ${PLAYER_ROBOT_LINKER_FLAGS}
                        ${PLAYER_ROBOT_VIEW_LINKER_FLAGS}
                        ${SPHERE_VIEW_LINKER_FLAGS}
                        ${GRID_VIEW_LINKER_FLAGS}
                        ${ND_LINKER_FLAGS}
                        ${ND_VIEW_LINKER_FLAGS}
                        ${RASTER_VIEW_LINKER_FLAGS}
                        ${PLANNER_LINKER_FLAGS}
                        ${PLANNER_VIEW_LINKER_FLAGS}
  )

  #
  # As a safeguard, you must establish dependencies to ensure that the compilations
  # at the right time. Dependencies are specified with the name of the target.
  #
  # NOTE: If the project does not have dependencies within the bundle, you must
  # comment on the ADD_DEPENDENCIES command.
  #
  ADD_DEPENDENCIES( sns
                    # target-name
                    player-robot
                    player-robot-view
                    sphere-view
                    grid-view
                    nd
                    nd-view
                    raster-view
                    planner
                    planner-view
  )

  SET_TARGET_PROPERTIES(sns-views PROPERTIES
                        LINK_FLAGS    ${FLAGS_BIN_LINKER}
                        COMPILE_FLAGS ${FLAGS_BIN_COMPILER})

  IF( WIN32 )
    SET_TARGET_PROPERTIES(sns-views PROPERTIES
                          RUNTIME_OUTPUT_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
                         )
  ENDIF( WIN32 )

  REGISTER_NEW_TARGET("sns-views")
  MESSAGE(STATUS "Created sns-views target")

  IF(NOT DEBUG_MODE)
    #
    # Install settings
    #
    # Binaries -> ${PROJECT_BINARIES_INSTALL_PATH}
    #
    INSTALL( TARGETS sns-views
            DESTINATION ${PROJECT_BINARIES_INSTALL_PATH}
            PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
                        GROUP_READ             GROUP_EXECUTE
                        WORLD_READ             WORLD_EXECUTE
    )
    MESSAGE(STATUS "Generated install commands for sns-views binary")
  ENDIF(NOT DEBUG_MODE)

ENDIF(NOT SNS_VIEWS_TARGET_DEPENDENCIES)