fix build of downstream apps for static fluidsynth lib

fixes #341
This commit is contained in:
derselbst 2018-02-20 12:44:30 +01:00
parent 28a794a61c
commit 4ad3aa2307
3 changed files with 17 additions and 10 deletions

View file

@ -451,6 +451,8 @@ endif ( enable-readline )
# General configuration file # General configuration file
configure_file ( ${CMAKE_SOURCE_DIR}/src/config.cmake configure_file ( ${CMAKE_SOURCE_DIR}/src/config.cmake
${CMAKE_BINARY_DIR}/config.h ) ${CMAKE_BINARY_DIR}/config.h )
configure_file ( ${CMAKE_SOURCE_DIR}/include/fluidsynth.cmake
${CMAKE_BINARY_DIR}/include/fluidsynth.h )
add_definitions ( -DHAVE_CONFIG_H ) add_definitions ( -DHAVE_CONFIG_H )
# Process subdirectories # Process subdirectories

View file

@ -27,24 +27,29 @@
extern "C" { extern "C" {
#endif #endif
#if defined(WIN32) #cmakedefine01 BUILD_SHARED_LIBS
#if defined(FLUIDSYNTH_DLL_EXPORTS)
#define FLUIDSYNTH_API __declspec(dllexport) #if (BUILD_SHARED_LIBS == 0)
#elif defined(FLUIDSYNTH_NOT_A_DLL) #define FLUIDSYNTH_API // building static lib? no visibility control then
#define FLUIDSYNTH_API #elif defined(WIN32)
#else #if defined(FLUIDSYNTH_NOT_A_DLL)
#define FLUIDSYNTH_API __declspec(dllimport) #define FLUIDSYNTH_API
#endif #elif defined(FLUIDSYNTH_DLL_EXPORTS)
#define FLUIDSYNTH_API __declspec(dllexport)
#else
#define FLUIDSYNTH_API __declspec(dllimport)
#endif
#elif defined(MACOS9) #elif defined(MACOS9)
#define FLUIDSYNTH_API __declspec(export) #define FLUIDSYNTH_API __declspec(export)
#elif defined(__GNUC__) #elif defined(__GNUC__)
#define FLUIDSYNTH_API __attribute__ ((visibility ("default"))) #define FLUIDSYNTH_API __attribute__ ((visibility ("default")))
#else #else
#define FLUIDSYNTH_API #define FLUIDSYNTH_API
#endif
#endif
#if defined(__GNUC__) || defined(__clang__) #if defined(__GNUC__) || defined(__clang__)
# define FLUID_DEPRECATED __attribute__((deprecated)) # define FLUID_DEPRECATED __attribute__((deprecated))

View file

@ -201,7 +201,7 @@ set ( public_HEADERS
) )
set ( public_main_HEADER set ( public_main_HEADER
${CMAKE_SOURCE_DIR}/include/fluidsynth.h ${CMAKE_BINARY_DIR}/include/fluidsynth.h
) )
if ( WIN32 AND NOT MINGW ) if ( WIN32 AND NOT MINGW )