From 7e0f8299702689872ea6941d6f050d36b41d0839 Mon Sep 17 00:00:00 2001 From: Egor Mayorov Date: Sat, 5 Oct 2024 00:21:00 +0300 Subject: [PATCH] macos build fix --- sapfor/experts/Sapfor_2017/CMakeLists.txt | 2 ++ .../experts/Sapfor_2017/_src/ProjectManipulation/StdCapture.h | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/sapfor/experts/Sapfor_2017/CMakeLists.txt b/sapfor/experts/Sapfor_2017/CMakeLists.txt index f3f4abf..b06ff45 100644 --- a/sapfor/experts/Sapfor_2017/CMakeLists.txt +++ b/sapfor/experts/Sapfor_2017/CMakeLists.txt @@ -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) diff --git a/sapfor/experts/Sapfor_2017/_src/ProjectManipulation/StdCapture.h b/sapfor/experts/Sapfor_2017/_src/ProjectManipulation/StdCapture.h index 4867c7a..2878448 100644 --- a/sapfor/experts/Sapfor_2017/_src/ProjectManipulation/StdCapture.h +++ b/sapfor/experts/Sapfor_2017/_src/ProjectManipulation/StdCapture.h @@ -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) -- 2.49.1