Skip to content

Commit a2e5a34

Browse files
unittests: fix windows build
- set equeue platform to posix for MINGW - enable PRIx formatting globally - remove redundant Semaphore implementation
1 parent e8eed6e commit a2e5a34

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

UNITTESTS/CMakeLists.txt

+7
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ endmacro()
1919

2020
use_cxx14()
2121

22+
23+
if (MINGW)
24+
# enable PRIx formatting globally
25+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__STDC_FORMAT_MACROS")
26+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_FORMAT_MACROS")
27+
endif (MINGW)
28+
2229
####################
2330
# GTEST
2431
####################

UNITTESTS/target_h/rtos/Semaphore.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
namespace rtos {
2424
class Semaphore {
2525
public:
26-
Semaphore(int32_t count = 0) {};
27-
Semaphore(int32_t count, uint16_t max_count) {};
28-
void acquire() {};
29-
bool try_acquire() { return false; };
30-
bool try_acquire_for(uint32_t millisec) { return false; };
31-
bool try_acquire_until(uint64_t millisec) { return false; };
32-
osStatus release(void) {return 0;};
26+
Semaphore(int32_t count = 0);
27+
Semaphore(int32_t count, uint16_t max_count);
28+
void acquire();
29+
bool try_acquire();
30+
bool try_acquire_for(uint32_t millisec);
31+
bool try_acquire_until(uint64_t millisec);
32+
osStatus release(void);
3333
};
3434
}
3535

events/internal/equeue_platform.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ extern "C" {
3535
// Try to infer a platform if none was manually selected
3636
#if !defined(EQUEUE_PLATFORM_POSIX) \
3737
&& !defined(EQUEUE_PLATFORM_MBED)
38-
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
38+
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__MINGW32__) || defined(__MINGW64__)
3939
#define EQUEUE_PLATFORM_POSIX
4040
#elif defined(__MBED__)
4141
#define EQUEUE_PLATFORM_MBED

0 commit comments

Comments
 (0)