mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-30 04:06:33 +08:00
Cygwin: refactored & simplified some of the OS define logic
This commit is contained in:
committed by
Daniel Agar
parent
2186f7b1b1
commit
be8adbfdf3
@@ -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.
|
||||||
|
set(added_definitions
|
||||||
|
-D__PX4_POSIX
|
||||||
|
-Dnoreturn_function=__attribute__\(\(noreturn\)\)
|
||||||
|
)
|
||||||
|
|
||||||
if(UNIX AND APPLE)
|
if(UNIX AND APPLE)
|
||||||
set(added_definitions
|
list(APPEND added_definitions
|
||||||
-D__PX4_POSIX
|
|
||||||
-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
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user