Skip to content

Commit

Permalink
fix BSD compilation issue.
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
brlcad committed Aug 6, 2024
1 parent 95696c2 commit 6f9914c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
3 changes: 2 additions & 1 deletion opennurbs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions opennurbs/opennurbs_defines_cpp.patch
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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")))
Expand Down

0 comments on commit 6f9914c

Please sign in to comment.