Cygwin: refactored & simplified some of the OS define logic

This commit is contained in:
Matthias Grob 2017-12-11 16:27:26 +00:00 committed by Daniel Agar
parent 2186f7b1b1
commit be8adbfdf3
3 changed files with 17 additions and 17 deletions

View File

@ -171,12 +171,15 @@ function(px4_os_add_flags)
)
# This block sets added_definitions and added_cxx_flags.
set(added_definitions
-D__PX4_POSIX
-Dnoreturn_function=__attribute__\(\(noreturn\)\)
)
if(UNIX AND APPLE)
set(added_definitions
-D__PX4_POSIX
list(APPEND added_definitions
-D__PX4_DARWIN
-D__DF_DARWIN
-Dnoreturn_function=__attribute__\(\(noreturn\)\)
)
set(added_cxx_flags)
@ -197,21 +200,17 @@ function(px4_os_add_flags)
endif()
elseif(CYGWIN)
set(added_definitions
-D__PX4_POSIX
list(APPEND added_definitions
-D__PX4_CYGWIN
-D_GNU_SOURCE
-D__USE_LINUX_IOCTL_DEFS
-Dnoreturn_function=__attribute__\(\(noreturn\)\)
-U __CUSTOM_FILE_IO__
)
else()
set(added_definitions
-D__PX4_POSIX
list(APPEND added_definitions
-D__PX4_LINUX
-D__DF_LINUX
-Dnoreturn_function=__attribute__\(\(noreturn\)\)
)
# Use -pthread For linux/g++.

View File

@ -52,11 +52,11 @@
#include "common_rc.h"
#include <drivers/drv_hrt.h>
#if defined (__PX4_LINUX) || defined (__PX4_DARWIN) || defined(__PX4_CYGWIN) || defined(__PX4_QURT)
#define dsm_udelay(arg) usleep(arg)
#else
#if defined(__PX4_NUTTX)
#include <nuttx/arch.h>
#define dsm_udelay(arg) up_udelay(arg)
#else
#define dsm_udelay(arg) usleep(arg)
#endif
// #define DSM_DEBUG

View File

@ -16,11 +16,6 @@ __EXPORT unsigned int sleep(unsigned int sec);
__END_DECLS
#elif defined(__PX4_LINUX) || defined(__PX4_NUTTX) || defined(__PX4_DARWIN) || defined(__PX4_CYGWIN)
#define px4_clock_gettime clock_gettime
#define px4_clock_settime clock_settime
#elif defined(__PX4_QURT)
#include <sys/timespec.h>
@ -33,4 +28,10 @@ int px4_clock_settime(clockid_t clk_id, struct timespec *tp);
__EXPORT unsigned int sleep(unsigned int sec);
__END_DECLS
#else
#define px4_clock_gettime clock_gettime
#define px4_clock_settime clock_settime
#endif