Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve STEP file import on Linux #13761

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/libslic3r/Format/STEP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ LoadStepFn get_load_step_fn()
#endif

if (!load_step_fn) {
auto libpath = boost::dll::program_location().parent_path();
#ifdef _WIN32
auto libpath = boost::dll::program_location().parent_path();
libpath /= "OCCTWrapper.dll";
HMODULE module = LoadLibraryW(libpath.wstring().c_str());
if (module == NULL)
Expand All @@ -61,8 +61,8 @@ LoadStepFn get_load_step_fn()
#elif __APPLE__
load_step_fn = &load_step_internal;
#else
libpath /= "OCCTWrapper.so";
void *plugin_ptr = dlopen(libpath.c_str(), RTLD_NOW | RTLD_GLOBAL);
// This is installed into /usr/lib(64)/ and dlopen will search there.
void *plugin_ptr = dlopen("OCCTWrapper.so", RTLD_NOW | RTLD_GLOBAL);

if (plugin_ptr) {
load_step_fn = reinterpret_cast<LoadStepFn>(dlsym(plugin_ptr, fn_name));
Expand Down
49 changes: 20 additions & 29 deletions src/occt_wrapper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,35 +19,23 @@ include(GenerateExportHeader)

generate_export_header(OCCTWrapper)

find_package(OpenCASCADE 7.6.1 REQUIRED)
find_package(OpenCASCADE REQUIRED)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid this will conflict with expectations from c6a0210.

Specifically for Fedora I filed https://bugzilla.redhat.com/show_bug.cgi?id=2333653 as the issue does not seem to be fixed in OCCT 2.8.1 which we have there.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fedora already has OpenCascade 7.8.1. Looking at https://tracker.dev.opencascade.org/ I'm not able to find a bug report about it.

I wonder if this has been reported upstream.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The very same question popped into my head, I asked about it in #12122 (comment).

# OpenCASCADE has an exact version match even if you don't specify the EXACT
# keyword in the find_package(). So lets implement it on our own.
set(OPENCASCADE_MODULE_VERSION
"${OpenCASCADE_MAJOR_VERSION}.${OpenCASCADE_MINOR_VERSION}.${OpenCASCADE_MAINTENANCE_VERSION}")
set(OPENCASCADE_REQUIRED_VERSION "7.8.0")
if (${OPENCASCADE_MODULE_VERSION} VERSION_LESS ${OPENCASCADE_REQUIRED_VERSION})
message(
FATAL_ERROR
"Coun't find a compatible OpenCASCADE version - "
"required: ${OPENCASCADE_REQUIRED_VERSION}, found: "
"${OPENCASCADE_MODULE_VERSION}"
)
endif()

set(OCCT_LIBS
TKXDESTEP
TKSTEP
TKSTEP209
TKSTEPAttr
TKSTEPBase
TKXCAF
TKXSBase
TKVCAF
TKCAF
TKLCAF
TKCDF
TKV3d
TKService
TKMesh
TKBO
TKPrim
TKHLR
TKShHealing
TKTopAlgo
TKGeomAlgo
TKBRep
TKGeomBase
TKG3d
TKG2d
TKMath
TKernel
TKDESTEP
)

slic3r_remap_configs("${OCCT_LIBS}" RelWithDebInfo Release)
Expand All @@ -59,5 +47,8 @@ target_link_libraries(OCCTWrapper libslic3r admesh)

include(GNUInstallDirs)

install(TARGETS OCCTWrapper DESTINATION "${CMAKE_INSTALL_BINDIR}")

if (WIN32 OR APPLE)
install(TARGETS OCCTWrapper DESTINATION "${CMAKE_INSTALL_BINDIR}")
else()
install(TARGETS OCCTWrapper DESTINATION "${CMAKE_INSTALL_LIBDIR}")
endif()