vcpkg/ports/openblas/fix-uwp-build.patch
nicole mazzuca 9ccd693f1b
[toolchain windows] set CMAKE_SYSTEM_PROCESSOR (#24100)
* [toolchain windows] set CMAKE_SYSTEM_NAME and CMAKE_SYSTEM_PROCESSOR

In specific, I did this for the cpuinfo PR - I realized the reason
that cpuinfo doesn't support arm64 windows cross compilation is because
we don't set CMAKE_SYSTEM_PROCESSOR.

* correctly set CMAKE_CROSSCOMPILING

* start fixin libraries

* more changes:

- gainput: remove line
- glog: remove try_run when cross compiling
- windows.cmake: set CMAKE_SYSTEM_VERSION

* more patches

- mapnik: set BOOST_REGEX_HAS_ICU to avoid check_cxx_source_runs
- orc: set HAS_PRE_1970 and HAS_POST_2038 for same
- seal: change out check_cxx_source_runs for check_cxx_source_compiles

* more changes

* fix x86-windows

* fix qpid-proton, glog

* build corrade-rc

* fix x64-uwp ports

* forgot to _actually_ always build corrade-rc .,.

* Replay #22831

* Dedupe CMAKE_SYSTEM_NAME settings.

* Add quotes for corrade_rc_param

Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>

* Update version DB.

Co-authored-by: nicole mazzuca <mazzucan@outlook.com>
Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>
2022-04-29 11:40:30 -07:00

160 lines
5.0 KiB
Diff

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));
--- a/driver/others/CMakeLists.txt
+++ b/driver/others/CMakeLists.txt
@@ -1,20 +1,23 @@
include_directories(${PROJECT_SOURCE_DIR})
include_directories(${PROJECT_BINARY_DIR})
+if(WIN32)
+ add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
+endif()
if (${CORE} STREQUAL "PPC440")
set(MEMORY memory_qalloc.c)
else ()
set(MEMORY memory.c)
endif ()
if (USE_THREAD)
if (USE_OPENMP)
set(BLAS_SERVER blas_server_omp.c)
- elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+ elseif (WIN32)
set(BLAS_SERVER blas_server_win32.c)
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "WindowsStore")
set(BLAS_SERVER blas_server_win32.c)
endif ()
if (NOT DEFINED BLAS_SERVER)
--- a/cmake/os.cmake
+++ b/cmake/os.cmake
@@ -15,13 +15,13 @@
if (${CMAKE_SYSTEM_NAME} STREQUAL "AIX")
set(EXTRALIB "${EXTRALIB} -lm")
endif ()
# TODO: this is probably meant for mingw, not other windows compilers
-if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+if (WIN32)
set(NEED_PIC 0)
set(NO_EXPRECISION 1)
set(EXTRALIB "${EXTRALIB} -defaultlib:advapi32")
@@ -66,13 +66,13 @@
if (CYGWIN)
set(NEED_PIC 0)
set(NO_EXPRECISION 1)
endif ()
-if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows" AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Interix" AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Android")
+if (NOT WIN32 AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Interix" AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Android")
if (USE_THREAD)
set(EXTRALIB "${EXTRALIB} -lpthread")
endif ()
endif ()
if (QUAD_PRECISION)
--- a/cmake/system.cmake
+++ b/cmake/system.cmake
@@ -422,22 +422,22 @@
endif ()
if (USE_SIMPLE_THREADED_LEVEL3)
set(CCOMMON_OPT "${CCOMMON_OPT} -DUSE_SIMPLE_THREADED_LEVEL3")
endif ()
-if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+if (NOT WIN32)
if (DEFINED MAX_STACK_ALLOC)
if (NOT ${MAX_STACK_ALLOC} EQUAL 0)
set(CCOMMON_OPT "${CCOMMON_OPT} -DMAX_STACK_ALLOC=${MAX_STACK_ALLOC}")
endif ()
else ()
set(CCOMMON_OPT "${CCOMMON_OPT} -DMAX_STACK_ALLOC=2048")
endif ()
endif ()
-if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+if (NOT WIN32)
if (DEFINED BLAS3_MEM_ALLOC_THRESHOLD)
if (NOT ${BLAS3_MEM_ALLOC_THRESHOLD} EQUAL 32)
set(CCOMMON_OPT "${CCOMMON_OPT} -DBLAS3_MEM_ALLOC_THRESHOLD=${BLAS3_MEM_ALLOC_THRESHOLD}")
endif()
endif()
endif()
@@ -544,13 +544,13 @@
#For LAPACK Fortran codes.
set(LAPACK_FFLAGS "${LAPACK_FFLAGS} ${CMAKE_Fortran_FLAGS}")
set(LAPACK_FPFLAGS "${LAPACK_FPFLAGS} ${FPFLAGS}")
#Disable -fopenmp for LAPACK Fortran codes on Windows.
-if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+if (NOT WIN32)
set(FILTER_FLAGS "-fopenmp;-mp;-openmp;-xopenmp=parallel")
foreach (FILTER_FLAG ${FILTER_FLAGS})
string(REPLACE ${FILTER_FLAG} "" LAPACK_FFLAGS ${LAPACK_FFLAGS})
string(REPLACE ${FILTER_FLAG} "" LAPACK_FPFLAGS ${LAPACK_FPFLAGS})
endforeach ()
endif ()
@@ -562,17 +562,17 @@
set(LAPACK_CFLAGS "${CMAKE_C_CFLAGS} -DHAVE_LAPACK_CONFIG_H")
if (INTERFACE64)
set(LAPACK_CFLAGS "${LAPACK_CFLAGS} -DLAPACK_ILP64")
endif ()
-if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+if (WIN32)
set(LAPACK_CFLAGS "${LAPACK_CFLAGS} -DOPENBLAS_OS_WINDOWS")
endif ()
-if (${CMAKE_C_COMPILER} STREQUAL "LSB" OR ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+if (${CMAKE_C_COMPILER} STREQUAL "LSB" OR WIN32)
set(LAPACK_CFLAGS "${LAPACK_CFLAGS} -DLAPACK_COMPLEX_STRUCTURE")
endif ()
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
if ("${F_COMPILER}" STREQUAL "FLANG")
if (${CMAKE_Fortran_COMPILER_VERSION} VERSION_LESS_EQUAL 3)