From 85d5e81ea364394cb5e224abbddb55124e21fb9e Mon Sep 17 00:00:00 2001 From: Leander Schulten Date: Tue, 9 Nov 2021 11:14:28 +0100 Subject: [PATCH] [dcmtk] no absolute paths --- ports/dcmtk/portfile.cmake | 20 ++++++++++++-------- ports/dcmtk/usage | 18 ++++++++++++++++++ ports/dcmtk/vcpkg.json | 14 ++++++++++++-- versions/baseline.json | 2 +- versions/d-/dcmtk.json | 5 +++++ 5 files changed, 48 insertions(+), 11 deletions(-) create mode 100644 ports/dcmtk/usage diff --git a/ports/dcmtk/portfile.cmake b/ports/dcmtk/portfile.cmake index a9b60e95a92de0..7e792dfed6126b 100644 --- a/ports/dcmtk/portfile.cmake +++ b/ports/dcmtk/portfile.cmake @@ -9,9 +9,8 @@ vcpkg_from_github( PATCHES ${CMAKE_CURRENT_LIST_DIR}/dcmtk.patch ) -vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} - PREFER_NINJA +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" OPTIONS -DDCMTK_WITH_DOXYGEN=OFF -DDCMTK_WITH_ZLIB=OFF @@ -34,13 +33,18 @@ vcpkg_configure_cmake( -DINSTALL_OTHER=OFF ) -vcpkg_install_cmake() +vcpkg_cmake_install() vcpkg_copy_pdbs() -vcpkg_fixup_cmake_targets() +vcpkg_cmake_config_fixup() -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/dcmtk/config/osconfig.h" "#define DCMTK_PREFIX \"${CURRENT_PACKAGES_DIR}\"" "") +vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/dcmtk/config/osconfig.h" "#define DCM_DICT_DEFAULT_PATH \"${CURRENT_PACKAGES_DIR}/share/dcmtk/dicom.dic:${CURRENT_PACKAGES_DIR}/share/dcmtk/private.dic\"" "") +vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/dcmtk/config/osconfig.h" "#define DEFAULT_CONFIGURATION_DIR \"${CURRENT_PACKAGES_DIR}/etc/dcmtk/\"" "") +vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/dcmtk/config/osconfig.h" "#define DEFAULT_SUPPORT_DATA_DIR \"${CURRENT_PACKAGES_DIR}/share/dcmtk/\"" "") # Handle copyright -file(INSTALL ${SOURCE_PATH}/COPYRIGHT DESTINATION ${CURRENT_PACKAGES_DIR}/share/dcmtk RENAME copyright) +file(INSTALL "${SOURCE_PATH}/COPYRIGHT" DESTINATION "${CURRENT_PACKAGES_DIR}/share/dcmtk" RENAME copyright) diff --git a/ports/dcmtk/usage b/ports/dcmtk/usage new file mode 100644 index 00000000000000..7702d1c408198f --- /dev/null +++ b/ports/dcmtk/usage @@ -0,0 +1,18 @@ +The package dcmtk provides CMake targets: + + find_package(DCMTK CONFIG REQUIRED) + # Note: 23 target(s) were omitted. + target_link_libraries(main PRIVATE cmr i2d ijg8 dcmfg) + +Add the following cmake code to your CMakeLists.txt to create definitions for DCMTK + if ("${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" STREQUAL "/") + message(WARNING "No vcpkg install dir found, DCMTK definitions are not set") + else() + target_compile_definitions(main + PUBLIC + "DCMTK_PREFIX=${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" + "DCM_DICT_DEFAULT_PATH=${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/dcmtk/dicom.dic:${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/dcmtk/private.dic" + "DEFAULT_CONFIGURATION_DIR=${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/etc/dcmtk/" + "DEFAULT_SUPPORT_DATA_DIR=${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/dcmtk/" + ) + endif() diff --git a/ports/dcmtk/vcpkg.json b/ports/dcmtk/vcpkg.json index a75b5a7bd4bf44..10616156b799d6 100644 --- a/ports/dcmtk/vcpkg.json +++ b/ports/dcmtk/vcpkg.json @@ -1,6 +1,16 @@ { "name": "dcmtk", "version-string": "3.6.6", - "port-version": 1, - "description": "This DICOM ToolKit (DCMTK) package consists of source code, documentation and installation instructions for a set of software libraries and applications implementing part of the DICOM/MEDICOM Standard." + "port-version": 2, + "description": "This DICOM ToolKit (DCMTK) package consists of source code, documentation and installation instructions for a set of software libraries and applications implementing part of the DICOM/MEDICOM Standard.", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] } diff --git a/versions/baseline.json b/versions/baseline.json index e43589c8da49f1..907e6fb3e945b9 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -1782,7 +1782,7 @@ }, "dcmtk": { "baseline": "3.6.6", - "port-version": 1 + "port-version": 2 }, "debug-assert": { "baseline": "1.3.3", diff --git a/versions/d-/dcmtk.json b/versions/d-/dcmtk.json index cf145878ee6b83..98820308ec2379 100644 --- a/versions/d-/dcmtk.json +++ b/versions/d-/dcmtk.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "24716759e4aa3fb67b014163ae3be95ad88120b6", + "version-string": "3.6.6", + "port-version": 2 + }, { "git-tree": "6b830172b906fea2468685175d0ecca5f374217c", "version-string": "3.6.6",