MantisBT - Community
View Issue Details
0032035Community[OCCT] OCCT:Configurationpublic2020-12-31 20:322021-01-12 15:48
efferre79 
efferre79 
normalmajor 
feedbackopen 
LinuxGentoorolling
[OCCT] 7.4.0 
[OCCT] 7.6.0* 
0032035: Configuration - bug in OpenCASCADEConfig.cmake when using INSTALL_DIR_CMAKE
when using INSTALL_DIR_CMAKE during the configuration phase, it's possible to change the installation location of cmake files

OpenCASCADEConfig.cmake defines opencascade installation root (variable) OpenCASCADE_INSTALL_PREFIX starting from the path of cmake file itself by assuming the cmake file is installed below the same path of the include and lib files. This is true only in the case INSTALL_DIR_CMAKE is not defined externally

the result is that find_package(OpenCASCADE) sets wrong OpenCASCADE_*_DIR variables in 3rd part cmake files trying to look for opencascade

The same applies for latest 7.5.0.
configure opencascade by using
$ cmake -DINSTALL_DIR_CMAKE=/usr/lib64/cmake 
No tags attached.
related to 0032046feedback taoyouh Configuration - CMake Installs .lib files to libd instead of lib on Windows 
Issue History
2020-12-31 20:32efferre79New Issue
2020-12-31 20:32efferre79Assigned To => bugmaster
2021-01-01 14:31kgvTarget Version => 7.6.0*
2021-01-01 14:31kgvSummarybug in OpenCASCADEConfig.cmake when using INSTALL_DIR_CMAKE => Configuration - bug in OpenCASCADEConfig.cmake when using INSTALL_DIR_CMAKE
2021-01-01 14:31kgvSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=24265#r24265
2021-01-11 14:45bugmasterNote Added: 0098068
2021-01-11 14:45bugmasterAssigned Tobugmaster => efferre79
2021-01-11 14:45bugmasterStatusnew => assigned
2021-01-11 15:20bugmasterStatusassigned => feedback
2021-01-12 15:23efferre79Note Added: 0098094
2021-01-12 15:36kgvNote Added: 0098095
2021-01-12 15:37kgvNote Edited: 0098095bug_revision_view_page.php?bugnote_id=98095#r24291
2021-01-12 15:38kgvNote Edited: 0098095bug_revision_view_page.php?bugnote_id=98095#r24292
2021-01-12 15:39kgvNote Edited: 0098095bug_revision_view_page.php?bugnote_id=98095#r24293
2021-01-12 15:39kgvNote Edited: 0098095bug_revision_view_page.php?bugnote_id=98095#r24294
2021-01-12 15:43kgvNote Edited: 0098095bug_revision_view_page.php?bugnote_id=98095#r24295
2021-01-12 15:43kgvNote Edited: 0098095bug_revision_view_page.php?bugnote_id=98095#r24296
2021-01-12 15:44kgvNote Edited: 0098095bug_revision_view_page.php?bugnote_id=98095#r24297
2021-01-12 15:44kgvRelationship addedrelated to 0032046
2021-01-12 15:45kgvNote Edited: 0098095bug_revision_view_page.php?bugnote_id=98095#r24298
2021-01-12 15:45kgvDescription Updatedbug_revision_view_page.php?rev_id=24300#r24300
2021-01-12 15:45kgvAdditional Information Updatedbug_revision_view_page.php?rev_id=24302#r24302
2021-01-12 15:47kgvNote Edited: 0098095bug_revision_view_page.php?bugnote_id=98095#r24303

Notes
(0098068)
bugmaster   
2021-01-11 14:45   
Hi,

INSTALL_DIR_... variables set location of folders cmake, doc, samples, etc relative INSTALL_DIR variable.
If you really need to redefine INSTALL_DIR_CMAKE externally use relative paths.

(0098094)
efferre79   
2021-01-12 15:23   
I am working under Linux

The cmake files are found on typical locations as indicated in https://cmake.org/cmake/help/latest/command/find_package.html [^] so it's better to install below /usr/lib${LIB_SUFFIX}/cmake/opencascade-${VERSION}.

I am trying to create an installation where there are many parallel versions of opencascade available, the simplest way is to install everything under a separate directory but the cmake files which should be installed as explained above (in the past the root path was something like /usr/lib64/opencascade-7.4.0/ros). Alternatively by using -DINSTALL_DIR_WITH_VERSION=ON it's possible to install in the default destination (e.g. below /usr) but there are some files which are not versioned, e.g. some binaries

/usr/bin/custom.sh
/usr/bin/custom_gcc_64.sh
/usr/bin/draw.sh
/usr/bin/env.sh
/usr/bin/sample.sh
(0098095)
kgv   
2021-01-12 15:36   
(edited on: 2021-01-12 15:47)
Just to comment *.sh scripts. Files like
> /usr/bin/custom.sh
> /usr/bin/custom_gcc_64.sh
> /usr/bin/draw.sh
> /usr/bin/env.sh

are hacks to pre-configure environment to libraries and resources within development environment.
E.g., when OCCT is not actually installed system-wide but placed somewhere within $HOME directory.
This is a common way for developing OCCT-based application relying not on OCCT packages provided by Linux distributive.

When installing DRAWEXE system-wide, starting executable directly should not require any $LD_LIBRARY_PATH hacks and application should be able to find resource files in their default locations (hence global variables like $CSF_OCCTResourcePath/$CSF_DrawPluginDefaults should not be necessary as well).

searchResources() function in src/Draw/Draw.cxx defines resource look up by Draw Harness - at first it tries to find resources within "/share/opencascade-7.6.0.dev/" folder with fully qualified version and then fallbacks to shorter options:
 ("/share/opencascade-" OCC_VERSION_STRING_EXT "/") + theResName,
 ("/share/opencascade-" OCC_VERSION_COMPLETE "/") + theResName,
 ("/share/opencascade-" OCC_VERSION_STRING "/") + theResName,
 ("/share/opencascade/") + theResName,
 ("/share/occt-" OCC_VERSION_STRING_EXT "/") + theResName,
 ("/share/occt-" OCC_VERSION_COMPLETE "/") + theResName,
 ("/share/occt-" OCC_VERSION_STRING "/") + theResName,
 ("/share/occt/") + theResName,


Apart from Draw Harness plugins and Tcl scripts, there is no much global resource files in OCCT nowadays necessary for using OCCT in other applications (most resources are embedded into .so and plugin interface for loading OCAF documents has been superseded by direct linking and registering drivers).