mirror of
https://github.com/pdf2htmlEX/pdf2htmlEX.git
synced 2024-12-22 13:00:08 +00:00
Compile under MinGW
This commit is contained in:
parent
dc069d2747
commit
8c65a2826b
@ -130,6 +130,9 @@ else()
|
||||
set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${PYTHON_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# Add additional dependencies
|
||||
set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} intl iconv gettextlib gettextpo gutils png jpeg openjpeg glib-2.0.dll z xml2 tiff gio-2.0.dll ltdl plibc.dll)
|
||||
|
||||
|
||||
# debug build flags (overwrite default cmake debug flags)
|
||||
set(CMAKE_C_FLAGS_DEBUG "-ggdb -pg")
|
||||
|
@ -42,6 +42,31 @@ using namespace pdf2htmlEX;
|
||||
Param param;
|
||||
ArgParser argparser;
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <errno.h>
|
||||
char *mkdtemp(char *tempbuf) {
|
||||
int rand_value = 0;
|
||||
char* tempbase = NULL;
|
||||
char tempbasebuf[MAX_PATH] = "";
|
||||
|
||||
if (strcmp(&tempbuf[strlen(tempbuf)-6], "XXXXXX")) {
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
srand((unsigned)time(0));
|
||||
rand_value = (int)((rand() / ((double)RAND_MAX+1.0)) * 1e6);
|
||||
tempbase = strrchr(tempbuf, '/');
|
||||
tempbase = tempbase ? tempbase+1 : tempbuf;
|
||||
strcpy(tempbasebuf, tempbase);
|
||||
sprintf(&tempbasebuf[strlen(tempbasebuf)-6], "%d", rand_value);
|
||||
::GetTempPath(MAX_PATH, tempbuf);
|
||||
strcat(tempbuf, tempbasebuf);
|
||||
::CreateDirectory(tempbuf, NULL);
|
||||
return tempbuf;
|
||||
}
|
||||
#endif
|
||||
|
||||
void deprecated_font_suffix(const char * dummy = nullptr)
|
||||
{
|
||||
cerr << "--font-suffix is deprecated. Use `--font-format` instead." << endl;
|
||||
|
@ -19,6 +19,11 @@
|
||||
|
||||
#include "ffw.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
#undef printf
|
||||
#undef vfprintf
|
||||
#endif
|
||||
|
||||
static real EPS=1e-6;
|
||||
|
||||
static inline int min(int a, int b)
|
||||
|
@ -14,6 +14,17 @@
|
||||
|
||||
using std::string;
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <windows.h>
|
||||
int mkdir(const char *pathname, mode_t mode) {
|
||||
if (::GetFileAttributes(pathname) == FILE_ATTRIBUTE_DIRECTORY) {
|
||||
errno = EEXIST;
|
||||
return -1;
|
||||
}
|
||||
return ::CreateDirectory(pathname, NULL) ? 0 : -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace pdf2htmlEX {
|
||||
|
||||
void create_directories(const string & path)
|
||||
@ -31,9 +42,15 @@ void create_directories(const string & path)
|
||||
{
|
||||
if(errno == EEXIST)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
struct _stat32 stat_buf;
|
||||
if((_stat32(path.c_str(), &stat_buf) == 0) && S_ISDIR(stat_buf.st_mode))
|
||||
return;
|
||||
#else
|
||||
struct stat stat_buf;
|
||||
if((stat(path.c_str(), &stat_buf) == 0) && S_ISDIR(stat_buf.st_mode))
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
throw string("Cannot create directory: ") + path;
|
||||
|
Loading…
Reference in New Issue
Block a user