<commit_before>cmake_minimum_required(VERSION 2.8)
set(CMAKE_LEGACY_CYGWIN_WIN32 0)
set(CMAKE_CXX_WARNING_LEVEL 4)
# Disables a warning about a change in Cygwin Cmake

project(dart)
message(STATUS "Generate makefile/project file for DART")

set(DART_MAJOR_VERSION "4")
set(DART_MINOR_VERSION "0")
set(DART_PATCH_VERSION "0")
set(PKG_DESC "Dynamic Animation and Robotics Toolkit.")
set(DART_VERSION "${DART_MAJOR_VERSION}.${DART_MINOR_VERSION}.${DART_PATCH_VERSION}")
set(PKG_EXTERNAL_DEPS "flann, ccd, fcl")

message(STATUS "CMAKE_SOURCE_DIR = ${CMAKE_SOURCE_DIR}")
message(STATUS "CMAKE_BINARY_DIR = ${CMAKE_BINARY_DIR}")

option(ENABLE_OPENMP "Build with OpenMP parallaization enabled" ON)
option(BUILD_CORE_ONLY "Build only the core of DART" OFF)
if(NOT MSVC)
    OPTION(BUILD_SHARED_LIBS "Build shared libraries" ON)
endif()

###############
message(STATUS "Checking dart build type")
if(NOT CMAKE_BUILD_TYPE)
  set(CMAKE_BUILD_TYPE Release CACHE STRING
      "Choose the type of build, options are: None Debug Release RelWithDebInfo Profile."
      FORCE)
endif(NOT CMAKE_BUILD_TYPE)
string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UPPERCASE)

set(BUILD_TYPE_PROFILE FALSE)
set(BUILD_TYPE_RELEASE FALSE)
set(BUILD_TYPE_RELWITHDEBINFO FALSE)
set(BUILD_TYPE_DEBUG FALSE)

if("${CMAKE_BUILD_TYPE_UPPERCASE}" STREQUAL "PROFILE")
  set(BUILD_TYPE_PROFILE TRUE)
elseif("${CMAKE_BUILD_TYPE_UPPERCASE}" STREQUAL "RELEASE")
  set(BUILD_TYPE_RELEASE TRUE)
elseif("${CMAKE_BUILD_TYPE_UPPERCASE}" STREQUAL "RELWITHDEBINFO")
  set(BUILD_TYPE_RELWITHDEBINFO TRUE)
elseif("${CMAKE_BUILD_TYPE_UPPERCASE}" STREQUAL "DEBUG")
  set(BUILD_TYPE_DEBUG TRUE)
else()
  build_error("CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} unknown. Valid options are: Debug Release RelWithDebInfo Profile Check")
endif()

# GCCFilter, if appliciable
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCPP)
   option(COLOR_GCC "Use GCCFilter to color compiler output messages" OFF)
   set(COLOR_GCC_OPTIONS "-c -r -w" CACHE STRING "Arguments that are passed to gccfilter when output coloring is switchend on. Defaults to -c -r -w.")
   if(COLOR_GCC)
      set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "gccfilter ${COLOR_GCC_OPTIONS}")
   endif()
endif()

if(MSVC)
  message(STATUS "Setup Visual Studio Specific Flags")
  set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd /Zi /Gy /W1 /EHsc")
  set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD /Zi /GL /Gy /W1 /EHsc /arch:SSE2")
  set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/LTCG")
elseif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
  set(CMAKE_CXX_FLAGS "-msse2 -fPIC")
  set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
  set(CMAKE_CXX_FLAGS_DEBUG "-g -fno-omit-frame-pointer -fno-inline-functions -fno-inline-functions-called-once -fno-optimize-sibling-calls")
  set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_DEBUG}")
  set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_DEBUG} -pg")
else()
  message(SEND_ERROR "Compiler not supported.")
endif()

set(CMAKE_DEBUG_POSTFIX "d")

# System Install paths
if(WIN32 AND CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
  set(CMAKE_INSTALL_PREFIX "C:/Golems" CACHE PATH "Install prefix" FORCE)
endif()

###############
# Find dependencies
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

find_package(Eigen REQUIRED)
find_package(FCL REQUIRED)
find_package(Assimp REQUIRED)
find_package(OpenGL REQUIRED)
find_package(NLOPT REQUIRED)

# IPOPT
find_package(IPOPT)
if(IPOPT_FOUND)
  message(STATUS "Looking for IPOPT - found")
  set(HAVE_IPOPT TRUE)
else(IPOPT_FOUND)
  message(WARNING "IPOPT not found, for ipopt optimization option, please install coinor-libipopt-dev.")
  set(HAVE_IPOPT FALSE)
endif()

# BulletCollision
if(UNIX)
  pkg_check_modules(BULLET bullet>=2.82)
  if (NOT BULLET_FOUND)
     pkg_check_modules(BULLET bullet2.82>=2.82)
  endif()
else()
  find_package(Bullet COMPONENTS BulletMath BulletCollision)
endif()
if(BULLET_FOUND)
  message(STATUS "Looking for BulletCollision - found")
  set(HAVE_BULLET_COLLISION TRUE)
  set(BULLET_COLLISION_LIBRARY "${BULLET_LIBRARIES}")
else(BULLET_FOUND)
  message(WARNING "BulletCollision not found, for bullet collision detector option, please install libbullet-dev.")
  set(HAVE_BULLET_COLLISION FALSE)
endif()

# GLUT
if(WIN32 AND NOT CYGWIN)
    set(GLUT_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include")
    set(GLUT_LIBRARIES glut32)
else()
    find_package(GLUT REQUIRED)
    set(GLUT_LIBRARIES ${GLUT_glut_LIBRARY})
endif()

# Boost
find_package(Boost REQUIRED system)
if(MSVC OR MSVC90 OR MSVC10)
    add_definitions(-DBOOST_ALL_NO_LIB)
endif()
add_definitions(-DBOOST_TEST_DYN_LINK)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)

# OpenMP
if(ENABLE_OPENMP)
  find_package(OpenMP)
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()

if(NOT BUILD_CORE_ONLY)
  find_package(FLANN REQUIRED)
  find_package(TinyXML REQUIRED)
  find_package(TinyXML2 REQUIRED)
  
  # urdfdom
  find_package(urdfdom REQUIRED)
  if(MSVC)
      set(urdfdom_LIBRARIES optimized urdfdom_sensor      debug urdfdom_sensord
                            optimized urdfdom_model_state debug urdfdom_model_stated
                            optimized urdfdom_model       debug urdfdom_modeld
                            optimized urdfdom_world       debug urdfdom_worldd
                            optimized console_bridge      debug console_bridged)
  endif()
endif()

include_directories(BEFORE ${PROJECT_SOURCE_DIR})
include_directories(${Eigen_INCLUDE_DIRS})
include_directories(${FCL_INCLUDE_DIRS})
include_directories(${Assimp_INCLUDE_DIRS})
include_directories(${Boost_INCLUDE_DIRS})
include_directories(${OPENGL_INCLUDE_DIR})
include_directories(${GLUT_INCLUDE_DIR})
include_directories(${NLOPT_INCLUDE_DIRS})
if(HAVE_IPOPT)
  include_directories(${IPOPT_INCLUDE_DIRS})
endif()
if(HAVE_BULLET_COLLISION)
  include_directories(${BULLET_INCLUDE_DIRS})
  add_definitions(${BULLET_CFLAGS})
endif()

if(NOT BUILD_CORE_ONLY)
  include_directories(${FLANN_INCLUDE_DIRS})
  include_directories(${urdfdom_INCLUDE_DIRS})
  include_directories(${TinyXML_INCLUDE_DIRS})
  include_directories(${TinyXML2_INCLUDE_DIRS})
endif()

include_directories("${CMAKE_BINARY_DIR}")

link_directories("${CMAKE_BINARY_DIR}/lib")
link_directories("${CMAKE_INSTALL_PREFIX}/lib")
link_directories(${Boost_LIBRARY_DIRS})

set(DART_CORE_DEPENDENCIES ${FCL_LIBRARIES}
                           ${Assimp_LIBRARIES}
                           ${Boost_LIBRARIES}
                           ${OPENGL_LIBRARIES}
                           ${GLUT_LIBRARY}
                           ${NLOPT_LIBRARIES})
if(HAVE_IPOPT)
  set(DART_CORE_DEPENDENCIES ${DART_CORE_DEPENDENCIES} ${IPOPT_LIBRARIES})<commit_msg>Add link_directories for bullet to CMakeLists.txt<commit_after>cmake_minimum_required(VERSION 2.8)
set(CMAKE_LEGACY_CYGWIN_WIN32 0)
set(CMAKE_CXX_WARNING_LEVEL 4)
# Disables a warning about a change in Cygwin Cmake

project(dart)
message(STATUS "Generate makefile/project file for DART")

set(DART_MAJOR_VERSION "4")
set(DART_MINOR_VERSION "0")
set(DART_PATCH_VERSION "0")
set(PKG_DESC "Dynamic Animation and Robotics Toolkit.")
set(DART_VERSION "${DART_MAJOR_VERSION}.${DART_MINOR_VERSION}.${DART_PATCH_VERSION}")
set(PKG_EXTERNAL_DEPS "flann, ccd, fcl")

message(STATUS "CMAKE_SOURCE_DIR = ${CMAKE_SOURCE_DIR}")
message(STATUS "CMAKE_BINARY_DIR = ${CMAKE_BINARY_DIR}")

option(ENABLE_OPENMP "Build with OpenMP parallaization enabled" ON)
option(BUILD_CORE_ONLY "Build only the core of DART" OFF)
if(NOT MSVC)
    OPTION(BUILD_SHARED_LIBS "Build shared libraries" ON)
endif()

###############
message(STATUS "Checking dart build type")
if(NOT CMAKE_BUILD_TYPE)
  set(CMAKE_BUILD_TYPE Release CACHE STRING
      "Choose the type of build, options are: None Debug Release RelWithDebInfo Profile."
      FORCE)
endif(NOT CMAKE_BUILD_TYPE)
string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UPPERCASE)

set(BUILD_TYPE_PROFILE FALSE)
set(BUILD_TYPE_RELEASE FALSE)
set(BUILD_TYPE_RELWITHDEBINFO FALSE)
set(BUILD_TYPE_DEBUG FALSE)

if("${CMAKE_BUILD_TYPE_UPPERCASE}" STREQUAL "PROFILE")
  set(BUILD_TYPE_PROFILE TRUE)
elseif("${CMAKE_BUILD_TYPE_UPPERCASE}" STREQUAL "RELEASE")
  set(BUILD_TYPE_RELEASE TRUE)
elseif("${CMAKE_BUILD_TYPE_UPPERCASE}" STREQUAL "RELWITHDEBINFO")
  set(BUILD_TYPE_RELWITHDEBINFO TRUE)
elseif("${CMAKE_BUILD_TYPE_UPPERCASE}" STREQUAL "DEBUG")
  set(BUILD_TYPE_DEBUG TRUE)
else()
  build_error("CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} unknown. Valid options are: Debug Release RelWithDebInfo Profile Check")
endif()

# GCCFilter, if appliciable
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCPP)
   option(COLOR_GCC "Use GCCFilter to color compiler output messages" OFF)
   set(COLOR_GCC_OPTIONS "-c -r -w" CACHE STRING "Arguments that are passed to gccfilter when output coloring is switchend on. Defaults to -c -r -w.")
   if(COLOR_GCC)
      set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "gccfilter ${COLOR_GCC_OPTIONS}")
   endif()
endif()

if(MSVC)
  message(STATUS "Setup Visual Studio Specific Flags")
  set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd /Zi /Gy /W1 /EHsc")
  set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD /Zi /GL /Gy /W1 /EHsc /arch:SSE2")
  set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/LTCG")
elseif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
  set(CMAKE_CXX_FLAGS "-msse2 -fPIC")
  set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
  set(CMAKE_CXX_FLAGS_DEBUG "-g -fno-omit-frame-pointer -fno-inline-functions -fno-inline-functions-called-once -fno-optimize-sibling-calls")
  set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_DEBUG}")
  set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_DEBUG} -pg")
else()
  message(SEND_ERROR "Compiler not supported.")
endif()

set(CMAKE_DEBUG_POSTFIX "d")

# System Install paths
if(WIN32 AND CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
  set(CMAKE_INSTALL_PREFIX "C:/Golems" CACHE PATH "Install prefix" FORCE)
endif()

###############
# Find dependencies
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

find_package(Eigen REQUIRED)
find_package(FCL REQUIRED)
find_package(Assimp REQUIRED)
find_package(OpenGL REQUIRED)
find_package(NLOPT REQUIRED)

# IPOPT
find_package(IPOPT)
if(IPOPT_FOUND)
  message(STATUS "Looking for IPOPT - found")
  set(HAVE_IPOPT TRUE)
else(IPOPT_FOUND)
  message(WARNING "IPOPT not found, for ipopt optimization option, please install coinor-libipopt-dev.")
  set(HAVE_IPOPT FALSE)
endif()

# BulletCollision
if(UNIX)
  pkg_check_modules(BULLET bullet>=2.82)
  if (NOT BULLET_FOUND)
     pkg_check_modules(BULLET bullet2.82>=2.82)
  endif()
else()
  find_package(Bullet COMPONENTS BulletMath BulletCollision)
endif()
if(BULLET_FOUND)
  message(STATUS "Looking for BulletCollision - found")
  set(HAVE_BULLET_COLLISION TRUE)
  set(BULLET_COLLISION_LIBRARY "${BULLET_LIBRARIES}")
else(BULLET_FOUND)
  message(WARNING "BulletCollision not found, for bullet collision detector option, please install libbullet-dev.")
  set(HAVE_BULLET_COLLISION FALSE)
endif()

# GLUT
if(WIN32 AND NOT CYGWIN)
    set(GLUT_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include")
    set(GLUT_LIBRARIES glut32)
else()
    find_package(GLUT REQUIRED)
    set(GLUT_LIBRARIES ${GLUT_glut_LIBRARY})
endif()

# Boost
find_package(Boost REQUIRED system)
if(MSVC OR MSVC90 OR MSVC10)
    add_definitions(-DBOOST_ALL_NO_LIB)
endif()
add_definitions(-DBOOST_TEST_DYN_LINK)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)

# OpenMP
if(ENABLE_OPENMP)
  find_package(OpenMP)
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()

if(NOT BUILD_CORE_ONLY)
  find_package(FLANN REQUIRED)
  find_package(TinyXML REQUIRED)
  find_package(TinyXML2 REQUIRED)
  
  # urdfdom
  find_package(urdfdom REQUIRED)
  if(MSVC)
      set(urdfdom_LIBRARIES optimized urdfdom_sensor      debug urdfdom_sensord
                            optimized urdfdom_model_state debug urdfdom_model_stated
                            optimized urdfdom_model       debug urdfdom_modeld
                            optimized urdfdom_world       debug urdfdom_worldd
                            optimized console_bridge      debug console_bridged)
  endif()
endif()

include_directories(BEFORE ${PROJECT_SOURCE_DIR})
include_directories(${Eigen_INCLUDE_DIRS})
include_directories(${FCL_INCLUDE_DIRS})
include_directories(${Assimp_INCLUDE_DIRS})
include_directories(${Boost_INCLUDE_DIRS})
include_directories(${OPENGL_INCLUDE_DIR})
include_directories(${GLUT_INCLUDE_DIR})
include_directories(${NLOPT_INCLUDE_DIRS})
if(HAVE_IPOPT)
  include_directories(${IPOPT_INCLUDE_DIRS})
endif()
if(HAVE_BULLET_COLLISION)
  include_directories(${BULLET_INCLUDE_DIRS})
  add_definitions(${BULLET_CFLAGS})
endif()

if(NOT BUILD_CORE_ONLY)
  include_directories(${FLANN_INCLUDE_DIRS})
  include_directories(${urdfdom_INCLUDE_DIRS})
  include_directories(${TinyXML_INCLUDE_DIRS})
  include_directories(${TinyXML2_INCLUDE_DIRS})
endif()

include_directories("${CMAKE_BINARY_DIR}")

link_directories("${CMAKE_BINARY_DIR}/lib")
link_directories("${CMAKE_INSTALL_PREFIX}/lib")
link_directories(${Boost_LIBRARY_DIRS})
if(HAVE_BULLET_COLLISION)
  link_directories("${BULLET_LIBRARY_DIRS}")
endif()

set(DART_CORE_DEPENDENCIES ${FCL_LIBRARIES}
                           ${Assimp_LIBRARIES}
                           ${Boost_LIBRARIES}
                           ${OPENGL_LIBRARIES}
                           ${GLUT_LIBRARY}
                           ${NLOPT_LIBRARIES})
if(HAVE_IPOPT)
  set(DART_CORE_DEPENDENCIES ${DART_CORE_DEPENDENCIES} ${IPOPT_LIBRARIES})
{'fraction_non_alphanumeric': 0.1009154155986818, 'fraction_numerical': 0.005126327352618088, 'mean_word_length': 5.8900100908173565, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5673563', 'n_tokens_mistral': 5377, 'n_tokens_neox': 4991, 'n_words': 901}