Compiling on Linux fails (fatal error: occgeom.hpp)

Having trouble installing or compiling FreeCAD? Get help here.
User avatar
PrzemoF
Posts: 2988
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

Re: Compiling on Linux fails (fatal error: occgeom.hpp)

Postby PrzemoF » Tue May 26, 2015 4:17 pm

For fedora 21:
1. Setting NGLIB_INCLUDE_DIR to /usr/include/netgen-mesher/
2. Adding _new_ position in cmake-gui NETGENDATA set to /usr/include/netgen-mesher/private
seems to fix compilation problem.

There is a line setting NETGENDATA in cMake/UseLibPackCLbundler.cmake (obviously that location doesn't work for fedora):

Code: Select all

set(NETGENDATA ${FREECAD_LIBPACK_DIR}/include/netgen)
What's the best way of fixing it?

This works (*), but looks like a nasty hack (cMake/FindNETGEN.cmake):

Code: Select all

diff --git a/cMake/FindNETGEN.cmake b/cMake/FindNETGEN.cmake
index c93aca0..19f5078 100644
--- a/cMake/FindNETGEN.cmake
+++ b/cMake/FindNETGEN.cmake
@@ -8,7 +8,7 @@
 # See also: http://git.salome-platform.org/gitweb/?p=NETGENPLUGIN_SRC.git;a=summary
 
 # nglib
-FIND_PATH(NGLIB_INCLUDE_DIR nglib.h /usr/include)
+FIND_PATH(NGLIB_INCLUDE_DIR nglib.h /usr/include /usr/include/netgen-mesher)
 FIND_LIBRARY(NGLIB_LIBRARIES nglib /usr/lib /usr/local/lib)
 
 # netgen headers
@@ -18,15 +18,16 @@ SET(NETGEN_INCLUDE_DIRS ${NETGEN_INCLUDE_DIRS} -DNO_PARALLEL_THREADS -DOCCGEOMET
 if(NOT NETGENDATA)
     SET(NETGENDATA /usr/share/netgen/libsrc)
 endif()
+SET(NETGENDATA_AUX /usr/include/netgen-mesher/private)
 
-FIND_PATH(NETGEN_DIR_csg csg.hpp PATHS ${NETGENDATA}/csg)
-FIND_PATH(NETGEN_DIR_gen array.hpp PATHS ${NETGENDATA}/general)
-FIND_PATH(NETGEN_DIR_geom2d geom2dmesh.hpp PATHS ${NETGENDATA}/geom2d)
-FIND_PATH(NETGEN_DIR_gprim gprim.hpp PATHS ${NETGENDATA}/gprim)
-FIND_PATH(NETGEN_DIR_la linalg.hpp PATHS ${NETGENDATA}/linalg)
-FIND_PATH(NETGEN_DIR_mesh meshing.hpp PATHS ${NETGENDATA}/meshing)
-FIND_PATH(NETGEN_DIR_occ occgeom.hpp PATHS ${NETGENDATA}/occ)
-FIND_PATH(NETGEN_DIR_stlgeom stlgeom.hpp PATHS ${NETGENDATA}/stlgeom)
+FIND_PATH(NETGEN_DIR_csg csg.hpp PATHS ${NETGENDATA}/csg  ${NETGENDATA_AUX}/csg)
+FIND_PATH(NETGEN_DIR_gen array.hpp PATHS ${NETGENDATA}/general ${NETGENDATA_AUX}/general)
+FIND_PATH(NETGEN_DIR_geom2d geom2dmesh.hpp PATHS ${NETGENDATA}/geom2d ${NETGENDATA_AUX}/geom2d)
+FIND_PATH(NETGEN_DIR_gprim gprim.hpp PATHS ${NETGENDATA}/gprim ${NETGENDATA_AUX}/gprim)
+FIND_PATH(NETGEN_DIR_la linalg.hpp PATHS ${NETGENDATA}/linalg ${NETGENDATA_AUX}/linalg)
+FIND_PATH(NETGEN_DIR_mesh meshing.hpp PATHS ${NETGENDATA}/meshing ${NETGENDATA_AUX}/meshing)
+FIND_PATH(NETGEN_DIR_occ occgeom.hpp PATHS ${NETGENDATA}/occ ${NETGENDATA_AUX}/occ)
+FIND_PATH(NETGEN_DIR_stlgeom stlgeom.hpp PATHS ${NETGENDATA}/stlgeom ${NETGENDATA_AUX}/stlgeom)
 
 SET(NETGEN_INCLUDE_DIRS ${NETGEN_INCLUDE_DIRS} ${NETGEN_DIR_csg})
 SET(NETGEN_
 
 
 INCLUDE_DIRS ${NETGEN_INCLUDE_DIRS} ${NETGEN_DIR_gen})
(*) works, means installing netgen-mesher-devel-private and checking box BUILD_FEM_NETGEN in cmake-gui builds FreeCAD with netgen without setting anything else.

Edit: Paths are set correctly, but compilation fails due to the #ifdef NETGEN_V5 condition in src/3rdParty/salomesmesh/src/NETGENPlugin/NETGENPlugin_Mesher.cpp