unittests: fix windows build

- set equeue platform to posix for MINGW
 - enable PRIx formatting globally
 - remove redundant Semaphore implementation
pull/12287/head
Maciej Bocianski 2020-01-20 13:24:41 +01:00
parent e8eed6ecd5
commit a2e5a34df6
3 changed files with 15 additions and 8 deletions

View File

@ -19,6 +19,13 @@ endmacro()
use_cxx14()
if (MINGW)
# enable PRIx formatting globally
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__STDC_FORMAT_MACROS")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_FORMAT_MACROS")
endif (MINGW)
####################
# GTEST
####################

View File

@ -23,13 +23,13 @@
namespace rtos {
class Semaphore {
public:
Semaphore(int32_t count = 0) {};
Semaphore(int32_t count, uint16_t max_count) {};
void acquire() {};
bool try_acquire() { return false; };
bool try_acquire_for(uint32_t millisec) { return false; };
bool try_acquire_until(uint64_t millisec) { return false; };
osStatus release(void) {return 0;};
Semaphore(int32_t count = 0);
Semaphore(int32_t count, uint16_t max_count);
void acquire();
bool try_acquire();
bool try_acquire_for(uint32_t millisec);
bool try_acquire_until(uint64_t millisec);
osStatus release(void);
};
}

View File

@ -35,7 +35,7 @@ extern "C" {
// Try to infer a platform if none was manually selected
#if !defined(EQUEUE_PLATFORM_POSIX) \
&& !defined(EQUEUE_PLATFORM_MBED)
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__MINGW32__) || defined(__MINGW64__)
#define EQUEUE_PLATFORM_POSIX
#elif defined(__MBED__)
#define EQUEUE_PLATFORM_MBED