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
+7 -8
View File
@@ -171,12 +171,15 @@ function(px4_os_add_flags)
) )
# This block sets added_definitions and added_cxx_flags. # This block sets added_definitions and added_cxx_flags.
if(UNIX AND APPLE)
set(added_definitions set(added_definitions
-D__PX4_POSIX -D__PX4_POSIX
-Dnoreturn_function=__attribute__\(\(noreturn\)\)
)
if(UNIX AND APPLE)
list(APPEND added_definitions
-D__PX4_DARWIN -D__PX4_DARWIN
-D__DF_DARWIN -D__DF_DARWIN
-Dnoreturn_function=__attribute__\(\(noreturn\)\)
) )
set(added_cxx_flags) set(added_cxx_flags)
@@ -197,21 +200,17 @@ function(px4_os_add_flags)
endif() endif()
elseif(CYGWIN) elseif(CYGWIN)
set(added_definitions list(APPEND added_definitions
-D__PX4_POSIX
-D__PX4_CYGWIN -D__PX4_CYGWIN
-D_GNU_SOURCE -D_GNU_SOURCE
-D__USE_LINUX_IOCTL_DEFS -D__USE_LINUX_IOCTL_DEFS
-Dnoreturn_function=__attribute__\(\(noreturn\)\)
-U __CUSTOM_FILE_IO__ -U __CUSTOM_FILE_IO__
) )
else() else()
set(added_definitions list(APPEND added_definitions
-D__PX4_POSIX
-D__PX4_LINUX -D__PX4_LINUX
-D__DF_LINUX -D__DF_LINUX
-Dnoreturn_function=__attribute__\(\(noreturn\)\)
) )
# Use -pthread For linux/g++. # Use -pthread For linux/g++.
+3 -3
View File
@@ -52,11 +52,11 @@
#include "common_rc.h" #include "common_rc.h"
#include <drivers/drv_hrt.h> #include <drivers/drv_hrt.h>
#if defined (__PX4_LINUX) || defined (__PX4_DARWIN) || defined(__PX4_CYGWIN) || defined(__PX4_QURT) #if defined(__PX4_NUTTX)
#define dsm_udelay(arg) usleep(arg)
#else
#include <nuttx/arch.h> #include <nuttx/arch.h>
#define dsm_udelay(arg) up_udelay(arg) #define dsm_udelay(arg) up_udelay(arg)
#else
#define dsm_udelay(arg) usleep(arg)
#endif #endif
// #define DSM_DEBUG // #define DSM_DEBUG
+6 -5
View File
@@ -16,11 +16,6 @@ __EXPORT unsigned int sleep(unsigned int sec);
__END_DECLS __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) #elif defined(__PX4_QURT)
#include <sys/timespec.h> #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); __EXPORT unsigned int sleep(unsigned int sec);
__END_DECLS __END_DECLS
#else
#define px4_clock_gettime clock_gettime
#define px4_clock_settime clock_settime
#endif #endif