diff options
Diffstat (limited to 'vcpkg/ports/gsl')
| -rw-r--r-- | vcpkg/ports/gsl/0001-configure.patch | 158 | ||||
| -rw-r--r-- | vcpkg/ports/gsl/0002-add-fp-control.patch | 97 | ||||
| -rw-r--r-- | vcpkg/ports/gsl/CMakeLists.txt | 86 | ||||
| -rw-r--r-- | vcpkg/ports/gsl/portfile.cmake | 37 | ||||
| -rw-r--r-- | vcpkg/ports/gsl/usage | 4 | ||||
| -rw-r--r-- | vcpkg/ports/gsl/vcpkg-cmake-wrapper.cmake | 11 | ||||
| -rw-r--r-- | vcpkg/ports/gsl/vcpkg.json | 14 |
7 files changed, 407 insertions, 0 deletions
diff --git a/vcpkg/ports/gsl/0001-configure.patch b/vcpkg/ports/gsl/0001-configure.patch new file mode 100644 index 0000000..44ba02a --- /dev/null +++ b/vcpkg/ports/gsl/0001-configure.patch @@ -0,0 +1,158 @@ +--- +diff --git a/config.h.in b/config.h +index adab7a58d..f6dc2278e 100644 +--- a/config.h.in ++++ b/config.h +@@ -11,19 +11,19 @@ + + /* Define to 1 if you have the declaration of 'acosh', and to 0 if you don't. + */ +-#undef HAVE_DECL_ACOSH ++#define HAVE_DECL_ACOSH 1 + + /* Define to 1 if you have the declaration of 'asinh', and to 0 if you don't. + */ +-#undef HAVE_DECL_ASINH ++#define HAVE_DECL_ASINH 1 + + /* Define to 1 if you have the declaration of 'atanh', and to 0 if you don't. + */ +-#undef HAVE_DECL_ATANH ++#define HAVE_DECL_ATANH 1 + + /* Define to 1 if you have the declaration of 'expm1', and to 0 if you don't. + */ +-#undef HAVE_DECL_EXPM1 ++#define HAVE_DECL_EXPM1 1 + + /* Define to 1 if you have the declaration of 'feenableexcept', and to 0 if + you don't. */ +@@ -43,31 +43,31 @@ + + /* Define to 1 if you have the declaration of 'frexp', and to 0 if you don't. + */ +-#undef HAVE_DECL_FREXP ++#define HAVE_DECL_FREXP 1 + + /* Define to 1 if you have the declaration of 'hypot', and to 0 if you don't. + */ +-#undef HAVE_DECL_HYPOT ++#define HAVE_DECL_HYPOT 1 + + /* Define to 1 if you have the declaration of 'isfinite', and to 0 if you + don't. */ +-#undef HAVE_DECL_ISFINITE ++#define HAVE_DECL_ISFINITE 1 + + /* Define to 1 if you have the declaration of 'isinf', and to 0 if you don't. + */ +-#undef HAVE_DECL_ISINF ++#define HAVE_DECL_ISINF 1 + + /* Define to 1 if you have the declaration of 'isnan', and to 0 if you don't. + */ +-#undef HAVE_DECL_ISNAN ++#define HAVE_DECL_ISNAN 1 + + /* Define to 1 if you have the declaration of 'ldexp', and to 0 if you don't. + */ +-#undef HAVE_DECL_LDEXP ++#define HAVE_DECL_LDEXP 1 + + /* Define to 1 if you have the declaration of 'log1p', and to 0 if you don't. + */ +-#undef HAVE_DECL_LOG1P ++#define HAVE_DECL_LOG1P 1 + + /* Define to 1 if you have the <dlfcn.h> header file. */ + #undef HAVE_DLFCN_H +@@ -76,13 +76,13 @@ + #undef HAVE_DOPRNT + + /* Defined if you have ansi EXIT_SUCCESS and EXIT_FAILURE in stdlib.h */ +-#undef HAVE_EXIT_SUCCESS_AND_FAILURE ++#define HAVE_EXIT_SUCCESS_AND_FAILURE 1 + + /* Defined on architectures with excess floating-point precision */ + #undef HAVE_EXTENDED_PRECISION_REGISTERS + + /* Define if x86 processor has sse extensions. */ +-#undef HAVE_FPU_X86_SSE ++#define HAVE_FPU_X86_SSE 1 + + /* Define to 1 if you have the <ieeefp.h> header file. */ + #undef HAVE_IEEEFP_H +@@ -97,43 +97,43 @@ + #undef HAVE_INLINE + + /* Define to 1 if you have the <inttypes.h> header file. */ +-#undef HAVE_INTTYPES_H ++#define HAVE_INTTYPES_H 1 + + /* Define to 1 if you have the 'm' library (-lm). */ + #undef HAVE_LIBM + + /* Define to 1 if you have the 'memcpy' function. */ +-#undef HAVE_MEMCPY ++#define HAVE_MEMCPY 1 + + /* Define to 1 if you have the 'memmove' function. */ +-#undef HAVE_MEMMOVE ++#define HAVE_MEMMOVE 1 + + /* Define this if printf can handle %Lf for long double */ + #undef HAVE_PRINTF_LONGDOUBLE + + /* Define to 1 if you have the <stdint.h> header file. */ +-#undef HAVE_STDINT_H ++#define HAVE_STDINT_H 1 + + /* Define to 1 if you have the <stdio.h> header file. */ +-#undef HAVE_STDIO_H ++#define HAVE_STDIO_H 1 + + /* Define to 1 if you have the <stdlib.h> header file. */ +-#undef HAVE_STDLIB_H ++#define HAVE_STDLIB_H 1 + + /* Define to 1 if you have the 'strdup' function. */ +-#undef HAVE_STRDUP ++#define HAVE_STRDUP 1 + + /* Define to 1 if you have the <strings.h> header file. */ + #undef HAVE_STRINGS_H + + /* Define to 1 if you have the <string.h> header file. */ +-#undef HAVE_STRING_H ++#define HAVE_STRING_H 1 + + /* Define to 1 if you have the 'strtol' function. */ +-#undef HAVE_STRTOL ++#define HAVE_STRTOL 1 + + /* Define to 1 if you have the 'strtoul' function. */ +-#undef HAVE_STRTOUL ++#define HAVE_STRTOUL 1 + + /* Define to 1 if you have the <sys/stat.h> header file. */ + #undef HAVE_SYS_STAT_H +@@ -145,7 +145,7 @@ + #undef HAVE_UNISTD_H + + /* Define to 1 if you have the 'vprintf' function. */ +-#undef HAVE_VPRINTF ++#define HAVE_VPRINTF 1 + + /* Define if you need to hide the static definitions of inline functions */ + #undef HIDE_INLINE_STATIC +@@ -180,7 +180,7 @@ + /* Define to 1 if all of the C89 standard headers exist (not just the ones + required in a freestanding environment). This macro is provided for + backward compatibility; new code need not use it. */ +-#undef STDC_HEADERS ++#define STDC_HEADERS 1 + + /* Version number of package */ + #undef VERSION +--- + diff --git a/vcpkg/ports/gsl/0002-add-fp-control.patch b/vcpkg/ports/gsl/0002-add-fp-control.patch new file mode 100644 index 0000000..dceeb38 --- /dev/null +++ b/vcpkg/ports/gsl/0002-add-fp-control.patch @@ -0,0 +1,97 @@ +--- + ieee-utils/fp-win.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++ + ieee-utils/fp.c | 2 ++ + 2 files changed, 72 insertions(+) + create mode 100644 ieee-utils/fp-win.c + +diff --git a/ieee-utils/fp-win.c b/ieee-utils/fp-win.c +new file mode 100644 +index 0000000..e024eae +--- /dev/null ++++ b/ieee-utils/fp-win.c +@@ -0,0 +1,70 @@ ++/* fp-win.c ++ * ++ * Author: Brian Gladman ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or (at ++ * your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++ */ ++ ++#include <float.h> ++ ++#include <config.h> ++#include <gsl/gsl_ieee_utils.h> ++#include <gsl/gsl_errno.h> ++ ++const char *fp_env_string = "round-to-nearest,double-precision,mask-all"; ++ ++int ++gsl_ieee_set_mode (int precision, int rounding, int exception_mask) ++{ ++ unsigned int old, mode = _DN_SAVE, mask = _MCW_DN | _MCW_RC | _MCW_EM; ++ ++ switch(precision) ++ { ++ case GSL_IEEE_SINGLE_PRECISION: mode |= _PC_24; break; ++ case GSL_IEEE_EXTENDED_PRECISION: mode |= _PC_64; break; ++ case GSL_IEEE_DOUBLE_PRECISION: ++ default: mode |= _PC_53; ++ } ++#ifndef _M_AMD64 ++ mask |= _MCW_PC; ++#endif ++ ++ switch(rounding) ++ { ++ case GSL_IEEE_ROUND_DOWN: mode |= _RC_DOWN; break; ++ case GSL_IEEE_ROUND_UP: mode |= _RC_UP; break; ++ case GSL_IEEE_ROUND_TO_ZERO: mode |= _RC_CHOP; break; ++ case GSL_IEEE_ROUND_TO_NEAREST: ++ default: mode |= _RC_NEAR; ++ } ++ ++ if(exception_mask & GSL_IEEE_MASK_INVALID) ++ mode |= _EM_INVALID; ++ if(exception_mask & GSL_IEEE_MASK_DENORMALIZED) ++ mode |= _EM_DENORMAL; ++ if(exception_mask & GSL_IEEE_MASK_DIVISION_BY_ZERO) ++ mode |= _EM_ZERODIVIDE; ++ if(exception_mask & GSL_IEEE_MASK_OVERFLOW) ++ mode |= _EM_OVERFLOW; ++ if(exception_mask & GSL_IEEE_MASK_UNDERFLOW) ++ mode |= _EM_UNDERFLOW; ++ if(exception_mask & GSL_IEEE_TRAP_INEXACT) ++ mode &= ~_EM_INEXACT; ++ else ++ mode |= _EM_INEXACT; ++ ++ _controlfp_s( &old, mode, mask); ++ return GSL_SUCCESS; ++} +diff --git a/ieee-utils/fp.c b/ieee-utils/fp.c +index 445a14f..b6ae5af 100644 +--- a/ieee-utils/fp.c ++++ b/ieee-utils/fp.c +@@ -45,6 +45,8 @@ + #endif + #elif HAVE_DECL_FEENABLEEXCEPT || HAVE_DECL_FESETTRAPENABLE + #include "fp-gnuc99.c" ++#elif _MSC_VER ++#include "fp-win.c" + #else + #include "fp-unknown.c" + #endif +-- + diff --git a/vcpkg/ports/gsl/CMakeLists.txt b/vcpkg/ports/gsl/CMakeLists.txt new file mode 100644 index 0000000..5bc9874 --- /dev/null +++ b/vcpkg/ports/gsl/CMakeLists.txt @@ -0,0 +1,86 @@ +cmake_minimum_required(VERSION 3.8) +project(gsl C) + +option(INSTALL_HEADERS "Install public header files" ON) + +# Function to extract parameter from makefile. Space separated values are returned as lists +function(extract_from_makefile PATTERN RETURN FILEPATH) + file(READ ${FILEPATH} MAKEFILE_CONTENT) + string(REGEX MATCH "${PATTERN}" CONTENTS "${MAKEFILE_CONTENT}") + set(CONTENTS ${CMAKE_MATCH_1}) + # Split string into list + string(REGEX REPLACE "([\t ]+(\\\\\n)?)+" ";" CONTENTS "${CONTENTS}") + string(REGEX REPLACE "[\t ]*\\\\\n[\t ]*;" "" CONTENTS "${CONTENTS}") + if("${CONTENTS}" STREQUAL "") + message(AUTHOR_WARNING "No match for \"${PATTERN}\" found in file ${FILEPATH}") + endif() + # Return + set(${RETURN} ${CONTENTS} PARENT_SCOPE) +endfunction(extract_from_makefile) + +# Function to extract C sources from makefile +function(extract_sources SUBFOLDER ALLSOURCES) + extract_from_makefile("lib[a-zA-Z1-9_]*_la_SOURCES[ \t]*=[ \t]*(((\\\\\n)?[^\n])*)" SOURCEFILES "${SUBFOLDER}/Makefile.am") + # Add the folder in front of the file names + string(REGEX REPLACE "([^;]+)" "${SUBFOLDER}/\\1" SOURCEFILES "${SOURCEFILES}") + # Return + set(${ALLSOURCES} ${${ALLSOURCES}} ${SOURCEFILES} PARENT_SCOPE) +endfunction(extract_sources) + +set(SOURCES) +set(CBLAS_SOURCES) +extract_from_makefile("SUBDIRS = (((\\\\\n)?[^\n])*)" FOLDERS "./Makefile.am") +extract_sources("." SOURCES) +foreach(DIR IN LISTS FOLDERS) + if("${DIR}" STREQUAL "cblas") + extract_sources("${DIR}" CBLAS_SOURCES) + else() + extract_sources("${DIR}" SOURCES) + endif() +endforeach() + +file(READ gsl_types.h GSLTYPES_H) +string(REPLACE "#ifdef WIN32" "#ifdef _WIN32" GSLTYPES_H "${GSLTYPES_H}") +if(BUILD_SHARED_LIBS) + string(REPLACE "# ifdef GSL_DLL" "# if 1 /*GSL_DLL*/" GSLTYPES_H "${GSLTYPES_H}") +endif() +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/gsl_types.h "${GSLTYPES_H}") + +file(GLOB_RECURSE PUBLIC_HEADERS gsl*.h) +list(APPEND PUBLIC_HEADERS ${CMAKE_CURRENT_BINARY_DIR}/gsl_types.h) + +# The debug libraries have a "d" postfix so that CMake's FindGSL.cmake +# module can distinguish between Release and Debug libraries +set(CMAKE_DEBUG_POSTFIX "d") + +add_library(gslcblas ${CBLAS_SOURCES}) +set_target_properties(gslcblas PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) + +add_library(gsl ${SOURCES}) +set_target_properties(gsl PROPERTIES DEFINE_SYMBOL DLL_EXPORT WINDOWS_EXPORT_ALL_SYMBOLS ON) +target_link_libraries(gsl PUBLIC gslcblas) + + +if(INSTALL_HEADERS) + set_target_properties(gsl PROPERTIES PUBLIC_HEADER "${PUBLIC_HEADERS}") +endif() +target_include_directories(gslcblas PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) +target_include_directories(gsl PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) +# For the build, we need to copy all headers to the gsl directory +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/gsl) +file(COPY ${PUBLIC_HEADERS} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/gsl") + +set(TARGET_INSTALL_OPTIONS) +if(INSTALL_HEADERS) + set(TARGET_INSTALL_OPTIONS PUBLIC_HEADER DESTINATION include/gsl) +endif() + +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/gsl.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/gsl.pc" @ONLY) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/gsl.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") + +install(TARGETS gsl gslcblas + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + ${TARGET_INSTALL_OPTIONS} +) diff --git a/vcpkg/ports/gsl/portfile.cmake b/vcpkg/ports/gsl/portfile.cmake new file mode 100644 index 0000000..ce644da --- /dev/null +++ b/vcpkg/ports/gsl/portfile.cmake @@ -0,0 +1,37 @@ +vcpkg_download_distfile(ARCHIVE + URLS + "https://ftpmirror.gnu.org/gsl/gsl-${VERSION}.tar.gz" + "https://ftp.gnu.org/gnu/gsl/gsl-${VERSION}.tar.gz" + "https://www.mirrorservice.org/sites/ftp.gnu.org/gnu/gsl/gsl-${VERSION}.tar.gz" + FILENAME "gsl-${VERSION}.tar.gz" + SHA512 4427f6ce59dc14eabd6d31ef1fcac1849b4d7357faf48873aef642464ddf21cc9b500d516f08b410f02a2daa9a6ff30220f3995584b0a6ae2f73c522d1abb66b +) + +vcpkg_extract_source_archive( + SOURCE_PATH + ARCHIVE "${ARCHIVE}" + PATCHES + 0001-configure.patch + 0002-add-fp-control.patch +) + +file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}") + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS_DEBUG -DINSTALL_HEADERS=OFF +) + +vcpkg_cmake_install() +vcpkg_copy_pdbs() +vcpkg_fixup_pkgconfig() + +vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/gsl.pc" "\${GSL_CBLAS_LIB}" "-lgsl \${GSL_CBLAS_LIB}") +if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/gsl.pc") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/gsl.pc" "-lgslcblas" "-lgslcblasd") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/gsl.pc" "\${GSL_CBLAS_LIB}" "-lgsld \${GSL_CBLAS_LIB}") +endif() + +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") +configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY) +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING") diff --git a/vcpkg/ports/gsl/usage b/vcpkg/ports/gsl/usage new file mode 100644 index 0000000..f1ae924 --- /dev/null +++ b/vcpkg/ports/gsl/usage @@ -0,0 +1,4 @@ +The package gsl is compatible with built-in CMake targets:
+
+ find_package(GSL REQUIRED)
+ target_link_libraries(main PRIVATE GSL::gsl GSL::gslcblas)
diff --git a/vcpkg/ports/gsl/vcpkg-cmake-wrapper.cmake b/vcpkg/ports/gsl/vcpkg-cmake-wrapper.cmake new file mode 100644 index 0000000..7a3ea85 --- /dev/null +++ b/vcpkg/ports/gsl/vcpkg-cmake-wrapper.cmake @@ -0,0 +1,11 @@ +_find_package(${ARGS})
+if(GSL_FOUND AND TARGET GSL::gsl)
+ set_property( TARGET GSL::gslcblas APPEND PROPERTY IMPORTED_CONFIGURATIONS Release )
+ set_property( TARGET GSL::gsl APPEND PROPERTY IMPORTED_CONFIGURATIONS Release )
+ if( EXISTS "${GSL_LIBRARY_DEBUG}" AND EXISTS "${GSL_CBLAS_LIBRARY_DEBUG}")
+ set_property( TARGET GSL::gsl APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
+ set_target_properties( GSL::gsl PROPERTIES IMPORTED_LOCATION_DEBUG "${GSL_LIBRARY_DEBUG}" )
+ set_property( TARGET GSL::gslcblas APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
+ set_target_properties( GSL::gslcblas PROPERTIES IMPORTED_LOCATION_DEBUG "${GSL_CBLAS_LIBRARY_DEBUG}" )
+ endif()
+endif()
\ No newline at end of file diff --git a/vcpkg/ports/gsl/vcpkg.json b/vcpkg/ports/gsl/vcpkg.json new file mode 100644 index 0000000..346be0a --- /dev/null +++ b/vcpkg/ports/gsl/vcpkg.json @@ -0,0 +1,14 @@ +{ + "name": "gsl", + "version": "2.8", + "port-version": 2, + "description": "The GNU Scientific Library is a numerical library for C and C++ programmers", + "homepage": "https://www.gnu.org/software/gsl/", + "license": "GPL-3.0-or-later", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + } + ] +} |