]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
New file bin/app-template/resources/SalomeApp.xml.in
authorCamille GOUTTEBROZE <camille.gouttebroze@cea.fr>
Fri, 26 Sep 2014 12:17:04 +0000 (14:17 +0200)
committerCamille GOUTTEBROZE <camille.gouttebroze@cea.fr>
Fri, 26 Sep 2014 12:17:04 +0000 (14:17 +0200)
bin/app-quickstart.py
bin/app-template/CMakeLists.txt
bin/app-template/resources/CMakeLists.txt [new file with mode: 0644]
bin/app-template/resources/SalomeApp.xml.in [new file with mode: 0644]

index 582005be13081f58429bc1c5603a1848a6c7773f..ab61a30979ef792bb4e8cc7075e2905318925c19 100755 (executable)
@@ -24,7 +24,7 @@ import shutil
 import optparse
 
 # Options of this script
-def ProfileQuickStartParser() :
+def profileQuickStartParser() :
 
     parser = optparse.OptionParser( usage = "usage: python app-quickstart.py [options]" )
 
@@ -62,13 +62,23 @@ def ProfileQuickStartParser() :
 
     return parser
 
+#
+def profileReplaceStrings( src, dst, options ) :
+    with open( dst, "wt" ) as fout:
+        with open( src, "rt" ) as fin:
+            for line in fin:
+                fout.write( line.replace( '[LIST_OF_MODULES]', options.modules )/
+                                .replace( '[NAME_OF_APPLICATION]', options.name.upper() )/
+                                .replace( '<Name_of_Application>', options.name )/
+                                .replace( '(name_of_application)', options.name.lower() ) )
 
 #Generation of a template profile sources
-def generate_sources( options, args ) :
+def profileGenerateSources( options, args ) :
 
     #Set name of several directories
     app_dir = os.path.join( options.prefix, options.name )
     src_dir = os.path.join( app_dir, "src" )
+    resources_dir = os.path.join( app_dir, "resources" )
     kernek_root_dir = os.environ["KERNEL_ROOT_DIR"]
     bin_dir = os.path.join( kernek_root_dir, "bin", "salome" )
     template_dir = os.path.join( bin_dir, "app-template"  )
@@ -89,10 +99,15 @@ def generate_sources( options, args ) :
     for f in contextFiles :
         shutil.copy( os.path.join( bin_dir, f ), src_dir )
 
+    #Adapt source directory
+    profileReplaceStrings( os.path.join( template_dir, "resources", "SalomeApp.xml.in" ), os.path.join( resources_dir, "SalomeApp.xml.in" ), options )
+    profileReplaceStrings( os.path.join( template_dir, "resources", "CMakeLists.txt" ), os.path.join( resources_dir, "CMakeLists.txt" ), options )
+    profileReplaceStrings( os.path.join( template_dir, "CMakeLists.txt" ), os.path.join( app_dir, "CMakeLists.txt" ), options )
+
 # -----------------------------------------------------------------------------
 
 if __name__ == '__main__':
 
-    (options, args) = ProfileQuickStartParser().parse_args()
+    (options, args) = profileQuickStartParser().parse_args()
 
-    generate_sources( options, args )
+    profileGenerateSources( options, args )
index 494079eff4907566efe14c05ac6995058f51e81b..be8abd8d83a72440b73f8e3f5a3faa90ac4fb0a4 100644 (file)
@@ -17,7 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR)
-
+PROJECT(Salome<Name_of_Application> C CXX)
 
 # Find KERNEL
 # ===========
@@ -38,9 +38,14 @@ ENDIF(EXISTS ${KERNEL_ROOT_DIR})
 SET(SALOME_INSTALL_SCRIPT_PYTHON "${SALOME_INSTALL_SCRIPT_PYTHON}" CACHE PATH 
    "Install path: SALOME Python scripts")
 
+# Specific to [NAME_OF_APPLICATION]:
+SET(SALOME_[NAME_OF_APPLICATION]_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/(name_of_application)" CACHE PATH 
+    "Install path: SALOME PYHELLO specific data")
+
 MARK_AS_ADVANCED(SALOME_INSTALL_SCRIPT_PYTHON)
 
 
 # Sources 
 # ========
 ADD_SUBDIRECTORY( src )
+ADD_SUBDIRECTORY( resources )
diff --git a/bin/app-template/resources/CMakeLists.txt b/bin/app-template/resources/CMakeLists.txt
new file mode 100644 (file)
index 0000000..a957ad5
--- /dev/null
@@ -0,0 +1,21 @@
+# Copyright (C) 2012-2014  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# 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, 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
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+SALOME_CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/SalomeApp.xml.in ${CMAKE_CURRENT_BINARY_DIR}/SalomeApp.xml INSTALL ${SALOME_[NAME_OF_APPLICATION]_INSTALL_RES_DATA})
+
diff --git a/bin/app-template/resources/SalomeApp.xml.in b/bin/app-template/resources/SalomeApp.xml.in
new file mode 100644 (file)
index 0000000..11102af
--- /dev/null
@@ -0,0 +1,22 @@
+<?xml version='1.0' encoding='utf-8'?>
+<document>  
+  <section name="launch">    
+    <parameter name="gui" value="yes"/>
+    <parameter name="splash" value="yes"/>
+    <parameter name="file" value="no"/>
+    <parameter name="key" value="no"/>
+    <parameter name="interp" value="no"/>
+    <parameter name="logger" value="no"/>
+    <parameter name="xterm" value="no"/>
+    <parameter name="portkill" value="no"/>
+    <parameter name="killall" value="no"/>
+    <parameter name="noexcepthandler" value="no"/>
+    <parameter name="modules" value="[LIST_OF_MODULES]"/>
+    <parameter name="pyModules" value=""/>
+    <parameter name="embedded" value="SalomeAppEngine,study,cppContainer,registry,moduleCatalog"/>
+    <parameter name="standalone" value=""/>
+  </section>
+  <section name="resources">
+    <parameter name="LightApp" value="%[NAME_OF_APPLICATION]_ROOT_DIR%/share/salome/resources"/>
+  </section>
+</document>