diff options
Diffstat (limited to 'vcpkg/ports/cfitsio')
| -rw-r--r-- | vcpkg/ports/cfitsio/0001-fix-dependencies.patch | 39 | ||||
| -rw-r--r-- | vcpkg/ports/cfitsio/0002-export-cmake-targets.patch | 48 | ||||
| -rw-r--r-- | vcpkg/ports/cfitsio/0003-add-Wno-error-implicit-funciton-declaration-to-cmake.patch | 27 | ||||
| -rw-r--r-- | vcpkg/ports/cfitsio/0004-pkg-config.patch | 13 | ||||
| -rw-r--r-- | vcpkg/ports/cfitsio/0005-fix-link2019-error.patch | 25 | ||||
| -rw-r--r-- | vcpkg/ports/cfitsio/0006-fix-uwp.patch | 13 | ||||
| -rw-r--r-- | vcpkg/ports/cfitsio/portfile.cmake | 75 | ||||
| -rw-r--r-- | vcpkg/ports/cfitsio/vcpkg.json | 35 |
8 files changed, 275 insertions, 0 deletions
diff --git a/vcpkg/ports/cfitsio/0001-fix-dependencies.patch b/vcpkg/ports/cfitsio/0001-fix-dependencies.patch new file mode 100644 index 0000000..d8df385 --- /dev/null +++ b/vcpkg/ports/cfitsio/0001-fix-dependencies.patch @@ -0,0 +1,39 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6d6af49..9e7d2ee 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -94,9 +94,8 @@ IF (NOT MSVC) + + # Find curl library, for HTTPS support: + IF (UseCurl) +- FIND_PACKAGE(CURL) ++ FIND_PACKAGE(CURL CONFIG REQUIRED) + IF (CURL_FOUND) +- INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIR}) + ADD_DEFINITIONS(-DCFITSIO_HAVE_CURL) + ENDIF() + ENDIF() +@@ -128,18 +127,20 @@ SET(SRC_FILES + + # Only include zlib source files if we are building a shared library. + # Users will need to link their executable with zlib independently. +-IF (BUILD_SHARED_LIBS) ++IF (0) + set(SRC_FILES ${SRC_FILES} + zlib/adler32.c zlib/crc32.c zlib/deflate.c zlib/infback.c + zlib/inffast.c zlib/inflate.c zlib/inftrees.c zlib/trees.c + zlib/uncompr.c zlib/zutil.c + ) ++ELSE() ++ FIND_PACKAGE(ZLIB REQUIRED) + ENDIF() + + ADD_LIBRARY(${LIB_NAME} ${LIB_TYPE} ${H_FILES} ${SRC_FILES}) +-TARGET_LINK_LIBRARIES(${LIB_NAME} ${PTHREADS_LIBRARY} ${M_LIB}) ++TARGET_LINK_LIBRARIES(${LIB_NAME} ${PTHREADS_LIBRARY} ${M_LIB} ZLIB::ZLIB) + IF (CURL_FOUND) +- TARGET_LINK_LIBRARIES(${LIB_NAME} ${CURL_LIBRARIES}) ++ TARGET_LINK_LIBRARIES(${LIB_NAME} CURL::libcurl) + ENDIF(CURL_FOUND) + + SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES VERSION ${${PROJECT_NAME}_VERSION} SOVERSION ${${PROJECT_NAME}_MAJOR_VERSION}) diff --git a/vcpkg/ports/cfitsio/0002-export-cmake-targets.patch b/vcpkg/ports/cfitsio/0002-export-cmake-targets.patch new file mode 100644 index 0000000..ab3a46c --- /dev/null +++ b/vcpkg/ports/cfitsio/0002-export-cmake-targets.patch @@ -0,0 +1,48 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9e7d2ee..5b37adc 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -24,7 +24,7 @@ OPTION(UseCurl "UseCurl" ON) + + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}") + set (LIB_DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}") +-set (INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include/") ++set (INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include/cfitsio") + + # Define project version + SET(${PROJECT_NAME}_MAJOR_VERSION 3) +@@ -138,19 +138,31 @@ ELSE() + ENDIF() + + ADD_LIBRARY(${LIB_NAME} ${LIB_TYPE} ${H_FILES} ${SRC_FILES}) +-TARGET_LINK_LIBRARIES(${LIB_NAME} ${PTHREADS_LIBRARY} ${M_LIB} ZLIB::ZLIB) ++TARGET_INCLUDE_DIRECTORIES(${LIB_NAME} PUBLIC $<INSTALL_INTERFACE:include/cfitsio>) ++TARGET_LINK_LIBRARIES(${LIB_NAME} PUBLIC ${PTHREADS_LIBRARY} ${M_LIB} ZLIB::ZLIB) + IF (CURL_FOUND) +- TARGET_LINK_LIBRARIES(${LIB_NAME} CURL::libcurl) ++ TARGET_LINK_LIBRARIES(${LIB_NAME} PUBLIC CURL::libcurl) + ENDIF(CURL_FOUND) + + SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES VERSION ${${PROJECT_NAME}_VERSION} SOVERSION ${${PROJECT_NAME}_MAJOR_VERSION}) +-install(TARGETS ${LIB_NAME} DESTINATION ${LIB_DESTINATION}) + install(TARGETS ${LIB_NAME} ++ EXPORT unofficial-${LIB_NAME}-config + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) + install(FILES ${H_FILES} DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel) + ++set(CFITSIO_VERSION 3.49) ++include(CMakePackageConfigHelpers) ++write_basic_package_version_file(unofficial-${LIB_NAME}-version.cmake VERSION ${CFITSIO_VERSION} COMPATIBILITY ExactVersion) ++ ++install(FILES ${CMAKE_BINARY_DIR}/unofficial-${LIB_NAME}-version.cmake DESTINATION share/unofficial-${LIB_NAME}) ++ ++install( ++ EXPORT unofficial-${LIB_NAME}-config ++ DESTINATION share/unofficial-${LIB_NAME} ++) ++ + # Only build test code and executables if building a shared library: + IF (BUILD_SHARED_LIBS) + diff --git a/vcpkg/ports/cfitsio/0003-add-Wno-error-implicit-funciton-declaration-to-cmake.patch b/vcpkg/ports/cfitsio/0003-add-Wno-error-implicit-funciton-declaration-to-cmake.patch new file mode 100644 index 0000000..288a1d2 --- /dev/null +++ b/vcpkg/ports/cfitsio/0003-add-Wno-error-implicit-funciton-declaration-to-cmake.patch @@ -0,0 +1,27 @@ +From af09ca45ad71a540aafc4989676e9a0b88bf2948 Mon Sep 17 00:00:00 2001 +From: Nicole Mazzuca <mazzucan@outlook.com> +Date: Fri, 16 Oct 2020 12:28:37 -0700 +Subject: [PATCH] add `-Wno-error=implicit-funciton-declaration` to cmake + +--- + CMakeLists.txt | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5b37adc..fead70c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -6,6 +6,10 @@ SET(CMAKE_LEGACY_CYGWIN_WIN32 0) + PROJECT(CFITSIO) + CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0) + ++if (NOT MSVC) ++ add_compile_options(-Wno-error=implicit-function-declaration) ++endif() ++ + # Allow @rpath token in target install name on Macs. + # See "cmake --help-policy CMP0042" for more information. + IF(POLICY CMP0042) +-- +2.28.0.windows.1 + diff --git a/vcpkg/ports/cfitsio/0004-pkg-config.patch b/vcpkg/ports/cfitsio/0004-pkg-config.patch new file mode 100644 index 0000000..65d98b5 --- /dev/null +++ b/vcpkg/ports/cfitsio/0004-pkg-config.patch @@ -0,0 +1,13 @@ +diff -urw cfitsio-3-7822097674.clean/cfitsio.pc.cmake cfitsio-3-7822097674/cfitsio.pc.cmake +--- cfitsio-3-7822097674.clean/cfitsio.pc.cmake 2020-08-12 20:01:04.000000000 +0200 ++++ cfitsio-3-7822097674/cfitsio.pc.cmake 2021-05-06 08:46:49.160351519 +0200 +@@ -6,7 +6,8 @@ + Name: cfitsio + Description: FITS File Subroutine Library + URL: https://heasarc.gsfc.nasa.gov/fitsio/ +-Version: @CFITSIO_MAJOR@.@CFITSIO_MINOR@ ++Version: @CFITSIO_VERSION@ ++Requires.private: @PKG_CONFIG_REQUIRES_PRIVATE@ + Libs: -L${libdir} @PKG_CONFIG_LIBS@ + Libs.private: -lm + Cflags: -I${includedir} diff --git a/vcpkg/ports/cfitsio/0005-fix-link2019-error.patch b/vcpkg/ports/cfitsio/0005-fix-link2019-error.patch new file mode 100644 index 0000000..0ab5886 --- /dev/null +++ b/vcpkg/ports/cfitsio/0005-fix-link2019-error.patch @@ -0,0 +1,25 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index fead70c..f05ae92 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -68,6 +68,7 @@ IF (USE_PTHREADS) + FIND_PACKAGE(pthreads REQUIRED) + INCLUDE_DIRECTORIES(${PTHREADS_INCLUDE_DIR}) + ADD_DEFINITIONS(-D_REENTRANT) ++ set(PTHREADS_LIBRARY PThreads4W::PThreads4W) + ENDIF() + + # Math library (not available in MSVC or MINGW) +diff --git a/fitsio2.h b/fitsio2.h +index 1adb17b..19f8511 100644 +--- a/fitsio2.h ++++ b/fitsio2.h +@@ -26,7 +26,7 @@ extern int Fitsio_Pthread_Status; + #define FFUNLOCK1(lockname) (Fitsio_Pthread_Status = pthread_mutex_unlock(&lockname)) + #define FFLOCK FFLOCK1(Fitsio_Lock) + #define FFUNLOCK FFUNLOCK1(Fitsio_Lock) +-#define ffstrtok(str, tok, save) strtok_r(str, tok, save) ++#define ffstrtok(str, tok, save) strtok_s(str, tok, save) + + #else + #define FFLOCK diff --git a/vcpkg/ports/cfitsio/0006-fix-uwp.patch b/vcpkg/ports/cfitsio/0006-fix-uwp.patch new file mode 100644 index 0000000..cb2fa7f --- /dev/null +++ b/vcpkg/ports/cfitsio/0006-fix-uwp.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7afb480..4fcdf40 100755 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -195,7 +195,7 @@ IF (BUILD_SHARED_LIBS) + + # To expand the command line arguments in Windows, see: + # http://msdn.microsoft.com/en-us/library/8bch7bkk.aspx +- if(MSVC) ++ if(MSVC AND NOT CMAKE_SYSTEM_NAME MATCHES "WindowsStore") + set_target_properties(FPack Funpack PROPERTIES LINK_FLAGS "setargv.obj") + endif(MSVC) + diff --git a/vcpkg/ports/cfitsio/portfile.cmake b/vcpkg/ports/cfitsio/portfile.cmake new file mode 100644 index 0000000..f85f67c --- /dev/null +++ b/vcpkg/ports/cfitsio/portfile.cmake @@ -0,0 +1,75 @@ +vcpkg_download_distfile(ARCHIVE + URLS "https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio-3.49.tar.gz" + FILENAME "cfitsio-3.49.tar.gz" + SHA512 9836a4af3bbbfed1ea1b4c70b9d500ac485d7c3d8131eb8a25ee6ef6662f46ba52b5161c45c709ed9a601ff0e9ec36daa5650eaaf4f2cc7d6f4bb5640f10da15 +) + +vcpkg_extract_source_archive( + SOURCE_PATH + ARCHIVE "${ARCHIVE}" + PATCHES + 0001-fix-dependencies.patch + 0002-export-cmake-targets.patch + 0003-add-Wno-error-implicit-funciton-declaration-to-cmake.patch + 0004-pkg-config.patch + 0005-fix-link2019-error.patch + 0006-fix-uwp.patch +) + +vcpkg_check_features( + OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + curl UseCurl +) + +set(PKG_CONFIG_REQUIRES_PRIVATE zlib) +if ("curl" IN_LIST FEATURES) + set(FIND_CURL_DEPENDENCY "find_dependency(CURL CONFIG)") + string(APPEND PKG_CONFIG_REQUIRES_PRIVATE " libcurl") +endif() + +if ("pthreads" IN_LIST FEATURES) + if (VCPKG_TARGET_IS_WINDOWS) + set(WITH_PTHREADS ON) + set(FIND_PTHREADS_DEPENDENCY "find_dependency(pthreads)") + else() + message(WARNING "Feature pthreads only support Windows, disable it now.") + set(WITH_PTHREADS OFF) + endif() +endif() + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + ${FEATURE_OPTIONS} + -DUSE_PTHREADS=${WITH_PTHREADS} + "-DPKG_CONFIG_REQUIRES_PRIVATE=${PKG_CONFIG_REQUIRES_PRIVATE}" + -DPKG_CONFIG_LIBS=-lcfitsio +) + +vcpkg_cmake_install() +vcpkg_fixup_pkgconfig(SYSTEM_LIBRARIES m) +vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-cfitsio) + +file(READ "${CURRENT_PACKAGES_DIR}/share/unofficial-cfitsio/unofficial-cfitsio-config.cmake" ASSIMP_CONFIG) +file(WRITE "${CURRENT_PACKAGES_DIR}/share/unofficial-cfitsio/unofficial-cfitsio-config.cmake" " +include(CMakeFindDependencyMacro) +${FIND_CURL_DEPENDENCY} +${FIND_PTHREADS_DEPENDENCY} +find_dependency(ZLIB) +${ASSIMP_CONFIG} +") + +vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/unofficial-cfitsio/unofficial-cfitsio-config.cmake" + "cmake_policy(VERSION 2.6)" + "cmake_policy(VERSION 2.6)\r\n\ +# Required for the evaluation of \"if(@BUILD_SHARED_LIBS@)\" below to function\r\n\ +cmake_policy(SET CMP0012 NEW)\r\n" + IGNORE_UNCHANGED +) + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/include/unistd.h" "${CURRENT_PACKAGES_DIR}/debug/share") + +file(INSTALL "${SOURCE_PATH}/FindPthreads.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/unofficial-cfitsio") + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/License.txt") diff --git a/vcpkg/ports/cfitsio/vcpkg.json b/vcpkg/ports/cfitsio/vcpkg.json new file mode 100644 index 0000000..f9ae0c3 --- /dev/null +++ b/vcpkg/ports/cfitsio/vcpkg.json @@ -0,0 +1,35 @@ +{ + "name": "cfitsio", + "version": "3.49", + "port-version": 6, + "description": "Library of C and Fortran subroutines for reading and writing data files in FITS (Flexible Image Transport System) data format", + "homepage": "https://heasarc.gsfc.nasa.gov/fitsio/", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + }, + "zlib" + ], + "features": { + "curl": { + "description": "UseCurl", + "dependencies": [ + "curl" + ] + }, + "pthreads": { + "description": "Thread-safe build (using pthreads)", + "dependencies": [ + { + "name": "pthreads", + "platform": "windows" + } + ] + } + } +} |