From 6c0f9dd17c88f5c773d92761b544a6164fd6478f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Braga?= Date: Tue, 21 May 2024 11:38:29 +0100 Subject: [PATCH 1/5] programs/test/test_AtomicInteger: fix compilation in VS2015 --- programs/tests/test_AtomicInteger.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/programs/tests/test_AtomicInteger.cpp b/programs/tests/test_AtomicInteger.cpp index d441545426..255c30a495 100644 --- a/programs/tests/test_AtomicInteger.cpp +++ b/programs/tests/test_AtomicInteger.cpp @@ -39,6 +39,8 @@ using namespace DUNE::Concurrency; +static constexpr int thread_num = 10; + class TestIncrement: public Thread { private: @@ -65,7 +67,6 @@ main(void) AtomicInteger aint(0); long target = 10000; - int thread_num = 10; TestIncrement* tests[thread_num]; for (int i = 0; i < thread_num; i++) From 65c10c3f6af33c0be6a9c4b0a9738e683f2e91d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Braga?= Date: Tue, 21 May 2024 12:47:10 +0100 Subject: [PATCH 2/5] Sensors/VantagePro2: move pragma pop directive after struct definition --- src/Sensors/VantagePro2/Parser.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Sensors/VantagePro2/Parser.hpp b/src/Sensors/VantagePro2/Parser.hpp index d9bf1863fc..ec55c64386 100644 --- a/src/Sensors/VantagePro2/Parser.hpp +++ b/src/Sensors/VantagePro2/Parser.hpp @@ -101,7 +101,7 @@ namespace Sensors #ifdef __GNUC__ struct __attribute__((__packed__)) LOOPData #elif defined(_MSC_VER) - __pragma(pack(push, 1)) struct LOOPData __pragma(pack(pop)) + __pragma(pack(push, 1)) struct LOOPData #endif { uint8_t Ack; // Acknowledge char @@ -151,6 +151,9 @@ namespace Sensors uint8_t CR; // '\r' 0x0d uint16_t WCRC; // CRC check bytes (CCITT-16 standard) 2bytes }; +#if defined(_MSC_VER) + __pragma(pack(pop)) +#endif //! DAVIS' LOOP data packet data. LOOPData m_LOOPData; From 3608987062cc493b4f62a9316065cf7a3e324a2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Braga?= Date: Tue, 21 May 2024 13:51:06 +0100 Subject: [PATCH 3/5] Vision/PointGrey: disable win compilation --- src/Vision/PointGrey/Task.cmake | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Vision/PointGrey/Task.cmake b/src/Vision/PointGrey/Task.cmake index 58577e0650..fe28bf8dd1 100644 --- a/src/Vision/PointGrey/Task.cmake +++ b/src/Vision/PointGrey/Task.cmake @@ -1,17 +1,17 @@ if(DUNE_SYS_HAS___ARM_ARCH_7A__) + if(NOT DUNE_SYS_HAS_OPENCV) + set(TASK_ENABLED FALSE) + endif(NOT DUNE_SYS_HAS_OPENCV) -if(NOT DUNE_SYS_HAS_OPENCV) - set(TASK_ENABLED FALSE) -endif(NOT DUNE_SYS_HAS_OPENCV) - -if(NOT DUNE_SYS_HAS_EXIV2) - set(TASK_ENABLED FALSE) -endif(NOT DUNE_SYS_HAS_EXIV2) + if(NOT DUNE_SYS_HAS_EXIV2) + set(TASK_ENABLED FALSE) + endif(NOT DUNE_SYS_HAS_EXIV2) -if(NOT DUNE_SYS_HAS_FLYCAPTURE) + if(NOT DUNE_SYS_HAS_FLYCAPTURE) + set(TASK_ENABLED FALSE) + endif(NOT DUNE_SYS_HAS_FLYCAPTURE) +elseif(DUNE_OS_WINDOWS) set(TASK_ENABLED FALSE) -endif(NOT DUNE_SYS_HAS_FLYCAPTURE) - endif(DUNE_SYS_HAS___ARM_ARCH_7A__) set(TASK_LICENSE "Proprietary") From 695350d43588052a4d5fbe439b903582bf144b3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Braga?= Date: Tue, 21 May 2024 14:07:55 +0100 Subject: [PATCH 4/5] Vision/PointGrey: also consider POINTGREY var --- src/Vision/PointGrey/Task.cmake | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/Vision/PointGrey/Task.cmake b/src/Vision/PointGrey/Task.cmake index fe28bf8dd1..5e21d7ec94 100644 --- a/src/Vision/PointGrey/Task.cmake +++ b/src/Vision/PointGrey/Task.cmake @@ -1,17 +1,21 @@ -if(DUNE_SYS_HAS___ARM_ARCH_7A__) - if(NOT DUNE_SYS_HAS_OPENCV) - set(TASK_ENABLED FALSE) - endif(NOT DUNE_SYS_HAS_OPENCV) +if(POINTGREY) + if(DUNE_SYS_HAS___ARM_ARCH_7A__) + if(NOT DUNE_SYS_HAS_OPENCV) + set(TASK_ENABLED FALSE) + endif(NOT DUNE_SYS_HAS_OPENCV) - if(NOT DUNE_SYS_HAS_EXIV2) - set(TASK_ENABLED FALSE) - endif(NOT DUNE_SYS_HAS_EXIV2) + if(NOT DUNE_SYS_HAS_EXIV2) + set(TASK_ENABLED FALSE) + endif(NOT DUNE_SYS_HAS_EXIV2) - if(NOT DUNE_SYS_HAS_FLYCAPTURE) + if(NOT DUNE_SYS_HAS_FLYCAPTURE) + set(TASK_ENABLED FALSE) + endif(NOT DUNE_SYS_HAS_FLYCAPTURE) + elseif(DUNE_OS_WINDOWS) set(TASK_ENABLED FALSE) - endif(NOT DUNE_SYS_HAS_FLYCAPTURE) -elseif(DUNE_OS_WINDOWS) + endif(DUNE_SYS_HAS___ARM_ARCH_7A__) +else() set(TASK_ENABLED FALSE) -endif(DUNE_SYS_HAS___ARM_ARCH_7A__) +endif(POINTGREY) set(TASK_LICENSE "Proprietary") From 8ab86434df0ce879a60422bf9ad1a746b403c6b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Braga?= Date: Tue, 21 May 2024 13:52:03 +0100 Subject: [PATCH 5/5] cmake/Compiler: modernized win compiler probing --- cmake/Compiler.cmake | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/cmake/Compiler.cmake b/cmake/Compiler.cmake index fa4bc4b0bf..17a1f28f4a 100644 --- a/cmake/Compiler.cmake +++ b/cmake/Compiler.cmake @@ -150,25 +150,33 @@ macro(dune_probe_cxx) if(DUNE_CXX_MICROSOFT) set(DUNE_CXX_NAME "Microsoft") - if(MSVC60) + # https://learn.microsoft.com/en-us/cpp/overview/compiler-versions + # https://cmake.org/cmake/help/latest/variable/MSVC_VERSION.html + if(MSVC_VERSION EQUAL 1200) message(FATAL_ERROR "Visual Studio 6.0 is not supported") - elseif(MSVC14) - set(msv_version "2015") - elseif(MSVC12) - set(msv_version "2013") - elseif(MSVC11) - set(msv_version "2012") - elseif(MSVC10) - set(msv_version "2010") - elseif(MSVC90) - set(msv_version "2008") - elseif(MSVC80) - set(msv_version "2005") - elseif(MSVC71) - set(msv_version "2003") - elseif(MSVC70) + elseif(MSVC_VERSION EQUAL 1300) set(msv_version "2002") - endif(MSVC60) + elseif(MSVC_VERSION EQUAL 1310) + set(msv_version "2003") + elseif(MSVC_VERSION EQUAL 1400) + set(msv_version "2005") + elseif(MSVC_VERSION EQUAL 1500) + set(msv_version "2008") + elseif(MSVC_VERSION EQUAL 1600) + set(msv_version "2010") + elseif(MSVC_VERSION EQUAL 1700) + set(msv_version "2012") + elseif(MSVC_VERSION EQUAL 1800) + set(msv_version "2013") + elseif(MSVC_VERSION EQUAL 1900) + set(msv_version "2015") + elseif(MSVC_VERSION GREATER_EQUAL 1910 AND MSVC_VERSION LESS 1920) + set(msv_version "2017") + elseif(MSVC_VERSION GREATER_EQUAL 1920 AND MSVC_VERSION LESS 1930) + set(msv_version "2019") + elseif(MSVC_VERSION GREATER_EQUAL 1930) + set(msv_version "2022") + endif() set(DUNE_CXX_CANONICAL "vs${msv_version}") set(DUNE_CXX_FLAGS "${DUNE_CXX_FLAGS} /wd4251 /wd4244 /wd4267 /wd4800 /wd4805 /wd4305 /wd4244 /wd4996")