diff options
-rw-r--r-- | CMakeLists.txt | 52 | ||||
-rw-r--r-- | config.h.in | 7 | ||||
-rw-r--r-- | include/AL/al.h | 14 | ||||
-rw-r--r-- | include/AL/alc.h | 14 |
4 files changed, 38 insertions, 49 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 7cf3db78..a46160cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,6 +60,8 @@ SET(LIB_MAJOR_VERSION "1") SET(LIB_MINOR_VERSION "13") SET(LIB_VERSION "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}") +SET(EXPORT_DECL "") + CHECK_TYPE_SIZE("long" SIZEOF_LONG) CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG) @@ -144,34 +146,34 @@ ELSE() CHECK_C_SOURCE_COMPILES("int foo() __attribute__((destructor)); int main() {return 0;}" HAVE_GCC_DESTRUCTOR) +ENDIF() - # Set visibility options if available - IF(NOT WIN32) - CHECK_C_COMPILER_FLAG(-fvisibility=internal HAVE_VISIBILITY_SWITCH) - IF(HAVE_VISIBILITY_SWITCH) - CHECK_C_SOURCE_COMPILES("int foo() __attribute__((visibility(\"default\"))); - int main() {return 0;}" HAVE_GCC_VISIBILITY) - IF(HAVE_GCC_VISIBILITY) - ADD_DEFINITIONS(-fvisibility=internal -DHAVE_GCC_VISIBILITY) - ENDIF() - ENDIF() - ELSE() - OPTION(WINE "Enable use of Wine headers when compiling" ON) - IF(WINE) - FIND_PATH(WINE_INCLUDE_DIR library.h - PATHS - /usr/include/wine - /usr/local/include/wine - PATH_SUFFIXES ".") - IF(WINE_INCLUDE_DIR) - MESSAGE(STATUS "Found Wine header files - ${WINE_INCLUDE_DIR}" ) - INCLUDE_DIRECTORIES("${WINE_INCLUDE_DIR}/windows") - SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} "${WINE_INCLUDE_DIR}/windows") - ELSE() - MESSAGE(STATUS "Could not find Wine header files" ) - ENDIF() +# Set visibility/export options if available +IF(WIN32) + SET(EXPORT_DECL "__declspec(dllexport)") + + OPTION(WINE "Enable use of Wine headers when compiling" ON) + IF(WINE) + FIND_PATH(WINE_INCLUDE_DIR library.h + PATHS + /usr/include/wine + /usr/local/include/wine) + IF(WINE_INCLUDE_DIR) + MESSAGE(STATUS "Found Wine header files - ${WINE_INCLUDE_DIR}" ) + INCLUDE_DIRECTORIES("${WINE_INCLUDE_DIR}/windows") + SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} "${WINE_INCLUDE_DIR}/windows") + ELSE() + MESSAGE(STATUS "Could not find Wine header files" ) ENDIF() ENDIF() +ELSE() + CHECK_C_COMPILER_FLAG(-fvisibility=internal HAVE_VISIBILITY_SWITCH) + CHECK_C_SOURCE_COMPILES("int foo() __attribute__((visibility(\"protected\"))); + int main() {return 0;}" HAVE_GCC_VISIBILITY) + IF(HAVE_VISIBILITY_SWITCH AND HAVE_GCC_VISIBILITY) + ADD_DEFINITIONS(-fvisibility=internal) + SET(EXPORT_DECL "__attribute__((visibility(\"protected\")))") + ENDIF() ENDIF() CHECK_C_SOURCE_COMPILES("int foo(const char *str, ...) __attribute__((format(printf, 1, 2))); diff --git a/config.h.in b/config.h.in index d22e3fba..f5ccb5c7 100644 --- a/config.h.in +++ b/config.h.in @@ -1,5 +1,6 @@ -#ifndef CONFIG_H -#define CONFIG_H +/* API declaration export attribute */ +#define AL_API ${EXPORT_DECL} +#define ALC_API ${EXPORT_DECL} /* Define to the library version */ #define ALSOFT_VERSION "${LIB_VERSION}" @@ -105,5 +106,3 @@ /* Define if we have the __restrict keyword */ #cmakedefine HAVE___RESTRICT - -#endif diff --git a/include/AL/al.h b/include/AL/al.h index 44db7798..95d33988 100644 --- a/include/AL/al.h +++ b/include/AL/al.h @@ -5,17 +5,11 @@ extern "C" { #endif -#if defined(AL_LIBTYPE_STATIC) - #define AL_API -#elif defined(_WIN32) && !defined(_XBOX) - #if defined(AL_BUILD_LIBRARY) - #define AL_API __declspec(dllexport) - #else +#ifndef AL_API + #if defined(AL_LIBTYPE_STATIC) + #define AL_API + #elif defined(_WIN32) #define AL_API __declspec(dllimport) - #endif -#else - #if defined(AL_BUILD_LIBRARY) && defined(HAVE_GCC_VISIBILITY) - #define AL_API __attribute__((visibility("protected"))) #else #define AL_API extern #endif diff --git a/include/AL/alc.h b/include/AL/alc.h index 00cb762d..4712055c 100644 --- a/include/AL/alc.h +++ b/include/AL/alc.h @@ -5,17 +5,11 @@ extern "C" { #endif -#if defined(AL_LIBTYPE_STATIC) - #define ALC_API -#elif defined(_WIN32) && !defined(_XBOX) - #if defined(AL_BUILD_LIBRARY) - #define ALC_API __declspec(dllexport) - #else +#ifndef ALC_API + #if defined(AL_LIBTYPE_STATIC) + #define ALC_API + #elif defined(_WIN32) #define ALC_API __declspec(dllimport) - #endif -#else - #if defined(AL_BUILD_LIBRARY) && defined(HAVE_GCC_VISIBILITY) - #define ALC_API __attribute__((visibility("protected"))) #else #define ALC_API extern #endif |