summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacek Poplawski <jacek.poplawski@qt.io>2023-07-05 12:47:37 +0200
committerJacek Poplawski <jacek.poplawski@qt.io>2023-07-21 06:08:04 +0200
commit3f9817b26cd26fa731ca88537c0137d31c0383e4 (patch)
tree2f1dc89d5c6899f16aa040ec02492c42d26a7c99
parent2540ec8d656acb8227987e6d5c1005f608fc18bb (diff)
Add initial support for building for VxWorks using clang
Change-Id: I8c4538cd5582bfea69a6e1890445c4c75e6ca0d7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r--mkspecs/common/vxworks/qplatformdefs.h43
-rw-r--r--mkspecs/vxworks-clang/qplatformdefs.h9
-rw-r--r--src/corelib/global/qsystemdetection.h2
3 files changed, 53 insertions, 1 deletions
diff --git a/mkspecs/common/vxworks/qplatformdefs.h b/mkspecs/common/vxworks/qplatformdefs.h
new file mode 100644
index 0000000000..75bbb3e0f9
--- /dev/null
+++ b/mkspecs/common/vxworks/qplatformdefs.h
@@ -0,0 +1,43 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef Q_VXWORKS_PLATFORMDEFS_H
+#define Q_VXWORKS_PLATFORMDEFS_H
+
+#include "qglobal.h"
+
+#include <unistd.h>
+#include <fcntl.h>
+
+#include <sys/time.h>
+#include <dirent.h>
+#include <pthread.h>
+
+// from VxWorks 7 <system.h>
+#ifndef S_ISSOCK
+# ifdef S_IFSOCK
+# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
+# else
+# define S_ISSOCK(m) 0
+# endif
+#endif
+
+#include "../common/posix/qplatformdefs.h"
+
+#undef QT_OPEN_LARGEFILE
+
+#define O_LARGEFILE 0
+#define QT_OPEN_LARGEFILE O_LARGEFILE
+
+#define QT_MMAP ::mmap
+
+#define QT_SNPRINTF ::snprintf
+#define QT_VSNPRINTF ::vsnprintf
+
+/* vxworks exposes these definitions only when _POSIX_C_SOURCE >=200809L but we don't want to set this, as it hides other API */
+#ifndef UTIME_NOW
+# define UTIME_NOW ((1l << 30) - 1l)
+# define UTIME_OMIT ((1l << 30) - 2l)
+#endif
+
+#endif /* Q_VXWORKS_PLATFORMDEFS_H */
diff --git a/mkspecs/vxworks-clang/qplatformdefs.h b/mkspecs/vxworks-clang/qplatformdefs.h
new file mode 100644
index 0000000000..a9fd98e333
--- /dev/null
+++ b/mkspecs/vxworks-clang/qplatformdefs.h
@@ -0,0 +1,9 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QPLATFORMDEFS_H
+#define QPLATFORMDEFS_H
+
+#include "../common/vxworks/qplatformdefs.h"
+
+#endif // QPLATFORMDEFS_H
diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h
index ca94d552ec..74ff3fea9b 100644
--- a/src/corelib/global/qsystemdetection.h
+++ b/src/corelib/global/qsystemdetection.h
@@ -123,7 +123,7 @@
# define Q_OS_INTEGRITY
#elif defined(__rtems__)
# define Q_OS_RTEMS
-#elif defined(VXWORKS) /* there is no "real" VxWorks define - this has to be set in the mkspec! */
+#elif defined(__vxworks)
# define Q_OS_VXWORKS
#elif defined(__HAIKU__)
# define Q_OS_HAIKU