netgen icon indicating copy to clipboard operation
netgen copied to clipboard

Some dependencies not reflected by cmake options

Open waebbl opened this issue 3 years ago • 0 comments

This issue is about version 6.2.2204, but should still apply to current HEAD.

I noticed, that the cmake options USE_JPEG, USE_MPEG and USE_PYTHON seem to need to depend on USE_GUI. If USE_GUI=OFF you will have two different outcomes:

  • in the case of USE_JPEG and USE_MPEG the user probably has libraries installed, not actually needed by netgen, the ffmpeg and / or jpeg libraries. Both are only linked to the resulting netgen binary, but not to either of libngcore.so or libnglib.so
  • for USE_PYTHON the case is more severe, as the python/gui.py file imports libngguipy module without checking whether USE_GUI is set, thus it will likely result in a runtime error, as the libngguipy.so is only built and installed when USE_GUI=ON.

Currently the package can successfully be built and installed with only one of these three options set. I've tested this with

cmake -DUSE_CCACHE=OFF -DUSE_CGNS=OFF -DUSE_GUI=no -DUSE_INTERNAL_TCL=OFF -DUSE_JPEG=yes -DUSE_MPEG=no -DUSE_NATIVE_ARCH=OFF -DUSE_MPI=no -DUSE_OCC=no -DUSE_PYTHON=no -DUSE_SUPERBUILD=OFF -DUSE_MPI4PY=OFF

respectively with enabling only USE_MPEG or USE_PYTHON.

I suppose, simply using cmake_dependent_option depending on USE_GUI for the three cases would be enough. I haven't checked, if the code in gui.py could be adapted.

waebbl avatar Oct 31 '22 15:10 waebbl