File tree Expand file tree Collapse file tree 3 files changed +38
-23
lines changed
Expand file tree Collapse file tree 3 files changed +38
-23
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,9 @@ elseif(MINGW)
6565 set (CMAKE_COMPILER_IS_MINGW 1)
6666endif ()
6767
68+ # Ensure try_compile sets the include paths (e.g. for Eigen3)
69+ set (CMAKE_TRY_COMPILE_CONFIGURATION ${CMAKE_BUILD_TYPE} )
70+
6871# https://github.com/fish-shell/fish-shell/issues/5865
6972include (CheckCXXSourceCompiles )
7073CHECK_CXX_SOURCE_COMPILES ("
@@ -104,6 +107,10 @@ if(CMAKE_TIMING_VERBOSE AND UNIX)
104107 set_property (GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CMAKE_SOURCE_DIR} /cmake/custom_output.sh" )
105108endif ()
106109
110+ # check for allocation functions that return aligned memory
111+ include ("${PCL_SOURCE_DIR} /cmake/pcl_alignment.cmake" )
112+ PCL_CHECK_FOR_ALIGNMENT ()
113+
107114# check for SSE flags
108115include ("${PCL_SOURCE_DIR} /cmake/pcl_find_sse.cmake" )
109116if (PCL_ENABLE_SSE AND "${CMAKE_CXX_FLAGS} " STREQUAL "${CMAKE_CXX_FLAGS_DEFAULT} " )
Original file line number Diff line number Diff line change 1+ ###############################################################################
2+ # Check for the presence of _mm_malloc() and posix_memalign()
3+ function (PCL_CHECK_FOR_ALIGNMENT )
4+ include (CheckCXXSourceCompiles )
5+ if (NOT DEFINED HAVE_MM_MALLOC)
6+ check_cxx_source_compiles ("
7+ // Intel compiler defines an incompatible _mm_malloc signature
8+ #if defined(__INTEL_COMPILER)
9+ #include <malloc.h>
10+ #else
11+ #include <mm_malloc.h>
12+ #endif
13+ int main()
14+ {
15+ void* mem = _mm_malloc (100, 16);
16+ return 0;
17+ }"
18+ HAVE_MM_MALLOC )
19+ endif ()
20+
21+ if (NOT DEFINED HAVE_POSIX_MEMALIGN)
22+ check_cxx_source_compiles ("
23+ #include <stdlib.h>
24+ int main()
25+ {
26+ void* mem;
27+ return posix_memalign (&mem, 16, 100);
28+ }"
29+ HAVE_POSIX_MEMALIGN )
30+ endif ()
31+ endfunction ()
Original file line number Diff line number Diff line change @@ -23,29 +23,6 @@ function(PCL_CHECK_FOR_SSE)
2323 set (CMAKE_REQUIRED_FLAGS)
2424 set (SSE_LEVEL 0)
2525
26- check_cxx_source_runs ("
27- // Intel compiler defines an incompatible _mm_malloc signature
28- #if defined(__INTEL_COMPILER)
29- #include <malloc.h>
30- #else
31- #include <mm_malloc.h>
32- #endif
33- int main()
34- {
35- void* mem = _mm_malloc (100, 16);
36- return 0;
37- }"
38- HAVE_MM_MALLOC )
39-
40- check_cxx_source_runs ("
41- #include <stdlib.h>
42- int main()
43- {
44- void* mem;
45- return posix_memalign (&mem, 16, 100);
46- }"
47- HAVE_POSIX_MEMALIGN )
48-
4926 if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANG)
5027 set (CMAKE_REQUIRED_FLAGS "-msse4.2" )
5128 endif ()
You can’t perform that action at this time.
0 commit comments