Salome HOME
Nouveau Patch Yoann pour 16614
[modules/hydrosolver.git] / src / salome_hydro / telemac2d / CMakeLists.txt
index f471ac120bf32ca4cebf9a5c505f49a6788481b3..4d6aedc6701ca8d1df1f4c2d4a4266cf6ff22268 100644 (file)
 #  You should have received a copy of the GNU General Public License
 #  along with SALOME HYDRO module.  If not, see <http://www.gnu.org/licenses/>.
 
-ADD_SUBDIRECTORY(eficas)
-
 # --- Python files ---
 
 SET(PYFILES
   __init__.py
-  polygon.py
 )
 
 SET(INSTALL_DIR ${SALOME_INSTALL_PYTHON}/salome/hydro/telemac2d)
@@ -30,51 +27,4 @@ SET(INSTALL_DIR ${SALOME_INSTALL_PYTHON}/salome/hydro/telemac2d)
 
 SALOME_INSTALL_SCRIPTS("${PYFILES}" ${INSTALL_DIR})
 
-# This macro is used to transform the list of libraries against which the
-# module is linked into a list of linker flags (-L and -l). If we just use the
-# list of libraries in the linker command, the full path of the libraries is
-# registered in the module dependencies, so it doesn't work when the installation
-# is moved.
-MACRO(LIB_LIST_TO_LINKER_FLAGS LINKER_FLAGS_VAR LIB_LIST)
-  SET(${LINKER_FLAGS_VAR})
-  FOREACH(LIB ${LIB_LIST})
-    GET_FILENAME_COMPONENT(DIRNAME ${LIB} PATH)
-    # Get the library filename without the shortest extension. We can't use
-    # command GET_FILENAME_COMPONENT with option NAME_WE because it returns
-    # the filename without the longest extension. For example, we need to get
-    # "libpython2.7" from "libpython2.7.so" and not "libpython2".
-    GET_FILENAME_COMPONENT(LIBFILENAME ${LIB} NAME)
-    STRING(FIND ${LIBFILENAME} "." DOTPOS REVERSE)
-    STRING(SUBSTRING ${LIBFILENAME} 0 ${DOTPOS} FILENAME_WO_EXT)
-    STRING(SUBSTRING ${FILENAME_WO_EXT} 3 -1 LIBNAME)
-    LIST(APPEND ${LINKER_FLAGS_VAR} "-L${DIRNAME}" "-l${LIBNAME}")
-  ENDFOREACH(LIB ${LIB_LIST})
-ENDMACRO(LIB_LIST_TO_LINKER_FLAGS)
-
-LIB_LIST_TO_LINKER_FLAGS(LINKER_FLAGS "${TELEMAC_LIBRARIES};${HDF5_hdf5_LIBRARY};${MEDFILE_LIBRARIES};${PYTHON_LIBRARY}")
-
-# Python wrapping for Telemac2D created with f2py
-SET(T2D_WRAP_API_LIB _apit2d.so)
-SET(T2D_WRAP_API_PYF_FILE apit2d.pyf)
-SET(T2D_WRAP_API_SRC_FILES ${TELEMAC_API_SRC_DIR}/api_handle_var_t2d.f90
-                           ${TELEMAC_API_SRC_DIR}/api_interface_t2d.f90
-                           ${TELEMAC_API_SRC_DIR}/api_handle_error_t2d.f90)
-
-# This sed string is used to add necessary definitions to the pyf file
-SET(SEDSTRING "s:python module _apit2d ! in:python module _apit2d ! in\\nusercode '''const int nb_var_t2d=100\\;\\n''':")
-
-ADD_CUSTOM_COMMAND(OUTPUT ${T2D_WRAP_API_LIB}
-                   COMMAND f2py -c ${T2D_WRAP_API_PYF_FILE} -I${TELEMAC_INCLUDE_DIR} ${LINKER_FLAGS}
-                   MAIN_DEPENDENCY ${T2D_WRAP_API_PYF_FILE}
-                  )
-
-ADD_CUSTOM_COMMAND(OUTPUT ${T2D_WRAP_API_PYF_FILE}
-                   COMMAND f2py -h ${T2D_WRAP_API_PYF_FILE} -m _apit2d ${T2D_WRAP_API_SRC_FILES}
-                           skip: get_boolean_t2d_d get_double_t2d_d get_integer_t2d_d get_string_t2d_d get_var_size_t2d_d
-                                 set_boolean_t2d_d set_double_t2d_d set_integer_t2d_d set_string_t2d_d :
-                   COMMAND sed -i -e \"${SEDSTRING}\" ${T2D_WRAP_API_PYF_FILE}
-                   MAIN_DEPENDENCY ${T2D_WRAP_API_SRC_FILES}
-                  )
-
-ADD_CUSTOM_TARGET(BUILD_T2D_WRAP_API_LIB ALL DEPENDS ${T2D_WRAP_API_LIB})
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${T2D_WRAP_API_LIB} DESTINATION ${INSTALL_DIR})
+ADD_SUBDIRECTORY(eficas)