vcpkg/ports/libmupdf/CMakeLists.txt
simon987 6cfa934411
[libmupdf] Update to 1.19.0-rc2 (#20328)
* Update libmupdf to 1.19.0-rc2

* Add results of ./vcpkg x-add-version --all

* minimize patch

* update version

* Use 4 spaces rather than 2

Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>

* Remove vcpkg-cmake-config dependency

* Run x-add-version

Co-authored-by: NancyLi1013 <lirui09@beyondsoft.com>
Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>
2021-11-09 13:42:04 -08:00

67 lines
1.9 KiB
CMake

cmake_minimum_required(VERSION 3.9)
project(libmupdf C)
set(CMAKE_DEBUG_POSTFIX d)
if(WIN32)
execute_process(
COMMAND "cmd.exe" "/c" "platform\\win32\\generate.bat"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
)
else()
find_program(MAKE_EXE NAMES make REQUIRED)
execute_process(
COMMAND ${MAKE_EXE} "generate"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
)
endif()
find_package(freetype NO_MODULE REQUIRED)
find_package(JPEG REQUIRED)
find_path(HARFBUZZ_INCLUDE hb.h PATH_SUFFIXES harfbuzz)
find_library(HARFBUZZ_LIBRARIES harfbuzz)
find_package(ZLIB REQUIRED)
find_package(OpenJPEG CONFIG REQUIRED)
find_library(JBIG2DEC_LIB NAMES jbig2decd jbig2dec)
file(GLOB_RECURSE SOURCES "source/*.c" "generated/*.c")
list(FILTER SOURCES EXCLUDE REGEX "source/tools/[a-z]*\\.c$")
list(FILTER SOURCES EXCLUDE REGEX "source/tests/.*.c$")
list(FILTER SOURCES EXCLUDE REGEX "source/fitz/output-docx.c")
add_library(libmupdf ${SOURCES})
if(WIN32)
target_compile_definitions(libmupdf PRIVATE -DSHARE_JPEG -DFZ_ENABLE_JS=0 -DFZ_ENABLE_ICC=0 -DMEMENTO_MUPDF_HACKS -DFZ_ENABLE_DOCX_OUTPUT=0 -DFZ_ENABLE_ODT_OUTPUT=0)
else()
target_compile_definitions(libmupdf PRIVATE -DHAVE_PTHREAD=1 -DSHARE_JPEG -DFZ_ENABLE_JS=0 -DFZ_ENABLE_ICC=0 -DMEMENTO_MUPDF_HACKS -DFZ_ENABLE_DOCX_OUTPUT=0 -DFZ_ENABLE_ODT_OUTPUT=0)
endif()
target_include_directories(libmupdf
PUBLIC
include
PRIVATE
generated
${JPEG_INCLUDE_DIR}
${HARFBUZZ_INCLUDE}
)
target_link_libraries(libmupdf PRIVATE
openjp2
freetype
${JPEG_LIBRARIES}
${HARFBUZZ_LIBRARIES}
${JBIG2DEC_LIB}
ZLIB::ZLIB
)
install(TARGETS libmupdf
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
if(BUILD_EXAMPLES)
add_executable(mu-office-test source/tests/mu-office-test.c)
target_link_libraries(mu-office-test PRIVATE libmupdf)
endif()