Skip to content

Commit

Permalink
Fix clang detection on Mac OS (#1038)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnwason authored Jul 30, 2024
1 parent 6638c33 commit 24af73b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions tesseract_common/cmake/tesseract_macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,13 @@ macro(tesseract_variables)
"unknown")
set(TESSERACT_COMPILE_OPTIONS_PUBLIC -mno-avx)
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
elseif(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang.*")
set(TESSERACT_COMPILE_OPTIONS_PRIVATE
-Wall
-Wextra
-Wconversion
-Wsign-conversion)
set(TESSERACT_COMPILE_DEFINITIONS "BOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED")
message(WARNING "Non-GNU compiler detected. If using AVX instructions, Eigen alignment issues may result.")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(TESSERACT_COMPILE_DEFINITIONS "_USE_MATH_DEFINES=ON")
Expand Down Expand Up @@ -132,12 +133,13 @@ macro(tesseract_variables)
"unknown")
set(TESSERACT_COMPILE_OPTIONS_PUBLIC -mno-avx)
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
elseif(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang.*")
set(TESSERACT_COMPILE_OPTIONS_PRIVATE
-Werror=all
-Werror=extra
-Werror=conversion
-Werror=sign-conversion)
set(TESSERACT_COMPILE_DEFINITIONS "BOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED")
message(WARNING "Non-GNU compiler detected. If using AVX instructions, Eigen alignment issues may result.")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(TESSERACT_COMPILE_DEFINITIONS "_USE_MATH_DEFINES=ON")
Expand Down
6 changes: 3 additions & 3 deletions tesseract_common/include/tesseract_common/yaml_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ struct convert<Eigen::VectorXd>
static Node encode(const Eigen::VectorXd& rhs)
{
Node node;
for (long i = 0; i < rhs.size(); ++i)
for (long i = 0; i < static_cast<long>(rhs.size()); ++i)
node.push_back(rhs(i));

return node;
Expand All @@ -343,8 +343,8 @@ struct convert<Eigen::VectorXd>
if (!node.IsSequence())
return false;

rhs.resize(static_cast<Eigen::Index>(node.size()));
for (long i = 0; i < node.size(); ++i)
rhs.resize(static_cast<long>(node.size()));
for (long i = 0; i < static_cast<long>(node.size()); ++i)
rhs(i) = node[i].as<double>();

return true;
Expand Down
2 changes: 1 addition & 1 deletion tesseract_environment/src/environment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1362,7 +1362,7 @@ bool Environment::Implementation::applyAddTrajectoryLinkCommand(const AddTraject
return false;
}

if (state.joint_names.size() != state.position.size())
if (static_cast<Eigen::Index>(state.joint_names.size()) != state.position.size())
{
CONSOLE_BRIDGE_logWarn("Tried to add trajectory link (%s) where joint names and position are different sizes.",
cmd->getLinkName().c_str());
Expand Down

0 comments on commit 24af73b

Please sign in to comment.