mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2025-03-11 03:12:41 +00:00
cmake: detect openMP
This commit is contained in:
parent
cdbd508007
commit
e229f62020
4 changed files with 27 additions and 0 deletions
|
@ -500,6 +500,20 @@ else ( enable-readline )
|
|||
unset ( READLINE_LIBS CACHE )
|
||||
endif ( enable-readline )
|
||||
|
||||
unset ( HAVE_OPENMP CACHE )
|
||||
find_package ( OpenMP QUIET )
|
||||
if ( OpenMP_FOUND OR OpenMP_C_FOUND )
|
||||
message(STATUS "Found OpenMP ${OpenMP_C_SPEC_DATE}")
|
||||
# require at least OMP 4.0
|
||||
if ( ( NOT OpenMP_C_SPEC_DATE LESS "201307" ) OR NOT ( OpenMP_C_VERSION VERSION_LESS "4.0" ) )
|
||||
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}" )
|
||||
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" )
|
||||
set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}" )
|
||||
set ( LIBFLUID_LIBS "${OpenMP_C_LIBRARIES};${LIBFLUID_LIBS}" )
|
||||
set ( HAVE_OPENMP 1 )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
if(enable-tests)
|
||||
# manipulate some variables to setup a proper test env
|
||||
|
|
|
@ -127,6 +127,12 @@ else ( WITH_PROFILING )
|
|||
message ( "Profiling: no" )
|
||||
endif ( WITH_PROFILING )
|
||||
|
||||
if ( HAVE_OPENMP )
|
||||
message ( "OpenMP 4.0: yes" )
|
||||
else ( HAVE_OPENMP )
|
||||
message ( "OpenMP 4.0: no" )
|
||||
endif ( HAVE_OPENMP )
|
||||
|
||||
if ( ENABLE_DEBUG )
|
||||
message ( "Debug: yes" )
|
||||
else ( ENABLE_DEBUG )
|
||||
|
|
|
@ -76,6 +76,9 @@
|
|||
/* Define to 1 if you have the <netinet/tcp.h> header file. */
|
||||
#cmakedefine HAVE_NETINET_TCP_H @HAVE_NETINET_TCP_H@
|
||||
|
||||
/* Define if compiling with openMP to enable parallel audio rendering */
|
||||
#cmakedefine HAVE_OPENMP @HAVE_OPENMP@
|
||||
|
||||
/* Define to 1 if you have the <pthread.h> header file. */
|
||||
#cmakedefine HAVE_PTHREAD_H @HAVE_PTHREAD_H@
|
||||
|
||||
|
|
|
@ -102,6 +102,10 @@
|
|||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_OPENMP
|
||||
#include <omp.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_IO_H
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue