diff --git a/docs/maintainers/vcpkg_configure_cmake.md b/docs/maintainers/vcpkg_configure_cmake.md index 93f6617673..200d358ae2 100644 --- a/docs/maintainers/vcpkg_configure_cmake.md +++ b/docs/maintainers/vcpkg_configure_cmake.md @@ -21,6 +21,11 @@ Specifies the directory containing the `CMakeLists.txt`. By convention, this is ### PREFER_NINJA Indicates that, when available, Vcpkg should use Ninja to perform the build. This should be specified unless the port is known to not work under Ninja. +### DISABLE_PARALLEL_CONFIGURE +Disables running the CMake configure step in parallel. + +This is needed for libraries which write back into their source directory during configure. + ### GENERATOR Specifies the precise generator to use. diff --git a/ports/jbig2dec/CMakeLists.txt b/ports/jbig2dec/CMakeLists.txt new file mode 100644 index 0000000000..a2a8376de3 --- /dev/null +++ b/ports/jbig2dec/CMakeLists.txt @@ -0,0 +1,25 @@ +cmake_minimum_required(VERSION 3.9) +project(jbig2dec C) + +set(CMAKE_DEBUG_POSTFIX d) + +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + +file(GLOB SOURCES jbig2*.c) +list(REMOVE_ITEM SOURCES + "${CMAKE_CURRENT_SOURCE_DIR}/jbig2dec.c" + "${CMAKE_CURRENT_SOURCE_DIR}/jbig2_image_png.c" + "${CMAKE_CURRENT_SOURCE_DIR}/jbig2_image_pbm.c" +) + +add_library(jbig2dec ${SOURCES}) + +install(TARGETS jbig2dec + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) + +if(NOT DISABLE_INSTALL_HEADERS) + install(FILES jbig2.h DESTINATION include) +endif() diff --git a/ports/jbig2dec/CONTROL b/ports/jbig2dec/CONTROL new file mode 100644 index 0000000000..0ff000f442 --- /dev/null +++ b/ports/jbig2dec/CONTROL @@ -0,0 +1,4 @@ +Source: jbig2dec +Version: 0.13 +Description: a decoder library and example utility implementing the JBIG2 bi-level image compression spec. Also known as ITU T.88 and ISO IEC 14492, and included by reference in Adobe's PDF version 1.4 and later. + diff --git a/ports/jbig2dec/portfile.cmake b/ports/jbig2dec/portfile.cmake new file mode 100644 index 0000000000..90e56bd9b2 --- /dev/null +++ b/ports/jbig2dec/portfile.cmake @@ -0,0 +1,23 @@ +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO ArtifexSoftware/jbig2dec + REF 0.13 + SHA512 11d1209810d6c80a095ec59d6af44010d4664f4ba744c0c14bdad9564359cf31dd0095b072fa63de381f2de57116e523883aa8843cc8d9baa2c3a8b9b1fc3527 + HEAD_REF master +) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS_DEBUG + -DDISABLE_INSTALL_HEADERS=1 +) + +vcpkg_install_cmake() + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/jbig2dec RENAME copyright) diff --git a/ports/libmupdf/CMakeLists.txt b/ports/libmupdf/CMakeLists.txt index 827f2de5d0..76ed52c5a7 100644 --- a/ports/libmupdf/CMakeLists.txt +++ b/ports/libmupdf/CMakeLists.txt @@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.9) project(libmupdf C) set(CMAKE_DEBUG_POSTFIX d) +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/include/mupdf/pdf/name-table.h") execute_process( @@ -14,26 +15,30 @@ 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 REQUIRED) +find_library(JBIG2DEC_LIB NAMES jbig2decd jbig2dec) -file(GLOB_RECURSE SOURCES "source/*.c") +file(GLOB_RECURSE SOURCES "source/*.c" "generated/*.c") list(FILTER SOURCES EXCLUDE REGEX "source/tools/[a-z]*\\.c$") add_library(libmupdf ${SOURCES}) -target_compile_definitions(libmupdf PRIVATE -DZ_SOLO) -target_include_directories(libmupdf PRIVATE - include - generated - thirdparty/jbig2dec - thirdparty/libjpeg - thirdparty/mujs - thirdparty/openjpeg/src/lib/openjp2 - ${JPEG_INCLUDE_DIR} - ${HARFBUZZ_INCLUDE} +target_compile_definitions(libmupdf PRIVATE -DSHARE_JPEG -DFZ_ENABLE_JS=0 -DNO_ICC) +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 @@ -41,3 +46,8 @@ install(TARGETS libmupdf 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() \ No newline at end of file diff --git a/ports/libmupdf/CONTROL b/ports/libmupdf/CONTROL index ed61402d7d..36ae69488d 100644 --- a/ports/libmupdf/CONTROL +++ b/ports/libmupdf/CONTROL @@ -1,4 +1,4 @@ Source: libmupdf -Version: 1.11-1 -Build-Depends: freetype, libjpeg-turbo, harfbuzz, zlib, curl, glfw3 +Version: 1.12.0 +Build-Depends: freetype, libjpeg-turbo, harfbuzz, zlib, curl, glfw3, openjpeg, jbig2dec Description: a lightweight PDF, XPS, and E-book library diff --git a/ports/libmupdf/portfile.cmake b/ports/libmupdf/portfile.cmake index df4997a702..b3618ea80b 100644 --- a/ports/libmupdf/portfile.cmake +++ b/ports/libmupdf/portfile.cmake @@ -1,21 +1,18 @@ -if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") - message(STATUS "Warning: Dynamic building not supported. Building static.") - set(VCPKG_LIBRARY_LINKAGE static) -endif() - include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/mupdf-1.11-source) -vcpkg_download_distfile(ARCHIVE - URLS "https://mupdf.com/downloads/mupdf-1.11-source.tar.gz" - FILENAME "mupdf.tar.gz" - SHA512 501670f540e298a8126806ebbd9db8b29866f663b7bbf26c9ade1933e42f0c00ad410b9d93f3ddbfb3e45c38722869095de28d832fe3fb3703c55cc9a01dbf63 + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO ArtifexSoftware/mupdf + REF 1.12.0 + SHA512 893a1958e34355acf73624e9c47f4a97adf13d5fe33604ac384df9ac22a56ef7c18e02143eaffc3c2a08f460e4c71fee00c094b6d6696f8446977bb18f65e3da + HEAD_REF master ) -vcpkg_extract_source_archive(${ARCHIVE}) file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) vcpkg_configure_cmake( SOURCE_PATH "${SOURCE_PATH}" + DISABLE_PARALLEL_CONFIGURE PREFER_NINJA ) @@ -27,4 +24,4 @@ vcpkg_copy_pdbs() #copyright file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) -file(RENAME ${CURRENT_PACKAGES_DIR}/share/${PORT}/COPYING ${CURRENT_PACKAGES_DIR}/share/${PORT}/COPYRIGHT) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/${PORT}/COPYING ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright) diff --git a/scripts/cmake/vcpkg_configure_cmake.cmake b/scripts/cmake/vcpkg_configure_cmake.cmake index bc1d73f07c..726aab2ecf 100644 --- a/scripts/cmake/vcpkg_configure_cmake.cmake +++ b/scripts/cmake/vcpkg_configure_cmake.cmake @@ -21,6 +21,11 @@ ## ### PREFER_NINJA ## Indicates that, when available, Vcpkg should use Ninja to perform the build. This should be specified unless the port is known to not work under Ninja. ## +## ### DISABLE_PARALLEL_CONFIGURE +## Disables running the CMake configure step in parallel. +## +## This is needed for libraries which write back into their source directory during configure. +## ## ### GENERATOR ## Specifies the precise generator to use. ## @@ -45,7 +50,7 @@ ## * [poco](https://github.com/Microsoft/vcpkg/blob/master/ports/poco/portfile.cmake) ## * [opencv](https://github.com/Microsoft/vcpkg/blob/master/ports/opencv/portfile.cmake) function(vcpkg_configure_cmake) - cmake_parse_arguments(_csc "PREFER_NINJA" "SOURCE_PATH;GENERATOR" "OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE" ${ARGN}) + cmake_parse_arguments(_csc "PREFER_NINJA;DISABLE_PARALLEL_CONFIGURE" "SOURCE_PATH;GENERATOR" "OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE" ${ARGN}) if(NOT VCPKG_PLATFORM_TOOLSET) message(FATAL_ERROR "Vcpkg has been updated with VS2017 support, however you need to rebuild vcpkg.exe by re-running bootstrap-vcpkg.bat\n") @@ -209,7 +214,7 @@ function(vcpkg_configure_cmake) -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=${CURRENT_PACKAGES_DIR}/debug) - if(NINJA_CAN_BE_USED AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") + if(NINJA_CAN_BE_USED AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows" AND NOT _csc_DISABLE_PARALLEL_CONFIGURE) vcpkg_find_acquire_program(NINJA) get_filename_component(NINJA_PATH ${NINJA} DIRECTORY)