import optparse
# Options of this script
-def ProfileQuickStartParser() :
+def profileQuickStartParser() :
parser = optparse.OptionParser( usage = "usage: python app-quickstart.py [options]" )
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" )
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 )
# 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
# ===========
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 )
--- /dev/null
+# 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})
+
--- /dev/null
+<?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>