From 30317983c4c9100d8455d4b9599e6a512e797902 Mon Sep 17 00:00:00 2001 From: CoderRC <108188026+CoderRC@users.noreply.github.com> Date: Mon, 27 Mar 2023 20:47:37 -0400 Subject: [PATCH] Added support for _POSIX_MAPPED_FILES if defined in source I have created my own library for mingw32 that includes the POSIX functions that the source needs to compile. That is how I will support llama.cpp for windows using mingw32 compilation in mys2. Compiled successfully using: make LDFLAGS='-D_POSIX_MAPPED_FILES -lmingw32_extended' --- main.cpp | 2 ++ mmap.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index 4b2afa54d..6738569ff 100644 --- a/main.cpp +++ b/main.cpp @@ -19,6 +19,8 @@ #include #include #include +#elif defined (_POSIX_MAPPED_FILES) +#include #endif #define ROUNDUP(X, K) (((X) + (K)-1) & -(K)) diff --git a/mmap.h b/mmap.h index 3559f51a3..87b9e7c64 100644 --- a/mmap.h +++ b/mmap.h @@ -17,7 +17,7 @@ #include #include -#if defined(_MSC_VER) || defined(__MINGW32__) +#if defined(_MSC_VER) || defined(__MINGW32__) && !(defined (_POSIX_MAPPED_FILES)) #ifndef __MINGW32__ #include #else