AprilRobotics / apriltag

AprilTag is a visual fiducial system popular for robotics research.
https://april.eecs.umich.edu/software/apriltag
Other
1.47k stars 522 forks source link

fix compilation with WIN32_LEAN_AND_MEAN #297

Open mitjap opened 8 months ago

mitjap commented 8 months ago

This PR resolves #296. I changed windows.h header for Winsock2.h. This way the library still works even when used with WIN32_LEAN_AND_MEAN preprocessor definition.

I think even better solution would be to move function gettimeofday in time_util.c which is the only place where it is used. This way we can also move any required headers (either windows.h, winsock.h or Winsock2.h) from header file which would prevent any side effects to other libraries.

https://github.com/AprilRobotics/apriltag/blob/cc655ad6e3dadb19658276f7476dad5e92f05144/common/time_util.h#L41

christian-rauch commented 5 months ago

I added a new standard CMake pipeline to the CI that tests multiple compilers on different systems. Could you rebase your PR and add a setting for "WIN32_LEAN_AND_MEAN"?