<commit_before>cmake_minimum_required(VERSION 2.6)
project(ompl CXX C)

set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")

set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
#set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_BUILD_TYPE Release)

find_package(Boost COMPONENTS date_time thread REQUIRED)

set(OMPL_CODE ${PROJECT_SOURCE_DIR}/code)
include_directories(${OMPL_CODE})
add_definitions(-W -Wall -Wextra)

add_library(ompl SHARED ${OMPL_CODE}/ompl/util/src/RandomNumbers.cpp 
			${OMPL_CODE}/ompl/util/src/Console.cpp
                        ${OMPL_CODE}/ompl/datastructures/src/SearchGrid.cpp
			${OMPL_CODE}/ompl/base/src/SpaceInformation.cpp
			${OMPL_CODE}/ompl/base/src/L2SquareStateDistanceEvaluator.cpp
			${OMPL_CODE}/ompl/base/src/LinearProjectionEvaluator.cpp
			${OMPL_CODE}/ompl/base/src/OrthogonalProjectionEvaluator.cpp
			${OMPL_CODE}/ompl/base/src/StateSampler.cpp
			${OMPL_CODE}/ompl/base/src/StateSamplerArray.cpp
			${OMPL_CODE}/ompl/base/src/UniformStateSampler.cpp
			${OMPL_CODE}/ompl/base/src/GoalRegion.cpp
			${OMPL_CODE}/ompl/base/src/GoalState.cpp
			${OMPL_CODE}/ompl/base/src/Planner.cpp
			${OMPL_CODE}/ompl/kinematic/src/PathKinematic.cpp
			${OMPL_CODE}/ompl/kinematic/src/SpaceInformationKinematic.cpp
			${OMPL_CODE}/ompl/kinematic/src/PathSmootherKinematic.cpp
			${OMPL_CODE}/ompl/kinematic/src/LinearStateInterpolatorKinematic.cpp
			${OMPL_CODE}/ompl/kinematic/planners/ik/src/HCIK.cpp
			${OMPL_CODE}/ompl/kinematic/planners/ik/src/GAIK.cpp
			${OMPL_CODE}/ompl/kinematic/planners/rrt/src/RRT.cpp
			${OMPL_CODE}/ompl/kinematic/planners/rrt/src/pRRT.cpp
			${OMPL_CODE}/ompl/kinematic/planners/rrt/src/LazyRRT.cpp
			${OMPL_CODE}/ompl/kinematic/planners/rrt/src/RRTConnect.cpp
			${OMPL_CODE}/ompl/kinematic/planners/est/src/EST.cpp
			${OMPL_CODE}/ompl/kinematic/planners/sbl/src/SBL.cpp
			${OMPL_CODE}/ompl/kinematic/planners/sbl/src/pSBL.cpp
			${OMPL_CODE}/ompl/kinematic/planners/kpiece/src/KPIECE1.cpp
			${OMPL_CODE}/ompl/kinematic/planners/kpiece/src/LBKPIECE1.cpp
			${OMPL_CODE}/ompl/dynamic/src/ControlSampler.cpp
			${OMPL_CODE}/ompl/dynamic/src/PathDynamic.cpp
			${OMPL_CODE}/ompl/dynamic/src/SpaceInformationControls.cpp
			${OMPL_CODE}/ompl/dynamic/src/UniformControlSampler.cpp
			${OMPL_CODE}/ompl/dynamic/src/SpaceInformationControlsIntegrator.cpp
			${OMPL_CODE}/ompl/dynamic/src/SpaceInformationControlsPhysics.cpp
			${OMPL_CODE}/ompl/dynamic/planners/rrt/src/RRT.cpp
			${OMPL_CODE}/ompl/dynamic/planners/kpiece/src/KPIECE1.cpp
			)

target_link_libraries(ompl
  ${Boost_THREAD_LIBRARY}
  ${Boost_DATE_TIME_LIBRARY}
)

### Tests

find_package(GTest)
option(BUILD_TESTS "Build ompl tests" ${GTEST_FOUND})

if(BUILD_TESTS)
  enable_testing()
	
  include_directories(${GTEST_INCLUDE_DIRS})
  
  macro(ADD_OMPL_TEST test_name)
    add_executable(${ARGV})
    target_link_libraries(${test_name} 
                          ompl
			  ${Boost_THREAD_LIBRARY}
			  ${Boost_DATE_TIME_LIBRARY} ${GTEST_LIBRARIES})
    add_test(${test_name} ${EXECUTABLE_OUTPUT_PATH}/${test_name})
  endmacro(ADD_OMPL_TEST)


  # Test kinematic motion planners on a 2D map
  ADD_OMPL_TEST(test_2dmap_kinematic ${OMPL_CODE}/tests/kinematic/2dmap/2dmap.cpp)

  # Test dynamic motion planners on a 2D map
  ADD_OMPL_TEST(test_2dmap_dynamic ${OMPL_CODE}/tests/dynamic/2dmap/2dmap.cpp)

  # Test datastructures implementation
  ADD_OMPL_TEST(test_heap ${OMPL_CODE}/tests/datastructures/heap/heap.cpp)
  ADD_OMPL_TEST(test_grid ${OMPL_CODE}/tests/datastructures/grid/grid.cpp)
  ADD_OMPL_TEST(test_gridb ${OMPL_CODE}/tests/datastructures/grid/gridb.cpp)
  ADD_OMPL_TEST(test_searchgrid ${OMPL_CODE}/tests/datastructures/searchgrid/searchgrid.cpp)

  # Test utilities
  ADD_OMPL_TEST(test_random ${OMPL_CODE}/tests/util/random/random.cpp)

  # Test compilation
  ADD_OMPL_TEST(test_compile ${OMPL_CODE}/tests/compile/compile.cpp)

endif(BUILD_TESTS)<commit_msg>add ROS flag in build system<commit_after>option(ROS "Build against ROS" FALSE)

if(NOT ROS)

  cmake_minimum_required(VERSION 2.6)
  project(ompl CXX C)
  set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
  set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
  set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)

endif(NOT ROS)

#set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_BUILD_TYPE Release)

set(OMPL_CODE ${PROJECT_SOURCE_DIR}/code)
include_directories(${OMPL_CODE})

set(OMPL_SOURCE_CODE ${OMPL_CODE}/ompl/util/src/RandomNumbers.cpp 
                     ${OMPL_CODE}/ompl/util/src/Console.cpp
                     ${OMPL_CODE}/ompl/datastructures/src/SearchGrid.cpp
		     ${OMPL_CODE}/ompl/base/src/SpaceInformation.cpp
		     ${OMPL_CODE}/ompl/base/src/L2SquareStateDistanceEvaluator.cpp
		     ${OMPL_CODE}/ompl/base/src/LinearProjectionEvaluator.cpp
		     ${OMPL_CODE}/ompl/base/src/OrthogonalProjectionEvaluator.cpp
		     ${OMPL_CODE}/ompl/base/src/StateSampler.cpp
		     ${OMPL_CODE}/ompl/base/src/StateSamplerArray.cpp
		     ${OMPL_CODE}/ompl/base/src/UniformStateSampler.cpp
		     ${OMPL_CODE}/ompl/base/src/GoalRegion.cpp
		     ${OMPL_CODE}/ompl/base/src/GoalState.cpp
		     ${OMPL_CODE}/ompl/base/src/Planner.cpp
		     ${OMPL_CODE}/ompl/kinematic/src/PathKinematic.cpp
		     ${OMPL_CODE}/ompl/kinematic/src/SpaceInformationKinematic.cpp
		     ${OMPL_CODE}/ompl/kinematic/src/PathSmootherKinematic.cpp
		     ${OMPL_CODE}/ompl/kinematic/src/LinearStateInterpolatorKinematic.cpp
		     ${OMPL_CODE}/ompl/kinematic/planners/ik/src/HCIK.cpp
		     ${OMPL_CODE}/ompl/kinematic/planners/ik/src/GAIK.cpp
		     ${OMPL_CODE}/ompl/kinematic/planners/rrt/src/RRT.cpp
		     ${OMPL_CODE}/ompl/kinematic/planners/rrt/src/pRRT.cpp
		     ${OMPL_CODE}/ompl/kinematic/planners/rrt/src/LazyRRT.cpp
		     ${OMPL_CODE}/ompl/kinematic/planners/rrt/src/RRTConnect.cpp
		     ${OMPL_CODE}/ompl/kinematic/planners/est/src/EST.cpp
		     ${OMPL_CODE}/ompl/kinematic/planners/sbl/src/SBL.cpp
		     ${OMPL_CODE}/ompl/kinematic/planners/sbl/src/pSBL.cpp
		     ${OMPL_CODE}/ompl/kinematic/planners/kpiece/src/KPIECE1.cpp
		     ${OMPL_CODE}/ompl/kinematic/planners/kpiece/src/LBKPIECE1.cpp
		     ${OMPL_CODE}/ompl/dynamic/src/ControlSampler.cpp
		     ${OMPL_CODE}/ompl/dynamic/src/PathDynamic.cpp
		     ${OMPL_CODE}/ompl/dynamic/src/SpaceInformationControls.cpp
		     ${OMPL_CODE}/ompl/dynamic/src/UniformControlSampler.cpp
		     ${OMPL_CODE}/ompl/dynamic/src/SpaceInformationControlsIntegrator.cpp
		     ${OMPL_CODE}/ompl/dynamic/src/SpaceInformationControlsPhysics.cpp
		     ${OMPL_CODE}/ompl/dynamic/planners/rrt/src/RRT.cpp
		     ${OMPL_CODE}/ompl/dynamic/planners/kpiece/src/KPIECE1.cpp)

if(ROS)  

  rosbuild_add_boost_directories()
  rosbuild_add_library(ompl ${OMPL_SOURCE_CODE})
  rosbuild_add_compile_flags(ompl -Wextra)
  rosbuild_link_boost(ompl thread date_time)
  option(BUILD_TESTS "Build ompl tests" TRUE)
  
else(ROS)
  find_package(Boost COMPONENTS date_time thread REQUIRED)
  add_library(ompl SHARED ${OMPL_SOURCE_CODE})
  add_definitions(-W -Wall -Wextra)
  target_link_libraries(ompl
    ${Boost_THREAD_LIBRARY}
    ${Boost_DATE_TIME_LIBRARY}
    )
  
  find_package(GTest)
  option(BUILD_TESTS "Build ompl tests" ${GTEST_FOUND})

endif(ROS)

### Tests


if(BUILD_TESTS)

  if(ROS)
    
    macro(add_ompl_test test_name)
      rosbuild_add_gtest(${ARGV})
      target_link_libraries(${test_name} ompl)
      rosbuild_link_boost(test_2dmap_kinematic thread date_time)			
    endmacro(add_ompl_test)

  else(ROS)
    
    enable_testing()
    
    include_directories(${GTEST_INCLUDE_DIRS})
    
    macro(add_ompl_test test_name)
      add_executable(${ARGV})
      target_link_libraries(${test_name} 
        ompl
	${Boost_THREAD_LIBRARY}
	${Boost_DATE_TIME_LIBRARY} ${GTEST_LIBRARIES})
      add_test(${test_name} ${EXECUTABLE_OUTPUT_PATH}/${test_name})
    endmacro(add_ompl_test)
    
  endif(ROS)
  
  # Test kinematic motion planners on a 2D map
  add_ompl_test(test_2dmap_kinematic ${OMPL_CODE}/tests/kinematic/2dmap/2dmap.cpp)

  # Test dynamic motion planners on a 2D map
  add_ompl_test(test_2dmap_dynamic ${OMPL_CODE}/tests/dynamic/2dmap/2dmap.cpp)

  # Test datastructures implementation
  add_ompl_test(test_heap ${OMPL_CODE}/tests/datastructures/heap/heap.cpp)
  add_ompl_test(test_grid ${OMPL_CODE}/tests/datastructures/grid/grid.cpp)
  add_ompl_test(test_gridb ${OMPL_CODE}/tests/datastructures/grid/gridb.cpp)
  add_ompl_test(test_searchgrid ${OMPL_CODE}/tests/datastructures/searchgrid/searchgrid.cpp)

  # Test utilities
  add_ompl_test(test_random ${OMPL_CODE}/tests/util/random/random.cpp)

  # Test compilation
  add_ompl_test(test_compile ${OMPL_CODE}/tests/compile/compile.cpp)

endif(BUILD_TESTS)
{'fraction_non_alphanumeric': 0.12507164966181358, 'fraction_numerical': 0.0033245443081508655, 'mean_word_length': 4.664935064935065, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4583300', 'n_tokens_mistral': 3770, 'n_tokens_neox': 3367, 'n_words': 299}