1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-22 13:00:08 +00:00

Fixed Linux build. Link with all libraries under MINGW only.

This commit is contained in:
Marc Sanfacon 2013-11-24 10:20:25 -05:00
parent 57c02b1972
commit c1f3fa6178
2 changed files with 25 additions and 15 deletions

View File

@ -75,7 +75,7 @@ else()
set(FONTFORGE_INCLUDE_DIRS ${FF_INCLUDE_PATH}/fontforge) set(FONTFORGE_INCLUDE_DIRS ${FF_INCLUDE_PATH}/fontforge)
include_directories(${FONTFORGE_INCLUDE_DIRS}) include_directories(${FONTFORGE_INCLUDE_DIRS})
# MacOSX gettext is in /opt/local/include - strange # MacOSX gettext is in /opt/local/include - strange
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
find_path(GETTEXT_INCLUDE_PATH libintl.h HINTS "/usr/local/opt/gettext/include") # homebrew find_path(GETTEXT_INCLUDE_PATH libintl.h HINTS "/usr/local/opt/gettext/include") # homebrew
if(GETTEXT_INCLUDE_PATH) if(GETTEXT_INCLUDE_PATH)
include_directories(${GETTEXT_INCLUDE_PATH}) include_directories(${GETTEXT_INCLUDE_PATH})
@ -97,7 +97,7 @@ else()
macro(wl_find_library LIB_NAME RESULT) macro(wl_find_library LIB_NAME RESULT)
unset(${RESULT}) unset(${RESULT})
unset(${RESULT} CACHE) unset(${RESULT} CACHE)
foreach(FULL_LIB_NAME foreach(FULL_LIB_NAME
${CMAKE_IMPORT_LIBRARY_PREFIX}${LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX} ${CMAKE_IMPORT_LIBRARY_PREFIX}${LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}
${CMAKE_SHARED_LIBRARY_PREFIX}${LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_SHARED_LIBRARY_PREFIX}${LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}
${CMAKE_STATIC_LIBRARY_PREFIX}${LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX} ${CMAKE_STATIC_LIBRARY_PREFIX}${LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}
@ -131,8 +131,9 @@ else()
endif() endif()
# Add additional dependencies # Add additional dependencies
if(MINGW)
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) 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)
endif()
# debug build flags (overwrite default cmake debug flags) # debug build flags (overwrite default cmake debug flags)
set(CMAKE_C_FLAGS_DEBUG "-ggdb -pg") set(CMAKE_C_FLAGS_DEBUG "-ggdb -pg")
@ -177,9 +178,9 @@ configure_file (${CMAKE_SOURCE_DIR}/share/pdf2htmlEX.js.in ${CMAKE_SOURCE_DIR}/s
set(PDF2HTMLEX_SRC ${PDF2HTMLEX_SRC} set(PDF2HTMLEX_SRC ${PDF2HTMLEX_SRC}
src/Param.h src/Param.h
src/pdf2htmlEX.cc src/pdf2htmlEX.cc
src/pdf2htmlEX-config.h src/pdf2htmlEX-config.h
src/HTMLRenderer/HTMLRenderer.h src/HTMLRenderer/HTMLRenderer.h
src/HTMLRenderer/draw.cc src/HTMLRenderer/draw.cc
src/HTMLRenderer/general.cc src/HTMLRenderer/general.cc
src/HTMLRenderer/image.cc src/HTMLRenderer/image.cc
@ -188,12 +189,12 @@ set(PDF2HTMLEX_SRC ${PDF2HTMLEX_SRC}
src/HTMLRenderer/outline.cc src/HTMLRenderer/outline.cc
src/HTMLRenderer/state.cc src/HTMLRenderer/state.cc
src/HTMLRenderer/text.cc src/HTMLRenderer/text.cc
src/BackgroundRenderer/BackgroundRenderer.h src/BackgroundRenderer/BackgroundRenderer.h
src/BackgroundRenderer/BackgroundRenderer.cc src/BackgroundRenderer/BackgroundRenderer.cc
src/BackgroundRenderer/SplashBackgroundRenderer.h src/BackgroundRenderer/SplashBackgroundRenderer.h
src/BackgroundRenderer/SplashBackgroundRenderer.cc src/BackgroundRenderer/SplashBackgroundRenderer.cc
src/BackgroundRenderer/CairoBackgroundRenderer.h src/BackgroundRenderer/CairoBackgroundRenderer.h
src/BackgroundRenderer/CairoBackgroundRenderer.cc src/BackgroundRenderer/CairoBackgroundRenderer.cc
src/util/const.h src/util/const.h
src/util/const.cc src/util/const.cc
src/util/css_const.h src/util/css_const.h
@ -232,7 +233,7 @@ set(PDF2HTMLEX_SRC ${PDF2HTMLEX_SRC}
add_executable(pdf2htmlEX ${PDF2HTMLEX_SRC}) add_executable(pdf2htmlEX ${PDF2HTMLEX_SRC})
target_link_libraries(pdf2htmlEX ${PDF2HTMLEX_LIBS}) target_link_libraries(pdf2htmlEX ${PDF2HTMLEX_LIBS})
add_custom_target(pdf2htmlEX_resources ALL DEPENDS add_custom_target(pdf2htmlEX_resources ALL DEPENDS
${CMAKE_SOURCE_DIR}/share/base.min.css ${CMAKE_SOURCE_DIR}/share/base.min.css
${CMAKE_SOURCE_DIR}/share/fancy.min.css ${CMAKE_SOURCE_DIR}/share/fancy.min.css
${CMAKE_SOURCE_DIR}/share/pdf2htmlEX.min.js ${CMAKE_SOURCE_DIR}/share/pdf2htmlEX.min.js
@ -240,15 +241,15 @@ add_custom_target(pdf2htmlEX_resources ALL DEPENDS
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/share/pdf2htmlEX.min.js add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/share/pdf2htmlEX.min.js
COMMAND ${CMAKE_SOURCE_DIR}/share/build_js.sh COMMAND ${CMAKE_SOURCE_DIR}/share/build_js.sh
DEPENDS DEPENDS
${CMAKE_SOURCE_DIR}/share/pdf2htmlEX.js ${CMAKE_SOURCE_DIR}/share/pdf2htmlEX.js
) )
add_custom_command(OUTPUT add_custom_command(OUTPUT
${CMAKE_SOURCE_DIR}/share/base.min.css ${CMAKE_SOURCE_DIR}/share/base.min.css
${CMAKE_SOURCE_DIR}/share/fancy.min.css ${CMAKE_SOURCE_DIR}/share/fancy.min.css
COMMAND ${CMAKE_SOURCE_DIR}/share/build_css.sh COMMAND ${CMAKE_SOURCE_DIR}/share/build_css.sh
DEPENDS DEPENDS
${CMAKE_SOURCE_DIR}/share/base.css ${CMAKE_SOURCE_DIR}/share/base.css
${CMAKE_SOURCE_DIR}/share/fancy.css ${CMAKE_SOURCE_DIR}/share/fancy.css
) )
@ -272,5 +273,5 @@ install (FILES ${PDF2HTMLEX_RESOURCE} DESTINATION share/pdf2htmlEX)
install (FILES pdf2htmlEX.1 DESTINATION share/man/man1) install (FILES pdf2htmlEX.1 DESTINATION share/man/man1)
enable_testing() enable_testing()
add_test(test_naming add_test(test_naming
python ${CMAKE_SOURCE_DIR}/test/test_naming.py) python ${CMAKE_SOURCE_DIR}/test/test_naming.py)

View File

@ -58,9 +58,17 @@ void TmpFiles::clean()
double TmpFiles::get_total_size() const double TmpFiles::get_total_size() const
{ {
double total_size = 0; double total_size = 0;
#ifndef _WIN32
struct stat st;
#else
struct _stat st; struct _stat st;
#endif
for(auto iter = tmp_files.begin(); iter != tmp_files.end(); ++iter) { for(auto iter = tmp_files.begin(); iter != tmp_files.end(); ++iter) {
#ifndef _WIN32
stat(iter->c_str(), &st);
#else
_stat(iter->c_str(), &st); _stat(iter->c_str(), &st);
#endif
total_size += st.st_size; total_size += st.st_size;
} }
@ -68,3 +76,4 @@ double TmpFiles::get_total_size() const
} }
} // namespace pdf2htmlEX } // namespace pdf2htmlEX