[tiff] Disable non-essential components. Fixes #259.

This commit is contained in:
Robert Schumacher 2016-11-10 17:52:19 -08:00
parent 7220f54e30
commit bb0fc030d5
2 changed files with 56 additions and 15 deletions

View File

@ -0,0 +1,43 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1ee6fd4..439e26a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -122,6 +122,11 @@ set(EXTRA_DIST
nmake.opt
libtiff-4.pc.in)
+option(BUILD_TOOLS "Build tool executables" ON)
+option(BUILD_DOCS "Build docs" ON)
+option(BUILD_CONTRIB "Build contributed executables" ON)
+option(BUILD_TESTS "Build tests" ON)
+
# These are annoyingly verbose, produce false positives or don't work
# nicely with all supported compiler versions, so are disabled unless
# explicitly enabled.
@@ -719,12 +724,20 @@ endif()
# Process subdirectories
add_subdirectory(port)
add_subdirectory(libtiff)
-add_subdirectory(tools)
-add_subdirectory(test)
-add_subdirectory(contrib)
-add_subdirectory(build)
-add_subdirectory(man)
-add_subdirectory(html)
+if(BUILD_TOOLS)
+ add_subdirectory(tools)
+endif()
+if(BUILD_TESTS)
+ add_subdirectory(test)
+endif()
+if(BUILD_CONTRIB)
+ add_subdirectory(contrib)
+endif()
+if(BUILD_DOCS)
+ add_subdirectory(build)
+ add_subdirectory(man)
+ add_subdirectory(html)
+endif()
#message(STATUS "EXTRA_DIST: ${EXTRA_DIST}")

View File

@ -7,9 +7,19 @@ vcpkg_download_distfile(ARCHIVE
)
vcpkg_extract_source_archive(${ARCHIVE})
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES add-component-options.patch
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS -Dcxx=OFF
OPTIONS
-Dcxx=OFF
-DBUILD_TOOLS=OFF
-DBUILD_DOCS=OFF
-DBUILD_CONTRIB=OFF
-DBUILD_TESTS=OFF
)
vcpkg_install_cmake()
@ -19,22 +29,10 @@ file(REMOVE_RECURSE
${CURRENT_PACKAGES_DIR}/debug/share
${CURRENT_PACKAGES_DIR}/share
)
file(COPY
file(INSTALL
${SOURCE_PATH}/COPYRIGHT
DESTINATION ${CURRENT_PACKAGES_DIR}/share/tiff
RENAME copyright
)
file(RENAME
${CURRENT_PACKAGES_DIR}/share/tiff/COPYRIGHT
${CURRENT_PACKAGES_DIR}/share/tiff/c2
)
file(RENAME
${CURRENT_PACKAGES_DIR}/share/tiff/c2
${CURRENT_PACKAGES_DIR}/share/tiff/copyright
)
file(GLOB EXES ${CURRENT_PACKAGES_DIR}/bin/*.exe ${CURRENT_PACKAGES_DIR}/debug/bin/*.exe)
file(REMOVE ${EXES})
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
endif()
vcpkg_copy_pdbs()