vcpkg/ports/openblas/uwp.patch
Daniel Ju 6f979a9017
[openblas] Support arm64-uwp builds (#32067)
* [openblas] Support arm64-uwp build

* Update version

* Merge UWP patches and don't set CMAKE_SYSTEM_PROCESSOR.

* Simplify supports clause.

---------

Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
2023-06-21 22:20:01 -07:00

86 lines
3.8 KiB
Diff

diff --git a/cmake/prebuild.cmake b/cmake/prebuild.cmake
index 730555a..1b09e00 100644
--- a/cmake/prebuild.cmake
+++ b/cmake/prebuild.cmake
@@ -39,6 +39,9 @@
# CPUIDEMU = ../../cpuid/table.o
+if (NOT DEFINED BLASHELPER_BINARY_DIR)
+ set(BLASHELPER_BINARY_DIR "${PROJECT_BINARY_DIR}")
+endif ()
if (DEFINED CPUIDEMU)
set(EXFLAGS "-DCPUIDEMU -DVENDOR=99")
@@ -1401,8 +1404,8 @@ else(NOT CMAKE_CROSSCOMPILING)
message(STATUS "Running getarch")
# use the cmake binary w/ the -E param to run a shell command in a cross-platform way
-execute_process(COMMAND "${PROJECT_BINARY_DIR}/${GETARCH_BIN}" 0 OUTPUT_VARIABLE GETARCH_MAKE_OUT)
-execute_process(COMMAND "${PROJECT_BINARY_DIR}/${GETARCH_BIN}" 1 OUTPUT_VARIABLE GETARCH_CONF_OUT)
+execute_process(COMMAND "${BLASHELPER_BINARY_DIR}/${GETARCH_BIN}" 0 OUTPUT_VARIABLE GETARCH_MAKE_OUT)
+execute_process(COMMAND "${BLASHELPER_BINARY_DIR}/${GETARCH_BIN}" 1 OUTPUT_VARIABLE GETARCH_CONF_OUT)
message(STATUS "GETARCH results:\n${GETARCH_MAKE_OUT}")
@@ -1430,8 +1433,8 @@ execute_process(COMMAND "${PROJECT_BINARY_DIR}/${GETARCH_BIN}" 1 OUTPUT_VARIABLE
endif ()
# use the cmake binary w/ the -E param to run a shell command in a cross-platform way
-execute_process(COMMAND "${PROJECT_BINARY_DIR}/${GETARCH2_BIN}" 0 OUTPUT_VARIABLE GETARCH2_MAKE_OUT)
-execute_process(COMMAND "${PROJECT_BINARY_DIR}/${GETARCH2_BIN}" 1 OUTPUT_VARIABLE GETARCH2_CONF_OUT)
+execute_process(COMMAND "${BLASHELPER_BINARY_DIR}/${GETARCH2_BIN}" 0 OUTPUT_VARIABLE GETARCH2_MAKE_OUT)
+execute_process(COMMAND "${BLASHELPER_BINARY_DIR}/${GETARCH2_BIN}" 1 OUTPUT_VARIABLE GETARCH2_CONF_OUT)
# append config data from getarch_2nd to the TARGET file and read in CMake vars
file(APPEND "${TARGET_CONF_TEMP}" ${GETARCH2_CONF_OUT})
diff --git a/cmake/system.cmake b/cmake/system.cmake
index 631e7fe..83220ce 100644
--- a/cmake/system.cmake
+++ b/cmake/system.cmake
@@ -13,6 +13,9 @@ if(CMAKE_CROSSCOMPILING AND NOT DEFINED TARGET)
set(TARGET "ARMV8")
elseif(ARM)
set(TARGET "ARMV7") # TODO: Ask compiler which arch this is
+ elseif(${HOST_OS} STREQUAL "WINDOWSSTORE")
+ set(CMAKE_CROSSCOMPILING 0)
+ add_definitions(-D_CRT_SECURE_NO_WARNINGS=1)
else()
message(FATAL_ERROR "When cross compiling, a TARGET is required.")
endif()
diff --git a/common_stackalloc.h b/common_stackalloc.h
index d3d5466..cd157fc 100644
--- a/common_stackalloc.h
+++ b/common_stackalloc.h
@@ -36,7 +36,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define STACK_ALLOC_PROTECT_CHECK
#endif
-#if defined(MAX_STACK_ALLOC) && MAX_STACK_ALLOC > 0
+#if defined(MAX_STACK_ALLOC) && MAX_STACK_ALLOC > 0 && !(defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP))
/*
* Allocate a buffer on the stack if the size is smaller than MAX_STACK_ALLOC.
@@ -63,7 +63,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endif
-#if defined(MAX_STACK_ALLOC) && MAX_STACK_ALLOC > 0
+#if defined(MAX_STACK_ALLOC) && MAX_STACK_ALLOC > 0 && !(defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP))
#define STACK_FREE(BUFFER) \
STACK_ALLOC_PROTECT_CHECK \
if(!stack_alloc_size) \
diff --git a/interface/zgemv.c b/interface/zgemv.c
index 3e98dba..ee597f7 100644
--- a/interface/zgemv.c
+++ b/interface/zgemv.c
@@ -244,7 +244,7 @@ void CNAME(enum CBLAS_ORDER order,
buffer_size = (buffer_size + 3) & ~3;
STACK_ALLOC(buffer_size, FLOAT, buffer);
-#if defined(ARCH_X86_64) && defined(MAX_STACK_ALLOC) && MAX_STACK_ALLOC > 0
+#if defined(ARCH_X86_64) && defined(MAX_STACK_ALLOC) && MAX_STACK_ALLOC > 0 && !(defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP))
// cgemv_t.S return NaN if there are NaN or Inf in the buffer (see bug #746)
if(trans && stack_alloc_size)
memset(buffer, 0, MIN(BUFFER_SIZE, sizeof(FLOAT) * buffer_size));