File tree 2 files changed +19
-10
lines changed
2 files changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -24,17 +24,30 @@ if(FINUFFT_BUILD_MATLAB)
24
24
# When building for matlab, we will fetch the OpenMP library used by matlab
25
25
# instead of system default for compatibility.
26
26
find_package (Matlab REQUIRED)
27
- find_library (OpenMP_iomp5_LIBRARY NAMES iomp5 HINTS ${Matlab_ROOT_DIR} /sys/os/ PATH_SUFFIXES glnxa64 maci64)
28
- find_library (OpenMP_pthreads_LIBRARY NAMES pthread CMAKE_FIND_ROOT_PATH_BOTH )
27
+ find_library (matlab_iomp5_lib NAMES iomp5 HINTS ${Matlab_ROOT_DIR} /sys/os/ PATH_SUFFIXES glnxa64 maci64)
28
+ find_library (pthreads_lib NAMES pthread CMAKE_FIND_ROOT_PATH_BOTH )
29
+
30
+ # Create a "fake" imported library pointing to the matlab openmp implementation
31
+ add_library (OpenMP::OpenMP_CXX SHARED IMPORTED )
32
+ set_target_properties (OpenMP::OpenMP_CXX PROPERTIES IMPORTED_LOCATION ${matlab_iomp5_lib} )
33
+ target_link_libraries (OpenMP::OpenMP_CXX INTERFACE ${pthreads_lib} )
34
+ # Set the OpenMP flag.
35
+ if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" )
36
+ target_compile_options (OpenMP::OpenMP_CXX INTERFACE -Xclang -fopenmp)
37
+ else ()
38
+ target_compile_options (OpenMP::OpenMP_CXX INTERFACE -fopenmp)
39
+ endif ()
40
+ else ()
41
+ # For non-matlab builds, find system OpenMP
42
+ if (FINUFFT_USE_OPENMP)
43
+ find_package (OpenMP REQUIRED)
44
+ endif ()
29
45
endif ()
30
46
31
47
# Find required packages
32
48
list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR} /cmake" )
33
49
find_package (FFTW REQUIRED)
34
50
35
- if (FINUFFT_USE_OPENMP)
36
- find_package (OpenMP REQUIRED)
37
- endif ()
38
51
39
52
set (FINUFFT_FFTW_LIBRARIES "FFTW::Float" "FFTW::Double" "FFTW::Float${FINUFFT_FFTW_SUFFIX} " "FFTW::Double${FINUFFT_FFTW_SUFFIX} " )
40
53
Original file line number Diff line number Diff line change 77
77
"cacheVariables" : {
78
78
"FINUFFT_FFTW_SUFFIX" : " Threads" ,
79
79
"FINUFFT_BUILD_MATLAB" : " ON" ,
80
- "FINUFFT_ENABLE_SANITIZERS" : " OFF" ,
81
- "OpenMP_C_LIB_NAMES" : " iomp5;pthreads" ,
82
- "OpenMP_CXX_LIB_NAMES" : " iomp5;pthreads" ,
83
- "OpenMP_C_FLAGS" : " -fopenmp" ,
84
- "OpenMP_CXX_FLAGS" : " -fopenmp"
80
+ "FINUFFT_ENABLE_SANITIZERS" : " OFF"
85
81
}
86
82
}
87
83
],
You can’t perform that action at this time.
0 commit comments