1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-07-02 16:25:41 +00:00
pdf2htmlEX/CMakeLists.txt

208 lines
7.2 KiB
CMake
Raw Normal View History

# 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)
2012-11-29 09:28:05 +00:00
include_directories(${CMAKE_SOURCE_DIR}/src)
2012-09-05 09:44:25 +00:00
2013-03-01 06:05:52 +00:00
set(PDF2HTMLEX_VERSION "0.8")
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)
2012-09-09 18:57:38 +00:00
pkg_check_modules(POPPLER REQUIRED poppler>=0.20.0)
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
2012-10-02 18:19:40 +00:00
# disable CAIRO for now
if(0)
pkg_check_modules(POPPLER_CAIRO poppler-cairo>=0.20.0)
if(POPPLER_CAIRO_FOUND)
2012-10-02 12:41:39 +00:00
set(HAVE_CAIRO 1)
2012-10-02 18:19:40 +00:00
include_directories(${POPPLER_CAIRO_INCLUDE_DIRS})
link_directories(${POPPLER_CAIRO_LIBRARY_DIRS})
set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${POPPLER_CAIRO_LIBRARIES})
2012-10-02 12:41:39 +00:00
else()
set(HAVE_CAIRO 0)
endif()
2012-10-02 18:19:40 +00:00
else()
set(HAVE_CAIRO 0)
endif()
2012-10-02 12:41:39 +00:00
# fontforge starts using pkg-config 'correctly' since 2.0.0
pkg_check_modules(FONTFORGE libfontforge>=2.0.0)
if(FONTFORGE_FOUND)
include_directories(${FONTFORGE_INCLUDE_DIRS})
link_directories(${FONTFORGE_LIBRARY_DIRS})
2012-09-16 16:52:02 +00:00
set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${FONTFORGE_LIBRARIES})
2012-09-05 09:44:25 +00:00
else()
2013-03-04 05:34:06 +00:00
message("Trying to locate old versions of fontforge...")
find_path(FF_INCLUDE_PATH fontforge/fontforge.h)
if(FF_INCLUDE_PATH)
message("Found fontforge.h: ${FF_INCLUDE_PATH}/fontforge/fontforge.h")
2012-09-16 05:55:13 +00:00
set(FONTFORGE_INCLUDE_DIRS ${FF_INCLUDE_PATH}/fontforge)
include_directories(${FONTFORGE_INCLUDE_DIRS})
# MacOSX gettext is in /opt/local/include - strange
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
2013-01-25 00:53:48 +00:00
find_path(GETTEXT_INCLUDE_PATH libintl.h HINTS "/usr/local/opt/gettext/include") # homebrew
if(GETTEXT_INCLUDE_PATH)
include_directories(${GETTEXT_INCLUDE_PATH})
else()
2012-09-17 17:32:27 +00:00
message("Cannot found libintl.h, if you see errors about libintl.h, add the path to gettext header files into your include paths")
endif()
endif()
else()
message(FATAL_ERROR "Error: cannot locate fontforge.h")
endif()
2013-03-04 05:34:06 +00:00
find_path(FF_CONFIG_INCLUDE_PATH config.h PATHS
${FONTFORGE_INCLUDE_DIRS} NO_DEFAULT_PATH)
if(FF_CONFIG_INCLUDE_PATH)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -include ${FF_CONFIG_INCLUDE_PATH}/config.h")
message("Found config.h: ${FF_CONFIG_INCLUDE_PATH}/config.h")
else()
message("Cannot locate config.h for fontforge")
endif()
2012-09-05 09:44:25 +00:00
2012-09-16 16:52:02 +00:00
macro(wl_find_library LIB_NAME RESULT)
2012-09-17 02:10:57 +00:00
unset(${RESULT})
unset(${RESULT} CACHE)
2012-09-16 16:52:02 +00:00
foreach(FULL_LIB_NAME
${CMAKE_IMPORT_LIBRARY_PREFIX}${LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}
${CMAKE_SHARED_LIBRARY_PREFIX}${LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}
${CMAKE_STATIC_LIBRARY_PREFIX}${LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}
)
find_library(FULL_LIB ${FULL_LIB_NAME})
if(FULL_LIB)
message("Found ${LIB_NAME}: ${FULL_LIB}")
set(${RESULT} ${FULL_LIB})
break()
endif()
endforeach()
unset(FULL_LIB_NAME)
unset(FULL_LIB_NAME CACHE)
unset(FULL_LIB)
unset(FULL_LIB CACHE)
endmacro()
wl_find_library(fontforge FONTFORGE_LIBRARIES)
if(NOT DEFINED FONTFORGE_LIBRARIES)
set(FONTFORGE_LIBRARIES fontforge)
2012-09-16 16:52:02 +00:00
message("Error: cannot locate fontforge")
endif()
2012-09-16 16:52:02 +00:00
set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${FONTFORGE_LIBRARIES})
wl_find_library(gunicode GUNICODE_LIBRARIES)
set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${GUNICODE_LIBRARIES})
message("Looking for libraries of python, which is required by fontforge, if you can link fontforge without python, you may disable this")
pkg_search_module(PYTHON python python-2.7)
2012-09-16 16:52:02 +00:00
set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${PYTHON_LIBRARIES})
2012-09-05 10:43:37 +00:00
endif()
2012-08-04 18:03:53 +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")
# release build flags (overwrite default cmake release flags)
set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
# 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")
# 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++")
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)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=gnu++0x")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++0x")
endif()
2012-10-12 14:39:58 +00:00
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag("${CMAKE_CXX_FLAGS}" CXX0X_SUPPORT)
if(NOT CXX0X_SUPPORT)
message(FATAL_ERROR "Error: you compiler does not support C++0x, please update it.")
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)
configure_file (${CMAKE_SOURCE_DIR}/share/pdf2htmlEX.js.in ${CMAKE_SOURCE_DIR}/share/pdf2htmlEX.js)
2012-08-14 05:56:41 +00:00
add_executable(pdf2htmlEX
2012-11-29 09:28:05 +00:00
src/Param.h
src/pdf2htmlEX-config.h
2012-08-14 05:56:41 +00:00
src/pdf2htmlEX.cc
2012-11-29 09:28:05 +00:00
src/HTMLRenderer/HTMLRenderer.h
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-12-11 12:48:01 +00:00
src/HTMLRenderer/TextLineBuffer.h
src/HTMLRenderer/TextLineBuffer.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
src/BackgroundRenderer/BackgroundRenderer.h
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/ArgParser.h
src/util/ArgParser.cc
2012-12-11 12:17:36 +00:00
src/util/base64stream.h
src/util/base64stream.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-12-11 12:17:36 +00:00
src/util/Preprocessor.h
src/util/Preprocessor.cc
2012-11-29 12:40:47 +00:00
src/util/StringFormatter.h
2012-12-11 12:17:36 +00:00
src/util/StringFormatter.cc
2012-11-29 09:28:05 +00:00
src/util/TmpFiles.h
src/util/TmpFiles.cc
2012-11-29 09:45:26 +00:00
src/util/unicode.h
src/util/unicode.cc
2012-09-10 05:08:47 +00:00
)
2012-09-16 16:52:02 +00:00
target_link_libraries(pdf2htmlEX ${PDF2HTMLEX_LIBS})
2012-08-14 05:56:41 +00:00
2012-08-15 03:15:33 +00:00
install (TARGETS pdf2htmlEX DESTINATION bin)
2012-09-22 14:47:44 +00:00
file (GLOB datafiles
share/base.css
share/jquery.js
share/pdf2htmlEX.js
share/manifest
)
2012-08-17 10:13:21 +00:00
install (FILES ${datafiles} DESTINATION share/pdf2htmlEX)
2012-09-01 17:22:40 +00:00
install (FILES pdf2htmlEX.1 DESTINATION share/man/man1)