Skip to content

Commit

Permalink
fix build on OSX
Browse files Browse the repository at this point in the history
  • Loading branch information
kakwa authored and kakwa committed Jan 24, 2017
1 parent f5435d8 commit 57e4df7
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 14 deletions.
10 changes: 1 addition & 9 deletions CMakeLists.txt
Expand Up @@ -77,14 +77,6 @@ LINK_DIRECTORIES(
/usr/lib/
)

IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# Mac OS X specific code
add_library(memstream
${SHARED}
src/lib/visio2svg/memstream.c
)
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

include_directories(
inc/
${LIBEMF2SVG_INCLUDE_DIR}
Expand Down Expand Up @@ -131,10 +123,10 @@ target_link_libraries(Visio2Svg
${LIBVISIO_LIBRARIES}
${LIBEMF2SVG_LIBRARIES}
${LIBWMF_LIBRARIES}
${LIBWMFLITE_LIBRARIES}
${LIBREVENGE_STREAM_LIBRARY}
${LIBXML2_LIBRARIES}
TitleGenerator
${EXTERNAL_MEMSTREAM}
${EXTERNAL_ARGP}
)

Expand Down
2 changes: 2 additions & 0 deletions cmake/Findlibwmf.cmake
Expand Up @@ -11,7 +11,9 @@ find_path(LIBWMF_INCLUDE_DIR

if (NOT LIBWMF_LIBRARIES)
find_library(LIBWMF_LIBRARIES NAMES wmf ${_LIBWMF_PATHS} PATH_SUFFIXES lib)
find_library(LIBWMFLITE_LIBRARIES NAMES wmflite ${_LIBWMF_PATHS} PATH_SUFFIXES lib)
endif ()

MESSAGE( STATUS "Find Header Directory for libwmf: " ${LIBWMF_INCLUDE_DIR})
MESSAGE( STATUS "Find Dynamic Library for libwmf: " ${LIBWMF_LIBRARIES})
MESSAGE( STATUS "Find Dynamic Library for libwmflite: " ${LIBWMFLITE_LIBRARIES})
6 changes: 3 additions & 3 deletions deps/memstream-0.1/memstream.c
Expand Up @@ -88,7 +88,7 @@ static int memstream_grow(struct memstream *ms, int minsize)
{
int newcap= ms->capacity * 2; memstream_check(ms);
while (newcap <= minsize) newcap *= 2; memstream_info(("grow %p to %i\n", ms, newcap));
ms->contents= realloc(ms->contents, newcap);
ms->contents= (char *)realloc(ms->contents, newcap);
if (!ms->contents) return -1; /* errno == ENOMEM */
memset(ms->contents + ms->capacity, 0, newcap - ms->capacity);
ms->capacity= newcap;
Expand Down Expand Up @@ -152,11 +152,11 @@ static int memstream_close(void *cookie)
FILE *open_memstream(char **ptr, size_t *sizeloc)
{
if (ptr && sizeloc) {
struct memstream *ms= calloc(1, sizeof(struct memstream));
struct memstream *ms= (struct memstream *)calloc(1, sizeof(struct memstream));
FILE *fp= 0; if (!ms) return 0; /* errno == ENOMEM */
ms->position= ms->size= 0;
ms->capacity= 4096;
ms->contents= calloc(ms->capacity, 1); if (!ms->contents) { free(ms); return 0; } /* errno == ENOMEM */
ms->contents= (char *)calloc(ms->capacity, 1); if (!ms->contents) { free(ms); return 0; } /* errno == ENOMEM */
ms->ptr= ptr;
ms->sizeloc= sizeloc;
memstream_print(ms);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/visio2svg/Visio2Svg.cpp
Expand Up @@ -24,7 +24,7 @@


#ifdef DARWIN
#include <memstream.h>
#include "memstream.c"
#endif

#define VISIOVSS 1
Expand Down
2 changes: 1 addition & 1 deletion tests/travis-setup.sh
Expand Up @@ -48,7 +48,7 @@ rm -rf libemf2svg-${EMF_VERSION}
tar -xf ${EMF_VERSION}.tar.gz || exit 1
cd libemf2svg-${EMF_VERSION} && CC=clang CXX=clang++ cmake . -DUSE_CLANG=ON && make && make install DESTDIR=$OUT && cd - || exit 1

if ! [ "$TRAVIS_OS_NAME" = "osx" ]
if ! [ "`uname`" = "Darwin" ]
then
! [ -e "librevenge-${RVNG_VERSION}.tar.xz" ] && wget http://netix.dl.sourceforge.net/project/libwpd/librevenge/librevenge-${RVNG_VERSION}/librevenge-${RVNG_VERSION}.tar.xz
rm -rf librevenge-${RVNG_VERSION}
Expand Down

0 comments on commit 57e4df7

Please sign in to comment.