Commit 0c7c88e6 authored by Brennan Ashton's avatar Brennan Ashton Committed by GitHub

Fix static library builds (#13)

Signed-off-by: default avatarBrennan Ashton <bashton@brennanashton.com>
parent 0c0453a0
...@@ -43,9 +43,6 @@ option(BUILD_SHARED_LIBS "Build Shared Libraries" ON) ...@@ -43,9 +43,6 @@ option(BUILD_SHARED_LIBS "Build Shared Libraries" ON)
if(BUILD_SHARED_LIBS) if(BUILD_SHARED_LIBS)
set (LIB_TYPE SHARED) set (LIB_TYPE SHARED)
else(BUILD_SHARED_LIBS) else(BUILD_SHARED_LIBS)
if(WIN32)
message(WARNING "You will have to modify libaec.h for static libs.")
endif(WIN32)
set(LIB_TYPE STATIC) set(LIB_TYPE STATIC)
endif(BUILD_SHARED_LIBS) endif(BUILD_SHARED_LIBS)
......
include (GenerateExportHeader)
add_library(aec ${LIB_TYPE} ${libaec_SRCS}) add_library(aec ${LIB_TYPE} ${libaec_SRCS})
set_target_properties(aec PROPERTIES VERSION 0.0.10 SOVERSION 0) set_target_properties(aec PROPERTIES VERSION 0.0.10 SOVERSION 0)
generate_export_header(aec
BASE_NAME libaec
EXPORT_MACRO_NAME libaec_EXPORT
EXPORT_FILE_NAME ${PROJECT_BINARY_DIR}/libaec_Export.h
STATIC_DEFINE libaec_BUILT_AS_STATIC
)
add_library(sz ${LIB_TYPE} sz_compat.c) add_library(sz ${LIB_TYPE} sz_compat.c)
set_target_properties(sz PROPERTIES VERSION 2.0.1 SOVERSION 2) set_target_properties(sz PROPERTIES VERSION 2.0.1 SOVERSION 2)
...@@ -41,7 +49,7 @@ else(WIN32) ...@@ -41,7 +49,7 @@ else(WIN32)
DESTINATION ${CMAKE_INSTALL_FULL_MANDIR}/man1 COMPONENT doc) DESTINATION ${CMAKE_INSTALL_FULL_MANDIR}/man1 COMPONENT doc)
endif(WIN32) endif(WIN32)
install(FILES libaec.h szlib.h install(FILES libaec.h szlib.h ${PROJECT_BINARY_DIR}/libaec_Export.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT headers) COMPONENT headers)
install(TARGETS aec_client install(TARGETS aec_client
......
...@@ -52,20 +52,12 @@ ...@@ -52,20 +52,12 @@
#include <stddef.h> #include <stddef.h>
#include "libaec_Export.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C"{ extern "C"{
#endif #endif
#if BUILDING_LIBAEC && HAVE_VISIBILITY
# define LIBAEC_DLL_EXPORTED __attribute__((__visibility__("default")))
#elif BUILDING_LIBAEC && defined _MSC_VER
# define LIBAEC_DLL_EXPORTED __declspec(dllexport)
#elif defined _MSC_VER
# define LIBAEC_DLL_EXPORTED __declspec(dllimport)
#else
# define LIBAEC_DLL_EXPORTED
#endif
struct internal_state; struct internal_state;
struct aec_stream { struct aec_stream {
...@@ -155,19 +147,19 @@ struct aec_stream { ...@@ -155,19 +147,19 @@ struct aec_stream {
/*********************************************/ /*********************************************/
/* Streaming encoding and decoding functions */ /* Streaming encoding and decoding functions */
/*********************************************/ /*********************************************/
LIBAEC_DLL_EXPORTED int aec_encode_init(struct aec_stream *strm); libaec_EXPORT int aec_encode_init(struct aec_stream *strm);
LIBAEC_DLL_EXPORTED int aec_encode(struct aec_stream *strm, int flush); libaec_EXPORT int aec_encode(struct aec_stream *strm, int flush);
LIBAEC_DLL_EXPORTED int aec_encode_end(struct aec_stream *strm); libaec_EXPORT int aec_encode_end(struct aec_stream *strm);
LIBAEC_DLL_EXPORTED int aec_decode_init(struct aec_stream *strm); libaec_EXPORT int aec_decode_init(struct aec_stream *strm);
LIBAEC_DLL_EXPORTED int aec_decode(struct aec_stream *strm, int flush); libaec_EXPORT int aec_decode(struct aec_stream *strm, int flush);
LIBAEC_DLL_EXPORTED int aec_decode_end(struct aec_stream *strm); libaec_EXPORT int aec_decode_end(struct aec_stream *strm);
/***************************************************************/ /***************************************************************/
/* Utility functions for encoding or decoding a memory buffer. */ /* Utility functions for encoding or decoding a memory buffer. */
/***************************************************************/ /***************************************************************/
LIBAEC_DLL_EXPORTED int aec_buffer_encode(struct aec_stream *strm); libaec_EXPORT int aec_buffer_encode(struct aec_stream *strm);
LIBAEC_DLL_EXPORTED int aec_buffer_decode(struct aec_stream *strm); libaec_EXPORT int aec_buffer_decode(struct aec_stream *strm);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -80,15 +80,15 @@ typedef struct SZ_com_t_s ...@@ -80,15 +80,15 @@ typedef struct SZ_com_t_s
int pixels_per_scanline; int pixels_per_scanline;
} SZ_com_t; } SZ_com_t;
LIBAEC_DLL_EXPORTED int SZ_BufftoBuffCompress( libaec_EXPORT int SZ_BufftoBuffCompress(
void *dest, size_t *destLen, void *dest, size_t *destLen,
const void *source, size_t sourceLen, const void *source, size_t sourceLen,
SZ_com_t *param); SZ_com_t *param);
LIBAEC_DLL_EXPORTED int SZ_BufftoBuffDecompress( libaec_EXPORT int SZ_BufftoBuffDecompress(
void *dest, size_t *destLen, void *dest, size_t *destLen,
const void *source, size_t sourceLen, const void *source, size_t sourceLen,
SZ_com_t *param); SZ_com_t *param);
LIBAEC_DLL_EXPORTED int SZ_encoder_enabled(void); libaec_EXPORT int SZ_encoder_enabled(void);
#endif /* SZLIB_H */ #endif /* SZLIB_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment