From: akl Date: Tue, 12 Mar 2013 10:48:19 +0000 (+0000) Subject: Fix to build by CMAKE with Netgen-5.0.0 X-Git-Tag: V7_1_0~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b22cd8fe61c0485c36993bb5686fb8bbbc2e273a;p=plugins%2Fnetgenplugin.git Fix to build by CMAKE with Netgen-5.0.0 --- diff --git a/adm_local/cmake_files/FindNETGEN.cmake b/adm_local/cmake_files/FindNETGEN.cmake index 1b2209f..c64662d 100644 --- a/adm_local/cmake_files/FindNETGEN.cmake +++ b/adm_local/cmake_files/FindNETGEN.cmake @@ -23,34 +23,62 @@ SET(NETGEN_INCLUDES) SET(NETGEN_INCLUDES ${NETGEN_INCLUDES} -I${NETGEN_INCLUDES_DIR} -I${NETGENHOME}/share/netgen/include) SET(NETGEN_INCLUDES ${NETGEN_INCLUDES} -DNO_PARALLEL_THREADS -DOCCGEOMETRY) +SET(NETGEN_LIBS) +FIND_LIBRARY(NETGEN_LIB_csg csg PATHS ${NETGENHOME}/lib ${NETGENHOME}/lib/LINUX) +#FIND_LIBRARY(NETGEN_LIB_gen gen PATHS ${NETGENHOME}/lib ${NETGENHOME}/lib/LINUX) +FIND_LIBRARY(NETGEN_LIB_geom2d geom2d PATHS ${NETGENHOME}/lib ${NETGENHOME}/lib/LINUX) +#FIND_LIBRARY(NETGEN_LIB_gprim gprim PATHS ${NETGENHOME}/lib ${NETGENHOME}/lib/LINUX) +FIND_LIBRARY(NETGEN_LIB_interface interface PATHS ${NETGENHOME}/lib ${NETGENHOME}/lib/LINUX) +#FIND_LIBRARY(NETGEN_LIB_la la PATHS ${NETGENHOME}/lib ${NETGENHOME}/lib/LINUX) +FIND_LIBRARY(NETGEN_LIB_mesh mesh PATHS ${NETGENHOME}/lib ${NETGENHOME}/lib/LINUX) +FIND_LIBRARY(NETGEN_LIB_occ occ PATHS ${NETGENHOME}/lib ${NETGENHOME}/lib/LINUX) +FIND_LIBRARY(NETGEN_LIB_stl stl PATHS ${NETGENHOME}/lib ${NETGENHOME}/lib/LINUX) FIND_LIBRARY(NETGEN_LIB_nglib nglib PATHS ${NETGENHOME}/lib ${NETGENHOME}/lib/LINUX) -# temporary, check to be added later +FOREACH(LIBNAME + ${NETGEN_LIB_csg} +# ${NETGEN_LIB_gen} + ${NETGEN_LIB_geom2d} +# ${NETGEN_LIB_gprim} + ${NETGEN_LIB_interface} +# ${NETGEN_LIB_la} + ${NETGEN_LIB_mesh} + ${NETGEN_LIB_occ} + ${NETGEN_LIB_stl} + ${NETGEN_LIB_nglib} + ) + IF(LIBNAME) + SET(NETGEN_LIBS ${NETGEN_LIBS} ${LIBNAME}) + ENDIF(LIBNAME) +ENDFOREACH(LIBNAME ) + +# Check Netgen version SET(NETGEN_V5 OFF) +SET(tmp_check_netgen ${CMAKE_BINARY_DIR}/tmp_check_netgen.cxx) +FILE(WRITE ${tmp_check_netgen} + "#include \n" + "#include \n" + "namespace nglib { \n" + "#include \"nglib.h\" \n" + "} \n" + "#include \n" + "int main() { \n" + "nglib::Ng_Init(); \n" + "netgen::Mesh* ngMesh; \n" + "ngMesh->CalcLocalH(1.0); \n" + "nglib::Ng_Exit(); \n" + "return 0; \n" + "} \n" + ) +TRY_COMPILE(NETGEN_V5 + ${CMAKE_BINARY_DIR} + ${tmp_check_netgen} + CMAKE_FLAGS "-DLINK_LIBRARIES:STRING=${NETGEN_LIB_nglib}" + COMPILE_DEFINITIONS ${CAS_CPPFLAGS} ${NETGEN_INCLUDES} + OUTPUT_VARIABLE OUTPUT + ) +FILE(REMOVE ${tmp_check_netgen}) IF(NETGEN_V5) SET(NETGEN_INCLUDES ${NETGEN_INCLUDES} -DNETGEN_V5) ENDIF(NETGEN_V5) - -SET(NETGEN_LIBS) -IF(WINDOWS) - FIND_LIBRARY(NETGEN_LIB_csg csg PATHS ${NETGENHOME}/lib ${NETGENHOME}/lib/LINUX) - FIND_LIBRARY(NETGEN_LIB_gen gen PATHS ${NETGENHOME}/lib ${NETGENHOME}/lib/LINUX) - FIND_LIBRARY(NETGEN_LIB_geom2d geom2d PATHS ${NETGENHOME}/lib ${NETGENHOME}/lib/LINUX) - FIND_LIBRARY(NETGEN_LIB_gprim gprim PATHS ${NETGENHOME}/lib ${NETGENHOME}/lib/LINUX) - FIND_LIBRARY(NETGEN_LIB_interface interface PATHS ${NETGENHOME}/lib ${NETGENHOME}/lib/LINUX) - FIND_LIBRARY(NETGEN_LIB_la la PATHS ${NETGENHOME}/lib ${NETGENHOME}/lib/LINUX) - FIND_LIBRARY(NETGEN_LIB_mesh mesh PATHS ${NETGENHOME}/lib ${NETGENHOME}/lib/LINUX) - FIND_LIBRARY(NETGEN_LIB_occ occ PATHS ${NETGENHOME}/lib ${NETGENHOME}/lib/LINUX) - FIND_LIBRARY(NETGEN_LIB_stl stl PATHS ${NETGENHOME}/lib ${NETGENHOME}/lib/LINUX) - SET(NETGEN_LIBS ${NETGEN_LIBS} ${NETGEN_LIB_csg}) - SET(NETGEN_LIBS ${NETGEN_LIBS} ${NETGEN_LIB_gen}) - SET(NETGEN_LIBS ${NETGEN_LIBS} ${NETGEN_LIB_geom2d}) - SET(NETGEN_LIBS ${NETGEN_LIBS} ${NETGEN_LIB_gprim}) - SET(NETGEN_LIBS ${NETGEN_LIBS} ${NETGEN_LIB_interface}) - SET(NETGEN_LIBS ${NETGEN_LIBS} ${NETGEN_LIB_la}) - SET(NETGEN_LIBS ${NETGEN_LIBS} ${NETGEN_LIB_mesh}) - SET(NETGEN_LIBS ${NETGEN_LIBS} ${NETGEN_LIB_occ}) - SET(NETGEN_LIBS ${NETGEN_LIBS} ${NETGEN_LIB_stl}) -ENDIF(WINDOWS) -SET(NETGEN_LIBS ${NETGEN_LIBS} ${NETGEN_LIB_nglib})