2012-09-23 12:28:09 +00:00
|
|
|
# leave this above project(pdf2htmlEX)
|
|
|
|
# set default build type to Release
|
|
|
|
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build configuration (Debug, Release, RelWithDebInfo, MinSizeRel)")
|
|
|
|
|
|
|
|
project(pdf2htmlEX)
|
2012-08-04 18:03:53 +00:00
|
|
|
cmake_minimum_required(VERSION 2.6.0 FATAL_ERROR)
|
|
|
|
|
2013-09-21 06:02:05 +00:00
|
|
|
option(ENABLE_SVG "Enable SVG support, for generating SVG background images and converting Type 3 fonts" OFF)
|
2013-09-18 08:16:40 +00:00
|
|
|
|
2012-11-29 09:28:05 +00:00
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/src)
|
2012-09-05 09:44:25 +00:00
|
|
|
|
2014-01-19 11:43:44 +00:00
|
|
|
set(PDF2HTMLEX_VERSION "0.12")
|
2012-09-16 16:52:02 +00:00
|
|
|
set(ARCHIVE_NAME pdf2htmlex-${PDF2HTMLEX_VERSION})
|
|
|
|
add_custom_target(dist
|
|
|
|
COMMAND git archive --prefix=${ARCHIVE_NAME}/ HEAD
|
|
|
|
| bzip2 > ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
|
|
|
|
2012-08-04 18:03:53 +00:00
|
|
|
find_package(PkgConfig)
|
2014-02-08 12:35:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
pkg_check_modules(POPPLER poppler>=0.25.0)
|
2013-09-16 12:39:53 +00:00
|
|
|
if(POPPLER_FOUND)
|
2014-02-08 12:35:33 +00:00
|
|
|
set(POPPLER_OLDER_THAN_0_25_0 0)
|
2013-09-16 12:39:53 +00:00
|
|
|
set(POPPLER_OLDER_THAN_0_23_0 0)
|
|
|
|
else()
|
2014-02-08 12:35:33 +00:00
|
|
|
set(POPPLER_OLDER_THAN_0_25_0 1)
|
|
|
|
pkg_check_modules(POPPLER poppler>=0.23.0)
|
|
|
|
if(POPPLER_FOUND)
|
|
|
|
set(POPPLER_OLDER_THAN_0_23_0 0)
|
|
|
|
else()
|
|
|
|
set(POPPLER_OLDER_THAN_0_23_0 1)
|
|
|
|
pkg_check_modules(POPPLER REQUIRED poppler>=0.20.0)
|
|
|
|
endif()
|
2013-09-16 12:39:53 +00:00
|
|
|
endif()
|
2014-02-08 12:35:33 +00:00
|
|
|
|
2012-08-04 18:03:53 +00:00
|
|
|
include_directories(${POPPLER_INCLUDE_DIRS})
|
2012-09-05 11:03:23 +00:00
|
|
|
link_directories(${POPPLER_LIBRARY_DIRS})
|
2012-09-16 16:52:02 +00:00
|
|
|
set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${POPPLER_LIBRARIES})
|
2012-09-05 10:43:37 +00:00
|
|
|
|
2013-09-18 08:16:40 +00:00
|
|
|
if(ENABLE_SVG)
|
|
|
|
pkg_check_modules(CAIRO REQUIRED cairo>=1.10.0)
|
|
|
|
message("Trying to locate cairo-svg...")
|
|
|
|
find_path(CAIRO_SVG_INCLUDE_PATH cairo-svg.h PATHS ${CAIRO_INCLUDE_DIRS} NO_DEFAULT_PATH)
|
|
|
|
if(CAIRO_SVG_INCLUDE_PATH)
|
|
|
|
include_directories(${CAIRO_INCLUDE_DIRS})
|
|
|
|
link_directories(${CAIRO_LIBRARY_DIRS})
|
|
|
|
set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${CAIRO_LIBRARIES})
|
|
|
|
set(ENABLE_SVG 1)
|
2013-09-23 08:37:02 +00:00
|
|
|
if(POPPLER_OLDER_THAN_0_23_0)
|
2013-09-23 08:40:48 +00:00
|
|
|
set(CAIROOUTPUTDEV_PATH 3rdparty/poppler/0.22.5)
|
2013-09-23 08:37:02 +00:00
|
|
|
else()
|
2013-09-23 08:40:48 +00:00
|
|
|
set(CAIROOUTPUTDEV_PATH 3rdparty/poppler/git)
|
2013-09-23 08:37:02 +00:00
|
|
|
endif()
|
|
|
|
include_directories(${CAIROOUTPUTDEV_PATH})
|
2013-09-18 08:16:40 +00:00
|
|
|
set(PDF2HTMLEX_SRC ${PDF2HTMLEX_SRC}
|
2013-09-23 08:37:02 +00:00
|
|
|
${CAIROOUTPUTDEV_PATH}/CairoFontEngine.h
|
|
|
|
${CAIROOUTPUTDEV_PATH}/CairoFontEngine.cc
|
|
|
|
${CAIROOUTPUTDEV_PATH}/CairoRescaleBox.h
|
|
|
|
${CAIROOUTPUTDEV_PATH}/CairoRescaleBox.cc
|
|
|
|
${CAIROOUTPUTDEV_PATH}/CairoOutputDev.h
|
|
|
|
${CAIROOUTPUTDEV_PATH}/CairoOutputDev.cc
|
2013-09-18 08:16:40 +00:00
|
|
|
)
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Error: no SVG support found in Cairo")
|
|
|
|
endif()
|
2013-09-18 07:49:18 +00:00
|
|
|
|
2013-09-18 10:02:53 +00:00
|
|
|
find_package(Freetype REQUIRED)
|
|
|
|
include_directories(${FREETYPE_INCLUDE_DIRS})
|
|
|
|
link_directories(${FREETYPE_LIBRARY_DIRS})
|
|
|
|
set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${FREETYPE_LIBRARIES})
|
|
|
|
endif()
|
2012-10-02 12:41:39 +00:00
|
|
|
|
2012-09-16 04:41:04 +00:00
|
|
|
# fontforge starts using pkg-config 'correctly' since 2.0.0
|
2014-03-22 14:36:22 +00:00
|
|
|
pkg_check_modules(FONTFORGE REQUIRED libfontforge>=2.0.0)
|
|
|
|
include_directories(${FONTFORGE_INCLUDE_DIRS})
|
|
|
|
link_directories(${FONTFORGE_LIBRARY_DIRS})
|
|
|
|
set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${FONTFORGE_LIBRARIES})
|
2012-08-04 18:03:53 +00:00
|
|
|
|
2012-09-23 12:28:09 +00:00
|
|
|
# debug build flags (overwrite default cmake debug flags)
|
2013-03-12 16:43:49 +00:00
|
|
|
set(CMAKE_C_FLAGS_DEBUG "-ggdb -pg")
|
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "-ggdb -pg")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "-pg")
|
2012-09-17 05:33:42 +00:00
|
|
|
|
2012-09-23 12:28:09 +00:00
|
|
|
# release build flags (overwrite default cmake release flags)
|
|
|
|
set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
|
2012-09-03 12:57:14 +00:00
|
|
|
|
2012-09-23 12:28:09 +00:00
|
|
|
# generic flags
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
|
2012-09-17 14:09:01 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
2012-09-23 12:28:09 +00:00
|
|
|
|
2012-09-10 20:19:08 +00:00
|
|
|
# clang compiler need c++11 flag
|
|
|
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
2012-09-10 20:22:34 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
2012-09-10 20:19:08 +00:00
|
|
|
endif()
|
2012-08-04 18:03:53 +00:00
|
|
|
|
2012-09-17 09:35:16 +00:00
|
|
|
# CYGWIN or GCC 4.5.x bug
|
2012-09-10 16:45:00 +00:00
|
|
|
if(CYGWIN)
|
2013-05-11 10:42:50 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x")
|
2012-09-10 16:45:00 +00:00
|
|
|
else()
|
2013-05-11 10:42:50 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
2012-09-10 16:45:00 +00:00
|
|
|
endif()
|
|
|
|
|
2012-10-12 14:39:58 +00:00
|
|
|
include(CheckCXXCompilerFlag)
|
|
|
|
check_cxx_compiler_flag("${CMAKE_CXX_FLAGS}" CXX0X_SUPPORT)
|
|
|
|
if(NOT CXX0X_SUPPORT)
|
2014-01-09 13:14:12 +00:00
|
|
|
message(FATAL_ERROR "Error: your compiler does not support C++0x, please update it.")
|
2012-10-12 14:39:58 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
|
2012-11-29 09:28:05 +00:00
|
|
|
configure_file (${CMAKE_SOURCE_DIR}/src/pdf2htmlEX-config.h.in ${CMAKE_SOURCE_DIR}/src/pdf2htmlEX-config.h)
|
2012-09-12 16:56:18 +00:00
|
|
|
configure_file (${CMAKE_SOURCE_DIR}/pdf2htmlEX.1.in ${CMAKE_SOURCE_DIR}/pdf2htmlEX.1)
|
2012-08-04 18:03:53 +00:00
|
|
|
|
2013-02-27 18:11:34 +00:00
|
|
|
include(${CMAKE_SOURCE_DIR}/src/css_class_names.cmakelists.txt)
|
|
|
|
configure_file (${CMAKE_SOURCE_DIR}/src/util/css_const.h.in ${CMAKE_SOURCE_DIR}/src/util/css_const.h)
|
|
|
|
configure_file (${CMAKE_SOURCE_DIR}/share/base.css.in ${CMAKE_SOURCE_DIR}/share/base.css)
|
2013-05-01 09:14:29 +00:00
|
|
|
configure_file (${CMAKE_SOURCE_DIR}/share/fancy.css.in ${CMAKE_SOURCE_DIR}/share/fancy.css)
|
2013-10-30 07:50:07 +00:00
|
|
|
configure_file (${CMAKE_SOURCE_DIR}/share/pdf2htmlEX.js.in ${CMAKE_SOURCE_DIR}/share/pdf2htmlEX.js)
|
2013-02-27 18:11:34 +00:00
|
|
|
|
2013-09-18 08:16:40 +00:00
|
|
|
set(PDF2HTMLEX_SRC ${PDF2HTMLEX_SRC}
|
2012-11-29 09:28:05 +00:00
|
|
|
src/Param.h
|
2013-11-24 15:20:25 +00:00
|
|
|
src/pdf2htmlEX.cc
|
2013-09-27 11:48:40 +00:00
|
|
|
src/pdf2htmlEX-config.h
|
2013-11-24 15:20:25 +00:00
|
|
|
src/HTMLRenderer/HTMLRenderer.h
|
2012-11-29 09:28:05 +00:00
|
|
|
src/HTMLRenderer/draw.cc
|
|
|
|
src/HTMLRenderer/general.cc
|
2012-08-14 08:23:15 +00:00
|
|
|
src/HTMLRenderer/image.cc
|
2013-02-05 14:00:23 +00:00
|
|
|
src/HTMLRenderer/font.cc
|
2012-11-29 09:28:05 +00:00
|
|
|
src/HTMLRenderer/link.cc
|
2013-01-28 13:01:02 +00:00
|
|
|
src/HTMLRenderer/outline.cc
|
2012-11-29 09:28:05 +00:00
|
|
|
src/HTMLRenderer/state.cc
|
|
|
|
src/HTMLRenderer/text.cc
|
2013-11-24 15:20:25 +00:00
|
|
|
src/BackgroundRenderer/BackgroundRenderer.h
|
2013-09-18 10:01:56 +00:00
|
|
|
src/BackgroundRenderer/BackgroundRenderer.cc
|
2013-11-24 15:20:25 +00:00
|
|
|
src/BackgroundRenderer/SplashBackgroundRenderer.h
|
|
|
|
src/BackgroundRenderer/SplashBackgroundRenderer.cc
|
|
|
|
src/BackgroundRenderer/CairoBackgroundRenderer.h
|
|
|
|
src/BackgroundRenderer/CairoBackgroundRenderer.cc
|
2012-11-29 09:45:26 +00:00
|
|
|
src/util/const.h
|
|
|
|
src/util/const.cc
|
2013-02-27 18:11:34 +00:00
|
|
|
src/util/css_const.h
|
2013-02-15 05:07:00 +00:00
|
|
|
src/util/encoding.h
|
|
|
|
src/util/encoding.cc
|
2012-11-29 09:28:05 +00:00
|
|
|
src/util/ffw.h
|
|
|
|
src/util/ffw.c
|
2012-11-29 10:16:05 +00:00
|
|
|
src/util/math.h
|
|
|
|
src/util/math.cc
|
2012-11-29 10:28:07 +00:00
|
|
|
src/util/misc.h
|
|
|
|
src/util/misc.cc
|
2012-11-29 09:45:26 +00:00
|
|
|
src/util/namespace.h
|
2012-11-29 10:16:05 +00:00
|
|
|
src/util/path.h
|
|
|
|
src/util/path.cc
|
2012-11-29 09:45:26 +00:00
|
|
|
src/util/unicode.h
|
|
|
|
src/util/unicode.cc
|
2014-01-15 13:29:46 +00:00
|
|
|
src/util/mingw.h
|
|
|
|
src/util/mingw.cc
|
2013-04-06 08:45:01 +00:00
|
|
|
src/ArgParser.h
|
|
|
|
src/ArgParser.cc
|
2013-04-06 15:41:58 +00:00
|
|
|
src/Base64Stream.h
|
|
|
|
src/Base64Stream.cc
|
2013-04-06 08:45:01 +00:00
|
|
|
src/Color.h
|
|
|
|
src/Color.cc
|
2013-04-06 16:42:54 +00:00
|
|
|
src/HTMLState.h
|
2013-04-06 15:51:33 +00:00
|
|
|
src/HTMLTextLine.h
|
|
|
|
src/HTMLTextLine.cc
|
2013-04-06 16:42:54 +00:00
|
|
|
src/HTMLTextPage.h
|
|
|
|
src/HTMLTextPage.cc
|
2013-04-06 08:45:01 +00:00
|
|
|
src/Preprocessor.h
|
|
|
|
src/Preprocessor.cc
|
|
|
|
src/StringFormatter.h
|
|
|
|
src/StringFormatter.cc
|
|
|
|
src/TmpFiles.h
|
|
|
|
src/TmpFiles.cc
|
2012-09-10 05:08:47 +00:00
|
|
|
)
|
2013-09-18 08:16:40 +00:00
|
|
|
|
|
|
|
add_executable(pdf2htmlEX ${PDF2HTMLEX_SRC})
|
2012-09-16 16:52:02 +00:00
|
|
|
target_link_libraries(pdf2htmlEX ${PDF2HTMLEX_LIBS})
|
2012-08-14 05:56:41 +00:00
|
|
|
|
2013-11-24 15:20:25 +00:00
|
|
|
add_custom_target(pdf2htmlEX_resources ALL DEPENDS
|
2013-10-30 07:50:07 +00:00
|
|
|
${CMAKE_SOURCE_DIR}/share/base.min.css
|
|
|
|
${CMAKE_SOURCE_DIR}/share/fancy.min.css
|
|
|
|
${CMAKE_SOURCE_DIR}/share/pdf2htmlEX.min.js
|
|
|
|
)
|
|
|
|
|
2013-10-22 07:03:07 +00:00
|
|
|
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/share/pdf2htmlEX.min.js
|
2013-10-30 07:50:07 +00:00
|
|
|
COMMAND ${CMAKE_SOURCE_DIR}/share/build_js.sh
|
2013-11-24 15:20:25 +00:00
|
|
|
DEPENDS
|
2013-10-30 07:50:07 +00:00
|
|
|
${CMAKE_SOURCE_DIR}/share/pdf2htmlEX.js
|
|
|
|
)
|
|
|
|
|
2013-11-24 15:20:25 +00:00
|
|
|
add_custom_command(OUTPUT
|
2013-10-30 07:50:07 +00:00
|
|
|
${CMAKE_SOURCE_DIR}/share/base.min.css
|
|
|
|
${CMAKE_SOURCE_DIR}/share/fancy.min.css
|
|
|
|
COMMAND ${CMAKE_SOURCE_DIR}/share/build_css.sh
|
2013-11-24 15:20:25 +00:00
|
|
|
DEPENDS
|
2013-10-30 07:50:07 +00:00
|
|
|
${CMAKE_SOURCE_DIR}/share/base.css
|
|
|
|
${CMAKE_SOURCE_DIR}/share/fancy.css
|
2013-10-20 08:35:31 +00:00
|
|
|
)
|
2013-10-19 07:06:32 +00:00
|
|
|
|
2012-08-15 03:15:33 +00:00
|
|
|
install (TARGETS pdf2htmlEX DESTINATION bin)
|
2013-10-21 01:33:38 +00:00
|
|
|
|
|
|
|
set(PDF2HTMLEX_RESOURCE
|
2013-11-05 20:53:28 +00:00
|
|
|
${CMAKE_SOURCE_DIR}/3rdparty/PDF.js/compatibility.js
|
2013-11-06 08:33:15 +00:00
|
|
|
${CMAKE_SOURCE_DIR}/3rdparty/PDF.js/compatibility.min.js
|
2013-10-19 07:06:32 +00:00
|
|
|
${CMAKE_SOURCE_DIR}/share/base.css
|
2013-11-05 20:53:28 +00:00
|
|
|
${CMAKE_SOURCE_DIR}/share/base.min.css
|
2013-10-19 07:06:32 +00:00
|
|
|
${CMAKE_SOURCE_DIR}/share/fancy.css
|
2013-11-05 20:53:28 +00:00
|
|
|
${CMAKE_SOURCE_DIR}/share/fancy.min.css
|
2013-10-19 07:06:32 +00:00
|
|
|
${CMAKE_SOURCE_DIR}/share/LICENSE
|
|
|
|
${CMAKE_SOURCE_DIR}/share/manifest
|
2013-11-05 20:53:28 +00:00
|
|
|
${CMAKE_SOURCE_DIR}/share/pdf2htmlEX.js
|
2013-10-22 07:03:07 +00:00
|
|
|
${CMAKE_SOURCE_DIR}/share/pdf2htmlEX.min.js
|
2013-10-19 07:06:32 +00:00
|
|
|
${CMAKE_SOURCE_DIR}/share/pdf2htmlEX-64x64.png
|
2012-09-22 14:47:44 +00:00
|
|
|
)
|
2013-10-21 01:33:38 +00:00
|
|
|
install (FILES ${PDF2HTMLEX_RESOURCE} DESTINATION share/pdf2htmlEX)
|
2012-09-01 17:22:40 +00:00
|
|
|
install (FILES pdf2htmlEX.1 DESTINATION share/man/man1)
|
2013-06-06 17:15:14 +00:00
|
|
|
|
|
|
|
enable_testing()
|
2013-11-24 15:20:25 +00:00
|
|
|
add_test(test_naming
|
2013-09-16 03:33:08 +00:00
|
|
|
python ${CMAKE_SOURCE_DIR}/test/test_naming.py)
|