Source

gazebo / CMakeLists.txt

Nate Koenig 8c40ce2 
natepak dd38ea2 
nkoenig f8678d9 
nkoenig bdce01e 

nkoenig f8678d9 
Nate Koenig 31f73a4 
natepak dd38ea2 
"Nat...@gmail.co… 4d72e74 













"Nat...@gmail.co… 12175ce 


"Nat...@gmail.co… 62f34e1 
"Nat...@gmail.co… 12175ce 

gerkey 0622ba0 
"Nat...@gmail.co… 12175ce 
gerkey 79ecbd3 

"Nat...@gmail.co… 12175ce 
gerkey 79ecbd3 
"Nat...@gmail.co… 12175ce 

Nathan Koenig bb0d916 
John Hsu d74fd0a 
John Hsu 0e73279 







Nathan Koenig bb0d916 




Nate Koenig f1d4434 









Nathan Koenig bb0d916 
Nate Koenig f1d4434 





Nathan Koenig bb0d916 
Nate Koenig f1d4434 
Nathan Koenig bb0d916 
Nate Koenig f1d4434 


natepak 2a8ea96 
nkoenig 879d665 


Nate Koenig 9ceedf4 
John Hsu ce5e0d0 
Nate Koenig 9ceedf4 
natepak 53794c5 
natepak 2a8ea96 

Nate Koenig 9ceedf4 
natepak dd38ea2 
Nate Koenig 8c40ce2 
natepak 3057ce2 
nkoenig f8678d9 
natepak f73bd9e 
nkoenig d76cb8d 








nkoenig 8d867ff 
nkoenig d76cb8d 

John Hsu 83b7c50 



nkoenig 414214c 








john hsu a211bee 










nkoenig 414214c 


Nate Koenig 9d9cee5 

Nate Koenig 9cc1490 
Nate Koenig 9d9cee5 

nkoenig 92890b5 
Nate Koenig 9d9cee5 

Nate Koenig 9cc1490 
Nate Koenig 13dc74e 
natepak 6ddee1c 
natepak 1448c2b 

nkoenig f8678d9 
Mihai Emanuel Do… 7746b13 
Nate Koenig 9d9cee5 
nkoenig f8678d9 

natepak 6ddee1c 
Nate Koenig 9d9cee5 







nkoenig 0f4388a 
Nate Koenig 8916ae5 




"Nat...@gmail.co… 12175ce 
nkoenig ec09a27 










John Hsu 83b7c50 
nkoenig 414214c 


nkoenig 879d665 
Nathan Koenig 7acd771 









nkoenig 879d665 
natepak b3a72e0 



nkoenig 879d665 
natepak b3a72e0 


Nathan Koenig 3178c7f 







"Nat...@gmail.co… b62e620 

nkoenig 879d665 
"Nat...@gmail.co… aeff075 




natepak b3a72e0 
natepak cdda01d 

nkoenig 879d665 
natepak b3a72e0 
nkoenig 23503b4 
natepak cdda01d 
natepak b3a72e0 
natepak cdda01d 

Nathan Koenig 93404fc 

John Hsu 7288d9b 
nkoenig 416f241 

natepak d242bf6 
natepak d56d111 
natepak cdda01d 
Nate Koenig 9d9cee5 



Nate Koenig 608497b 
natepak 2a8ea96 
Nathan Koenig 13aa65a 
Nate Koenig a044e26 
nkoenig 8b73e98 
Nate Koenig 9ceedf4 
Nate Koenig 0d8ab6c 
Nate Koenig 27a8dfb 
Nate Koenig 9d73bbf 
natepak 2a8ea96 
Nate Koenig 2221b64 


Mihai Emanuel Do… bbf4e59 
Nate Koenig 2221b64 
nkoenig 35798db 
Nate Koenig 27a8dfb 
Nathan Koenig bb0d916 
nkoenig 35798db 
John Hsu ce5e0d0 
Nate Koenig 9ceedf4 


gerkey 79ecbd3 
natepak d56d111 


Nate Koenig 9ceedf4 







natepak 9072348 
natepak cdda01d 
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)

if(COMMAND CMAKE_POLICY)
  CMAKE_POLICY(SET CMP0003 NEW)
  CMAKE_POLICY(SET CMP0004 NEW)
endif(COMMAND CMAKE_POLICY)
enable_testing()

# with -fPIC
if(UNIX AND NOT WIN32)
  set (CMAKE_INSTALL_PREFIX "/usr" CACHE STRING "Install Prefix")
 find_program(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin )
 if(CMAKE_UNAME)
   exec_program(uname ARGS -m OUTPUT_VARIABLE CMAKE_SYSTEM_PROCESSOR)
   set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR} CACHE INTERNAL
     "processor type (i386 and x86_64)")
   if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
     ADD_DEFINITIONS(-fPIC)
   endif(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
 endif(CMAKE_UNAME)
endif()

project (Gazebo)
string (TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER)

set (GAZEBO_VERSION_NAME "helium")
set (GAZEBO_MAJOR_VERSION 1)
set (GAZEBO_MINOR_VERSION 2)
set (GAZEBO_PATCH_VERSION 5)

set (GAZEBO_VERSION ${GAZEBO_MAJOR_VERSION}.${GAZEBO_MINOR_VERSION})
set (GAZEBO_VERSION_FULL ${GAZEBO_MAJOR_VERSION}.${GAZEBO_MINOR_VERSION}.${GAZEBO_PATCH_VERSION})

message (STATUS "${PROJECT_NAME} version ${GAZEBO_VERSION_FULL}")
set (CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)


# developer's option to cache PKG_CONFIG_PATH and LD_LIBRARY_PATH for local installs
if(PKG_CONFIG_PATH)
  set (ENV{PKG_CONFIG_PATH} ${PKG_CONFIG_PATH}:$ENV{PKG_CONFIG_PATH})
endif()
if(LD_LIBRARY_PATH)
  set (ENV{LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}:$ENV{LD_LIBRARY_PATH})
endif()


set (INCLUDE_INSTALL_DIR "include/gazebo-${GAZEBO_VERSION}/gazebo") 
set (LIB_INSTALL_DIR "lib" CACHE STRING "Installation directory for libraries (relative to CMAKE_INSTALL_PREFIX)") 
set (BIN_INSTALL_DIR "bin" CACHE STRING "Installation directory for binaries (relative to CMAKE_INSTALL_PREFIX)") 


set (USE_FULL_RPATH OFF CACHE BOOL "Set to true to enable full rpath")

if (USE_FULL_RPATH)
  # use, i.e. don't skip the full RPATH for the build tree
  set(CMAKE_SKIP_BUILD_RPATH  FALSE)
  
  # when building, don't use the install RPATH already
  # (but later on when installing)
  set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) 
  
  set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}")
  
  # add the automatically determined parts of the RPATH
  # which point to directories outside the build tree to the install RPATH
  set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
  
  # the RPATH to be used when installing, but only if its not a system directory
  list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}" isSystemDir)
  if("${isSystemDir}" STREQUAL "-1")
    set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}")
  endif("${isSystemDir}" STREQUAL "-1")
endif()

set (BUILD_GAZEBO ON CACHE INTERNAL "Build Gazebo" FORCE)
set (build_errors "" CACHE INTERNAL "build errors" FORCE)
set (build_warnings "" CACHE INTERNAL "build warnings" FORCE)


set (MIN_OGRE_VERSION 1.7.1 CACHE INTERNAL "Ogre version requirement" FORCE)
set (MIN_BOOST_VERSION 1.40.0 CACHE INTERNAL "Boost min version requirement" FORCE)

set (FREEIMAGE_MAJOR_VERSION 3 CACHE INTERNAL "FreeImage major version requirement" FORCE)
set (FREEIMAGE_MINOR_VERSION 9 CACHE INTERNAL "FreeImage minor version requirement" FORCE)
set (MIN_FREEIMAGE_VERSION ${FREEIMAGE_MAJOR_VERSION}.${FREEIMAGE_MINOR_VERSION}.0 CACHE INTERNAL "FreeImage version requirement" FORCE)

set (gazebo_cmake_dir ${PROJECT_SOURCE_DIR}/cmake CACHE PATH "Location of CMake scripts")

include (${gazebo_cmake_dir}/DissectVersion.cmake)

#####################################
# Build type cflags
set (CMAKE_C_FLAGS_ALL " -Wall -Wextra -Wno-long-long -Wno-unused-value -Wno-unused-value -Wno-unused-value -Wno-unused-value -Wfloat-equal -Wshadow -Winit-self -Wswitch-default -Wmissing-include-dirs -pedantic" CACHE INTERNAL "General C Flags")


#####################################
# Build type link flags
set (CMAKE_LINK_FLAGS_RELEASE " " CACHE INTERNAL "Link flags fro release" FORCE)
set (CMAKE_LINK_FLAGS_DEBUG " " CACHE INTERNAL "Link flags for debug" FORCE)
set (CMAKE_LINK_FLAGS_PROFILE " -pg" CACHE INTERNAL "Link flags for profile" FORCE)
set (CMAKE_LINK_FLAGS_CHECK " --coverage" CACHE INTERNAL "Link flags for static code checking" FORCE)

message (STATUS "\n\n====== Finding 3rd Party Packages ======")
include (${gazebo_cmake_dir}/SearchForStuff.cmake)
message (STATUS "----------------------------------------\n")

if (SSE2_FOUND)
  set (CMAKE_C_FLAGS_ALL "${CMAKE_C_FLAGS_ALL} -msse -msse2 -mfpmath=sse")
endif()
if (SSE3_FOUND)
  set (CMAKE_C_FLAGS_ALL "${CMAKE_C_FLAGS_ALL} -msse3")
endif()
if (SSSE3_FOUND)
  set (CMAKE_C_FLAGS_ALL "${CMAKE_C_FLAGS_ALL} -mssse3")
endif()

if (ENABLE_SSE4)
  message(STATUS "\nSSE4 will be enabled if system supports it.\n")
  if (SSE4_1_FOUND)
    set (CMAKE_C_FLAGS_ALL "${CMAKE_C_FLAGS_ALL} -msse4.1")
  endif()
  if (SSE4_2_FOUND)
    set (CMAKE_C_FLAGS_ALL "${CMAKE_C_FLAGS_ALL} -msse4.2")
  endif()
else()
  message(STATUS "\nSSE4 disabled.\n")
endif()

set (CMAKE_C_FLAGS_RELEASE " -s -O2 -DNDEBUG ${CMAKE_C_FLAGS_ALL}" CACHE INTERNAL "C Flags for release" FORCE)
set (CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})

set (CMAKE_C_FLAGS_DEBUG " -ggdb3 ${CMAKE_C_FLAGS_ALL}" CACHE INTERNAL "C Flags for debug" FORCE)
set (CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})

set (CMAKE_C_FLAGS_PROFILE " -fno-omit-frame-pointer -g -pg ${CMAKE_C_FLAGS_ALL}" CACHE INTERNAL "C Flags for profile" FORCE)
set (CMAKE_CXX_FLAGS_PROFILE ${CMAKE_C_FLAGS_PROFILE})

set (CMAKE_C_FLAGS_CHECK " -g -O0 -Wformat=2 --coverage -fno-inline ${CMAKE_C_FLAGS_ALL}" CACHE INTERNAL "C Flags for static code checking" FORCE)
set (CMAKE_CXX_FLAGS_CHECK "${CMAKE_C_FLAGS_CHECK} -fno-elide-constructors -fno-default-inline -fno-implicit-inline-templates")

#####################################
# Set the default build type
if (NOT CMAKE_BUILD_TYPE)
  set (CMAKE_BUILD_TYPE "RELEASE" CACHE STRING 
    "Choose the type of build, options are: debug release profile check" FORCE)
endif (NOT CMAKE_BUILD_TYPE)
string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE)

#####################################
# Set all the global build flags
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_LINK_FLAGS_${CMAKE_BUILD_TYPE}}")
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_LINK_FLAGS_${CMAKE_BUILD_TYPE}}")
set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_LINK_FLAGS_${CMAKE_BUILD_TYPE}}")

if ("${CMAKE_BUILD_TYPE}" STREQUAL "PROFILE")
  set (BUILD_TYPE_PROFILE TRUE)
else()
  set (BUILD_TYPE_PROFILE FALSE)
endif()

if ("${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE")
  set (BUILD_TYPE_RELEASE TRUE)
else()
  set (BUILD_TYPE_RELEASE FALSE)
endif()

if ( "${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG")
  set (BUILD_TYPE_DEBUG TRUE)
else()
  set (BUILD_TYPE_DEBUG FALSE)
endif()

message (STATUS "\n\n====== Configuring 3rd Party Packages ======")
add_subdirectory(deps)
message (STATUS "----------------------------------------\n")

#################################################
# OS Specific initialization
if (UNIX)
  gz_setup_unix()
else (WIN32)
  gz_setup_windows()
else (APPLE)
  gz_setup_apple()
endif()

#################################################
# Print warnings and errors
if ( build_warnings )
  message(STATUS "BUILD WARNINGS")
  foreach (msg ${build_warnings})
    message(STATUS ${msg})
  endforeach ()
  message(STATUS "END BUILD WARNINGS\n")
endif (build_warnings)

########### Add uninstall target ###############
configure_file(
  "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
  "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake"
  IMMEDIATE @ONLY)
add_custom_target(uninstall
  "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake")

add_subdirectory(doc)

if (build_errors)

  # Create a Makefile that allows doxygen to run
  file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/Makefile
       "doc: gazebo.dox\n\tdoxygen $<\n\n")

  message(STATUS "BUILD ERRORS: These must be resolved before compiling.")
  foreach (msg ${build_errors})
    message(STATUS ${msg})
  endforeach ()
  message(STATUS "END BUILD ERRORS\n")
  message (FATAL_ERROR "Errors encountered in build. Please see the BUILD ERRORS above.")
else (build_errors)

  ########################################
  # Write the config.h file
  configure_file (${gazebo_cmake_dir}/gazebo_config.h.in ${PROJECT_BINARY_DIR}/gazebo/gazebo_config.h)
  gz_install_includes("" ${PROJECT_BINARY_DIR}/gazebo/gazebo_config.h)

  configure_file(${CMAKE_SOURCE_DIR}/cmake/setup.sh.in ${PROJECT_BINARY_DIR}/setup.sh @ONLY)
  install(FILES ${CMAKE_CURRENT_BINARY_DIR}/setup.sh DESTINATION ${CMAKE_INSTALL_PREFIX}/share/gazebo-${GAZEBO_VERSION}/)
 
  include_directories(${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR})
  
  message (STATUS "C Flags:${CMAKE_CXX_FLAGS}")
  message (STATUS "Build Type: ${CMAKE_BUILD_TYPE}")
  message (STATUS "Install path: ${CMAKE_INSTALL_PREFIX}")
 

  if (BUILD_GAZEBO)
    add_subdirectory(gazebo)
    add_subdirectory(sdf)
    add_subdirectory(media)
    add_subdirectory(test)
    add_subdirectory(tools)
    add_subdirectory(plugins)
    add_subdirectory(interfaces)
  endif (BUILD_GAZEBO)

  ########################################
  # Make the package config files
  set (pkgconfig_files gazebo_ode gazebo_transport gazebo)

  foreach (pkgconfig ${pkgconfig_files})
    configure_file(${CMAKE_SOURCE_DIR}/cmake/pkgconfig/${pkgconfig}.in ${CMAKE_CURRENT_BINARY_DIR}/cmake/pkgconfig/${pkgconfig}.pc @ONLY)
    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cmake/pkgconfig/${pkgconfig}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig COMPONENT pkgconfig)
  endforeach()

  ########################################
  # Package Creation: 
  include (${gazebo_cmake_dir}/gazebo_cpack.cmake)
  set (CPACK_PACKAGE_VERSION "${GAZEBO_VERSION_FULL}")
  set (CPACK_PACKAGE_VERSION_MAJOR "${GAZEBO_MAJOR_VERSION}")
  set (CPACK_PACKAGE_VERSION_MINOR "${GAZEBO_MINOR_VERSION}")
  set (CPACK_PACKAGE_VERSION_PATCH "${GAZEBO_PATCH_VERSION}")

  if (CPACK_GENERATOR)
    message(STATUS "Found CPack generators: ${CPACK_GENERATOR}")

    configure_file("${gazebo_cmake_dir}/cpack_options.cmake.in" ${GAZEBO_CPACK_CFG_FILE} @ONLY)
    set(CPACK_PROJECT_CONFIG_FILE ${GAZEBO_CPACK_CFG_FILE})
    include (CPack)
  endif()

  message(STATUS "Configuration successful. Type make to compile gazebo")
endif(build_errors)