Commit 465feee0 authored by Ioan Sucan's avatar Ioan Sucan
Browse files

add compiler settings from OMPL + fix some warnings. a bunch still remain

parent dd749734
......@@ -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)
......
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 "")
......@@ -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) {}
......
......@@ -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];
......
......@@ -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)
......
......@@ -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) :
......
......@@ -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])
{
......
......@@ -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)
{
......
......@@ -308,7 +308,7 @@ struct BVTQ
std::priority_queue<BVT, std::vector<BVT>, BVT_Comparer> pq;
/** \brief Queue size */
int qsize;
unsigned int qsize;
};
......
......@@ -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;
......
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