Skip to content

Make filters compile with MSVC #88

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jun 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,30 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

if(WIN32)
add_compile_definitions(
# For math constants
# https://docs.microsoft.com/en-us/cpp/c-runtime-library/math-constants?view=vs-2019
_USE_MATH_DEFINES
# Minimize Windows namespace collision
NOMINMAX
WIN32_LEAN_AND_MEAN
)
# set the same behavior for windows as it is on linux
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif()

##############################################################################
# Find dependencies
##############################################################################

find_package(ament_cmake REQUIRED)
find_package(pluginlib REQUIRED)
find_package(rclcpp REQUIRED)

if(WIN32 AND POLICY CMP0167)
cmake_policy(SET CMP0167 NEW)
endif()
find_package(Boost QUIET COMPONENTS headers)
if(NOT Boost_headers_FOUND)
find_package(Boost REQUIRED)
Expand Down
2 changes: 1 addition & 1 deletion include/filters/median.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ bool MedianFilter<T>::update(const T & data_in, T & data_out)
for (size_t row = 0; row < length; ++row) {
temp_storage_[row] = (*data_storage_)[row];
}
data_out = median(&temp_storage_[0], length);
data_out = median(&temp_storage_[0], static_cast<int>(length));

return true;
}
Expand Down
3 changes: 1 addition & 2 deletions test/test_realtime_circular_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@
*/

#include <gtest/gtest.h>
#include <sys/time.h>

#include <vector>
#include <utility>

#include "filters/realtime_circular_buffer.hpp"

TEST(RealtimeCircularBuffer, InitializationScalar)
Expand Down