From 11b49cc7c726d4c979657206e0284e27d372cf00 Mon Sep 17 00:00:00 2001 From: derselbst Date: Sat, 1 Jul 2017 23:53:47 +0200 Subject: [PATCH 1/2] use cmakes native Thread module to find pthreads --- fluidsynth/CMakeLists.txt | 6 +- fluidsynth/cmake_admin/FindPthreads.cmake | 96 ----------------------- 2 files changed, 3 insertions(+), 99 deletions(-) delete mode 100644 fluidsynth/cmake_admin/FindPthreads.cmake diff --git a/fluidsynth/CMakeLists.txt b/fluidsynth/CMakeLists.txt index c76b7549..4118c4c7 100644 --- a/fluidsynth/CMakeLists.txt +++ b/fluidsynth/CMakeLists.txt @@ -169,9 +169,9 @@ if ( WIN32 ) endif ( MINGW ) else ( WIN32 ) # Check PThreads, but not in Windows - find_package ( Pthreads REQUIRED ) - set ( HAVE_LIBPTHREAD ${PTHREADS_FOUND} ) - set ( LIBFLUID_LIBS "m" ) + find_package ( Threads REQUIRED ) + set ( HAVE_LIBPTHREAD ${Threads_FOUND} ) + set ( LIBFLUID_LIBS "m" ${CMAKE_THREAD_LIBS_INIT} ) endif ( WIN32 ) # IBM OS/2 diff --git a/fluidsynth/cmake_admin/FindPthreads.cmake b/fluidsynth/cmake_admin/FindPthreads.cmake deleted file mode 100644 index e44e0835..00000000 --- a/fluidsynth/cmake_admin/FindPthreads.cmake +++ /dev/null @@ -1,96 +0,0 @@ -# - Find the Pthreads library -# This module searches for the Pthreads library (including the -# pthreads-win32 port). -# -# This module defines these variables: -# -# PTHREADS_FOUND -# True if the Pthreads library was found -# PTHREADS_LIBRARY -# The location of the Pthreads library -# PTHREADS_INCLUDE_DIR -# The include directory of the Pthreads library -# PTHREADS_DEFINITIONS -# Preprocessor definitions to define (HAVE_PTHREAD_H is a fairly common -# one) -# -# This module responds to the PTHREADS_EXCEPTION_SCHEME -# variable on Win32 to allow the user to control the -# library linked against. The Pthreads-win32 port -# provides the ability to link against a version of the -# library with exception handling. IT IS NOT RECOMMENDED -# THAT YOU CHANGE PTHREADS_EXCEPTION_SCHEME TO ANYTHING OTHER THAN -# "C" because most POSIX thread implementations do not support stack -# unwinding. -# -# PTHREADS_EXCEPTION_SCHEME -# C = no exceptions (default) -# (NOTE: This is the default scheme on most POSIX thread -# implementations and what you should probably be using) -# CE = C++ Exception Handling -# SE = Structure Exception Handling (MSVC only) -# - -# -# Define a default exception scheme to link against -# and validate user choice. -# -IF(NOT DEFINED PTHREADS_EXCEPTION_SCHEME) - # Assign default if needed - SET(PTHREADS_EXCEPTION_SCHEME "C") -ELSE(NOT DEFINED PTHREADS_EXCEPTION_SCHEME) - # Validate - IF(NOT PTHREADS_EXCEPTION_SCHEME STREQUAL "C" AND - NOT PTHREADS_EXCEPTION_SCHEME STREQUAL "CE" AND - NOT PTHREADS_EXCEPTION_SCHEME STREQUAL "SE") - - MESSAGE(FATAL_ERROR "See documentation for FindPthreads.cmake, only C, CE, and SE modes are allowed") - - ENDIF(NOT PTHREADS_EXCEPTION_SCHEME STREQUAL "C" AND - NOT PTHREADS_EXCEPTION_SCHEME STREQUAL "CE" AND - NOT PTHREADS_EXCEPTION_SCHEME STREQUAL "SE") - - IF(NOT MSVC AND PTHREADS_EXCEPTION_SCHEME STREQUAL "SE") - MESSAGE(FATAL_ERROR "Structured Exception Handling is only allowed for MSVC") - ENDIF(NOT MSVC AND PTHREADS_EXCEPTION_SCHEME STREQUAL "SE") - -ENDIF(NOT DEFINED PTHREADS_EXCEPTION_SCHEME) - -# -# Find the header file -# -FIND_PATH(PTHREADS_INCLUDE_DIR pthread.h) - -# -# Find the library -# -SET(names) -IF(MSVC) - SET(names - pthreadV${PTHREADS_EXCEPTION_SCHEME}2 - pthread - ) -ELSEIF(MINGW) - SET(names - pthreadG${PTHREADS_EXCEPTION_SCHEME}2 - pthread - ) -ELSE(MSVC) # Unix / Cygwin / Apple / Etc. - SET(names pthread) -ENDIF(MSVC) - -FIND_LIBRARY(PTHREADS_LIBRARY ${names} - DOC "The Portable Threads Library") - -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Pthreads DEFAULT_MSG - PTHREADS_LIBRARY PTHREADS_INCLUDE_DIR) - -IF(PTHREADS_INCLUDE_DIR AND PTHREADS_LIBRARY) - SET(PTHREADS_DEFINITIONS -DHAVE_PTHREAD_H) - SET(PTHREADS_INCLUDE_DIRS ${PTHREADS_INCLUDE_DIR}) - SET(PTHREADS_LIBRARIES ${PTHREADS_LIBRARY}) -ENDIF(PTHREADS_INCLUDE_DIR AND PTHREADS_LIBRARY) - -MARK_AS_ADVANCED(PTHREADS_INCLUDE_DIR) -MARK_AS_ADVANCED(PTHREADS_LIBRARY) From a5c8c9accb66a25f7d5f3a71cb63d77222717268 Mon Sep 17 00:00:00 2001 From: derselbst Date: Sun, 2 Jul 2017 09:43:53 +0200 Subject: [PATCH 2/2] fix build with lash support --- fluidsynth/src/bindings/fluid_lash.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fluidsynth/src/bindings/fluid_lash.h b/fluidsynth/src/bindings/fluid_lash.h index cef7e273..22b8c258 100644 --- a/fluidsynth/src/bindings/fluid_lash.h +++ b/fluidsynth/src/bindings/fluid_lash.h @@ -46,8 +46,8 @@ extern cca_client_t * fluid_lash_client; #endif -fluid_lash_args_t *fluid_lash_extract_args (int * pargc, char *** pargv); -int fluid_lash_connect (fluid_lash_args_t * args); -void fluid_lash_create_thread (fluid_synth_t * synth); +FLUIDSYNTH_API fluid_lash_args_t *fluid_lash_extract_args (int * pargc, char *** pargv); +FLUIDSYNTH_API int fluid_lash_connect (fluid_lash_args_t * args); +FLUIDSYNTH_API void fluid_lash_create_thread (fluid_synth_t * synth); #endif /* defined(HAVE_LASH) || defined(HAVE_LADCCA) */