vcpkg/ports/itk/portfile.cmake
Niels Dekker d4fbdf21c4 [itk] Support legacy user code by default (#7241)
No longer specify `ITK_LEGACY_REMOVE` and `ITK_FUTURE_LEGACY_REMOVE`
options for `vcpkg_configure_cmake`. By default, these two flags are
`OFF`, for ITK 5.0.0:
https://github.com/InsightSoftwareConsortium/ITK/blob/v5.0.0/CMakeLists.txt#L261

This commit will allow legacy ITK user code to build with vcpkg, and it
will ease adding vcpkg support to https://github.com/SuperElastix/elastix

Dženan Zukić @dzenanz suggested this change:
https://discourse.itk.org/t/how-to-avoid-rebuilding-itk-by-azure-ci-at-the-github-of-another-project-elastix/2002/7

CONTROL version bumped as requested by Phil Christensen @Rastaban
2019-08-07 12:30:42 -04:00

76 lines
2.7 KiB
CMake

include(vcpkg_common_functions)
string(LENGTH "${CURRENT_BUILDTREES_DIR}" BUILDTREES_PATH_LENGTH)
if(BUILDTREES_PATH_LENGTH GREATER 37 AND CMAKE_HOST_WIN32)
message(WARNING "${PORT}'s buildsystem uses very long paths and may fail on your system.\n"
"We recommend moving vcpkg to a short path such as 'C:\\src\\vcpkg' or using the subst command."
)
endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO InsightSoftwareConsortium/ITK
REF v5.0.0
SHA512 7eecd62ab3124147f0abce482699dfdc43610703959d4a3f667c8ce12a6ecacf836a863d146f3cc7d5220b4aa05adf70a0d4dc6fa8e87bac215565badc96acff
HEAD_REF master
PATCHES
fix_openjpeg_search.patch
fix_libminc_config_path.patch
)
if ("vtk" IN_LIST FEATURES)
set(ITKVtkGlue ON)
else()
set(ITKVtkGlue OFF)
endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
DISABLE_PARALLEL_CONFIGURE
OPTIONS
-DBUILD_TESTING=OFF
-DBUILD_EXAMPLES=OFF
-DDO_NOT_INSTALL_ITK_TEST_DRIVER=ON
-DITK_INSTALL_DATA_DIR=share/itk/data
-DITK_INSTALL_DOC_DIR=share/itk/doc
-DITK_INSTALL_PACKAGE_DIR=share/itk
-DITK_USE_64BITS_IDS=ON
-DITK_USE_CONCEPT_CHECKING=ON
#-DITK_USE_SYSTEM_LIBRARIES=ON # enables USE_SYSTEM for all third party libraries, some of which do not have vcpkg ports such as CastXML, SWIG, MINC etc
-DITK_USE_SYSTEM_DOUBLECONVERSION=ON
-DITK_USE_SYSTEM_EXPAT=ON
-DITK_USE_SYSTEM_JPEG=ON
-DITK_USE_SYSTEM_PNG=ON
-DITK_USE_SYSTEM_TIFF=ON
-DITK_USE_SYSTEM_ZLIB=ON
-DITK_USE_SYSTEM_EIGEN=ON
# This should be turned on some day, however for now ITK does download specific versions so it shouldn't spontaneously break
-DITK_FORBID_DOWNLOADS=OFF
-DITK_SKIP_PATH_LENGTH_CHECKS=ON
# I haven't tried Python wrapping in vcpkg
#-DITK_WRAP_PYTHON=ON
#-DITK_PYTHON_VERSION=3
-DITK_USE_SYSTEM_HDF5=ON # HDF5 was problematic in the past
-DModule_ITKVtkGlue=${ITKVtkGlue} # optional feature
-DModule_IOSTL=ON # example how to turn on a non-default module
-DModule_MorphologicalContourInterpolation=ON # example how to turn on a remote module
-DModule_RLEImage=ON # example how to turn on a remote module
-DGDCM_USE_SYSTEM_OPENJPEG=ON #Use port openjpeg instead of own third-party
${ADDITIONAL_OPTIONS}
)
vcpkg_install_cmake()
vcpkg_copy_pdbs()
vcpkg_fixup_cmake_targets()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)