1+ /* +---------------------------------------------------------------------------+
2+ | Mobile Robot Programming Toolkit (MRPT) |
3+ | https://www.mrpt.org/ |
4+ | |
5+ | Copyright (c) 2005-2024, Individual contributors, see AUTHORS file |
6+ | See: https://www.mrpt.org/Authors - All rights reserved. |
7+ | Released under BSD License. See details in https://www.mrpt.org/License |
8+ +---------------------------------------------------------------------------+
9+ */
10+
11+ #pragma once
12+
13+ // clang-format off
14+
15+ /** MRPT_BUILT_AS_DLL is defined only if MRPT has been built
16+ * as a shared library (.dll/.so) vs. a static library (.lib/.a).
17+ * Additionally, MRPT_EXPORTS will be defined only when compiling
18+ * the DLLs, not when the user imports them.
19+ */
20+ $ {CMAKE_MRPT_BUILD_SHARED_LIB }
21+
22+ #define MRPT_HAS_TBB $ {CMAKE_MRPT_HAS_TBB }
23+
24+ /** These two values are detected in Eigen when building MRPT, so we have
25+ the same settings given the user-provided flags */
26+ #define MRPT_MAX_ALIGN_BYTES ${EIGEN_MAX_ALIGN_BYTES}
27+ #define MRPT_MAX_STATIC_ALIGN_BYTES ${EIGEN_MAX_STATIC_ALIGN_BYTES}
28+
29+ /* Automatic definition of OS-macros */
30+ #if defined(_WIN32 ) || defined(_WIN32_ ) || defined(WIN32 ) || defined(_WIN64 )
31+ #define MRPT_OS_WINDOWS
32+ #elif defined(unix ) || defined(__unix__ ) || defined(__unix )
33+ #define MRPT_OS_LINUX
34+ #elif defined(__APPLE__ )
35+ #define MRPT_OS_APPLE
36+ #else
37+ #error Unsupported platform (Found neither _WIN32_, __unix__ or __APPLE__)
38+ #endif
39+
40+ /** The architecture is 32 or 64 bit wordsize: */
41+ #define MRPT_WORD_SIZE ${CMAKE_MRPT_WORD_SIZE}
42+
43+ /** True if we are in amd64 or i386 architectures */
44+ #define MRPT_ARCH_INTEL_COMPATIBLE ${MRPT_ARCH_INTEL_COMPATIBLE}
45+
46+ /** Use optimized functions with the SSE2 machine instructions set */
47+ #if defined WIN32 && (!defined WIN64 || defined EM64T ) && \
48+ (_MSC_VER >= 1400 ) || (defined __SSE2__ && defined __GNUC__ && __GNUC__ >= 4 )
49+ #define MRPT_HAS_SSE2 ${CMAKE_MRPT_HAS_SSE2} // This value can be set to 0 from CMake with ENABLE_SSE2
50+ #else
51+ #define MRPT_HAS_SSE2 0
52+ #endif
53+
54+ /** Use optimized functions with the SSE3 machine instructions set */
55+ #if defined WIN32 && (!defined WIN64 || defined EM64T ) && \
56+ (_MSC_VER >= 1500 ) || (defined __SSE3__ && defined __GNUC__ && __GNUC__ >= 4 )
57+ #define MRPT_HAS_SSE3 ${CMAKE_MRPT_HAS_SSE3} // This value can be set to 0 from CMake with ENABLE_SSE3
58+ #else
59+ #define MRPT_HAS_SSE3 0
60+ #endif
61+
62+ // This value can be set to 0 from CMake with ENABLE_XXX
63+ #define MRPT_HAS_SSE4_1 ${CMAKE_MRPT_HAS_SSE4_1}
64+ #define MRPT_HAS_SSE4_2 ${CMAKE_MRPT_HAS_SSE4_2}
65+ #define MRPT_HAS_SSE4_A ${CMAKE_MRPT_HAS_SSE4_A}
66+ #define MRPT_HAS_AVX ${CMAKE_MRPT_HAS_AVX}
67+ #define MRPT_HAS_AVX2 ${CMAKE_MRPT_HAS_AVX2}
68+ #define MRPT_HAS_NEON ${CMAKE_MRPT_HAS_NEON}
69+
70+ /** Are we in a big-endian system? (Intel, amd, etc.. are little-endian) */
71+ #define MRPT_IS_BIG_ENDIAN ${CMAKE_MRPT_IS_BIG_ENDIAN}
72+
73+ /** Are we in an Emscripten build? */
74+ #define MRPT_IN_EMSCRIPTEN ${CMAKE_MRPT_IN_EMSCRIPTEN}
75+
76+ /** Standard headers */
77+ #ifndef HAVE_INTTYPES_H
78+ #cmakedefine HAVE_INTTYPES_H 1
79+ #endif
80+
81+ #ifndef HAVE_STDINT_H
82+ #cmakedefine HAVE_STDINT_H 1
83+ #endif
84+
85+ #ifndef HAVE_WINSOCK2_H
86+ #cmakedefine HAVE_WINSOCK2_H 1
87+ #endif
88+
89+ #ifndef HAVE_ALLOCA_H
90+ #cmakedefine HAVE_ALLOCA_H 1
91+ #endif
92+
93+ #ifndef HAVE_LINUX_SERIAL_H
94+ #cmakedefine HAVE_LINUX_SERIAL_H 1
95+ #endif
96+
97+ #ifndef HAVE_LINUX_INPUT_H
98+ #cmakedefine HAVE_LINUX_INPUT_H 1
99+ #endif
100+
101+ #ifndef HAVE_SYS_TIME_H
102+ #cmakedefine HAVE_SYS_TIME_H 1
103+ #endif
104+
105+ #ifndef HAVE_PTHREAD_H
106+ #cmakedefine HAVE_PTHREAD_H 1
107+ #endif
108+
109+ #ifndef HAVE_UNISTD_H
110+ #cmakedefine HAVE_UNISTD_H 1
111+ #endif
112+
113+ // Has <malloc.h>?
114+ #ifndef HAVE_MALLOC_H
115+ #cmakedefine HAVE_MALLOC_H 1
116+ #endif
117+
118+ // Has <malloc/malloc.h>?
119+ #ifndef HAVE_MALLOC_MALLOC_H
120+ #cmakedefine HAVE_MALLOC_MALLOC_H 1
121+ #endif
122+
123+ #ifndef HAVE_FREEGLUT_EXT_H
124+ #cmakedefine HAVE_FREEGLUT_EXT_H 1
125+ #endif
126+
127+ /** Standard functions */
128+ #ifndef HAVE_TIMEGM
129+ #cmakedefine HAVE_TIMEGM
130+ #endif
131+
132+ #ifndef HAVE_MKGMTIME
133+ #cmakedefine HAVE_MKGMTIME
134+ #endif
135+
136+ #ifndef HAVE_ALLOCA
137+ #cmakedefine HAVE_ALLOCA
138+ #endif
139+
140+ #ifndef HAVE_GETTID
141+ #cmakedefine HAVE_GETTID
142+ #endif
143+
144+ #ifndef HAVE_SINCOS
145+ #cmakedefine HAVE_SINCOS
146+ #endif
147+
148+ #ifndef HAVE_LRINT
149+ #cmakedefine HAVE_LRINT
150+ #endif
151+
152+ #ifndef HAVE_STRTOK_R
153+ #cmakedefine HAVE_STRTOK_R
154+ #endif
155+
156+ #ifndef HAVE_LOCALTIME_R
157+ #cmakedefine HAVE_LOCALTIME_R
158+ #endif
159+
160+ #ifndef HAVE_ALIGNED_MALLOC
161+ #cmakedefine HAVE_ALIGNED_MALLOC
162+ #endif
163+
164+ /* Standard types */
165+ #ifndef HAVE_LONG_DOUBLE
166+ #cmakedefine HAVE_LONG_DOUBLE
167+ #endif
168+
169+ /* BFD library for debug symbols */
170+ #define MRPT_HAS_BFD ${CMAKE_MRPT_HAS_BFD}
171+ #cmakedefine HAVE_DECL_BFD_SECTION_FLAGS 1
172+ #cmakedefine HAVE_DECL_BFD_GET_SECTION_FLAGS 1
173+ #cmakedefine HAVE_DECL_BFD_GET_SECTION_VMA 1
174+ #cmakedefine HAVE_DECL_BFD_SECTION_VMA 1
175+ #cmakedefine HAVE_1_ARG_BFD_SECTION_SIZE 1
176+
177+
178+ /* Defined only if MRPT is being build/was built with precompiled
179+ headers enabled */
180+ #cmakedefine MRPT_ENABLE_PRECOMPILED_HDRS 1
181+
182+ // -------------------------------
183+ // Some checks:
184+ // -------------------------------
185+ #if !defined(MRPT_OS_WINDOWS ) && !defined(MRPT_OS_LINUX ) && !defined(MRPT_OS_APPLE )
186+ #error Neither OS detected from MRPT_OS_LINUX, MRPT_OS_APPLE or MRPT_OS_WINDOWS!
187+ #endif
188+
189+ // clang-format on
0 commit comments