aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/minc
diff options
context:
space:
mode:
authorEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
committerEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
commit54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch)
treed915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/minc
move to own git serverHEADmaster
Diffstat (limited to 'vcpkg/ports/minc')
-rw-r--r--vcpkg/ports/minc/avoid-try-run.diff17
-rw-r--r--vcpkg/ports/minc/build.patch43
-rw-r--r--vcpkg/ports/minc/cmake-config.patch62
-rw-r--r--vcpkg/ports/minc/portfile.cmake42
-rw-r--r--vcpkg/ports/minc/usage12
-rw-r--r--vcpkg/ports/minc/vcpkg.json34
6 files changed, 210 insertions, 0 deletions
diff --git a/vcpkg/ports/minc/avoid-try-run.diff b/vcpkg/ports/minc/avoid-try-run.diff
new file mode 100644
index 0000000..5353a6c
--- /dev/null
+++ b/vcpkg/ports/minc/avoid-try-run.diff
@@ -0,0 +1,17 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index dcd594b..a357b90 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -174,6 +174,12 @@ ELSE(HAVE_CLOCK_GETTIME_RT)
+ CHECK_SYMBOL_EXISTS(clock_gettime "time.h" HAVE_CLOCK_GETTIME_SYMBOL)
+ # then check that it's available
+ IF(HAVE_CLOCK_GETTIME_SYMBOL)
++ if(CMAKE_CROSSCOMPILING)
++ # Seed try_run results. Override in triplet if needed.
++ set(HAVE_CLOCK_GETTIME_RUN 0 CACHE STRING "")
++ set(CMAKE_TRY_COMPILE_TARGET_TYPE EXECUTABLE)
++ try_compile(HAVE_CLOCK_GETTIME_COMP SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/check_clock_gettime.c)
++ endif()
+ TRY_RUN(HAVE_CLOCK_GETTIME_RUN HAVE_CLOCK_GETTIME_COMP
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}/check_clock_gettime.c
diff --git a/vcpkg/ports/minc/build.patch b/vcpkg/ports/minc/build.patch
new file mode 100644
index 0000000..40f4df6
--- /dev/null
+++ b/vcpkg/ports/minc/build.patch
@@ -0,0 +1,43 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index caf681a..58b7648 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -3,6 +3,8 @@
+ # Andrew Janke - a.janke@gmail.com
+ # Vladimir S. FONOV - vladimir.fonov@gmail.com
+
++CMAKE_MINIMUM_REQUIRED(VERSION 3.6...3.10)
++
+ PROJECT(LIBMINC)
+
+ SET(LIBMINC_PACKAGE_VERSION_MAJOR 2)
+@@ -22,8 +24,6 @@ INCLUDE(CTest)
+
+ ENABLE_TESTING()
+
+-CMAKE_MINIMUM_REQUIRED(VERSION 3.6)
+-
+ IF( POLICY CMP0063 )
+ CMAKE_POLICY(SET CMP0063 NEW)
+ ENDIF()
+@@ -445,6 +445,11 @@ IF(UNIX)
+ SET(LIBMINC_STATIC_LIBRARIES_CONFIG ${LIBMINC_STATIC_LIBRARIES_CONFIG} m dl ${RT_LIBRARY_NAME})
+ ENDIF(UNIX)
+
++if(WIN32)
++ add_definitions(-DMNCAPI=)
++ list(APPEND LIBMINC_LIBRARIES_CONFIG ws2_32)
++endif()
++
+ SET(minc_LIB_SRCS ${minc2_LIB_SRCS} ${minc_common_SRCS})
+ SET(minc_HEADERS ${minc2_HEADERS} ${minc_common_HEADERS})
+
+@@ -513,7 +518,7 @@ IF( LIBMINC_INSTALL_LIB_DIR )
+ ${LIBMINC_EXPORTED_TARGETS}
+ LIBRARY DESTINATION ${LIBMINC_INSTALL_LIB_DIR} COMPONENT libraries
+ ARCHIVE DESTINATION ${LIBMINC_INSTALL_LIB_DIR} COMPONENT libraries
+- RUNTIME DESTINATION ${LIBMINC_INSTALL_LIB_DIR} COMPONENT libraries
++ RUNTIME DESTINATION ${LIBMINC_INSTALL_BIN_DIR} COMPONENT libraries
+ )
+ ENDIF( LIBMINC_INSTALL_LIB_DIR )
+
diff --git a/vcpkg/ports/minc/cmake-config.patch b/vcpkg/ports/minc/cmake-config.patch
new file mode 100644
index 0000000..6588995
--- /dev/null
+++ b/vcpkg/ports/minc/cmake-config.patch
@@ -0,0 +1,62 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index a80e172..dcd594b 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -63,13 +63,19 @@ IF(NOT LIBMINC_EXTERNALLY_CONFIGURED)
+ SET (LIBMINC_INSTALL_DATA_DIR share)
+
+ IF(LIBMINC_MINC1_SUPPORT)
+- FIND_PACKAGE(NETCDF REQUIRED)
++ find_package(netCDF CONFIG REQUIRED)
++ set(NETCDF_LIBRARY netCDF::netcdf)
+ ENDIF(LIBMINC_MINC1_SUPPORT)
+
+ # external packages
+ FIND_PACKAGE(ZLIB REQUIRED)
+- SET(HDF5_NO_FIND_PACKAGE_CONFIG_FILE ON)
+- FIND_PACKAGE(HDF5 REQUIRED COMPONENTS C )
++ set(ZLIB_LIBRARY ZLIB::ZLIB)
++ find_package(hdf5 CONFIG REQUIRED)
++ if (TARGET hdf5::hdf5-shared)
++ SET(HDF5_LIBRARIES hdf5::hdf5-shared)
++ elseif (TARGET hdf5::hdf5-static)
++ SET(HDF5_LIBRARIES hdf5::hdf5-static)
++ endif()
+
+ IF(LIBMINC_USE_NIFTI)
+ IF (LIBMINC_USE_SYSTEM_NIFTI)
+@@ -533,7 +539,7 @@ ENDIF()
+
+
+ # config for install dir
+-SET(LIBMINC_USE_FILE_CONFIG "\${LIBMINC_INSTALL_PREFIX}/lib/cmake/Use${LIBMINC_EXTERNAL_LIB_PREFIX}LIBMINC.cmake" )
++SET(LIBMINC_USE_FILE_CONFIG "\${CMAKE_CURRENT_LIST_DIR}/Use${LIBMINC_EXTERNAL_LIB_PREFIX}LIBMINC.cmake" )
+ SET(LIBMINC_INCLUDE_DIRS_CONFIG "\${LIBMINC_INSTALL_PREFIX}/include" )
+ SET(LIBMINC_LIBRARY_DIRS_CONFIG "\${LIBMINC_INSTALL_PREFIX}/lib" )
+ SET(LIBMINC_STATIC_LIBRARIES_CONFIG "" )
+diff --git a/LIBMINCConfig.cmake.in b/LIBMINCConfig.cmake.in
+index f8f7eb6..131f54f 100644
+--- a/LIBMINCConfig.cmake.in
++++ b/LIBMINCConfig.cmake.in
+@@ -1,5 +1,11 @@
+ # LIBMINC CMake configuration file
+
++include(CMakeFindDependencyMacro)
++find_dependency(ZLIB)
++find_dependency(hdf5 CONFIG)
++if("@LIBMINC_MINC1_SUPPORT@")
++ find_dependency(netCDF CONFIG)
++endif()
+
+ get_filename_component(LIBMINC_INSTALL_PREFIX "${CMAKE_CURRENT_LIST_DIR}/../../" ABSOLUTE)
+ get_filename_component(LIBMINC_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH )
+@@ -21,7 +27,8 @@ set(LIBMINC_NIFTI_SUPPORT @LIBMINC_NIFTI_SUPPORT@)
+ #set(NIFTI_LIBRARIES "@NIFTI_LIBRARIES@")
+
+ set(LIBMINC_INCLUDE_DIRS "@LIBMINC_INCLUDE_DIRS_CONFIG@") # ${LIBMINC_INSTALL_PREFIX}/include
+-set(LIBMINC_LIBRARY_DIRS "@LIBMINC_LIBRARY_DIRS_CONFIG@") # ${LIBMINC_INSTALL_PREFIX}/lib
++find_library(Z_VCPKG_LIBMINC_LIBRARY NAMES minc2 REQUIRED) # pick from vcpkg search paths
++get_filename_component(LIBMINC_LIBRARY_DIRS "${Z_VCPKG_LIBMINC_LIBRARY}" PATH)
+ set(LIBMINC_USE_FILE "@LIBMINC_USE_FILE_CONFIG@") # ${LIBMINC_INSTALL_PREFIX}/lib/UseLIBMINC.cmake
+
+ set(LIBMINC_LIBRARIES "@LIBMINC_LIBRARIES_CONFIG@")
diff --git a/vcpkg/ports/minc/portfile.cmake b/vcpkg/ports/minc/portfile.cmake
new file mode 100644
index 0000000..2606114
--- /dev/null
+++ b/vcpkg/ports/minc/portfile.cmake
@@ -0,0 +1,42 @@
+string(REGEX REPLACE "(release-[0-9][.][0-9])[.]([0-9])\$" "\\1.0\\2" git_tag "release-${VERSION}")
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO BIC-MNI/libminc
+ REF ${git_tag}
+ SHA512 78d5c14b82c8da5de7651de22fe47ae934925b27a626b8685b19554b7a35240eb5ab6d4da6232ce046e9e0f25619bbfae1d7c0fc34994d935986dc151d7b93a0
+ HEAD_REF master
+ PATCHES
+ avoid-try-run.diff
+ build.patch
+ cmake-config.patch
+)
+
+vcpkg_check_features(
+ OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ FEATURES
+ "minc1" LIBMINC_MINC1_SUPPORT
+)
+
+if(VCPKG_TARGET_IS_WINDOWS)
+ vcpkg_check_linkage(ONLY_STATIC_LIBRARY) # Symbols are not properly exported
+endif()
+
+string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" LIBMINC_BUILD_SHARED_LIBS)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ -DBUILD_TESTING=OFF
+ -DLIBMINC_BUILD_SHARED_LIBS=${LIBMINC_BUILD_SHARED_LIBS}
+ -DLIBMINC_USE_SYSTEM_NIFTI=ON
+ ${FEATURE_OPTIONS}
+)
+vcpkg_cmake_install()
+vcpkg_copy_pdbs()
+vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake PACKAGE_NAME libminc)
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+
+file(INSTALL "${CURRENT_PORT_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")
diff --git a/vcpkg/ports/minc/usage b/vcpkg/ports/minc/usage
new file mode 100644
index 0000000..1a4c1ce
--- /dev/null
+++ b/vcpkg/ports/minc/usage
@@ -0,0 +1,12 @@
+minc provides CMake integration:
+
+ find_package(LIBMINC CONFIG REQUIRED)
+ target_include_directories(main PRIVATE ${LIBMINC_INCLUDE_DIRS})
+ target_link_directories(main PRIVATE ${LIBMINC_LIBRARY_DIRS})
+ target_link_libraries(main PRIVATE ${LIBMINC_LIBRARIES})
+
+LIBMINC_LIBRARIES may include imported targets.
+Downstream CMake config may need to add:
+
+ include(CMakeFindDependencyMacro)
+ find_dependency(LIBMINC CONFIG)
diff --git a/vcpkg/ports/minc/vcpkg.json b/vcpkg/ports/minc/vcpkg.json
new file mode 100644
index 0000000..6537b60
--- /dev/null
+++ b/vcpkg/ports/minc/vcpkg.json
@@ -0,0 +1,34 @@
+{
+ "name": "minc",
+ "version": "2.4.6",
+ "description": "MINC - Medical Image NetCDF or MINC isn't netCDF",
+ "homepage": "https://github.com/BIC-MNI/libminc",
+ "license": null,
+ "dependencies": [
+ {
+ "name": "hdf5",
+ "default-features": false
+ },
+ "nifticlib",
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ },
+ "zlib"
+ ],
+ "features": {
+ "minc1": {
+ "description": "Support minc1 file format, requires NETCDF",
+ "dependencies": [
+ {
+ "name": "netcdf-c",
+ "default-features": false
+ }
+ ]
+ }
+ }
+}