superslicer-2.5.59.2-link-occtwrapper-statically.patch 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
  2. index b84292b..63fea9c 100644
  3. --- a/src/CMakeLists.txt
  4. +++ b/src/CMakeLists.txt
  5. @@ -19,7 +19,7 @@ add_subdirectory(libnest2d)
  6. add_subdirectory(libslic3r)
  7. if (SLIC3R_ENABLE_FORMAT_STEP)
  8. - add_subdirectory(occt_wrapper)
  9. + add_subdirectory(occt_wrapper EXCLUDE_FROM_ALL)
  10. endif ()
  11. if (SLIC3R_GUI)
  12. diff --git a/src/libslic3r/CMakeLists.txt b/src/libslic3r/CMakeLists.txt
  13. index 36917f3..63c4201 100644
  14. --- a/src/libslic3r/CMakeLists.txt
  15. +++ b/src/libslic3r/CMakeLists.txt
  16. @@ -435,10 +435,7 @@ target_link_libraries(libslic3r
  17. qoi
  18. )
  19. -if (APPLE)
  20. - # TODO: we need to fix notarization with the separate shared library
  21. - target_link_libraries(libslic3r OCCTWrapper)
  22. -endif ()
  23. +target_link_libraries(libslic3r OCCTWrapper)
  24. if (TARGET OpenVDB::openvdb)
  25. target_link_libraries(libslic3r OpenVDB::openvdb)
  26. diff --git a/src/libslic3r/Format/STEP.cpp b/src/libslic3r/Format/STEP.cpp
  27. index 5165bb7..3ed0154 100644
  28. --- a/src/libslic3r/Format/STEP.cpp
  29. +++ b/src/libslic3r/Format/STEP.cpp
  30. @@ -22,17 +22,13 @@
  31. namespace Slic3r {
  32. -#if __APPLE__
  33. extern "C" bool load_step_internal(const char *path, OCCTResult* res);
  34. -#endif
  35. LoadStepFn get_load_step_fn()
  36. {
  37. static LoadStepFn load_step_fn = nullptr;
  38. -#ifndef __APPLE__
  39. constexpr const char* fn_name = "load_step_internal";
  40. -#endif
  41. if (!load_step_fn) {
  42. auto libpath = boost::dll::program_location().parent_path();
  43. @@ -54,22 +50,8 @@ LoadStepFn get_load_step_fn()
  44. FreeLibrary(module);
  45. throw;
  46. }
  47. -#elif __APPLE__
  48. - load_step_fn = &load_step_internal;
  49. #else
  50. - libpath /= "OCCTWrapper.so";
  51. - void *plugin_ptr = dlopen(libpath.c_str(), RTLD_NOW | RTLD_GLOBAL);
  52. -
  53. - if (plugin_ptr) {
  54. - load_step_fn = reinterpret_cast<LoadStepFn>(dlsym(plugin_ptr, fn_name));
  55. - if (!load_step_fn) {
  56. - dlclose(plugin_ptr);
  57. - throw Slic3r::RuntimeError(std::string("Cannot load function from OCCTWrapper.so: ") + fn_name
  58. - + "\n\n" + dlerror());
  59. - }
  60. - } else {
  61. - throw Slic3r::RuntimeError(std::string("Cannot load OCCTWrapper.so:\n\n") + dlerror());
  62. - }
  63. + load_step_fn = &load_step_internal;
  64. #endif
  65. }
  66. diff --git a/src/occt_wrapper/CMakeLists.txt b/src/occt_wrapper/CMakeLists.txt
  67. index 16de4e0..ad983be 100644
  68. --- a/src/occt_wrapper/CMakeLists.txt
  69. +++ b/src/occt_wrapper/CMakeLists.txt
  70. @@ -1,12 +1,7 @@
  71. cmake_minimum_required(VERSION 3.13)
  72. project(OCCTWrapper)
  73. -if (APPLE)
  74. - # TODO: we need to fix notarization with the separate shared library
  75. - add_library(OCCTWrapper STATIC OCCTWrapper.cpp)
  76. -else ()
  77. - add_library(OCCTWrapper MODULE OCCTWrapper.cpp)
  78. -endif ()
  79. +add_library(OCCTWrapper STATIC OCCTWrapper.cpp)
  80. set_target_properties(OCCTWrapper
  81. PROPERTIES