macos build fix

This commit is contained in:
2024-10-05 00:21:00 +03:00
parent e64ee54c2a
commit 7e0f829970
2 changed files with 6 additions and 0 deletions

View File

@@ -500,6 +500,8 @@ add_definitions("-D __SPF_BUILT_IN_PPPA")
if (WIN32)
target_link_libraries(Sapfor_F SageNewSrc SageLib SageOldSrc)
elseif(APPLE)
target_link_libraries(Sapfor_F SageNewSrc SageLib SageOldSrc pthread)
elseif(UNIX)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0)
target_link_libraries(Sapfor_F SageNewSrc SageLib SageOldSrc pthread stdc++fs)

View File

@@ -66,7 +66,11 @@ class StdCapture
ret = pipe(pipes, 1024 * 1024 * 20, O_BINARY); // 20 MB
#else
ret = pipe(pipes) == -1;
#ifdef __APPLE__
fcntl(*pipes, F_PREALLOCATE, 1024 * 1024 * 20);
#else
fcntl(*pipes, F_SETPIPE_SZ, 1024 * 1024 * 20);
#endif
#endif
fd_blocked = (errno == EINTR || errno == EBUSY);
if (fd_blocked)