diff --git a/AthenaCore.pri b/AthenaCore.pri index c94feee..9e16039 100644 --- a/AthenaCore.pri +++ b/AthenaCore.pri @@ -1,8 +1,11 @@ !contains(ATHENA_PRO, true): { INCLUDEPATH += $$PWD/include + mac:INCLUDEPATH += /usr/local/include unix:LIBS += -lz -llzo2 win32:LIBS += -lz -llzo2 + mac:LIBS += -L/usr/local/lib -lz -llzo2 QMAKE_CXXFLAGS += -std=c++11 + mac:QMAKE_CXXFLAGS += -stdlib=libc++ } ATHENA_CORE=true @@ -21,7 +24,12 @@ SOURCES += \ $$PWD/src/LZ77/LZType11.cpp \ $$PWD/src/LZ77/LZBase.cpp -win32:SOURCES += $$PWD/src/win32_largefilewrapper.c +win32:SOURCES += \ + $$PWD/src/win32_largefilewrapper.c + +mac:SOURCES += \ + $$PWD/src/osx_largefilewrapper.c + HEADERS += \ $$PWD/include/Athena/IStream.hpp \ @@ -53,3 +61,7 @@ HEADERS += \ win32:HEADERS += \ $$PWD/include/win32_largefilewrapper.h + +mac:HEADERS += \ + $$PWD/include/osx_largefilewrapper.h + diff --git a/include/osx_largefilewrapper.h b/include/osx_largefilewrapper.h new file mode 100644 index 0000000..0e83b9a --- /dev/null +++ b/include/osx_largefilewrapper.h @@ -0,0 +1,16 @@ +#ifndef OSX_LARGEFILEWRAPPER_H +#define OSX_LARGEFILEWRAPPER_H + +#if defined(__APPLE__) +#include +#ifdef __cplusplus +extern "C" { +#endif +int fseeko64(FILE* fp, off_t offset, int whence); +off_t ftello64(FILE* fp); +#ifdef __cplusplus +} +#endif +#endif + +#endif // OSX_LARGEFILEWRAPPER_H diff --git a/src/Athena/FileReader.cpp b/src/Athena/FileReader.cpp index fc4ee00..0a9fc79 100644 --- a/src/Athena/FileReader.cpp +++ b/src/Athena/FileReader.cpp @@ -20,8 +20,10 @@ #include "Athena/IOException.hpp" #include "utf8.h" -#ifdef _WIN32 +#if _WIN32 #include "win32_largefilewrapper.h" +#elif __APPLE__ +#include "osx_largefilewrapper.h" #endif namespace Athena diff --git a/src/Athena/FileWriter.cpp b/src/Athena/FileWriter.cpp index aa10dce..e4a5572 100644 --- a/src/Athena/FileWriter.cpp +++ b/src/Athena/FileWriter.cpp @@ -19,8 +19,10 @@ #include "Athena/InvalidOperationException.hpp" #include "Athena/IOException.hpp" -#ifdef _MSC_VER +#if _WIN32 #include "win32_largefilewrapper.h" +#elif __APPLE__ +#include "osx_largefilewrapper.h" #endif #include "utf8.h" diff --git a/src/osx_largefilewrapper.c b/src/osx_largefilewrapper.c new file mode 100644 index 0000000..a941d15 --- /dev/null +++ b/src/osx_largefilewrapper.c @@ -0,0 +1,13 @@ +#include "osx_largefilewrapper.h" +#include + +int fseeko64(FILE* fp, off_t offset, int whence) +{ + return fseeko(fp, offset, whence); +} + +off_t ftello64(FILE* fp) +{ + return ftello(fp); +} +