|
| 1 | +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Kleis Auke Wolthuizen <github@kleisauke.nl> |
| 3 | +Date: Tue, 28 Jun 2022 15:45:17 +0200 |
| 4 | +Subject: [PATCH 1/2] Set PROJECT_VERSION manually |
| 5 | + |
| 6 | +Upstream-Status: Pending |
| 7 | + |
| 8 | +diff --git a/CMakeLists.txt b/CMakeLists.txt |
| 9 | +index 1111111..2222222 100644 |
| 10 | +--- a/CMakeLists.txt |
| 11 | ++++ b/CMakeLists.txt |
| 12 | +@@ -11,24 +11,8 @@ endif() |
| 13 | + cmake_policy(VERSION ${NIFTI_CMAKE_POLICY_VERSION}) |
| 14 | + |
| 15 | + set(NIFTI_HOMEPAGE_URL "https://nifti-imaging.github.io") |
| 16 | +-execute_process(COMMAND git "describe" "--tags" |
| 17 | +- OUTPUT_VARIABLE GIT_REPO_VERSION_UNCLEANED |
| 18 | +- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) |
| 19 | +- |
| 20 | +-#Extract the GIT_REPO_VERSION as composed of non-negative integer components, |
| 21 | +-# i.e. <major>[.<minor>[.<patch>[.<tweak>]]] |
| 22 | +-string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+((beta.*)?(alpha.*)?\\.[0-9]+(\\.g[0-9a-f]+)?)?" |
| 23 | +- GIT_REPO_VERSION "${GIT_REPO_VERSION_UNCLEANED}") |
| 24 | +- |
| 25 | +-if( NOT GIT_REPO_VERSION ) |
| 26 | +- message(NOTE "Invalid git tag does not match required regular expression, " |
| 27 | +- "can not extract version information from '${GIT_REPO_VERSION_UNCLEANED}'") |
| 28 | +- # NOTE: cmake -DGIT_REPO_VERSION:STRING=<major>[.<minor>[.<patch>[.<tweak>]]] can be used |
| 29 | +- # to set the repo string for non-git repos. |
| 30 | +- set(GIT_REPO_VERSION "0.0.0.0") #Manually set the version string for testing purposes |
| 31 | +-endif() |
| 32 | + project(NIFTI |
| 33 | +- VERSION ${GIT_REPO_VERSION} |
| 34 | ++ VERSION 3.0.1 |
| 35 | + DESCRIPTION "Niftilib is a set of i/o libraries for reading and writing files in the nifti-1 data format. nifti-1 is a binary file format for storing medical image data, e.g. magnetic resonance image (MRI) and functional MRI (fMRI) brain images." |
| 36 | + LANGUAGES C) |
| 37 | + |
| 38 | +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
| 39 | +From: =?UTF-8?q?Corentin=20No=C3=ABl?= <corentin.noel@collabora.com> |
| 40 | +Date: Wed, 2 Feb 2022 18:00:39 +0100 |
| 41 | +Subject: [PATCH 2/2] Generate pkgconfig files |
| 42 | + |
| 43 | +This allow to easily include the libraries in other projects. |
| 44 | + |
| 45 | +See https://www.freedesktop.org/wiki/Software/pkg-config/ for more information |
| 46 | +about what pkg-config is. |
| 47 | + |
| 48 | +Upstream-Status: Submitted [https://github.com/NIFTI-Imaging/nifti_clib/pull/140] |
| 49 | + |
| 50 | +diff --git a/CMakeLists.txt b/CMakeLists.txt |
| 51 | +index 1111111..2222222 100644 |
| 52 | +--- a/CMakeLists.txt |
| 53 | ++++ b/CMakeLists.txt |
| 54 | +@@ -56,6 +56,7 @@ set_if_not_defined(NIFTI_INSTALL_RUNTIME_DIR bin) |
| 55 | + set_if_not_defined(NIFTI_INSTALL_LIBRARY_DIR lib) |
| 56 | + set_if_not_defined(NIFTI_INSTALL_ARCHIVE_DIR ${NIFTI_INSTALL_LIBRARY_DIR}) |
| 57 | + set_if_not_defined(NIFTI_INSTALL_INCLUDE_DIR include/nifti) |
| 58 | ++set_if_not_defined(NIFTI_INSTALL_PKGCONFIG_DIR ${NIFTI_INSTALL_LIBRARY_DIR}/pkgconfig) |
| 59 | + set_if_not_defined(NIFTI_INSTALL_MAN_DIR share/man/man1) |
| 60 | + set_if_not_defined(NIFTI_INSTALL_DOC_DIR share/doc/${PROJECT_NAME}) |
| 61 | + set_if_not_defined(NIFTI_ZLIB_LIBRARIES "") |
| 62 | +diff --git a/cmake/nifti_macros.cmake b/cmake/nifti_macros.cmake |
| 63 | +index 1111111..2222222 100644 |
| 64 | +--- a/cmake/nifti_macros.cmake |
| 65 | ++++ b/cmake/nifti_macros.cmake |
| 66 | +@@ -135,6 +135,10 @@ function(install_nifti_target target_name) |
| 67 | + COMPONENT Development |
| 68 | + INCLUDES DESTINATION ${NIFTI_INSTALL_INCLUDE_DIR} |
| 69 | + ) |
| 70 | ++ |
| 71 | ++ install(FILES $<TARGET_PROPERTY:${target_name},PKG_CONFIG> |
| 72 | ++ COMPONENT Development |
| 73 | ++ DESTINATION ${NIFTI_INSTALL_PKGCONFIG_DIR}) |
| 74 | + endfunction() |
| 75 | + |
| 76 | + function(get_lib_version_var ver_header_text ver_type version_out) |
| 77 | +diff --git a/nifti2/CMakeLists.txt b/nifti2/CMakeLists.txt |
| 78 | +index 1111111..2222222 100644 |
| 79 | +--- a/nifti2/CMakeLists.txt |
| 80 | ++++ b/nifti2/CMakeLists.txt |
| 81 | +@@ -2,11 +2,13 @@ set(NIFTI_NIFTILIB2_NAME ${NIFTI_PACKAGE_PREFIX}nifti2) |
| 82 | + |
| 83 | + add_nifti_library(${NIFTI_NIFTILIB2_NAME} nifti2_io.c ) |
| 84 | + target_link_libraries( ${NIFTI_NIFTILIB2_NAME} PUBLIC ${NIFTI_PACKAGE_PREFIX}znz ${NIFTI_SYSTEM_MATH_LIB}) |
| 85 | ++configure_file(nifti2.pc.in nifti2.pc @ONLY) |
| 86 | + set_target_properties( |
| 87 | + ${NIFTI_NIFTILIB2_NAME} |
| 88 | + PROPERTIES |
| 89 | + PUBLIC_HEADER |
| 90 | + "${CMAKE_CURRENT_LIST_DIR}/nifti1.h;${CMAKE_CURRENT_LIST_DIR}/nifti2.h;${CMAKE_CURRENT_LIST_DIR}/nifti2_io.h" |
| 91 | ++ PKG_CONFIG ${CMAKE_CURRENT_BINARY_DIR}/nifti2.pc |
| 92 | + ) |
| 93 | + # Set library version when building shared libs. |
| 94 | + if(BUILD_SHARED_LIBS) |
| 95 | +diff --git a/nifti2/nifti2.pc.in b/nifti2/nifti2.pc.in |
| 96 | +new file mode 100644 |
| 97 | +index 0000000..1111111 |
| 98 | +--- /dev/null |
| 99 | ++++ b/nifti2/nifti2.pc.in |
| 100 | +@@ -0,0 +1,11 @@ |
| 101 | ++prefix=@CMAKE_INSTALL_PREFIX@ |
| 102 | ++exec_prefix=${prefix} |
| 103 | ++libdir=${prefix}/@NIFTI_INSTALL_LIBRARY_DIR@ |
| 104 | ++includedir=${prefix}/@NIFTI_INSTALL_INCLUDE_DIR@ |
| 105 | ++ |
| 106 | ++Name: nifti2 |
| 107 | ++Description: Core i/o routines for reading and writing nifti-2 format files |
| 108 | ++Version: @PROJECT_VERSION@ |
| 109 | ++Requires: znzlib |
| 110 | ++Libs: -L${libdir} -lnifti2 |
| 111 | ++Cflags: -I${includedir} |
| 112 | +diff --git a/nifticdf/CMakeLists.txt b/nifticdf/CMakeLists.txt |
| 113 | +index 1111111..2222222 100644 |
| 114 | +--- a/nifticdf/CMakeLists.txt |
| 115 | ++++ b/nifticdf/CMakeLists.txt |
| 116 | +@@ -1,11 +1,13 @@ |
| 117 | + set(NIFTI_CDFLIB_NAME ${NIFTI_PACKAGE_PREFIX}nifticdf) |
| 118 | + |
| 119 | + add_nifti_library(${NIFTI_CDFLIB_NAME} nifticdf.c ) |
| 120 | ++configure_file(nifticdf.pc.in nifticdf.pc @ONLY) |
| 121 | + set_target_properties( |
| 122 | + ${NIFTI_CDFLIB_NAME} |
| 123 | + PROPERTIES |
| 124 | + PUBLIC_HEADER |
| 125 | + "${CMAKE_CURRENT_LIST_DIR}/nifticdf.h" |
| 126 | ++ PKG_CONFIG ${CMAKE_CURRENT_BINARY_DIR}/nifticdf.pc |
| 127 | + ) |
| 128 | + target_compile_options(${NIFTI_CDFLIB_NAME} PRIVATE "-D__COMPILE_UNUSED_FUNCTIONS__") |
| 129 | + target_link_libraries(${NIFTI_CDFLIB_NAME} PUBLIC ${NIFTI_PACKAGE_PREFIX}niftiio) |
| 130 | +diff --git a/nifticdf/nifticdf.pc.in b/nifticdf/nifticdf.pc.in |
| 131 | +new file mode 100644 |
| 132 | +index 0000000..1111111 |
| 133 | +--- /dev/null |
| 134 | ++++ b/nifticdf/nifticdf.pc.in |
| 135 | +@@ -0,0 +1,10 @@ |
| 136 | ++prefix=@CMAKE_INSTALL_PREFIX@ |
| 137 | ++exec_prefix=${prefix} |
| 138 | ++libdir=${prefix}/@NIFTI_INSTALL_LIBRARY_DIR@ |
| 139 | ++includedir=${prefix}/@NIFTI_INSTALL_INCLUDE_DIR@ |
| 140 | ++ |
| 141 | ++Name: nifticdf |
| 142 | ++Description: Functions to compute cumulative distributions and their inverses |
| 143 | ++Version: @PROJECT_VERSION@ |
| 144 | ++Libs: -L${libdir} -lnifticdf |
| 145 | ++Cflags: -I${includedir} |
| 146 | +diff --git a/niftilib/CMakeLists.txt b/niftilib/CMakeLists.txt |
| 147 | +index 1111111..2222222 100644 |
| 148 | +--- a/niftilib/CMakeLists.txt |
| 149 | ++++ b/niftilib/CMakeLists.txt |
| 150 | +@@ -2,11 +2,13 @@ set(NIFTI_NIFTILIB_NAME ${NIFTI_PACKAGE_PREFIX}niftiio) |
| 151 | + |
| 152 | + add_nifti_library(${NIFTI_NIFTILIB_NAME} nifti1_io.c ) |
| 153 | + target_link_libraries( ${NIFTI_NIFTILIB_NAME} PUBLIC ${NIFTI_PACKAGE_PREFIX}znz ${NIFTI_SYSTEM_MATH_LIB}) |
| 154 | ++configure_file(niftiio.pc.in niftiio.pc @ONLY) |
| 155 | + set_target_properties( |
| 156 | + ${NIFTI_NIFTILIB_NAME} |
| 157 | + PROPERTIES |
| 158 | + PUBLIC_HEADER |
| 159 | + "${CMAKE_CURRENT_LIST_DIR}/nifti1_io.h;${CMAKE_CURRENT_LIST_DIR}/nifti1.h" |
| 160 | ++ PKG_CONFIG ${CMAKE_CURRENT_BINARY_DIR}/niftiio.pc |
| 161 | + ) |
| 162 | + # Set library version when building shared libs. |
| 163 | + if(BUILD_SHARED_LIBS) |
| 164 | +diff --git a/niftilib/niftiio.pc.in b/niftilib/niftiio.pc.in |
| 165 | +new file mode 100644 |
| 166 | +index 0000000..1111111 |
| 167 | +--- /dev/null |
| 168 | ++++ b/niftilib/niftiio.pc.in |
| 169 | +@@ -0,0 +1,11 @@ |
| 170 | ++prefix=@CMAKE_INSTALL_PREFIX@ |
| 171 | ++exec_prefix=${prefix} |
| 172 | ++libdir=${prefix}/@NIFTI_INSTALL_LIBRARY_DIR@ |
| 173 | ++includedir=${prefix}/@NIFTI_INSTALL_INCLUDE_DIR@ |
| 174 | ++ |
| 175 | ++Name: niftiio |
| 176 | ++Description: Core i/o routines for reading and writing nifti-1 format files |
| 177 | ++Version: @PROJECT_VERSION@ |
| 178 | ++Requires: znzlib |
| 179 | ++Libs: -L${libdir} -lniftiio |
| 180 | ++Cflags: -I${includedir} |
| 181 | +diff --git a/znzlib/CMakeLists.txt b/znzlib/CMakeLists.txt |
| 182 | +index 1111111..2222222 100644 |
| 183 | +--- a/znzlib/CMakeLists.txt |
| 184 | ++++ b/znzlib/CMakeLists.txt |
| 185 | +@@ -2,10 +2,12 @@ set(NIFTI_ZNZLIB_NAME ${NIFTI_PACKAGE_PREFIX}znz) |
| 186 | + |
| 187 | + add_nifti_library(${NIFTI_ZNZLIB_NAME} znzlib.c ) |
| 188 | + target_link_libraries( ${NIFTI_ZNZLIB_NAME} PUBLIC ${NIFTI_ZLIB_LIBRARIES} ) |
| 189 | ++configure_file(znzlib.pc.in znzlib.pc @ONLY) |
| 190 | + set_target_properties( |
| 191 | + ${NIFTI_ZNZLIB_NAME} |
| 192 | + PROPERTIES |
| 193 | + PUBLIC_HEADER ${CMAKE_CURRENT_LIST_DIR}/znzlib.h |
| 194 | ++ PKG_CONFIG ${CMAKE_CURRENT_BINARY_DIR}/znzlib.pc |
| 195 | + ) |
| 196 | + target_compile_definitions(${NIFTI_ZNZLIB_NAME} PUBLIC ${ZNZ_COMPILE_DEF}) |
| 197 | + # Set library version if building shared libs. |
| 198 | +diff --git a/znzlib/znzlib.pc.in b/znzlib/znzlib.pc.in |
| 199 | +new file mode 100644 |
| 200 | +index 0000000..1111111 |
| 201 | +--- /dev/null |
| 202 | ++++ b/znzlib/znzlib.pc.in |
| 203 | +@@ -0,0 +1,12 @@ |
| 204 | ++prefix=@CMAKE_INSTALL_PREFIX@ |
| 205 | ++exec_prefix=${prefix} |
| 206 | ++libdir=${prefix}/@NIFTI_INSTALL_LIBRARY_DIR@ |
| 207 | ++includedir=${prefix}/@NIFTI_INSTALL_INCLUDE_DIR@ |
| 208 | ++zlib_support=true |
| 209 | ++ |
| 210 | ++Name: znzlib |
| 211 | ++Description: Low level library for handling read/write of compressed files |
| 212 | ++Version: @PROJECT_VERSION@ |
| 213 | ++Requires: zlib |
| 214 | ++Libs: -L${libdir} -lznz |
| 215 | ++Cflags: -I${includedir} |
0 commit comments