[clapack] Add uwp support (#9957)

* [clapack] Add uwp support

* use _CRT_NONSTDC_NO_DEPRECATE instead of patching codes
This commit is contained in:
Jack·Boos·Yu 2020-05-21 05:20:59 +08:00 committed by GitHub
parent ac2233abc6
commit 07537f9a9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 106 additions and 4 deletions

View File

@ -1,5 +1,5 @@
Source: clapack
Version: 3.2.1-12
Version: 3.2.1-13
Homepage: https://www.netlib.org/clapack
Description: CLAPACK (f2c'ed version of LAPACK)
Build-Depends: openblas (!osx)

View File

@ -1,5 +1,3 @@
include(vcpkg_common_functions)
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_download_distfile(ARCHIVE
@ -15,13 +13,22 @@ vcpkg_extract_source_archive_ex(
remove_internal_blas.patch
fix-ConfigFile.patch
fix-install.patch
support-uwp.patch
)
if (VCPKG_TARGET_IS_UWP)
if (NOT EXISTS ${CURRENT_INSTALLED_DIR}/../x86-windows/tools/arithchk.exe)
message(FATAL_ERROR "Please install ${PORT}:x86-windows first.")
endif()
set(ARITHCHK_PATH ${CURRENT_INSTALLED_DIR}/../x86-windows/tools/arithchk.exe)
endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DCMAKE_DEBUG_POSTFIX=d
-DARITHCHK_PATH=${ARITHCHK_PATH}
)
vcpkg_install_cmake()
@ -37,4 +44,4 @@ file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/FindLAPACK.cmake DESTINATION ${CURRENT_PA
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
# Handle copyright
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/clapack RENAME copyright)
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)

View File

@ -0,0 +1,95 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index db58b4e..0fb61a0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,6 +15,9 @@ if(NOT USE_BLAS_WRAP)
# _zrotg_ seems to be missing in the wrap header
add_definitions(-DNO_BLAS_WRAP)
endif()
+if (ARITHCHK_PATH)
+ add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
+endif()
include_directories(${CLAPACK_SOURCE_DIR}/INCLUDE)
add_subdirectory(F2CLIBS)
add_subdirectory(SRC)
diff --git a/F2CLIBS/libf2c/CMakeLists.txt b/F2CLIBS/libf2c/CMakeLists.txt
index 094614a..e5b40ab 100644
--- a/F2CLIBS/libf2c/CMakeLists.txt
+++ b/F2CLIBS/libf2c/CMakeLists.txt
@@ -44,12 +44,19 @@ if(UNIX)
endif()
set_target_properties(arithchk PROPERTIES COMPILE_DEFINITIONS
"NO_FPINIT;NO_LONG_LONG")
+
+if (ARITHCHK_PATH)
+ADD_CUSTOM_COMMAND(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/arith.h
+ COMMAND ${ARITHCHK_PATH} > ${CMAKE_CURRENT_BINARY_DIR}/arith.h
+ )
+else()
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/arith.h
COMMAND arithchk > ${CMAKE_CURRENT_BINARY_DIR}/arith.h
DEPENDS arithchk
)
-
+endif()
set(OFILES ${MISC} ${POW} ${CX} ${DCX} ${REAL} ${DBL} ${INT}
${HALF} ${CMP} ${EFL} ${CHAR} ${I77} ${TIME})
@@ -69,3 +76,6 @@ install(TARGETS f2c EXPORT clapack-targets
ARCHIVE DESTINATION lib
INCLUDES DESTINATION include)
+install(TARGETS arithchk
+ RUNTIME DESTINATION tools
+)
\ No newline at end of file
diff --git a/F2CLIBS/libf2c/inquire.c b/F2CLIBS/libf2c/inquire.c
index 5936a67..4846d41 100644
--- a/F2CLIBS/libf2c/inquire.c
+++ b/F2CLIBS/libf2c/inquire.c
@@ -32,7 +32,7 @@ integer f_inqu(inlist *a)
{ byfile=1;
g_char(a->infile,a->infilen,buf);
#ifdef NON_UNIX_STDIO
- x = access(buf,0) ? -1 : 0;
+ x = _access(buf,0) ? -1 : 0;
for(i=0,p=NULL;i<MXUNIT;i++)
if(f__units[i].ufd != NULL
&& f__units[i].ufnm != NULL
diff --git a/F2CLIBS/libf2c/open.c b/F2CLIBS/libf2c/open.c
index a06428d..9d08cf7 100644
--- a/F2CLIBS/libf2c/open.c
+++ b/F2CLIBS/libf2c/open.c
@@ -48,7 +48,7 @@ f__bufadj(int n, int c)
#endif
{
unsigned int len;
- char *nbuf, *s, *t, *te;
+ char *nbuf = NULL, *s = NULL, *t = NULL, *te = NULL;
if (f__buf == f__buf0)
f__buflen = 1024;
diff --git a/F2CLIBS/libf2c/rsne.c b/F2CLIBS/libf2c/rsne.c
index e8e9dae..4d65436 100644
--- a/F2CLIBS/libf2c/rsne.c
+++ b/F2CLIBS/libf2c/rsne.c
@@ -103,7 +103,7 @@ mk_hashtab(Namelist *nl)
Vardesc *v, **vd, **vde;
hashentry *he;
- hashtab **x, **x0, *y;
+ hashtab **x = NULL, **x0 = NULL, *y = NULL;
for(x = &nl_cache; y = *x; x0 = x, x = &y->next)
if (nl == y->nl)
return y;
@@ -308,7 +308,7 @@ x_rsne(cilist *a)
char buf[64];
hashtab *ht;
Vardesc *v;
- dimen *dn, *dn0, *dn1;
+ dimen *dn = NULL, *dn0 = NULL, *dn1;
ftnlen *dims, *dims1;
ftnlen b, b0, b1, ex, no, nomax, size, span;
ftnint no1, no2, type;