Salome HOME
Merge branch 'V8_0_0_BR'
[tools/yacsgen.git] / module_generator / aster_tmpl.py
index 63f6c44e20f8be22e09870aca72de3b67176eca8..2be0f95f78998c131c86b31c6aa91a3efd7cc63a 100644 (file)
@@ -1,9 +1,9 @@
-# Copyright (C) 2009-2013  EDF R&D
+# Copyright (C) 2009-2015  EDF R&D
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
 # License as published by the Free Software Foundation; either
-# version 2.1 of the License.
+# version 2.1 of the License, or (at your option) any later version.
 #
 # This library is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -62,10 +62,15 @@ class ${component}(${module}_ORB__POA.${component},dsccalcium.PyDSCComponent,SUP
     if hasattr(self,"init_timer"):
       self.init_timer()
     #fin modif pour aster 9.0
-    if os.path.exists(os.path.join(aster_dir,"elements")):
-      shutil.copyfile(os.path.join(aster_dir,"elements"),"elem.1")
+    elements_file = ""
+    if os.path.exists(os.path.join(aster_dir,"share", "aster", "elements")):
+      elements_file = os.path.join(aster_dir,"elements")
+    elif os.path.exists(os.path.join(aster_dir,"elements")):
+      elements_file = os.path.join(aster_dir,"elements")
     else:
-      shutil.copyfile(os.path.join(aster_dir,"catobj","elements"),"elem.1")
+      elements_file = os.path.join(aster_dir,"catobj","elements")
+    shutil.copyfile(elements_file,"elem.1")
+    
 
   def init_service(self,service):
 ${initservice}
@@ -309,40 +314,6 @@ asterCEXEService="""
 asterCEXEService=Template(asterCEXEService)
 asterEXEService=asterCEXEService
 
-
-check_aster="""
-#
-# Check availability of Aster binary distribution
-#
-
-AC_DEFUN([AC_CHECK_ASTER],[
-
-AC_CHECKING(for Aster)
-
-Aster_ok=no
-
-AC_ARG_WITH(aster,
-      [AC_HELP_STRING([--with-aster=DIR],[root directory path of Aster installation])],
-      [ASTER_DIR="$withval"],[ASTER_DIR=""])
-
-if test -f ${ASTER_DIR}/asteru ; then
-   Aster_ok=yes
-   AC_MSG_RESULT(Using Aster distribution in ${ASTER_DIR})
-
-   ASTER_INCLUDES=-I$ASTER_DIR/bibc/include
-
-   AC_SUBST(ASTER_DIR)
-   AC_SUBST(ASTER_INCLUDES)
-
-else
-   AC_MSG_WARN("Cannot find Aster distribution")
-fi
-
-AC_MSG_RESULT(for Aster: $Aster_ok)
-
-])dnl
-"""
-
 comm="""
 DEBUT(PAR_LOT='NON')
 """
@@ -467,3 +438,43 @@ if __name__ == '__main__':
 """
 component=Template(component)
 
+# CMakeLists.txt in src/<component> for an aster component
+# template parameters:
+#   sources: source files, separated by spaces
+#   module: module name
+#   resources: files to be installed in resources directory
+#   scripts: scripts to be installed
+cmake_src_compo_aster="""
+# scripts / static
+SET(_bin_py
+  ${sources}
+)
+
+SET(_res_files
+  ${resources}
+)
+
+SET(_bin_scripts
+  ${scripts}
+)
+
+# --- rules ---
+INSTALL(FILES $${_res_files} DESTINATION $${SALOME_${module}_INSTALL_RES_DATA})
+SALOME_INSTALL_SCRIPTS("$${_bin_scripts}" $${SALOME_INSTALL_SCRIPT_SCRIPTS})
+SALOME_INSTALL_SCRIPTS("$${_bin_py}" $${SALOME_INSTALL_PYTHON})
+"""
+cmake_src_compo_aster=Template(cmake_src_compo_aster)
+
+# CMakeLists.txt in src/<component> for an aster lib component
+# template parameters:
+#   sources: source files, separated by spaces
+cmake_src_compo_aster_lib="""
+# scripts / static
+SET(_bin_SCRIPTS
+  ${sources}
+)
+
+# --- rules ---
+SALOME_INSTALL_SCRIPTS("$${_bin_SCRIPTS}" $${SALOME_INSTALL_PYTHON})
+"""
+cmake_src_compo_aster_lib=Template(cmake_src_compo_aster_lib)