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") 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++) 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; diff --git a/src/Vision/PointGrey/Task.cmake b/src/Vision/PointGrey/Task.cmake index 58577e0650..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(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_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(DUNE_SYS_HAS___ARM_ARCH_7A__) +else() set(TASK_ENABLED FALSE) -endif(NOT DUNE_SYS_HAS_FLYCAPTURE) - -endif(DUNE_SYS_HAS___ARM_ARCH_7A__) +endif(POINTGREY) set(TASK_LICENSE "Proprietary")