1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-07-03 08:38:39 +00:00
pdf2htmlEX/CMakeLists.txt

123 lines
4.1 KiB
CMake
Raw Normal View History

2012-08-04 18:03:53 +00:00
project(pdftohtmlEX)
cmake_minimum_required(VERSION 2.6.0 FATAL_ERROR)
2012-09-10 05:03:25 +00:00
include_directories(${CMAKE_SOURCE_DIR}/src/include)
2012-09-05 09:44:25 +00:00
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-05 10:43:37 +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-05 09:44:25 +00:00
else()
find_path(FF_INCLUDE_PATH fontforge/fontforge.h)
if(FF_INCLUDE_PATH)
message("Found fontforge.h: ${FF_INCLUDE_PATH}/fontforge/fontforge.h")
include_directories(${FF_INCLUDE_PATH}/fontforge)
# MacOSX gettext is in /opt/local/include - strange
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
find_path(GETTEXT_INCLUDE_PATH libintl.h)
if(GETTEXT_INCLUDE_PATH)
include_directories(${GETTEXT_INCLUDE_PATH})
else()
# disable i18n if there is no gettext
set(NO_GETTEXT "YesPlease")
endif()
endif()
else()
message(FATAL_ERROR "Error: cannot locate fontforge.h")
endif()
2012-09-05 09:44:25 +00:00
find_path(FF_CONFIG_INCLUDE_PATH fontforge/config.h)
if(FF_CONFIG_INCLUDE_PATH)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -include ${FF_INCLUDE_PATH}/fontforge/config.h")
endif()
2012-09-10 17:53:33 +00:00
foreach(FF_LIB_NAME
${CMAKE_IMPORT_LIBRARY_PREFIX}fontforge${CMAKE_IMPORT_LIBRARY_SUFFIX}
${CMAKE_SHARED_LIBRARY_PREFIX}fontforge${CMAKE_SHARED_LIBRARY_SUFFIX}
${CMAKE_STATIC_LIBRARY_PREFIX}fontforge${CMAKE_STATIC_LIBRARY_SUFFIX}
)
find_library(FF_LIB ${FF_LIB_NAME})
if(FF_LIB)
message("Found ${FF_LIB_NAME}: ${FF_LIB}")
set(FONTFORGE_LIBRARIES ${FF_LIB})
break()
endif()
endforeach()
2012-09-10 15:47:24 +00:00
if(NOT FF_LIB)
set(FONTFORGE_LIBRARIES fontforge)
message("Error: cannot locate ${FF_LIB_NAME}")
endif()
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-05 10:43:37 +00:00
endif()
2012-08-04 18:03:53 +00:00
2012-09-06 09:38:52 +00:00
set(PDF2HTMLEX_VERSION "0.3")
2012-08-27 17:24:01 +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
2012-09-05 09:44:25 +00:00
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wunused-function")
2012-09-12 17:31:19 +00:00
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ggdb")
2012-08-04 18:03:53 +00:00
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wunused-function")
# 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-09-12 17:31:19 +00:00
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb")
2012-08-04 18:03:53 +00:00
2012-09-10 16:45:00 +00:00
# CYGWIN bug
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-09-10 05:03:25 +00:00
configure_file (${CMAKE_SOURCE_DIR}/src/include/pdf2htmlEX-config.h.in ${CMAKE_SOURCE_DIR}/src/include/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
2012-08-14 05:56:41 +00:00
add_executable(pdf2htmlEX
src/pdf2htmlEX.cc
2012-09-10 05:08:47 +00:00
src/include/HTMLRenderer.h
2012-08-14 08:23:15 +00:00
src/HTMLRenderer/general.cc
2012-08-14 06:35:55 +00:00
src/HTMLRenderer/state.cc
src/HTMLRenderer/install.cc
src/HTMLRenderer/export.cc
2012-08-14 08:23:15 +00:00
src/HTMLRenderer/text.cc
src/HTMLRenderer/image.cc
2012-09-10 05:08:47 +00:00
src/include/namespace.h
2012-09-04 15:33:15 +00:00
src/HTMLRenderer/LineBuffer.cc
2012-09-10 05:08:47 +00:00
src/include/ff.h
src/ff.c
src/include/BackgroundRenderer.h
2012-08-14 05:56:41 +00:00
src/BackgroundRenderer.cc
2012-09-10 05:08:47 +00:00
src/include/FontPreprocessor.h
2012-09-06 16:58:23 +00:00
src/FontPreprocessor.cc
2012-09-10 05:08:47 +00:00
src/include/util.h
2012-09-09 17:18:09 +00:00
src/util.cc
2012-09-10 09:01:15 +00:00
src/include/ArgParser.h
src/ArgParser.cc
2012-09-10 05:08:47 +00:00
src/include/pdf2htmlEX-config.h
)
2012-08-14 05:56:41 +00:00
2012-09-10 15:47:24 +00:00
target_link_libraries(pdf2htmlEX ${POPPLER_LIBRARIES} ${FONTFORGE_LIBRARIES} ${PYTHON_LIBRARIES})
2012-08-14 05:56:41 +00:00
2012-08-15 03:15:33 +00:00
install (TARGETS pdf2htmlEX DESTINATION bin)
2012-08-17 10:13:21 +00:00
file (GLOB datafiles share/*)
install (FILES ${datafiles} DESTINATION share/pdf2htmlEX)
2012-09-01 17:22:40 +00:00
install (FILES pdf2htmlEX.1 DESTINATION share/man/man1)