From 6f9914ca14827fd40fa1ec06b42234bc43abb187 Mon Sep 17 00:00:00 2001 From: Christopher Sean Morrison Date: Tue, 6 Aug 2024 10:19:51 -0400 Subject: [PATCH] fix BSD compilation issue. fcloseall() on BSD returns void, so can't directly use it as a return on a function that returns int. instead of manually rolling a version that reports how many were closed, we just close all and say 0 (aiming to avoid any error-checking callers while still closing all handles). --- opennurbs/CMakeLists.txt | 3 ++- opennurbs/opennurbs_defines_cpp.patch | 14 ++++++++++++++ ...rbs_defines.patch => opennurbs_defines_h.patch} | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 opennurbs/opennurbs_defines_cpp.patch rename opennurbs/{opennurbs_defines.patch => opennurbs_defines_h.patch} (99%) diff --git a/opennurbs/CMakeLists.txt b/opennurbs/CMakeLists.txt index c4430158..b49d0bf6 100644 --- a/opennurbs/CMakeLists.txt +++ b/opennurbs/CMakeLists.txt @@ -22,7 +22,8 @@ if (ENABLE_OPENNURBS) COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/opennurbs_brep_h.patch COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/opennurbs_cmake.patch COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/opennurbs_compress.patch - COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/opennurbs_defines.patch + COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/opennurbs_defines_h.patch + COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/opennurbs_defines_cpp.patch COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/opennurbs_example_brep.patch COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/opennurbs_example_gl.patch COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/opennurbs_file_utilities.patch diff --git a/opennurbs/opennurbs_defines_cpp.patch b/opennurbs/opennurbs_defines_cpp.patch new file mode 100644 index 00000000..db7d98ca --- /dev/null +++ b/opennurbs/opennurbs_defines_cpp.patch @@ -0,0 +1,14 @@ +diff --git a/opennurbs_defines.cpp b/opennurbs_defines.cpp +index 8d5f8830..1f60f588 100644 +--- a/opennurbs_defines.cpp ++++ b/opennurbs_defines.cpp +@@ -498,6 +498,9 @@ int ON::CloseAllFiles() + #elif defined(ON_RUNTIME_APPLE) || defined(ON_RUNTIME_ANDROID) + //fcloseall is not supported on mac/ios or android + return EOF; ++#elif defined(BSD) ++ fcloseall(); ++ return 0; + #else + return fcloseall(); + #endif diff --git a/opennurbs/opennurbs_defines.patch b/opennurbs/opennurbs_defines_h.patch similarity index 99% rename from opennurbs/opennurbs_defines.patch rename to opennurbs/opennurbs_defines_h.patch index d9f4cd06..259d8d90 100644 --- a/opennurbs/opennurbs_defines.patch +++ b/opennurbs/opennurbs_defines_h.patch @@ -8,7 +8,7 @@ +#define ON_CLASS __attribute__ ((visibility ("default"))) +#define ON_DECL __attribute__ ((visibility ("default"))) +#define ON_EXTERN_DECL __attribute__ ((visibility ("default"))) -+ ++ #elif defined(ON_COMPILER_CLANG) /* using opennurbs as an Apple shared library */ #define ON_CLASS __attribute__ ((visibility ("default")))