diff --git a/CMakeLists.txt b/CMakeLists.txt index 628dfb0ceb730730e88aa3217a2cf380614b49ff..96c7ea6e7d66e74275329f4e8df41d2eabaf0f36 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,15 +6,25 @@ if (NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release) endif() +# This shouldn't be necessary, but there has been trouble +# with MSVC being set off, but MSVCXX ON. +if(MSVC OR MSVC90 OR MSVC10) + set(MSVC ON) +endif (MSVC OR MSVC90 OR MSVC10) + set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules") - +include(CompilerSettings) include(FCLVersion) -option(FCL_STATIC_LIBRARY "Whether the FCL library should be static rather than shared" OFF) +if(MSVC OR IS_ICPC) + option(FCL_STATIC_LIBRARY "Whether the FCL library should be static rather than shared" ON) +else() + option(FCL_STATIC_LIBRARY "Whether the FCL library should be static rather than shared" OFF) +endif() # Whether to enable SSE -option(FCL_USE_SSE "Whether FCL should SSE instructions" ON) +option(FCL_USE_SSE "Whether FCL should SSE instructions" OFF) set(FCL_HAVE_SSE 0) if(FCL_USE_SSE) if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") @@ -53,7 +63,7 @@ endif() find_package(Boost COMPONENTS thread date_time filesystem system unit_test_framework REQUIRED) include_directories(${Boost_INCLUDE_DIR}) -if(MSVC OR MSVC90 OR MSVC10) +if(MSVC) add_definitions(-DBOOST_ALL_NO_LIB) endif() add_definitions(-DBOOST_TEST_DYN_LINK) diff --git a/CMakeModules/CompilerSettings.cmake b/CMakeModules/CompilerSettings.cmake new file mode 100644 index 0000000000000000000000000000000000000000..807ce63dbe1968f8e674baf49d98e8d68c15e84d --- /dev/null +++ b/CMakeModules/CompilerSettings.cmake @@ -0,0 +1,50 @@ +if(CMAKE_COMPILER_IS_GNUCXX) + add_definitions(-W -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter) +endif(CMAKE_COMPILER_IS_GNUCXX) +if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + add_definitions(-W -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wno-delete-non-virtual-dtor -Wno-overloaded-virtual -Wno-unknown-pragmas) +endif() + +if(MSVC OR MSVC90 OR MSVC10) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /MP /W1 /D_ITERATOR_DEBUG_LEVEL=0") +endif(MSVC OR MSVC90 OR MSVC10) + +if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + set(IS_ICPC 1) +else() + set(IS_ICPC 0) +endif() +if(IS_ICPC) + add_definitions(-wd191 -wd411 -wd654 -wd1125 -wd1292 -wd1565 -wd1628 -wd2196) + set(CMAKE_AR "xiar" CACHE STRING "Intel archiver" FORCE) + set(CMAKE_CXX_FLAGS "-pthread" CACHE STRING "Default compile flags" FORCE) + set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" + CACHE STRING "Flags used by the C++ compiler during release builds." FORCE) + set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g" CACHE STRING + "Flags used by the C++ compiler during debug builds." FORCE) + set(CMAKE_LINKER "xild" CACHE STRING "Intel linker" FORCE) +endif(IS_ICPC) + +if(CMAKE_CXX_COMPILER_ID STREQUAL "XL") + set(IS_XLC 1) +else() + set(IS_XLC 0) +endif() +if(IS_XLC) + add_definitions(-qpic -q64 -qmaxmem=-1) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -q64") + set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -q64") +endif(IS_XLC) + +if((CMAKE_COMPILER_IS_GNUCXX OR IS_ICPC) AND NOT MINGW) + add_definitions(-fPIC) +endif((CMAKE_COMPILER_IS_GNUCXX OR IS_ICPC) AND NOT MINGW) + +# Set rpath http://www.paraview.org/Wiki/CMake_RPATH_handling +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) + +# no prefix needed for python modules +set(CMAKE_SHARED_MODULE_PREFIX "") diff --git a/include/fcl/narrowphase/gjk_libccd.h b/include/fcl/narrowphase/gjk_libccd.h index 20c24709e2191b4df3c6a60c585d4f48210974c5..a222507fd46a3af872f5811d7356f00e2c3592a2 100644 --- a/include/fcl/narrowphase/gjk_libccd.h +++ b/include/fcl/narrowphase/gjk_libccd.h @@ -68,7 +68,7 @@ public: /// @brief Get GJK object from a shape /// Notice that only local transformation is applied. /// Gloal transformation are considered later - static void* createGJKObject(const T& s, const Transform3f& tf) { return NULL; } + static void* createGJKObject(const T& /* s */, const Transform3f& /*tf*/) { return NULL; } /// @brief Delete GJK object static void deleteGJKObject(void* o) {} diff --git a/include/fcl/traversal/traversal_node_bvh_shape.h b/include/fcl/traversal/traversal_node_bvh_shape.h index d2bd5cfa4fe33f1c0d493dc48d6e0e9dfe9675d5..5239403040892a6fb697c7be7d8d645dbe9c5cdc 100644 --- a/include/fcl/traversal/traversal_node_bvh_shape.h +++ b/include/fcl/traversal/traversal_node_bvh_shape.h @@ -302,7 +302,7 @@ static inline void meshShapeCollisionOrientedNodeLeafTesting(int b1, int b2, AABB overlap_part; AABB shape_aabb; computeBV<AABB, S>(model2, tf2, shape_aabb); - bool res = AABB(tf1.transform(p1), tf1.transform(p2), tf1.transform(p3)).overlap(shape_aabb, overlap_part); + /* bool res = */ AABB(tf1.transform(p1), tf1.transform(p2), tf1.transform(p3)).overlap(shape_aabb, overlap_part); result.addCostSource(CostSource(overlap_part, cost_density), request.num_max_cost_sources); } } @@ -313,7 +313,7 @@ static inline void meshShapeCollisionOrientedNodeLeafTesting(int b1, int b2, AABB overlap_part; AABB shape_aabb; computeBV<AABB, S>(model2, tf2, shape_aabb); - bool res = AABB(tf1.transform(p1), tf1.transform(p2), tf1.transform(p3)).overlap(shape_aabb, overlap_part); + /* bool res = */ AABB(tf1.transform(p1), tf1.transform(p2), tf1.transform(p3)).overlap(shape_aabb, overlap_part); result.addCostSource(CostSource(overlap_part, cost_density), request.num_max_cost_sources); } } @@ -759,7 +759,7 @@ namespace details { template<typename BV, typename S, typename NarrowPhaseSolver> -void meshShapeDistanceOrientedNodeLeafTesting(int b1, int b2, +void meshShapeDistanceOrientedNodeLeafTesting(int b1, int /* b2 */, const BVHModel<BV>* model1, const S& model2, Vec3f* vertices, Triangle* tri_indices, const Transform3f& tf1, @@ -767,7 +767,7 @@ void meshShapeDistanceOrientedNodeLeafTesting(int b1, int b2, const NarrowPhaseSolver* nsolver, bool enable_statistics, int & num_leaf_tests, - const DistanceRequest& request, + const DistanceRequest& /* request */, DistanceResult& result) { if(enable_statistics) num_leaf_tests++; @@ -792,7 +792,7 @@ static inline void distancePreprocessOrientedNode(const BVHModel<BV>* model1, Vec3f* vertices, Triangle* tri_indices, int init_tri_id, const S& model2, const Transform3f& tf1, const Transform3f& tf2, const NarrowPhaseSolver* nsolver, - const DistanceRequest& request, + const DistanceRequest& /* request */, DistanceResult& result) { const Triangle& init_tri = tri_indices[init_tri_id]; diff --git a/src/BV/kIOS.cpp b/src/BV/kIOS.cpp index 347d8c49ac17d7af5298d3c4b38069d2e1cbde37..67d068a471677bce09516f4ce4001db4f731ea60 100644 --- a/src/BV/kIOS.cpp +++ b/src/BV/kIOS.cpp @@ -135,7 +135,7 @@ FCL_REAL kIOS::size() const FCL_REAL kIOS::distance(const kIOS& other, Vec3f* P, Vec3f* Q) const { FCL_REAL d_max = 0; - unsigned int id_a = -1, id_b = -1; + int id_a = -1, id_b = -1; for(unsigned int i = 0; i < num_spheres; ++i) { for(unsigned int j = 0; j < other.num_spheres; ++j) diff --git a/src/articulated_model/joint.cpp b/src/articulated_model/joint.cpp index 2243f0815d396de302a2ea5ed1a4ea89fc86e6f8..b42097c2b2980c5c188d946063986b1f643d2b75 100644 --- a/src/articulated_model/joint.cpp +++ b/src/articulated_model/joint.cpp @@ -45,8 +45,8 @@ Joint::Joint(const boost::shared_ptr<Link>& link_parent, const boost::shared_ptr const Transform3f& transform_to_parent, const std::string& name) : link_parent_(link_parent), link_child_(link_child), - transform_to_parent_(transform_to_parent), - name_(name) + name_(name), + transform_to_parent_(transform_to_parent) {} Joint::Joint(const std::string& name) : diff --git a/src/collision.cpp b/src/collision.cpp index 9635a70a4235db733945cbe64ea12556eb784d1a..68f51f6b1e706c47df9aeed82a2312a6b025b9b9 100644 --- a/src/collision.cpp +++ b/src/collision.cpp @@ -87,7 +87,7 @@ std::size_t collide(const CollisionGeometry* o1, const Transform3f& tf1, NODE_TYPE node_type1 = o1->getNodeType(); NODE_TYPE node_type2 = o2->getNodeType(); - if(object_type1 == OT_GEOM & object_type2 == OT_BVH) + if(object_type1 == OT_GEOM && object_type2 == OT_BVH) { if(!looktable.collision_matrix[node_type2][node_type1]) { diff --git a/src/narrowphase/narrowphase.cpp b/src/narrowphase/narrowphase.cpp index 3ff84588ef8f4ffa174e289a0bc6e4b98b2df278..cbdec59204c6c714f6593c37e91107c6d016f624 100644 --- a/src/narrowphase/narrowphase.cpp +++ b/src/narrowphase/narrowphase.cpp @@ -213,7 +213,6 @@ bool sphereTriangleIntersect(const Sphere& s, const Transform3f& tf, } else { - FCL_REAL distance = 0; if(normal_) *normal_ = normal; if(contact_points) *contact_points = contact_point; if(penetration_depth) *penetration_depth = -radius; @@ -1217,10 +1216,10 @@ bool boxBoxIntersect(const Box& s1, const Transform3f& tf1, int return_code; Vec3f normal; FCL_REAL depth; - int cnum = boxBox2(s1.side, tf1.getRotation(), tf1.getTranslation(), - s2.side, tf2.getRotation(), tf2.getTranslation(), - normal, &depth, &return_code, - 4, contacts); + /* int cnum = */ boxBox2(s1.side, tf1.getRotation(), tf1.getTranslation(), + s2.side, tf2.getRotation(), tf2.getTranslation(), + normal, &depth, &return_code, + 4, contacts); if(normal_) *normal_ = normal; if(penetration_depth_) *penetration_depth_ = depth; @@ -1524,7 +1523,7 @@ bool convexHalfspaceIntersect(const Convex& s1, const Transform3f& tf1, Vec3f v; FCL_REAL depth = std::numeric_limits<FCL_REAL>::max(); - for(std::size_t i = 0; i < s1.num_points; ++i) + for(int i = 0; i < s1.num_points; ++i) { Vec3f p = tf1.transform(s1.points[i]); @@ -2112,7 +2111,7 @@ bool conePlaneIntersect(const Cone& s1, const Transform3f& tf1, Vec3f q; FCL_REAL p_d[2]; - FCL_REAL q_d; + FCL_REAL q_d(0); if(n_positive == 2) { @@ -2153,7 +2152,7 @@ bool convexPlaneIntersect(const Convex& s1, const Transform3f& tf1, Vec3f v_min, v_max; FCL_REAL d_min = std::numeric_limits<FCL_REAL>::max(), d_max = -std::numeric_limits<FCL_REAL>::max(); - for(std::size_t i = 0; i < s1.num_points; ++i) + for(int i = 0; i < s1.num_points; ++i) { Vec3f p = tf1.transform(s1.points[i]); @@ -2231,7 +2230,7 @@ bool planeTriangleIntersect(const Plane& s1, const Transform3f& tf1, Vec3f q; FCL_REAL p_d[2]; - FCL_REAL q_d; + FCL_REAL q_d(0); if(n_positive == 2) { diff --git a/src/traversal/traversal_recurse.cpp b/src/traversal/traversal_recurse.cpp index 68ea258dce24bc35362f88145155c7af689dc486..ec68b330dfbf0274fd4d01945d2630a685a20bc7 100644 --- a/src/traversal/traversal_recurse.cpp +++ b/src/traversal/traversal_recurse.cpp @@ -308,7 +308,7 @@ struct BVTQ std::priority_queue<BVT, std::vector<BVT>, BVT_Comparer> pq; /** \brief Queue size */ - int qsize; + unsigned int qsize; }; diff --git a/test/test_fcl_broadphase.cpp b/test/test_fcl_broadphase.cpp index 7101b720835bc291a0d57ede0f43f077ae15ca24..39b787d53eceda19a5becf1576f63d1bfda64411 100644 --- a/test/test_fcl_broadphase.cpp +++ b/test/test_fcl_broadphase.cpp @@ -285,13 +285,13 @@ void generateEnvironmentsMesh(std::vector<CollisionObject*>& env, double env_sca void generateSelfDistanceEnvironments(std::vector<CollisionObject*>& env, double env_scale, std::size_t n) { - int n_edge = std::floor(std::pow(n, 1/3.0)); + unsigned int n_edge = std::floor(std::pow(n, 1/3.0)); FCL_REAL step_size = env_scale * 2 / n_edge; FCL_REAL delta_size = step_size * 0.05; FCL_REAL single_size = step_size - 2 * delta_size; - std::size_t i = 0; + unsigned int i = 0; for(; i < n_edge * n_edge * n_edge / 4; ++i) { int x = i % (n_edge * n_edge); @@ -347,7 +347,7 @@ void generateSelfDistanceEnvironments(std::vector<CollisionObject*>& env, double void generateSelfDistanceEnvironmentsMesh(std::vector<CollisionObject*>& env, double env_scale, std::size_t n) { - int n_edge = std::floor(std::pow(n, 1/3.0)); + unsigned int n_edge = std::floor(std::pow(n, 1/3.0)); FCL_REAL step_size = env_scale * 2 / n_edge; FCL_REAL delta_size = step_size * 0.05;