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'
This commit is contained in:
CoderRC 2023-03-27 20:47:37 -04:00 committed by GitHub
parent 0b5448a3a4
commit 30317983c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -19,6 +19,8 @@
#include <unistd.h> #include <unistd.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/stat.h> #include <sys/stat.h>
#elif defined (_POSIX_MAPPED_FILES)
#include <sys/mman.h>
#endif #endif
#define ROUNDUP(X, K) (((X) + (K)-1) & -(K)) #define ROUNDUP(X, K) (((X) + (K)-1) & -(K))

2
mmap.h
View file

@ -17,7 +17,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <sys/stat.h> #include <sys/stat.h>
#if defined(_MSC_VER) || defined(__MINGW32__) #if defined(_MSC_VER) || defined(__MINGW32__) && !(defined (_POSIX_MAPPED_FILES))
#ifndef __MINGW32__ #ifndef __MINGW32__
#include <Windows.h> #include <Windows.h>
#else #else