From d8e5000d47c705e4527f9cd8fe5c5960bdcea64f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 20 Dec 2020 15:32:03 +0100 Subject: [PATCH] msvc tests --- CMakeLists.txt | 23 +++++++++++++++-------- coordinates/Sgp4Propagator.h | 2 ++ globalfunctions/timevalOperations.h | 6 ++++++ osal/Endiness.h | 14 ++++++++++++++ serviceinterface/ServiceInterfaceBuffer.h | 2 +- timemanager/Clock.h | 2 ++ 6 files changed, 40 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 084bd4ae9..02849ca44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,14 +106,20 @@ else() ) endif() -set(WARNING_FLAGS - -Wall - -Wextra - -Wshadow=local - -Wimplicit-fallthrough=1 - -Wno-unused-parameter - -Wno-psabi -) +if(CMAKE_COMPILER_IS_GNUCXX) + set(WARNING_FLAGS + -Wall + -Wextra + -Wshadow=local + -Wimplicit-fallthrough=1 + -Wno-unused-parameter + -Wno-psabi + ) +endif() + +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + set(COMPILER_FLAGS "/permissive-") +endif() # Required include paths to compile the FSFW target_include_directories(${LIB_FSFW_NAME} INTERFACE @@ -132,5 +138,6 @@ target_include_directories(${LIB_FSFW_NAME} PRIVATE # Machine specific options can be set with the ABI_FLAGS variable. target_compile_options(${LIB_FSFW_NAME} PRIVATE ${WARNING_FLAGS} + ${COMPILER_FLAGS} ${ABI_FLAGS} ) diff --git a/coordinates/Sgp4Propagator.h b/coordinates/Sgp4Propagator.h index 3949547e1..f813c6f4d 100644 --- a/coordinates/Sgp4Propagator.h +++ b/coordinates/Sgp4Propagator.h @@ -1,7 +1,9 @@ #ifndef SGP4PROPAGATOR_H_ #define SGP4PROPAGATOR_H_ +#ifndef WIN32 #include +#endif #include "../contrib/sgp4/sgp4unit.h" #include "../returnvalues/HasReturnvaluesIF.h" diff --git a/globalfunctions/timevalOperations.h b/globalfunctions/timevalOperations.h index 3977d5d96..18eef866d 100644 --- a/globalfunctions/timevalOperations.h +++ b/globalfunctions/timevalOperations.h @@ -2,7 +2,13 @@ #define TIMEVALOPERATIONS_H_ #include + +#ifdef WIN32 +// Why MSVC? Why? :))) +#include +#else #include +#endif timeval& operator+=(timeval& lhs, const timeval& rhs); diff --git a/osal/Endiness.h b/osal/Endiness.h index 65cc0a10f..9d3fdef0f 100644 --- a/osal/Endiness.h +++ b/osal/Endiness.h @@ -22,9 +22,23 @@ #else #error "Can't decide which end is which!" #endif +#else + +#ifdef WIN32 +#include +#if REG_DWORD == REG_DWORD_LITTLE_ENDIAN +#define BYTE_ORDER_SYSTEM LITTLE_ENDIAN +#else +#define BYTE_ORDER_SYSTEM BIG_ENDIAN +#endif + + #else #error __BYTE_ORDER__ not defined #endif + +#endif + #endif diff --git a/serviceinterface/ServiceInterfaceBuffer.h b/serviceinterface/ServiceInterfaceBuffer.h index c5d5b2584..e69538d1d 100644 --- a/serviceinterface/ServiceInterfaceBuffer.h +++ b/serviceinterface/ServiceInterfaceBuffer.h @@ -30,7 +30,7 @@ protected: //! This is called when buffer becomes full. If //! buffer is not used, then this is called every //! time when characters are put to stream. - int overflow(int c = Traits::eof()) override; + int overflow(int c = std::ostream::traits_type::eof()) override; //! This function is called when stream is flushed, //! for example when std::endl is put to stream. diff --git a/timemanager/Clock.h b/timemanager/Clock.h index d8b06fda5..7e27e40db 100644 --- a/timemanager/Clock.h +++ b/timemanager/Clock.h @@ -6,7 +6,9 @@ #include "../globalfunctions/timevalOperations.h" #include +#ifndef WIN32 #include +#endif //! Don't use these for time points, type is not large enough for UNIX epoch. using dur_millis_t = uint32_t;