Commit fe26c6a2 authored by isucan's avatar isucan
Browse files

checking for sse

git-svn-id: https://kforge.ros.org/fcl/fcl_ros@167 253336fb-580f-4252-a368-f3cef5a2a82b
parent 3e15126c
......@@ -7,19 +7,25 @@ project(fcl CXX C)
# Release : w/o debug symbols, w/ optimization
# RelWithDebInfo : w/ debug symbols, w/ optimization
# MinSizeRel : w/o debug symbols, w/ optimization, stripped binaries
#set(ROS_BUILD_TYPE RelWithDebInfo)
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_BUILD_TYPE Release)
#set the default path for built executables to the "bin" directory
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
#set the default path for built libraries to the "lib" directory
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
# Check for SSE flags
set(FCL_HAVE_SSE 0)
include(FCLCheckSSE)
fcl_check_for_sse()
if (SSE_FLAGS)
message(STATUS "FCL uses SSE")
add_definitions(${SSE_FLAGS})
set(FCL_HAVE_SSE 0)
# waiting for Jia to fix this; not using sse anyway
else()
message(STATUS "FCL does not use SSE")
endif()
# make sure we know what flag we used for SSE
include_directories("include")
find_package(PkgConfig)
......@@ -32,16 +38,13 @@ if(OCTOMAP_FOUND)
include_directories(${OCTOMAP_INCLUDE_DIRS})
link_directories(${OCTOMAP_LIBRARY_DIRS})
endif()
add_definitions(-DUSE_SVMLIGHT=0)
add_library(${PROJECT_NAME} SHARED src/BV/AABB.cpp src/BV/OBB.cpp src/BV/RSS.cpp src/BV/kIOS.cpp src/BV/OBBRSS.cpp src/BV/kDOP.cpp src/traversal/traversal_node_base.cpp src/traversal/traversal_node_bvhs.cpp src/intersect.cpp src/ccd/motion.cpp src/BVH/BV_fitter.cpp src/BVH/BV_splitter.cpp src/BVH/BVH_model.cpp src/BVH/BVH_utility.cpp src/math/transform.cpp src/traversal/traversal_node_setup.cpp src/shape/geometric_shapes.cpp src/shape/geometric_shapes_utility.cpp src/collision_node.cpp src/traversal/traversal_recurse.cpp src/broadphase/broadphase_bruteforce.cpp src/broadphase/broadphase_spatialhash.cpp src/broadphase/broadphase_SaP.cpp src/broadphase/broadphase_SSaP.cpp src/broadphase/broadphase_interval_tree.cpp src/broadphase/broadphase_dynamic_AABB_tree.cpp src/broadphase/broadphase_dynamic_AABB_tree_array.cpp src/collision.cpp src/collision_func_matrix.cpp src/broadphase/interval_tree.cpp src/ccd/conservative_advancement.cpp src/ccd/interval.cpp src/ccd/interval_vector.cpp src/ccd/interval_matrix.cpp src/ccd/taylor_model.cpp src/ccd/taylor_vector.cpp src/ccd/taylor_matrix.cpp src/distance_func_matrix.cpp src/distance.cpp src/narrowphase/gjk.cpp src/narrowphase/gjk_libccd.cpp src/narrowphase/narrowphase.cpp src/broadphase/hierarchy_tree.cpp src/profile.cpp src/collision_data.cpp)
target_link_libraries(${PROJECT_NAME} ${CCD_LIBRARIES} ${OCTOMAP_LIBRARIES})
add_subdirectory(include/fcl)
add_subdirectory(src)
set(pkg_conf_file "${CMAKE_CURRENT_SOURCE_DIR}/fcl.pc")
configure_file("${pkg_conf_file}.in" "${pkg_conf_file}" @ONLY)
install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION lib/ LIBRARY DESTINATION lib/)
install(DIRECTORY include/ DESTINATION include FILES_MATCHING PATTERN "*.h")
install(FILES "${pkg_conf_file}" DESTINATION lib/pkgconfig/ COMPONENT pkgconfig)
macro(fcl_check_for_sse)
# check for SSE extensions
include(CheckCXXSourceRuns)
if( CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX )
set(SSE_FLAGS)
set(CMAKE_REQUIRED_FLAGS "-msse3")
check_cxx_source_runs("
#include <pmmintrin.h>
int main()
{
__m128d a, b;
double vals[2] = {0};
a = _mm_loadu_pd(vals);
b = _mm_hadd_pd(a,a);
_mm_storeu_pd(vals, b);
return 0;
}"
HAS_SSE3_EXTENSIONS)
set(CMAKE_REQUIRED_FLAGS "-msse2")
check_cxx_source_runs("
#include <emmintrin.h>
int main()
{
__m128d a, b;
double vals[2] = {0};
a = _mm_loadu_pd(vals);
b = _mm_add_pd(a,a);
_mm_storeu_pd(vals,b);
return 0;
}"
HAS_SSE2_EXTENSIONS)
set(CMAKE_REQUIRED_FLAGS "-msse")
check_cxx_source_runs("
#include <xmmintrin.h>
int main()
{
__m128 a, b;
float vals[4] = {0};
a = _mm_loadu_ps(vals);
b = a;
b = _mm_add_ps(a,b);
_mm_storeu_ps(vals,b);
return 0;
}"
HAS_SSE_EXTENSIONS)
set(CMAKE_REQUIRED_FLAGS)
if(HAS_SSE3_EXTENSIONS)
set(SSE_FLAGS "-msse3 -mfpmath=sse")
message(STATUS " Found SSE3 extensions, using flags: ${SSE_FLAGS}")
elseif(HAS_SSE2_EXTENSIONS)
set(SSE_FLAGS "-msse2 -mfpmath=sse")
message(STATUS " Found SSE2 extensions, using flags: ${SSE_FLAGS}")
elseif(HAS_SSE_EXTENSIONS)
set(SSE_FLAGS "-msse -mfpmath=sse")
message(STATUS " Found SSE extensions, using flags: ${SSE_FLAGS}")
endif()
elseif(MSVC)
check_cxx_source_runs("
#include <emmintrin.h>
int main()
{
__m128d a, b;
double vals[2] = {0};
a = _mm_loadu_pd(vals);
b = _mm_add_pd(a,a);
_mm_storeu_pd(vals,b);
return 0;
}"
HAS_SSE2_EXTENSIONS)
if( HAS_SSE2_EXTENSIONS )
message(STATUS " Found SSE2 extensions")
set(SSE_FLAGS "/arch:SSE2 /fp:fast -D__SSE__ -D__SSE2__" )
endif()
endif()
endmacro(fcl_check_for_sse)
file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}" VERSION_DIR)
configure_file("${VERSION_DIR}/config.h.in" "${VERSION_DIR}/config.h")
/*
* Software License Agreement (BSD License)
*
* Copyright (c) 2011, Willow Garage, Inc.
* Copyright (c) 2012, Willow Garage, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
......@@ -32,11 +32,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/** \author Jia Pan */
#ifndef FCL_CONFIG_
#define FCL_CONFIG_
#ifndef FCL_SIMD_H
#define FCL_SIMD_H
#include "fcl/simd/math_simd_details.h"
#define FCL_VERSION "@FCL_VERSION@"
#cmakedefine01 FCL_HAVE_SSE
#endif
......@@ -37,9 +37,14 @@
#ifndef FCL_VEC_3F_H
#define FCL_VEC_3F_H
#include "fcl/config.h"
#include "fcl/data_types.h"
#include "fcl/math/math_details.h"
#include "fcl/simd/math_simd_details.h"
#if FCL_HAVE_SSE
# include "fcl/simd/math_simd_details.h"
#endif
#include <cmath>
#include <iostream>
#include <limits>
......@@ -213,10 +218,11 @@ void generateCoordinateSystem(const Vec3fX<T>& w, Vec3fX<T>& u, Vec3fX<T>& v)
}
}
typedef Vec3fX<details::Vec3Data<FCL_REAL> > Vec3f;
//typedef Vec3fX<details::sse_meta_f4> Vec3f;
#if FCL_HAVE_SSE
typedef Vec3fX<details::sse_meta_f4> Vec3f;
#else
typedef Vec3fX<details::Vec3Data<FCL_REAL> > Vec3f;
#endif
static inline std::ostream& operator << (std::ostream& o, const Vec3f& v)
{
......
add_library(${PROJECT_NAME} SHARED
BV/AABB.cpp
BV/OBB.cpp
BV/RSS.cpp
BV/kIOS.cpp
BV/OBBRSS.cpp
BV/kDOP.cpp
traversal/traversal_node_base.cpp
traversal/traversal_node_bvhs.cpp
intersect.cpp
ccd/motion.cpp
BVH/BV_fitter.cpp
BVH/BV_splitter.cpp
BVH/BVH_model.cpp
BVH/BVH_utility.cpp
math/transform.cpp
traversal/traversal_node_setup.cpp
shape/geometric_shapes.cpp
shape/geometric_shapes_utility.cpp
collision_node.cpp
traversal/traversal_recurse.cpp
broadphase/broadphase_bruteforce.cpp
broadphase/broadphase_spatialhash.cpp
broadphase/broadphase_SaP.cpp
broadphase/broadphase_SSaP.cpp
broadphase/broadphase_interval_tree.cpp
broadphase/broadphase_dynamic_AABB_tree.cpp
broadphase/broadphase_dynamic_AABB_tree_array.cpp
collision.cpp
collision_func_matrix.cpp
broadphase/interval_tree.cpp
ccd/conservative_advancement.cpp
ccd/interval.cpp
ccd/interval_vector.cpp
ccd/interval_matrix.cpp
ccd/taylor_model.cpp
ccd/taylor_vector.cpp
ccd/taylor_matrix.cpp
distance_func_matrix.cpp
distance.cpp
narrowphase/gjk.cpp
narrowphase/gjk_libccd.cpp
narrowphase/narrowphase.cpp
broadphase/hierarchy_tree.cpp
profile.cpp
collision_data.cpp)
target_link_libraries(${PROJECT_NAME} ${CCD_LIBRARIES} ${OCTOMAP_LIBRARIES})
install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION lib/ LIBRARY DESTINATION lib/)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment