Skip to content

Commit

Permalink
[clapack] Remove broken host-arithchk (microsoft#17573)
Browse files Browse the repository at this point in the history
  • Loading branch information
ras0219-msft authored Jun 11, 2021
1 parent b112843 commit c0bca71
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 26 deletions.
9 changes: 9 additions & 0 deletions ports/clapack/arith_linux64.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#define IEEE_8087
#define Arith_Kind_ASL 1
#define Long int
#define Intcast (int)(long)
#define Double_Align
#define X64_bit_pointers
#define NO_LONG_LONG
#define QNaN0 0x0
#define QNaN1 0xfff80000
12 changes: 12 additions & 0 deletions ports/clapack/arith_osx.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* Suitable for macOS on x86_64 and arm64 */
/* Not suitable for 32-bit macOS */

#define IEEE_8087
#define Arith_Kind_ASL 1
#define Long int
#define Intcast (int)(long)
#define Double_Align
#define X64_bit_pointers
#define NANCHECK
#define QNaN0 0x0
#define QNaN1 0x7ff80000
8 changes: 8 additions & 0 deletions ports/clapack/arith_win32.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* Windows 32-bit */

#define IEEE_8087
#define Arith_Kind_ASL 1
#define Double_Align
#define NANCHECK
#define QNaN0 0x0
#define QNaN1 0x7ff80000
9 changes: 9 additions & 0 deletions ports/clapack/arith_win64.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* Windows 64-bit */

#define IEEE_8087
#define Arith_Kind_ASL 1
#define Double_Align
#define X64_bit_pointers
#define NANCHECK
#define QNaN0 0x0
#define QNaN1 0x7ff80000
27 changes: 22 additions & 5 deletions ports/clapack/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,27 @@ vcpkg_extract_source_archive_ex(
support-uwp.patch
)

if(NOT TARGET_TRIPLET STREQUAL HOST_TRIPLET)
set(ARITHCHK_PATH ${CURRENT_HOST_INSTALLED_DIR}/tools/clapack/arithchk${VCPKG_HOST_EXECUTABLE_SUFFIX})
if(NOT EXISTS "${ARITHCHK_PATH}")
message(FATAL_ERROR "Expected ${ARITHCHK_PATH} to exist.")
set(ARITH_PATH)
if(DEFINED CLAPACK_ARITH_PATH)
set(ARITH_PATH "-DARITH_PATH=${CLAPACK_ARITH_PATH}")
elseif(NOT TARGET_TRIPLET STREQUAL HOST_TRIPLET)
if(VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_UWP)
if(VCPKG_TARGET_ARCHITECTURE MATCHES "^x64$|^arm64$")
set(ARITH_PATH "-DARITH_PATH=${CMAKE_CURRENT_LIST_DIR}/arith_win64.h")
else()
set(ARITH_PATH "-DARITH_PATH=${CMAKE_CURRENT_LIST_DIR}/arith_win32.h")
endif()
elseif(VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_IOS)
set(ARITH_PATH "-DARITH_PATH=${CMAKE_CURRENT_LIST_DIR}/arith_osx.h")
elseif(VCPKG_TARGET_IS_LINUX AND VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
set(ARITH_PATH "-DARITH_PATH=${CMAKE_CURRENT_LIST_DIR}/arith_linux64.h")
else()
message(WARNING
"Unable to cross-compile clapack for ${VCPKG_TARGET_ARCHITECTURE}-${VCPKG_CMAKE_SYSTEM_NAME}.
No arith.h is available and arithchk must be executed for the target.
To fix this issue, define CLAPACK_ARITH_PATH in your triplet to the location of a pre-generated arith.h file.
Continuing with trying to run arithchk anyway.")
endif()
endif()

Expand All @@ -32,7 +49,7 @@ vcpkg_configure_cmake(
PREFER_NINJA
OPTIONS
-DCMAKE_DEBUG_POSTFIX=d
-DARITHCHK_PATH=${ARITHCHK_PATH}
${ARITH_PATH}
)

vcpkg_install_cmake()
Expand Down
20 changes: 6 additions & 14 deletions ports/clapack/support-uwp.patch
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ index db58b4e..0fb61a0 100644
# _zrotg_ seems to be missing in the wrap header
add_definitions(-DNO_BLAS_WRAP)
endif()
+if (ARITHCHK_PATH)
+if (MSVC)
+ add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
+endif()
include_directories(${CLAPACK_SOURCE_DIR}/INCLUDE)
Expand All @@ -21,11 +21,11 @@ index 094614a..e5b40ab 100644
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
+ )
+if (ARITH_PATH)
+configure_file(
+ "${ARITH_PATH}"
+ "${CMAKE_CURRENT_BINARY_DIR}/arith.h"
+ COPYONLY)
+else()
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/arith.h
Expand All @@ -37,14 +37,6 @@ index 094614a..e5b40ab 100644

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)

+if (NOT ARITHCHK_PATH)
+ install(TARGETS arithchk RUNTIME DESTINATION tools/clapack)
+endif()
\ 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
Expand Down
8 changes: 2 additions & 6 deletions ports/clapack/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
{
"name": "clapack",
"version-string": "3.2.1",
"port-version": 17,
"port-version": 18,
"description": "CLAPACK (f2c'ed version of LAPACK)",
"homepage": "https://www.netlib.org/clapack",
"dependencies": [
"blas",
{
"name": "clapack",
"host": true
}
"blas"
]
}
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -1262,7 +1262,7 @@
},
"clapack": {
"baseline": "3.2.1",
"port-version": 17
"port-version": 18
},
"clara": {
"baseline": "1.1.5",
Expand Down
5 changes: 5 additions & 0 deletions versions/c-/clapack.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "229447785643f09b1a4ef53bab355ff3757e178e",
"version-string": "3.2.1",
"port-version": 18
},
{
"git-tree": "a75c0e3b1dbe8fa6cd276b2a6fc5b61b19e9ea45",
"version-string": "3.2.1",
Expand Down

0 comments on commit c0bca71

Please sign in to comment.