# HG changeset patch # User koda # Date 1370991753 -7200 # Node ID bcc25cb9b122b737af5a723ed7139a8f7b26d710 # Parent 4d69569baabbba534695ba224d67eab512dec5d5 and now also avwrapper can be shared/static, add visibility to its exported functions, drop (needed only when static) diff -r 4d69569baabb -r bcc25cb9b122 hedgewars/CMakeLists.txt --- a/hedgewars/CMakeLists.txt Wed Jun 12 01:00:47 2013 +0200 +++ b/hedgewars/CMakeLists.txt Wed Jun 12 01:02:33 2013 +0200 @@ -186,21 +186,19 @@ if(${FFMPEG_FOUND}) + list(APPEND pascal_flags "-dUSE_VIDEO_RECORDING") + # TODO: this check is only for SDL < 2 # fpc will take care of linking but we need to have this library installed find_package(GLUT REQUIRED) - #TODO: convert avwrapper to .pas unit so we can skip this step include_directories(${FFMPEG_INCLUDE_DIR}) - list(APPEND pascal_flags "-dUSE_VIDEO_RECORDING") - if(WIN32) - # there are some problems with linking our avwrapper as static lib, so link it as shared - add_library(avwrapper SHARED avwrapper.c) - target_link_libraries(avwrapper ${FFMPEG_LIBRARIES}) - install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}avwrapper${CMAKE_SHARED_LIBRARY_SUFFIX}" DESTINATION ${target_library_install_dir}) - else() - add_library(avwrapper STATIC avwrapper.c) - endif() + add_library(avwrapper avwrapper.c) + #TODO: find good VERSION and SOVERSION values + target_link_libraries(avwrapper ${FFMPEG_LIBRARIES}) + install(TARGETS avwrapper RUNTIME DESTINATION ${target_binary_install_dir} + LIBRARY DESTINATION ${target_library_install_dir} + ARCHIVE DESTINATION ${target_library_install_dir}) endif() diff -r 4d69569baabb -r bcc25cb9b122 hedgewars/avwrapper.c --- a/hedgewars/avwrapper.c Wed Jun 12 01:00:47 2013 +0200 +++ b/hedgewars/avwrapper.c Wed Jun 12 01:02:33 2013 +0200 @@ -28,6 +28,14 @@ #define AVIO_FLAG_WRITE AVIO_WRONLY #endif +#if (defined _MSC_VER) +#define AVWRAP_DECL __declspec(dllexport) +#elif ((__GNUC__ >= 3) && (!__EMX__) && (!sun)) +#define AVWRAP_DECL __attribute__((visibility("default"))) +#else +#define AVWRAP_DECL +#endif + static AVFormatContext* g_pContainer; static AVOutputFormat* g_pFormat; static AVStream* g_pAStream; @@ -371,7 +379,7 @@ } } -void AVWrapper_WriteFrame(uint8_t* pY, uint8_t* pCb, uint8_t* pCr) +AVWRAP_DECL void AVWrapper_WriteFrame(uint8_t* pY, uint8_t* pCb, uint8_t* pCr) { g_pVFrame->data[0] = pY; g_pVFrame->data[1] = pCb; @@ -379,7 +387,7 @@ WriteFrame(g_pVFrame); } -void AVWrapper_Init( +AVWRAP_DECL void AVWrapper_Init( void (*pAddFileLogRaw)(const char*), const char* pFilename, const char* pDesc, @@ -472,7 +480,7 @@ g_pVFrame->pts = -1; } -void AVWrapper_Close() +AVWRAP_DECL void AVWrapper_Close() { // output buffered frames if (g_pVCodec->capabilities & CODEC_CAP_DELAY) diff -r 4d69569baabb -r bcc25cb9b122 hedgewars/uVideoRec.pas --- a/hedgewars/uVideoRec.pas Wed Jun 12 01:00:47 2013 +0200 +++ b/hedgewars/uVideoRec.pas Wed Jun 12 01:02:33 2013 +0200 @@ -28,9 +28,6 @@ {$ELSE} {$IFNDEF WIN32} - {$linklib avcodec} - {$linklib avformat} - {$linklib avutil} {$linklib avwrapper} {$ENDIF}