1 # Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License.
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Lesser General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this library; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
25 from PyQt4 import pyqtconfig
27 # Get the PyQt configuration information.
28 config = pyqtconfig.Configuration()
33 # Set enviroment for make file
35 if 'HYDRO_SRC_DIR' in os.environ :
36 config._macros[ 'INCDIR' ] += ' ' + os.path.join( os.environ[ 'HYDRO_SRC_DIR' ], 'src/HYDROData' )
37 src_path = os.path.join( os.environ[ 'HYDRO_SRC_DIR' ], 'src/HYDROPy' )
39 if 'CASROOT' in os.environ :
40 config._macros[ 'INCDIR' ] += ' ' + os.path.join( os.environ[ 'CASROOT' ], 'inc' )
42 if 'HYDRO_ROOT_DIR' in os.environ :
43 config._macros[ 'LIBDIR' ] += ' ' + os.path.join( os.environ[ 'HYDRO_ROOT_DIR' ], 'lib/salome' )
44 installs_path = os.path.join( os.environ[ 'HYDRO_ROOT_DIR' ], 'lib/python' + os.environ[ 'PYTHON_VERSION' ] + '/site-packages/salome' )
46 config._macros[ 'DEFINES' ] += ' HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS'
48 # The name of the SIP build file generated by SIP and used by the build
50 build_file = "HYDROData.sbf"
52 # Get the extra SIP flags needed by the imported PyQt modules. Note that
53 # this normally only includes those flags (-x and -t) that relate to SIP's
55 pyqt_sip_flags = config.pyqt_sip_flags
57 # Run SIP to generate the code. Note that we tell SIP where to find the qt
58 # module's specification files using the -I flag.
64 '-I', config.pyqt_sip_dir,
66 os.path.join( src_path, 'HYDROData.sip' )
70 # We are going to install the SIP specification file for this module and
71 # its configuration module.
73 installs.append( [ 'HYDROData.py', installs_path ] )
75 # Create the Makefile. The QtGuiModuleMakefile class provided by the
76 # pyqtconfig module takes care of all the extra preprocessor, compiler and
77 # linker flags needed by the Qt library.
78 makefile = pyqtconfig.QtGuiModuleMakefile(
80 build_file=build_file,
81 install_dir=installs_path,
86 # Add the library we are wrapping. The name doesn't include any platform
87 # specific prefixes or extensions (e.g. the "lib" prefix on UNIX, or the
88 # ".dll" extension on Windows).
89 makefile.extra_libs = [ 'HYDROData' ]
91 # Generate the Makefile itself.
94 # Now we create the configuration module. This is done by merging a Python
95 # dictionary (whose values are normally determined dynamically) with a
98 # Publish where the SIP specifications for this module will be
100 'HYDROData_sip_dir': installs_path,
102 # Publish the set of SIP flags needed by this module. As these are the
103 # same flags needed by the qt module we could leave it out, but this
104 # allows us to change the flags at a later date without breaking
105 # scripts that import the configuration module.
106 'HYDROData_sip_flags': pyqt_sip_flags
109 # This creates the HYDROData.py module from the HYDROData.py.in
110 # template and the dictionary.
111 sipconfig.create_config_module( 'HYDROData.py', os.path.join( src_path, 'HYDROData.py.in' ), content )