Back to index

salome-kernel  6.5.0
Public Member Functions | Public Attributes | Static Public Attributes | Private Attributes
am2cmake.CMakeFile Class Reference
Collaboration diagram for am2cmake.CMakeFile:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def parseFile
def initialize
def treatLine
def treatAttribution
def finalize
def setLibAdd
def setCompilationFlags
def addLibTarget
def addBinTarget
def addInstallTarget
def writeListsFile
def writeEnvScript

Public Attributes

 the_root
 root
 dirs
 files
 module
 amFile
 listsFile
 content

Static Public Attributes

string key = "_SRC"
string msg = "Source dir must finished with %s !"
list hxxmodule = self.the_root[:-len(key)]
tuple hxxmodule = basename(hxxmodule)
tuple upmod = self.module.upper()
string tmp
string tmp1 = ""
string extra_srcdir = "${CMAKE_CURRENT_SOURCE_DIR}/extra"
string doc_source = "${CMAKE_CURRENT_BINARY_DIR}/%s"
 resdir = self.module
dictionary d

Private Attributes

 __thedict__

Detailed Description

Definition at line 93 of file am2cmake.py.


Constructor & Destructor Documentation

def am2cmake.CMakeFile.__init__ (   self,
  the_root,
  root,
  dirs,
  files,
  f,
  module 
)

Definition at line 95 of file am2cmake.py.

00095 
00096     def __init__(self, the_root, root, dirs, files, f, module):
00097         #
00098         self.the_root = the_root
00099         self.root = root
00100         self.dirs = dirs
00101         self.files = files
00102         self.module = module
00103         #
00104         from os.path import join
00105         self.amFile = join(root, f)
00106         self.listsFile = join(root, "CMakeLists.txt")
00107         #
00108         self.parseFile()
00109         #
00110         return
    

Member Function Documentation

def am2cmake.CMakeFile.addBinTarget (   self,
  key,
  newlines 
)

Definition at line 2258 of file am2cmake.py.

02258 
02259     def addBinTarget(self, key, newlines):
02260         # --
02261         newlines.append(r'''
02262         FOREACH(amname ${%s})
02263         '''%(key))
02264         # --
02265         newlines.append(r'''
02266         SET(test ON)
02267         ''')
02268         if key == "check_PROGRAMS":
02269             newlines.append(r'''
02270             IF(bin_PROGRAMS)
02271             STRING(REGEX MATCH ${amname} is_present ${bin_PROGRAMS})
02272             IF(is_present)
02273             SET(test OFF)
02274             ENDIF(is_present)
02275             ENDIF(bin_PROGRAMS)
02276             ''')
02277             pass
02278         newlines.append(r'''
02279         IF(test)
02280         ''')
02281         # --
02282         newlines.append(r'''
02283         SET(name "${amname}_exe")
02284         SET(srcs ${${amname}_SOURCES} ${dist_${amname}_SOURCES})
02285         SET(l ${nodist_${amname}_SOURCES})
02286         FOREACH(f ${l})
02287         SET(src ${CMAKE_CURRENT_BINARY_DIR}/${f})
02288         SET(srcs ${srcs} ${src})
02289         ENDFOREACH(f ${l})
02290         LIST(LENGTH srcs nb)
02291         IF(nb)
02292         ADD_EXECUTABLE(${name} ${srcs})
02293         ''')
02294         # --
02295         self.setCompilationFlags(key, newlines)
02296         # --
02297         self.setLibAdd(key, newlines)
02298         # --
02299         if self.module in ["jobmanager", "medfile", "netgen"]:
02300             newlines.append(r'''
02301             SET(DEST bin)
02302             ''')
02303         else:
02304             newlines.append(r'''
02305             SET(DEST bin/salome)
02306             ''')
02307             pass
02308         # --
02309         if key == "bin_PROGRAMS":
02310             newlines.append(r'''
02311             IF(WINDOWS)
02312             INSTALL(TARGETS ${name} DESTINATION ${DEST})
02313             INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.exe DESTINATION ${DEST} RENAME ${amname}.exe)
02314             INSTALL(CODE "FILE(REMOVE ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.exe)")
02315             ELSE(WINDOWS)
02316             SET(PERMS)
02317             SET(PERMS ${PERMS} OWNER_READ OWNER_WRITE OWNER_EXECUTE)
02318             SET(PERMS ${PERMS} GROUP_READ GROUP_EXECUTE)
02319             SET(PERMS ${PERMS} WORLD_READ WORLD_EXECUTE)
02320             INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${name} DESTINATION ${DEST} PERMISSIONS ${PERMS} RENAME ${amname})
02321             ENDIF(WINDOWS)
02322             ''')
02323             pass
02324         # --
02325         newlines.append(r'''
02326         ENDIF(nb)
02327         ''')
02328         # --
02329         newlines.append(r'''
02330         ENDIF(test)
02331         ''')
02332         newlines.append(r'''
02333         ENDFOREACH(amname ${%s})
02334         '''%(key))
02335         # --
02336         return
    

Here is the call graph for this function:

def am2cmake.CMakeFile.addInstallTarget (   self,
  key,
  destination,
  newlines 
)

Definition at line 2337 of file am2cmake.py.

02337 
02338     def addInstallTarget(self, key, destination, newlines):
02339         newlines.append(r"FOREACH(f ${%s})"%(key))
02340         newlines.append(r'''
02341         SET(DEST %s)
02342         '''%(destination))
02343         newlines.append(r'''
02344         STRING(COMPARE EQUAL ${f} SALOMEconfig.h.in test_SALOMEconfig.h.in)
02345         IF(test_SALOMEconfig.h.in)
02346         INSTALL(FILES SALOMEconfig.ref.in DESTINATION ${DEST} RENAME SALOMEconfig.h.in)
02347         ELSE(test_SALOMEconfig.h.in)
02348         SET(dummy dummy-NOTFOUND)
02349         MARK_AS_ADVANCED(dummy)
02350         # FILE(REMOVE ${CMAKE_INSTALL_PREFIX}/${DEST}/${f})
02351         FIND_FILE(dummy ${f} PATHS ${CMAKE_CURRENT_SOURCE_DIR} NO_DEFAULT_PATH)
02352         IF(dummy)
02353         ''')
02354         if key in ['dist_salomescript_SCRIPTS',
02355                    'dist_appliskel_SCRIPTS',
02356                    'dist_appliskel_PYTHON']:
02357             newlines.append(r'''
02358             SET(PERMS)
02359             SET(PERMS ${PERMS} OWNER_READ OWNER_WRITE OWNER_EXECUTE)
02360             SET(PERMS ${PERMS} GROUP_READ GROUP_EXECUTE)
02361             SET(PERMS ${PERMS} WORLD_READ WORLD_EXECUTE)
02362             INSTALL(FILES ${f} DESTINATION ${DEST} PERMISSIONS ${PERMS})
02363             ''')
02364         else:
02365             newlines.append(r'''
02366             GET_FILENAME_COMPONENT(ext ${f} EXT)
02367             IF(ext STREQUAL .py)
02368             IF(DEST STREQUAL bin/salome)
02369             SET(PERMS)
02370             SET(PERMS ${PERMS} OWNER_READ OWNER_WRITE OWNER_EXECUTE)
02371             SET(PERMS ${PERMS} GROUP_READ GROUP_EXECUTE)
02372             SET(PERMS ${PERMS} WORLD_READ WORLD_EXECUTE)
02373             INSTALL(FILES ${f} DESTINATION ${DEST} PERMISSIONS ${PERMS})
02374             ELSE(DEST STREQUAL bin/salome)
02375             INSTALL(FILES ${f} DESTINATION ${DEST})
02376             ENDIF(DEST STREQUAL bin/salome)
02377             ELSE(ext STREQUAL .py)
02378             INSTALL(FILES ${f} DESTINATION ${DEST})
02379             ENDIF(ext STREQUAL .py)
02380             ''')
02381             pass
02382         newlines.append(r'''
02383         ELSE(dummy)
02384         GET_FILENAME_COMPONENT(ext ${f} EXT)
02385         IF(ext STREQUAL .qm)
02386         STRING(REGEX REPLACE .qm .ts input ${f})
02387         ''')
02388         if self.module in ["kernel", "gui", "yacs"]:
02389             newlines.append(r'''
02390             SET(input ${CMAKE_CURRENT_SOURCE_DIR}/resources/${input})
02391             ''')
02392         else:
02393             newlines.append(r'''
02394             SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input})
02395             ''')
02396             pass
02397         newlines.append(r'''
02398         SET(output ${CMAKE_CURRENT_BINARY_DIR}/${f})
02399         # ADD_CUSTOM_COMMAND(
02400         # OUTPUT ${output}
02401         # COMMAND ${QT_LRELEASE_EXECUTABLE} ${input} -qm ${output}
02402         # MAIN_DEPENDENCY ${input}
02403         # )
02404         EXECUTE_PROCESS(COMMAND ${QT_LRELEASE_EXECUTABLE} ${input} -qm ${output})
02405         ENDIF(ext STREQUAL .qm)
02406         INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${f} DESTINATION ${DEST})
02407         ENDIF(dummy)
02408         ENDIF(test_SALOMEconfig.h.in)
02409         ''')
02410         newlines.append(r'''
02411         GET_FILENAME_COMPONENT(ext ${f} EXT)
02412         IF(ext STREQUAL .py)
02413         INSTALL(CODE "SET(PYTHON_FILE ${f})")
02414         INSTALL(CODE "SET(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})")
02415         INSTALL(CODE "SET(DEST ${DEST})")
02416         INSTALL(CODE "SET(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE})")
02417         ''')
02418         if self.module == "kernel":
02419             newlines.append('''
02420             IF(f STREQUAL SALOME_ContainerPy.py)
02421             ELSE(f STREQUAL SALOME_ContainerPy.py)
02422             IF(f STREQUAL am2cmake.py)
02423             ELSE(f STREQUAL am2cmake.py)
02424             INSTALL(SCRIPT ${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/install_and_compile_python_file.cmake)
02425             ENDIF(f STREQUAL am2cmake.py)
02426             ENDIF(f STREQUAL SALOME_ContainerPy.py)
02427             ''')
02428         else:
02429             newlines.append('''
02430             STRING(REPLACE "\\\\" "/" KERNEL_ROOT_DIR ${KERNEL_ROOT_DIR})
02431             INSTALL(SCRIPT ${KERNEL_ROOT_DIR}/salome_adm/cmake_files/install_and_compile_python_file.cmake)
02432             ''')
02433             pass
02434         newlines.append(r'''
02435         ENDIF(ext STREQUAL .py)
02436         ''') 
02437         newlines.append(r"ENDFOREACH(f ${%s})"%(key))
02438         return
    
def am2cmake.CMakeFile.addLibTarget (   self,
  key,
  newlines 
)

Definition at line 1994 of file am2cmake.py.

01994 
01995     def addLibTarget(self, key, newlines):
01996         newlines.append(r'''
01997         FOREACH(amname ${%s})
01998         '''%(key))
01999         # --
02000         # Replace .la by _la ...
02001         # --
02002         newlines.append(r'''
02003         STRING(REPLACE .la _la amname ${amname})
02004         ''')
02005         # --
02006         # Remove the _la for the cmake name
02007         # --
02008         newlines.append(r'''
02009         STRING(LENGTH ${amname} len)
02010         MATH(EXPR newlen "${len}-3")
02011         STRING(SUBSTRING ${amname} 0 ${newlen} name)
02012         ''')
02013         # --
02014         # Does the target begins with lib ??
02015         # If yes, remove lib at beginning for cmake name
02016         # --
02017         newlines.append(r'''
02018         STRING(REGEX MATCH "^lib" BEGIN_WITH_lib ${name})
02019         IF(BEGIN_WITH_lib)
02020         STRING(LENGTH ${name} len)
02021         MATH(EXPR newlen "${len}-3")
02022         STRING(SUBSTRING ${name} 3 ${newlen} name)
02023         ENDIF(BEGIN_WITH_lib)
02024         ''')
02025         # --
02026         # Does the target is an idl library
02027         # --
02028         newlines.append(r'''
02029         STRING(REGEX MATCH "IDL" ISIDL ${name})
02030         ''')
02031         # --
02032         # Set the type of the library
02033         # --
02034         newlines.append(r'''
02035         IF(ISIDL)
02036         IF(WINDOWS)
02037         SET(type STATIC)
02038         ELSE(WINDOWS)
02039         SET(type SHARED)
02040         ENDIF(WINDOWS)
02041         ELSE(ISIDL)
02042         SET(type SHARED)
02043         ENDIF(ISIDL)
02044         ''')
02045         if key == "noinst_LTLIBRARIES":
02046             newlines.append(r'''
02047             IF(WINDOWS)
02048             SET(type STATIC)
02049             ELSE(WINDOWS)
02050             SET(type STATIC)
02051             ENDIF(WINDOWS)
02052             ''')
02053             pass
02054         # --
02055         # Set sources for the library
02056         # --
02057         newlines.append(r'''
02058         SET(srcs)
02059         FOREACH(src ${${amname}_SOURCES} ${dist_${amname}_SOURCES})
02060         GET_FILENAME_COMPONENT(ext ${src} EXT)
02061         IF(ext STREQUAL .f)
02062         IF(src STREQUAL trte.f)
02063         SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${src})
02064         STRING(REPLACE ".f" ".c" src ${src})
02065         SET(src ${CMAKE_CURRENT_BINARY_DIR}/${src})
02066         SET(output ${src})
02067         SET(cmd f2c)
02068         IF(NOT WINDOWS)
02069         IF(CMAKE_SIZEOF_VOID_P STREQUAL 8)
02070         SET(cmd valgrind f2c)  # f2c seems to be buggy on 64 bits ... but with valgrind, it works :)
02071         ENDIF()
02072         ENDIF(NOT WINDOWS)
02073         ADD_CUSTOM_COMMAND(
02074         OUTPUT ${output}
02075         COMMAND ${cmd} ${input}
02076         MAIN_DEPENDENCY ${input}
02077         )
02078         ELSE(src STREQUAL trte.f)
02079         SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${src})
02080         STRING(REPLACE ".f" ".o" src ${src})
02081         SET(src ${CMAKE_CURRENT_BINARY_DIR}/${src})
02082         SET(output ${src})
02083         IF(WINDOWS)
02084         SET(F77 g77)
02085         ELSE(WINDOWS)
02086         SET(F77 gfortran)
02087         ENDIF(WINDOWS)
02088         ADD_CUSTOM_COMMAND(
02089         OUTPUT ${output}
02090         COMMAND ${F77} -c -o ${output} ${input}
02091         MAIN_DEPENDENCY ${input}
02092         )
02093         ENDIF(src STREQUAL trte.f)
02094         ENDIF(ext STREQUAL .f)
02095         SET(srcs ${srcs} ${src})
02096         ENDFOREACH(src ${${amname}_SOURCES} ${dist_${amname}_SOURCES})
02097         ''')
02098         newlines.append(r'''
02099         SET(l ${nodist_${amname}_SOURCES} ${UIC_FILES})
02100         FOREACH(f ${l})
02101         SET(src ${CMAKE_CURRENT_BINARY_DIR}/${f})
02102         SET(srcs ${srcs} ${src})
02103         ENDFOREACH(f ${l})
02104         ''')
02105         newlines.append(r'''
02106         SET(build_srcs)
02107         SET(l ${nodist_${amname}_SOURCES} ${BUILT_SOURCES})
02108         FOREACH(f ${l})
02109         GET_FILENAME_COMPONENT(ext ${f} EXT)
02110         IF(ext STREQUAL .py)
02111         SET(fff)
02112         ELSE(ext STREQUAL .py)
02113         SET(fff ${CMAKE_CURRENT_BINARY_DIR}/${f})
02114         ENDIF(ext STREQUAL .py)
02115         IF(fff)
02116         IF(build_srcs)
02117         LIST(FIND build_srcs ${fff} index)
02118         IF(NOT index EQUAL -1)
02119         SET(fff)
02120         ENDIF(NOT index EQUAL -1)
02121         ENDIF(build_srcs)
02122         ENDIF(fff)
02123         IF(fff)
02124         SET(build_srcs ${build_srcs} ${fff})
02125         ENDIF(fff)
02126         ENDFOREACH(f ${l})
02127         ''')
02128         # --
02129         # Add the library to cmake
02130         # --
02131         newlines.append(r'''
02132         ADD_LIBRARY(${name} ${type} ${srcs})
02133         ''')
02134         # --
02135         # The compilation flags
02136         # --
02137         self.setCompilationFlags(key, newlines)
02138         # --
02139         newlines.append(r'''
02140         SET_TARGET_PROPERTIES(${name} PROPERTIES VERSION ${VERSION_INFO} SOVERSION ${SOVERSION_INFO})
02141         ''')
02142         # --
02143         self.setLibAdd(key, newlines)
02144         # --
02145         if 1: # key != "noinst_LTLIBRARIES":
02146             newlines.append(r'''
02147             SET(key %s)
02148             '''%(key))
02149             newlines.append(r'''
02150             SET(test ON)
02151             IF(${key} STREQUAL noinst_LTLIBRARIES)
02152             SET(test OFF)
02153             ENDIF(${key} STREQUAL noinst_LTLIBRARIES)
02154             ''')
02155             if self.module == "netgen" :
02156                 newlines.append(r'''
02157                 IF(${key} STREQUAL noinst_LTLIBRARIES)
02158                 IF(WINDOWS)
02159                 SET(test ON)
02160                 ENDIF(WINDOWS)
02161                 ENDIF(${key} STREQUAL noinst_LTLIBRARIES)
02162                 ''')
02163                 pass
02164             newlines.append(r'''
02165             IF(test)
02166             ''')
02167             if self.module in ["medfile", "netgen"]:
02168                 newlines.append(r'''
02169                 SET(DEST lib)
02170                 ''')
02171             elif key == "libparaview_LTLIBRARIES":
02172                 newlines.append(r'''
02173                 SET(DEST lib/paraview)
02174                 ''')                
02175             else:
02176                 newlines.append(r'''
02177                 SET(DEST lib/salome)
02178                 ''')
02179                 pass
02180             newlines.append(r'''
02181             IF(BEGIN_WITH_lib)
02182             INSTALL(TARGETS ${name} DESTINATION ${DEST})
02183             ''')
02184             if self.module == "gui":
02185                 newlines.append(r'''
02186                 FOREACH(lib SalomePyQt)
02187                 IF(name STREQUAL lib)
02188                 IF(WINDOWS)
02189                 IF(CMAKE_BUILD_TYPE STREQUAL Release)
02190                 INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME ${name}.pyd)
02191                 ELSE(CMAKE_BUILD_TYPE STREQUAL Release)
02192                 INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME ${name}_d.pyd)
02193                 ENDIF(CMAKE_BUILD_TYPE STREQUAL Release)
02194                 ELSE(WINDOWS)
02195                 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so DESTINATION ${DEST} RENAME ${name}.so)
02196                 ENDIF(WINDOWS)
02197                 ENDIF(name STREQUAL lib)
02198                 ENDFOREACH(lib SalomePyQt)
02199                 FOREACH(lib SalomePy)
02200                 IF(name STREQUAL lib)
02201                 IF(WINDOWS)
02202                 IF(CMAKE_BUILD_TYPE STREQUAL Release)
02203                 INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME lib${name}.pyd)
02204                 ELSE(CMAKE_BUILD_TYPE STREQUAL Release)
02205                 INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME lib${name}_d.pyd)
02206                 ENDIF(CMAKE_BUILD_TYPE STREQUAL Release)
02207                 ENDIF(WINDOWS)
02208                 ENDIF(name STREQUAL lib)
02209                 ENDFOREACH(lib SalomePy)
02210                 ''')
02211                 pass
02212             if self.module == "geom":
02213                 newlines.append(r'''
02214                 IF(WINDOWS)
02215                 STRING(REGEX MATCH "Export" ISExport ${name})
02216                 IF(ISExport)
02217                 INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME lib${name}.dll)
02218                 ENDIF(ISExport)
02219                 STRING(REGEX MATCH "Import" ISImport ${name})
02220                 IF(ISImport)
02221                 INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME lib${name}.dll)
02222                 ENDIF(ISImport)
02223                 ENDIF(WINDOWS)
02224                 ''')
02225                 pass
02226             newlines.append(r'''
02227             ELSE(BEGIN_WITH_lib)
02228             ''')
02229             newlines.append(r'''
02230             IF(WINDOWS)
02231             INSTALL(TARGETS ${name} DESTINATION ${salomepythondir})
02232             IF(CMAKE_BUILD_TYPE STREQUAL Release)
02233             INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${salomepythondir}/${name}.dll DESTINATION ${salomepythondir} RENAME ${name}.pyd)
02234             ELSE(CMAKE_BUILD_TYPE STREQUAL Release)
02235             INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${salomepythondir}/${name}.dll DESTINATION ${salomepythondir} RENAME ${name}_d.pyd)
02236             ENDIF(CMAKE_BUILD_TYPE STREQUAL Release)
02237             ELSE(WINDOWS)
02238             GET_TARGET_PROPERTY(version ${name} VERSION)
02239             GET_TARGET_PROPERTY(soversion ${name} SOVERSION)
02240             INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so.${version} DESTINATION ${salomepythondir} RENAME ${name}.so.${version})
02241             INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so.${version} DESTINATION ${salomepythondir} RENAME ${name}.so.${soversion})
02242             INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so.${version} DESTINATION ${salomepythondir} RENAME ${name}.so)
02243             ENDIF(WINDOWS)
02244             ''')
02245             newlines.append(r'''
02246             ENDIF(BEGIN_WITH_lib)
02247             ''')
02248             newlines.append(r'''
02249             ENDIF(test)
02250             ''')
02251             pass
02252         # --
02253         newlines.append(r'''
02254         ENDFOREACH(amname ${%s})
02255         '''%(key))
02256         # --
02257         return
    

Here is the call graph for this function:

def am2cmake.CMakeFile.finalize (   self,
  newlines 
)

Definition at line 1080 of file am2cmake.py.

01080 
01081     def finalize(self, newlines):
01082       
01083         # --
01084         # Convert the .in files in build dir
01085         # --
01086         upmod = ""
01087         if self.module == "hexoticplugin" :
01088           upmod = "HexoticPLUGIN"
01089         else :
01090           upmod = self.module.upper()
01091 
01092         import operator
01093         mod = self.module
01094         if mod in ['kernel', 'gui'] and self.root[-len('gui'):] == 'gui' or mod == 'med' and operator.contains(self.root, 'doxygen'):
01095             newlines.append(r'''
01096             SET(top_builddir
01097                 ${CMAKE_BINARY_DIR}
01098             )
01099             SET(top_srcdir 
01100                 ${CMAKE_SOURCE_DIR}
01101             )
01102             SET(srcdir 
01103                 ${CMAKE_CURRENT_SOURCE_DIR}
01104             )
01105             SET(builddir 
01106                 ${CMAKE_CURRENT_BINARY_DIR}
01107             )
01108             SET(datadir
01109                 ${CMAKE_INSTALL_PREFIX}/share
01110             )
01111             SET(docdir 
01112                 ${datadir}/doc/salome
01113             )
01114             ''')
01115             self.files.append("static/header.html.in")
01116         elif self.root[-len(mod):] == upmod and operator.contains(self.root, 'doc') or mod in ['kernel', 'gui', 'geom', 'med', 'smesh', 'visu'] and self.root[-len('tui'):] == 'tui':
01117             newlines.append(r'''
01118             SET(top_builddir
01119                 ${CMAKE_BINARY_DIR}
01120             )
01121             SET(top_srcdir 
01122                 ${CMAKE_SOURCE_DIR}
01123             )
01124             SET(srcdir 
01125                 ${CMAKE_CURRENT_SOURCE_DIR}
01126             )
01127             SET(builddir 
01128                 ${CMAKE_CURRENT_BINARY_DIR}
01129             )
01130             SET(datadir
01131                 ${CMAKE_INSTALL_PREFIX}/share
01132             )
01133             SET(docdir 
01134                 ${datadir}/doc/salome
01135             )
01136             ''')
01137             self.files.append("static/header.html.in")
01138             if mod in ['geom', 'smesh', 'visu','netgenplugin','blsurfplugin','hexoticplugin','ghs3dplugin',"ghs3dprlplugin"] and self.root[-len(mod):] == upmod:
01139               self.files.append("static/header_py.html.in")
01140      
01141         if self.module == "yacs":
01142             key = "salomegui"
01143             if self.root[-len(key):] == key:
01144                 self.files.append("resources/YACSCatalog.xml.in")
01145                 self.files.append("resources/SalomeApp.xml.in")
01146                 pass
01147             pass
01148             from os import path
01149             if operator.contains(self.root, 'YACS_SRC'+path.sep+'doc'):
01150                 newlines.append(r'''
01151                 SET(srcdir 
01152                   ${CMAKE_CURRENT_SOURCE_DIR}
01153                 )
01154                 ''')
01155             
01156         if self.module == "jobmanager":
01157             key = "salomegui"
01158             if self.root[-len(key):] == key:
01159                 self.files.append("resources/SalomeApp.xml.in")
01160                 pass
01161             pass
01162         for f in self.files:
01163             if f[-3:] == ".in":
01164                 if self.module == 'yacs' and f == "Doxyfile.in":
01165                     continue
01166                 if f == "sstream.in":
01167                     continue
01168                 if f in ["runContainer.in", "stopContainer.in"]:
01169                     if self.module == "med":
01170                         if self.root[-3:] == "csh":
01171                             continue
01172                         pass
01173                     pass
01174                 if f == "SALOMEconfig.ref.in":
01175                     out = "SALOMEconfig.h"
01176                 else:
01177                     out = f[:-3]
01178                     pass
01179                 newlines.append(r'''
01180                 SET(input ${CMAKE_CURRENT_SOURCE_DIR}/%s)
01181                 '''%(f))
01182                 newlines.append(r'''
01183                 SET(output ${CMAKE_CURRENT_BINARY_DIR}/%s)
01184                 '''%(out))
01185                 newlines.append(r'''
01186                 MESSAGE(STATUS "Creation of ${output}")
01187                 CONFIGURE_FILE(${input} ${output})
01188                 ''')
01189                 pass
01190             pass
01191 
01192         # --
01193         # add commands for generating of user's documentation
01194         # --
01195         doc_gui_destination = "${CMAKE_INSTALL_PREFIX}/share/doc/salome/gui/%s"%(upmod)
01196         doc_tui_destination = "${CMAKE_INSTALL_PREFIX}/share/doc/salome/tui/%s"%(upmod)
01197         doc_destination = "${CMAKE_INSTALL_PREFIX}/share/doc/salome"
01198         head_source = "${CMAKE_CURRENT_SOURCE_DIR}/images/head.png"
01199         if mod == 'kernel':
01200             prepare_generating_doc_src = "${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/prepare_generating_doc.py"
01201         else:
01202             prepare_generating_doc_src = "$ENV{KERNEL_ROOT_DIR}/bin/salome/prepare_generating_doc.py"
01203         if mod in ['kernel', 'gui'] and self.root[-len('gui'):] == 'gui' or mod == 'med' and operator.contains(self.root, 'doxygen'):
01204             if mod == 'med':
01205                 doc_source = "${CMAKE_CURRENT_BINARY_DIR}/doc_ref_user/html"
01206                 input = "Doxyfile_med_user"
01207             else:
01208                 doc_source = "${CMAKE_CURRENT_BINARY_DIR}/%s"%(upmod)
01209                 input = ""
01210             newlines.append("""\t    ADD_CUSTOM_TARGET(usr_docs ${DOXYGEN_EXECUTABLE} %s
01211             COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; shutil.rmtree(r'''%s''', True); shutil.copytree(r'''%s''', r'''%s'''); shutil.copy(r'''%s''', r'''%s''')"
01212             VERBATIM 
01213             WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}             
01214             )"""%(input, doc_gui_destination, doc_source, doc_gui_destination, head_source, doc_gui_destination))
01215         from os import path
01216         if mod in ['geom', 'smesh', 'visu', 'netgenplugin','blsurfplugin','hexoticplugin','ghs3dplugin','ghs3dprlplugin'] and self.root[-len(mod):] == upmod and operator.contains(self.root, 'doc'):
01217             ign = r"""'*usr_docs*', '*CMakeFiles*', '*.cmake', 'doxyfile*', '*.vcproj', 'static', 'Makefile*'"""
01218             if mod in ['geom', 'smesh']:
01219                 if mod == 'geom':
01220                     tmp = 'geompy'
01221                     input = "COMMAND ${DOXYGEN_EXECUTABLE} doxyfile_tui \n\t\t"
01222                 else:
01223                     tmp =  'smesh' 
01224                     input = ''
01225                 newlines.append(r"""
01226                 IF(WINDOWS)
01227                   STRING(REPLACE "/" "\\" f "%s")
01228               ELSE(WINDOWS)
01229                 SET(f "%s")                   
01230                 ENDIF(WINDOWS)
01231                 ADD_CUSTOM_TARGET(usr_docs ${PYTHON_EXECUTABLE} ${f} %s.py ${CMAKE_SOURCE_DIR}/src/%s_SWIG/%sDC.py %s
01232                 %sCOMMAND ${DOXYGEN_EXECUTABLE} doxyfile_py
01233                 COMMAND ${DOXYGEN_EXECUTABLE} doxyfile
01234                 COMMAND ${PYTHON_EXECUTABLE} -c "import os; os.remove(r'''%s.py''')"
01235                 COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; shutil.rmtree(r'''%s''', True); shutil.copytree(r'''${CMAKE_CURRENT_BINARY_DIR}''', r'''%s''', ignore=shutil.ignore_patterns(%s)); shutil.copy(r'''%s''', r'''%s''')"
01236                 VERBATIM 
01237                 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}             
01238                 )"""%(prepare_generating_doc_src, prepare_generating_doc_src, tmp, upmod, tmp, tmp, input, tmp, doc_gui_destination, doc_gui_destination, ign, head_source, doc_gui_destination))
01239             else:
01240                 config_f = ""
01241               if mod in ['netgenplugin','blsurfplugin','hexoticplugin','ghs3dplugin', "ghs3dprlplugin"] :
01242                     config_f = "doxyfile_py"
01243                 else:
01244                     config_f = "doxyfile_idl"
01245                 newlines.append("""\t    ADD_CUSTOM_TARGET(usr_docs ${DOXYGEN_EXECUTABLE} %s
01246                 COMMAND ${DOXYGEN_EXECUTABLE} doxyfile
01247                 COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; shutil.rmtree(r'''%s''',True); shutil.copytree(r'''${CMAKE_CURRENT_BINARY_DIR}''',r'''%s''', ignore=shutil.ignore_patterns(%s)); shutil.copy(r'''%s''',r'''%s''')"
01248                 VERBATIM 
01249                 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
01250                 )"""%(config_f, doc_gui_destination, doc_gui_destination, ign, head_source, doc_gui_destination))
01251         elif mod == 'yacs' and operator.contains(self.root, upmod + '_SRC'+path.sep+'doc'):
01252             from sys import platform
01253             params = '';
01254             if platform == "win32":
01255                 params = '-Q';
01256             newlines.append(r"""
01257             ADD_CUSTOM_TARGET(html_docs ${SPHINX_EXECUTABLE} %s -c ${CMAKE_BINARY_DIR}/doc -b html ${ALLSPHINXOPTS} html
01258             COMMAND ${PYTHON_EXECUTABLE} -c \"import shutil\;shutil.rmtree('''%s''', True)\;shutil.copytree('''${CMAKE_CURRENT_BINARY_DIR}/html''', '''%s''')\"
01259             WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})"""%(params, doc_gui_destination, doc_gui_destination))             
01260        elif mod in ['kernel', 'smesh', 'geom'] and operator.contains(self.root, upmod + '_SRC'+path.sep+'doc'+path.sep+'docutils'):
01261             from sys import platform
01262             params = ""
01263             ext = ""
01264             prf = ""
01265             if platform == "win32":
01266                 params = '-Q';
01267                 ext = "bat"
01268                 prf = "call"
01269             else:
01270                 ext = "sh"
01271                 prf = ". "
01272             doc_gui_destination = "${CMAKE_INSTALL_PREFIX}/share/doc/salome/tui/%s/docutils"%(upmod)
01273             scr = self.writeEnvScript(upmod)                   
01274             newlines.append(r"""
01275             IF(WINDOWS)
01276                STRING(REPLACE "/" "\\" SCR "%s")
01277            ELSE(WINDOWS)
01278                SET(SCR "%s")
01279             ENDIF(WINDOWS)
01280             FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/env_s.%s "${SCR}")
01281             ADD_CUSTOM_TARGET(html_docs %s ${CMAKE_CURRENT_BINARY_DIR}/env_s.%s && ${SPHINX_EXECUTABLE} %s -c ${CMAKE_BINARY_DIR}/doc/docutils -W -b html ${ALLSPHINXOPTS} html
01282             COMMAND ${PYTHON_EXECUTABLE} -c \"import shutil\;shutil.rmtree('''%s''', True)\;shutil.copytree('''${CMAKE_CURRENT_BINARY_DIR}/html''', '''%s''')\"
01283             WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})"""%(scr,scr,ext,prf,ext,params, doc_gui_destination, doc_gui_destination))
01284 
01285 
01286 

Here is the call graph for this function:

def am2cmake.CMakeFile.initialize (   self,
  newlines 
)

Definition at line 468 of file am2cmake.py.

00468 
00469     def initialize(self, newlines):
00470         if self.root == self.the_root:
00471             # --
00472             newlines.append("""
00473             CMAKE_MINIMUM_REQUIRED(VERSION 2.4.7 FATAL_ERROR)
00474             IF(COMMAND cmake_policy)
00475             cmake_policy(SET CMP0003 NEW)
00476             ENDIF(COMMAND cmake_policy)
00477             """)
00478             # --
00479             newlines.append("""
00480             ENABLE_TESTING()
00481             """)
00482             # --
00483             newlines.append("""
00484             SET(MODULE %s)
00485             """%(self.module.upper()))
00486             # --
00487             if self.module == "netgen":
00488                 newlines.append("""
00489                 INCLUDE(${CMAKE_SOURCE_DIR}/cmake/FindPLATFORM.cmake)
00490                 INCLUDE(${CMAKE_SOURCE_DIR}/cmake/FindCAS.cmake)
00491                 """)
00492             else:
00493                 if self.module == "kernel":
00494                     newlines.append("""
00495                     INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindPLATFORM.cmake)
00496                     INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindPYTHON.cmake)
00497                     INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindOMNIORB.cmake)
00498                     INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindPTHREADS.cmake)
00499                     INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindMPI.cmake)
00500                     INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindHDF5.cmake)
00501                     INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindBOOST.cmake)
00502                     INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindLIBXML2.cmake)
00503                     INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindSWIG.cmake)
00504                     INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindCPPUNIT.cmake)
00505                     INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindDOXYGEN.cmake)
00506                     INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindLIBBATCH.cmake)
00507                     INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindSPHINX.cmake)
00508                     """)
00509                     pass
00510                 else:
00511                     if self.module == "med":
00512                         newlines.append("""
00513                         SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR})
00514                         IF(KERNEL_ROOT_DIR)
00515                         INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPLATFORM.cmake)
00516                         INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPYTHON.cmake)
00517                         INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindOMNIORB.cmake)
00518                         INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPTHREADS.cmake)
00519                         INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindMPI.cmake)
00520                         INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindHDF5.cmake)
00521                         INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindBOOST.cmake)
00522                         INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindLIBXML2.cmake)
00523                         INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSWIG.cmake)
00524                         INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindCPPUNIT.cmake)
00525                         INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindDOXYGEN.cmake)
00526                         INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindLIBBATCH.cmake)
00527                         INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindKERNEL.cmake)
00528                         ELSE(KERNEL_ROOT_DIR)
00529                         INCLUDE(${CMAKE_SOURCE_DIR}/adm_local_without_kernel/cmake_files/FindPLATFORM.cmake)
00530                         INCLUDE(${CMAKE_SOURCE_DIR}/adm_local_without_kernel/cmake_files/FindMPI.cmake)
00531                         ENDIF(KERNEL_ROOT_DIR)
00532                         """)
00533                     else:
00534                         newlines.append("""
00535                         SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR})
00536                         INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPLATFORM.cmake)
00537                         INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPYTHON.cmake)
00538                         INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindOMNIORB.cmake)
00539                         INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPTHREADS.cmake)
00540                         INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindMPI.cmake)
00541                         INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindHDF5.cmake)
00542                         INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindBOOST.cmake)
00543                         INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindLIBXML2.cmake)
00544                         INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSWIG.cmake)
00545                         INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindCPPUNIT.cmake)
00546                         INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindDOXYGEN.cmake)
00547                         INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindLIBBATCH.cmake)
00548                         INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindKERNEL.cmake)
00549                         """)
00550                         pass
00551                     if self.module == "gui":
00552                         newlines.append("""
00553                         INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindCAS.cmake)
00554                         INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindQT4.cmake)
00555                         INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindOPENGL.cmake)
00556                         INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindVTK.cmake)
00557                         INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindQWT.cmake)
00558                         INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindSIPPYQT.cmake)
00559                         """)
00560                     else:
00561                         newlines.append("""
00562                         SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR})
00563                         IF(GUI_ROOT_DIR)
00564                         INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindCAS.cmake)
00565                         INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindQT4.cmake)
00566                         INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindOPENGL.cmake)
00567                         INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindVTK.cmake)
00568                         INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindQWT.cmake)
00569                         INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindSIPPYQT.cmake)
00570                         INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindGUI.cmake)
00571                         ENDIF(GUI_ROOT_DIR)
00572                         """)
00573                         if self.module == "med":
00574                             #METIS must be after PARMETIS to prevent to activate METIS if PARMETIS already exists
00575                             newlines.append("""
00576                             INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindPARMETIS.cmake)
00577                             INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindMETIS.cmake)
00578                             INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindSCOTCH.cmake)
00579                             INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindSPLITTER.cmake)
00580                             INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindRENUMBER.cmake)
00581                             INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindMEDFILE.cmake)
00582                             IF(WINDOWS)
00583                             INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindXDR.cmake)
00584                             ENDIF(WINDOWS)
00585                             """)
00586                             pass
00587                         if self.module == "smesh":
00588                             newlines.append("""
00589                             SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR})
00590                             SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR})
00591                             INCLUDE(${GEOM_ROOT_DIR}/adm_local/cmake_files/FindGEOM.cmake)
00592                             INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMEDFILE.cmake)
00593                             INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake)
00594                             INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSPHINX.cmake)
00595                             """)
00596                             pass
00597                         if self.module == "geom":
00598                             newlines.append("""
00599                             INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSPHINX.cmake)
00600                             """)
00601                             pass
00602 
00603                         if self.module == "netgenplugin":
00604                             newlines.append("""
00605                             SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR})
00606                             SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR})
00607                             SET(SMESH_ROOT_DIR $ENV{SMESH_ROOT_DIR})
00608                             INCLUDE(${GEOM_ROOT_DIR}/adm_local/cmake_files/FindGEOM.cmake)
00609                             INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake)
00610                             INCLUDE(${SMESH_ROOT_DIR}/adm_local/cmake_files/FindSMESH.cmake)
00611                             INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindNETGEN.cmake)
00612                             """)
00613                             pass
00614                         if self.module == "blsurfplugin":
00615                             newlines.append("""
00616                             SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR})
00617                             SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR})
00618                             SET(SMESH_ROOT_DIR $ENV{SMESH_ROOT_DIR})
00619                             INCLUDE(${GEOM_ROOT_DIR}/adm_local/cmake_files/FindGEOM.cmake)
00620                             INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake)
00621                             INCLUDE(${SMESH_ROOT_DIR}/adm_local/cmake_files/FindSMESH.cmake)
00622                             INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindBLSURF.cmake)
00623                             """)
00624                             pass
00625                         if self.module in ["ghs3dplugin", "hexoticplugin"]:
00626                             newlines.append("""
00627                             SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR})
00628                             SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR})
00629                             SET(SMESH_ROOT_DIR $ENV{SMESH_ROOT_DIR})
00630                             INCLUDE(${GEOM_ROOT_DIR}/adm_local/cmake_files/FindGEOM.cmake)
00631                             INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake)
00632                             INCLUDE(${SMESH_ROOT_DIR}/adm_local/cmake_files/FindSMESH.cmake)
00633                             """)
00634                             pass
00635                         if self.module == "ghs3dprlplugin":
00636                             newlines.append("""
00637                             SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR})
00638                             SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR})
00639                             SET(SMESH_ROOT_DIR $ENV{SMESH_ROOT_DIR})
00640                             INCLUDE(${GEOM_ROOT_DIR}/adm_local/cmake_files/FindGEOM.cmake)
00641                             INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMEDFILE.cmake)
00642                             INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake)
00643                             INCLUDE(${SMESH_ROOT_DIR}/adm_local/cmake_files/FindSMESH.cmake)
00644                             """)
00645                             pass
00646                         if self.module == "visu":
00647                             newlines.append("""
00648                             SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR})
00649                             INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake)
00650                             """)
00651                             pass
00652                         if self.module == "yacs":
00653                             newlines.append("""
00654                             INCLUDE(${CMAKE_SOURCE_DIR}/adm/cmake/FindEXPAT.cmake)
00655                             INCLUDE(${CMAKE_SOURCE_DIR}/adm/cmake/FindGRAPHVIZ.cmake)
00656                             INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSPHINX.cmake)
00657                             """)
00658                             pass
00659                         if self.module == "hxx2salome":
00660                             newlines.append("""
00661                             SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR})
00662                             INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMEDFILE.cmake)
00663                             INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake)
00664                             """)
00665                             pass
00666                         pass
00667                     pass
00668                 pass
00669             # --
00670             newlines.append("""
00671             SET(DOXYGEN_IS_OK 0)
00672             """)
00673             if self.module not in ['med']:
00674                 newlines.append("""
00675                 IF(WINDOWS)
00676                 SET(CPPUNIT_IS_OK 0)
00677                 ENDIF(WINDOWS)
00678                 """)
00679                 pass
00680             # --
00681             if self.module == "kernel":
00682                 newlines.append("""
00683                 SET(WITH_LOCAL 1)
00684                 SET(WITH_BATCH 1)
00685                 SET(CALCIUM_IDL_INT_F77 long)
00686                 SET(CALCIUM_CORBA_INT_F77 CORBA::Long)
00687                 SET(LONG_OR_INT int)
00688                 """)
00689             elif self.module == "gui":
00690                 newlines.append("""
00691                 SET(GUI_ENABLE_CORBA ${CORBA_GEN})
00692                 SET(ENABLE_VTKVIEWER ON)
00693                 SET(ENABLE_SALOMEOBJECT ON)
00694                 SET(ENABLE_OCCVIEWER ON)
00695                 SET(ENABLE_GLVIEWER ON)
00696                 SET(ENABLE_PLOT2DVIEWER ON)
00697                 SET(ENABLE_PYCONSOLE ON)
00698                 SET(ENABLE_SUPERVGRAPHVIEWER ON)
00699                 SET(ENABLE_QXGRAPHVIEWER ON)
00700                 """)
00701                 pass
00702             elif self.module == "jobmanager":
00703                 newlines.append("""
00704                 IF(GUI_ROOT_DIR)
00705                 SET(HAS_GUI ON)
00706                 ENDIF(GUI_ROOT_DIR)
00707                 """)
00708                 pass
00709             elif self.module == "geom":
00710                 newlines.append("""
00711                 IF(GUI_ROOT_DIR)
00712                 SET(GEOM_ENABLE_GUI ON)
00713                 ENDIF(GUI_ROOT_DIR)
00714                 """)
00715                 pass
00716             elif self.module == "medfile":
00717                 newlines.append("""
00718                 SET(MED_NUM_MAJEUR 3)
00719                 SET(MED_NUM_MINEUR 0)
00720                 SET(MED_NUM_RELEASE 3)
00721                 SET(LONG_OR_INT int)
00722                 IF(NOT WINDOWS)
00723                 SET(FLIBS -lgfortranbegin -lgfortran)
00724                 ENDIF(NOT WINDOWS)
00725                 """)
00726                 pass
00727             elif self.module == "med":
00728                 newlines.append("""
00729                 IF(KERNEL_ROOT_DIR)
00730                 SET(MED_ENABLE_KERNEL ON)
00731                 IF(NOT WINDOWS)
00732                 SET(MED_ENABLE_SPLITTER ON)
00733                 ENDIF(NOT WINDOWS)
00734                 ENDIF(KERNEL_ROOT_DIR)
00735                 IF(GUI_ROOT_DIR)
00736                 SET(MED_ENABLE_GUI ON)
00737                 ENDIF(GUI_ROOT_DIR)
00738                 """)
00739                 pass
00740             elif self.module == "smesh":
00741                 newlines.append("""
00742                 IF(GUI_ROOT_DIR)
00743                 SET(SMESH_ENABLE_GUI ON)
00744                 ENDIF(GUI_ROOT_DIR)
00745                 """)
00746                 pass
00747             elif self.module == "netgen":
00748                 newlines.append("""
00749                 SET(OCCFLAGS ${CAS_CPPFLAGS})
00750                 SET(OCCLIBS ${CAS_LDPATH})
00751                 SET(OCCLIBS ${OCCLIBS} ${TKernel} ${TKGeomBase} ${TKMath} ${TKG2d} ${TKG3d} ${TKXSBase} ${TKOffset} ${TKFillet} ${TKShHealing})
00752                 SET(OCCLIBS ${OCCLIBS} ${TKMesh} ${TKMeshVS} ${TKTopAlgo} ${TKGeomAlgo} ${TKBool} ${TKPrim} ${TKBO} ${TKIGES} ${TKBRep})
00753                 SET(OCCLIBS ${OCCLIBS} ${TKSTEPBase} ${TKSTEP} ${TKSTL} ${TKSTEPAttr} ${TKSTEP209} ${TKXDESTEP} ${TKXDEIGES} ${TKXCAF} ${TKLCAF} ${FWOSPlugin})
00754                 """)
00755                 pass
00756             elif self.module == "netgenplugin":
00757                 newlines.append("""
00758                 IF(GUI_ROOT_DIR)
00759                 SET(NETGENPLUGIN_ENABLE_GUI ON)
00760                 ENDIF(GUI_ROOT_DIR)
00761                 """)
00762                 pass
00763             elif self.module == "blsurfplugin":
00764                 newlines.append("""
00765                 IF(GUI_ROOT_DIR)
00766                 SET(BLSURFPLUGIN_ENABLE_GUI ON)
00767                 ENDIF(GUI_ROOT_DIR)
00768                 """)
00769                 pass
00770             elif self.module == "ghs3dplugin":
00771                 newlines.append("""
00772                 IF(GUI_ROOT_DIR)
00773                 SET(GHS3DPLUGIN_ENABLE_GUI ON)
00774                 ENDIF(GUI_ROOT_DIR)
00775                 """)
00776                 pass
00777             elif self.module == "hexoticplugin":
00778                 newlines.append("""
00779                 IF(GUI_ROOT_DIR)
00780                 SET(HEXOTICPLUGIN_ENABLE_GUI ON)
00781                 ENDIF(GUI_ROOT_DIR)
00782                 """)
00783                 pass
00784             elif self.module == "ghs3dprlplugin":
00785                 newlines.append("""
00786                 IF(GUI_ROOT_DIR)
00787                 SET(GHS3DPRLPLUGIN_ENABLE_GUI ON)
00788                 ENDIF(GUI_ROOT_DIR)
00789                 """)
00790                 pass
00791             elif self.module == "yacs":
00792                 newlines.append("""
00793                 SET(SALOME_KERNEL ON)
00794                 SET(HAS_GUI ON)
00795                 SET(WITH_QT4 ON)
00796                 """)
00797                 pass
00798             # --
00799             newlines.append("""
00800             set(VERSION 6.5.0)
00801             set(SHORT_VERSION 6.5)
00802             set(XVERSION 0x060500)
00803             """)
00804             pass
00805         # --
00806         newlines.append("""
00807         SET(VERSION_INFO 0.0.0)
00808         SET(SOVERSION_INFO 0)
00809         SET(SUBDIRS)
00810         SET(bin_PROGRAMS)
00811         SET(AM_CPPFLAGS -I${CMAKE_BINARY_DIR} )
00812         SET(AM_CXXFLAGS -I${CMAKE_BINARY_DIR})
00813         SET(LDADD)
00814         SET(pythondir lib/python${PYTHON_VERSION}/site-packages)
00815         SET(salomepythondir ${pythondir}/salome)
00816         SET(salomepypkgdir ${salomepythondir}/salome)
00817         """)
00818         
00819         if self.module == "smesh" and self.root[-len('SMESH_PY'):] == 'SMESH_PY':
00820            newlines.append("""
00821            SET(smeshpypkgdir ${salomepythondir}/salome/smesh)
00822            """)
00823            pass
00824         if self.module == "netgen":
00825             newlines.append(r'''
00826             SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DNO_PARALLEL_THREADS -DOCCGEOMETRY -I${CMAKE_CURRENT_SOURCE_DIR})
00827             ''')
00828         elif self.module == "kernel":
00829             newlines.append(r'''
00830             SET(AM_CPPFLAGS ${AM_CPPFLAGS} -DHAVE_SALOME_CONFIG -I${CMAKE_BINARY_DIR}/salome_adm/unix -include SALOMEconfig.h)
00831             SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DHAVE_SALOME_CONFIG -I${CMAKE_BINARY_DIR}/salome_adm/unix -include SALOMEconfig.h)
00832             ''')
00833         else:
00834             if self.module not in ["yacs"]:
00835                 newlines.append(r'''
00836                 IF(KERNEL_ROOT_DIR)
00837                 SET(AM_CPPFLAGS ${AM_CPPFLAGS} -DHAVE_SALOME_CONFIG -I${KERNEL_ROOT_DIR}/include/salome -include SALOMEconfig.h)
00838                 SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DHAVE_SALOME_CONFIG -I${KERNEL_ROOT_DIR}/include/salome -include SALOMEconfig.h)
00839                 ENDIF(KERNEL_ROOT_DIR)
00840                 ''')
00841                 pass
00842             if self.module == "gui":
00843                 newlines.append(r'''
00844                 IF(KERNEL_ROOT_DIR)
00845                 SET(AM_CPPFLAGS ${AM_CPPFLAGS} -DWITH_SALOMEDS_OBSERVER -DSUIT_ENABLE_PYTHON)
00846                 SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DWITH_SALOMEDS_OBSERVER -DSUIT_ENABLE_PYTHON)
00847                 ENDIF(KERNEL_ROOT_DIR)
00848                 ''')
00849                 pass
00850             if self.module in ["smesh", "netgenplugin", "blsurfplugin", "ghs3dplugin", "hexoticplugin"]:
00851                 newlines.append(r'''
00852                 SET(AM_CPPFLAGS ${AM_CPPFLAGS} -DWITH_SMESH_CANCEL_COMPUTE)
00853                 SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DWITH_SMESH_CANCEL_COMPUTE)
00854                 ''')
00855                 pass
            if self.module == "ghs3dplugin":

Definition at line 111 of file am2cmake.py.

00111 
00112     def parseFile(self):
00113         
00114         # --
00115         # Read the Makefile.am file
00116         # --
00117         amFile = self.amFile
00118         stream = open(amFile)
00119         content = stream.read()
00120         stream.close()
00121         
00122         # --
00123         # Replace the composed lines separated by "\\n" by an unique line
00124         # --
00125         content = p_multiline.sub(r' ', content)
00126         
00127         # --
00128         # Compatibility netgen plugin
00129         # --
00130         content = content.replace("../NETGEN/libNETGEN.la", "${NETGEN_LIBS}")
00131         
00132         # --
00133         cas_list = [
00134             "BinLPlugin",
00135             "BinPlugin",
00136             "BinTObjPlugin",
00137             "BinXCAFPlugin",
00138             "FWOSPlugin",
00139             "PTKernel",
00140             "StdLPlugin",
00141             "StdPlugin",
00142             "TKAdvTools",
00143             "TKBin",
00144             "TKBinL",
00145             "TKBinTObj",
00146             "TKBinXCAF",
00147             "TKBO",
00148             "TKBool",
00149             "TKBRep",
00150             "TKCAF",
00151             "TKCDF",
00152             "TKernel",
00153             "TKFeat",
00154             "TKFillet",
00155             "TKG2d",
00156             "TKG3d",
00157             "TKGeomAlgo",
00158             "TKGeomBase",
00159             "TKHLR",
00160             "TKIGES",
00161             "TKLCAF",
00162             "TKMath",
00163             "TKMesh",
00164             "TKMeshVS",
00165             "TKNIS",
00166             "TKOffset",
00167             "TKOpenGl",
00168             "TKPCAF",
00169             "TKPLCAF",
00170             "TKPrim",
00171             "TKPShape",
00172             "TKService",
00173             "TKShapeSchema",
00174             "TKShHealing",
00175             "TKStdLSchema",
00176             "TKStdSchema",
00177             "TKSTEP",
00178             "TKSTEP209",
00179             "TKSTEPAttr",
00180             "TKSTEPBase",
00181             "TKSTL",
00182             "TKTObj",
00183             "TKTopAlgo",
00184             "TKV2d",
00185             "TKV3d",
00186             "TKVRML",
00187             "TKXCAF",
00188             "TKXCAFSchema",
00189             "TKXDEIGES",
00190             "TKXDESTEP",
00191             "TKXMesh",
00192             "TKXml",
00193             "TKXmlL",
00194             "TKXmlTObj",
00195             "TKXmlXCAF",
00196             "TKXSBase",
00197             "XCAFPlugin",
00198             "XmlLPlugin",
00199             "XmlPlugin",
00200             "XmlTObjPlugin",
00201             "XmlXCAFPlugin",
00202             ]
00203         vtk_list = [
00204             "vtkCommonPythonD",
00205             "vtkGraphicsPythonD",
00206             "vtkImagingPythonD",
00207             "vtkPythonCore",
00208             ]
00209         kernel_list  = [
00210             "CalciumC",
00211             "DF",
00212             "Launcher",
00213             "LifeCycleCORBATest",
00214             "NamingServiceTest",
00215             "OpUtil",
00216             "Registry",
00217             "ResourcesManager",
00218             "SALOMEBasics",
00219             "SalomeCatalog",
00220             "SalomeCommunication",
00221             "SalomeContainer",
00222             "SalomeDatastream",
00223             "SalomeDSCContainer",
00224             "SalomeDSClient",
00225             "SalomeDSCSupervBasic",
00226             "SalomeDSCSuperv",
00227             "SalomeDSImpl",
00228             "SALOMEDSImplTest",
00229             "SalomeDS",
00230             "SALOMEDSTest",
00231             "SalomeGenericObj",
00232             "SalomeHDFPersist",
00233             "SalomeIDLKernel",
00234             "SalomeLauncher",
00235             "SalomeLifeCycleCORBA",
00236             "SALOMELocalTrace",
00237             "SALOMELocalTraceTest",
00238             "SalomeLoggerServer",
00239             "SalomeMPIContainer",
00240             "SalomeNotification",
00241             "SalomeNS",
00242             "SalomeResourcesManager",
00243             "SalomeTestComponentEngine",
00244             "SalomeTestMPIComponentEngine",
00245             "SALOMETraceCollectorTest",
00246             "TOOLSDS",
00247             "UtilsTest",
00248             "with_loggerTraceCollector",
00249             "SalomeKernelHelpers",
00250             ]
00251         gui_list = [
00252             "caf",
00253             "CAM",
00254             "CASCatch",
00255             "DDS",
00256             "Event",
00257             "GLViewer",
00258             "LightApp",
00259             "LogWindow",
00260             "ObjBrowser",
00261             "OCCViewer",
00262             "OpenGLUtils",
00263             "Plot2d",
00264             "PyConsole",
00265             "PyInterp",
00266             "QDS",
00267             "qtx",
00268             "QxScene",
00269             "SalomeApp",
00270             "SalomeAppTest",
00271             "SalomeIDLGUI",
00272             "SalomeObject",
00273             "SalomePrs",
00274             "SalomePyQtGUILight",
00275             "SalomePyQtGUI",
00276             "SalomePyQt",
00277             "SalomePy",
00278             "SalomeSession",
00279             "SalomeStyle",
00280             "SOCC",
00281             "SPlot2d",
00282             "std",
00283             "SUITApp",
00284             "suit",
00285             "SUPERVGraph",
00286             "SVTK",
00287             "ToolsGUI",
00288             "ViewerTools",
00289             "VTKViewer",
00290             "vtkEDFOverloads",
00291             "vtkTools"
00292             ]
00293         geom_list = [
00294             "AdvancedGUI",
00295             "BasicGUI",
00296             "BlocksGUI",
00297             "BooleanGUI",
00298             "BREPExport",
00299             "BREPImport",
00300             "BuildGUI",
00301             "DisplayGUI",
00302             "DlgRef",
00303             "EntityGUI",
00304             "GenerationGUI",
00305             "GEOMAlgo",
00306             "GEOMAlgo_NEW",
00307             "GEOMArchimede",
00308             "GEOMBase",
00309             "GEOMbasic",
00310             "GEOMClient",
00311             "GEOMEngine",
00312             "GEOMFiltersSelection",
00313             "GEOMimpl",
00314             "GEOMObject",
00315             "GEOMSketcher",
00316             "GEOM",
00317             "GEOM_SupervEngine",
00318             "GEOMToolsGUI",
00319             "GroupGUI",
00320             "IGESExport",
00321             "IGESImport",
00322             "MeasureGUI",
00323            "Material",
00324             "NMTDS",
00325             "NMTDS_NEW",
00326             "NMTTools",
00327             "NMTTools_NEW",
00328             "OCC2VTK",
00329             "OperationGUI",
00330             "PrimitiveGUI",
00331             "RepairGUI",
00332             "SalomeIDLGEOM",
00333             "ShHealOper",
00334             "STEPExport",
00335             "STEPImport",
00336             "STLExport",
00337             "TransformationGUI",
00338             "VTKExport",
00339             ]
00340         med_list = [
00341             "interpkernel",
00342             "InterpKernelTest",
00343             "MEDClientcmodule",
00344             "medcouplingclient",
00345             "medcouplingcorba",
00346             "medcouplingremapper",
00347             "medcoupling",
00348             "MEDEngine",
00349             "medloader",
00350             "MEDMEMCppTest",
00351             "MEDMEMImpl",
00352             "medmem",
00353             "MED",
00354             "medsplitter",
00355             "MEDSPLITTERTest",
00356             "med_V2_1",
00357             "MEDWrapperBase",
00358             "MEDWrapper",
00359             "MEDWrapper_V2_1",
00360             "MEDWrapper_V2_2",
00361             "paramedcouplingcorba",
00362             "paramedloader",
00363             "paramedmemcompo",
00364             "paramedmem",
00365             "ParaMEDMEMTest",
00366             "SalomeIDLMED",
00367             "SalomeIDLMEDTests",
00368             ]
00369         smesh_list = [
00370             "GeomSelectionTools",
00371             "MEFISTO2D",
00372             "MeshDriverDAT",
00373             "MeshDriverMED",
00374             "MeshDriver",
00375             "MeshDriverSTL",
00376             "MeshDriverUNV",
00377             "SalomeIDLSMESH",
00378             "SMDS",
00379             "SMESHClient",
00380             "SMESHControls",
00381             "SMESHDS",
00382             "SMESHEngine",
00383             "SMESHFiltersSelection",
00384             "SMESHimpl",
00385             "SMESHObject",
00386             "SMESH",
00387             "SMESHUtils",
00388             "StdMeshersEngine",
00389             "StdMeshersGUI",
00390             "StdMeshers",
00391             ]
00392         full_list  = cas_list + vtk_list
00393         full_list += kernel_list + gui_list
00394         full_list += geom_list + med_list + smesh_list
00395         # --
00396         # E.A. : sort by len before substitution ...
00397         # Why ? Thing to "-lMEDWrapper" then "-lMEDWrapper_V2_1" substition
00398         # And you understand ...
00399         # --
00400         full_list.sort(cmp = lambda x, y : cmp(len(y), len(x)))
00401         # --
00402         for key in full_list:
00403             content = content.replace("-l%s"%(key), "${%s}"%(key))
00404          
00405             pass
00406         
00407         # --
00408         # Split content in lines to treat each one separately
00409         # --
00410         lines = content.split('\n')
00411         
00412         # --
00413         # newlines contains the lines of the future CMakeLists.txt file
00414         # --
00415         newlines = []
00416         
00417         # --
00418         # opened_ifs is used to deals with nested conditionnals
00419         # --
00420         opened_ifs = []
00421         
00422         # --
00423         # the __thedict__ dictionnary contains key, val
00424         # of the Makefile.am file
00425         # --
00426         self.__thedict__ = {}
00427         
00428         # --
00429         # Initialize file ... mainly includes other cmake files
00430         # --
00431         self.initialize(newlines)
00432         
00433         # --
00434         # Do the job for each line
00435         # --
00436         for line in lines:
00437             self.treatLine(line, newlines, opened_ifs)
00438             pass
00439         
00440         # --
00441         # Finalize file ... it is in here the cmake job is done
00442         # --
00443         self.finalize(newlines)
00444         
00445         # --
00446         # Concatenate newlines into content
00447         # --
00448         content = '\n'.join(newlines)
00449         
00450         # --
00451         # Add a CR at end if necessary
00452         # --
00453         lines = content.split('\n')
00454         # lines = [ l.strip() for l in lines ]
00455         if len(lines[-1]) != 0:
00456             lines.append('')
00457             pass
00458         content = '\n'.join(lines)
00459         
00460         # --
00461         self.content  = "# ---------------------------------------------------------------------\n"
00462         self.content += "# This file was automatically generated by am2cmake (erwan.adam@cea.fr)\n"
00463         self.content += "# ---------------------------------------------------------------------\n"
00464         self.content += content
00465         
00466         # --
00467         return
    
def am2cmake.CMakeFile.setCompilationFlags (   self,
  key,
  newlines 
)

Definition at line 1876 of file am2cmake.py.

01876 
01877     def setCompilationFlags(self, key, newlines):
01878         newlines.append(r'''
01879         SET(var)
01880         IF(WINDOWS)
01881         SET(targets)
01882         SET(targets ${targets} SalomeIDLKernel)
01883         SET(targets ${targets} SalomeDS)
01884         SET(targets ${targets} SALOMEDSTest)
01885         SET(targets ${targets} SALOMEDS_Client_exe)
01886         SET(targets ${targets} SalomeIDLGEOM)
01887         SET(targets ${targets} GEOMEngine)
01888         SET(targets ${targets} MEDEngine)
01889         SET(targets ${targets} SMESHEngine)
01890         SET(targets ${targets} SMESH)
01891         SET(targets ${targets} SalomeIDLSPADDER)
01892         SET(targets ${targets} MeshJobManagerEngine)
01893         SET(targets ${targets} StdMeshersEngine)
01894         SET(targets ${targets} VISUEngineImpl)
01895         FOREACH(target ${targets})
01896         IF(name STREQUAL ${target})
01897         SET(var ${var} -DNOGDI)
01898         ENDIF(name STREQUAL ${target})
01899         ENDFOREACH(target ${targets})
01900         ENDIF(WINDOWS)
01901         ''')
01902         # --
01903         if self.module in ["medfile", "yacs"]:
01904             newlines.append(r'''
01905             IF(WINDOWS)
01906             SET(var ${var} -DNOGDI)
01907             ENDIF(WINDOWS)
01908             ''')
01909             pass
01910         # --
01911         newlines.append(r'''
01912         IF(WINDOWS)
01913         SET(targets)
01914         SET(targets ${targets} MEFISTO2D)
01915         FOREACH(target ${targets})
01916         IF(name STREQUAL ${target})
01917         SET(dir $ENV{F2CHOME})
01918         STRING(REPLACE "\\\\" "/" dir ${dir})
01919         SET(var ${var} -I${dir})
01920         SET(var ${var} -DF2C_BUILD)
01921         ENDIF(name STREQUAL ${target})
01922         ENDFOREACH(target ${targets})
01923         ENDIF(WINDOWS)
01924         ''')
01925         # --
01926         if self.module in ["geom", "med"]:
01927             newlines.append(r'''
01928             SET(var ${var} -I${CMAKE_CURRENT_SOURCE_DIR})
01929             SET(var ${var} -I${CMAKE_CURRENT_BINARY_DIR})
01930             ''')
01931             pass
01932         newlines.append(r'''
01933         SET(var ${var} ${AM_CPPFLAGS})
01934         SET(var ${var} ${AM_CXXFLAGS})
01935         ''')
01936         # --
01937         newlines.append(r'''
01938         IF(type STREQUAL STATIC)
01939         SET(var ${var} -fPIC)
01940         ENDIF(type STREQUAL STATIC)
01941         ''')
01942         # --
01943         if self.module == "yacs":
01944             newlines.append(r'''
01945             SET(var ${var} -DYACS_PTHREAD)
01946             SET(var ${var} -DCMAKE_BUILD)
01947             SET(var ${var} -DSALOME_KERNEL)
01948             SET(var ${var} -DDSC_PORTS)
01949             SET(var ${var} -DOMNIORB)
01950             ''')
01951             pass
01952         newlines.append(r'''
01953   SET(var ${var} ${PLATFORM_CPPFLAGS})
01954   SET(var ${var} ${PTHREAD_CFLAGS})
01955   SET(var ${var} ${${amname}_CPPFLAGS})
01956   SET(var ${var} ${${amname}_CXXFLAGS})
01957   SET(var ${var} ${${amname}_CFLAGS})
01958         SET(vars)
01959         IF(WINDOWS)
01960         SET(vars ${vars} -include SALOMEconfig.h)
01961         SET(vars ${vars} -ftemplate-depth-32)
01962         SET(vars ${vars} -fPIC)
01963         SET(vars ${vars} -g)
01964         ENDIF(WINDOWS)
01965         SET(flags)
01966         FOREACH(f ${var})
01967         FOREACH(v ${vars})
01968         IF(f STREQUAL v)
01969         SET(f)
01970         ENDIF(f STREQUAL v)
01971         ENDFOREACH(v ${vars})
01972         IF(f)
01973         string(REGEX MATCH "^-I" test_include ${f})
01974         if(test_include)
01975         string(REGEX REPLACE "^-I" "" include_dir ${f})
01976         if(include_dir)
01977         if(include_dir STREQUAL /usr/include)
01978         else(include_dir STREQUAL /usr/include)
01979         string(REGEX MATCH "^\\." test_dot ${include_dir})
01980         if(test_dot)
01981         set(include_dir ${CMAKE_CURRENT_BINARY_DIR}/${include_dir})
01982         endif(test_dot)
01983         include_directories(${include_dir})
01984         endif(include_dir STREQUAL /usr/include)
01985         endif(include_dir)
01986         else(test_include)
01987         SET(flags "${flags} ${f}")
01988         endif(test_include)
01989         ENDIF(f)
01990         ENDFOREACH(f ${var})
01991         SET_TARGET_PROPERTIES(${name} PROPERTIES COMPILE_FLAGS "${flags}")
01992         ''')
01993         return
    

Here is the caller graph for this function:

def am2cmake.CMakeFile.setLibAdd (   self,
  key,
  newlines 
)

Definition at line 1786 of file am2cmake.py.

01786 
01787     def setLibAdd(self, key, newlines):
01788         # --
01789         newlines.append(r'''
01790         SET(libadd)
01791         ''')
01792         # --
01793         newlines.append(r'''
01794         IF(WINDOWS)
01795         SET(targets)
01796         SET(targets ${targets} MEFISTO2D)
01797         FOREACH(target ${targets})
01798         IF(name STREQUAL ${target})
01799         SET(dir $ENV{F2CHOME})
01800         STRING(REPLACE "\\\\" "/" dir ${dir})
01801         SET(libadd ${libadd} ${dir}/LIBF77.lib)
01802         SET(libadd ${libadd} ${dir}/LIBI77.lib)
01803         ENDIF(name STREQUAL ${target})
01804         ENDFOREACH(target ${targets})
01805         ELSE(WINDOWS)
01806         SET(targets)
01807         SET(targets ${targets} MEFISTO2D)
01808         FOREACH(target ${targets})
01809         IF(name STREQUAL ${target})
01810         SET(libadd ${libadd} -lf2c)
01811         ENDIF(name STREQUAL ${target})
01812         ENDFOREACH(target ${targets})
01813         ENDIF(WINDOWS)
01814         ''')
01815         # --
01816         newlines.append(r'''
01817         SET(libs ${PLATFORM_LIBADD} ${PLATFORM_LDFLAGS} ${LDADD} ${${amname}_LIBADD} ${${amname}_LDADD} ${${amname}_LDFLAGS})
01818         FOREACH(lib SALOMEBasics SalomeBatch)
01819         IF(name STREQUAL lib)
01820         SET(libs ${libs} ${PTHREAD_LIBS})
01821         ENDIF(name STREQUAL lib)
01822         ENDFOREACH(lib SALOMEBasics SalomeBatch)
01823         ''')
01824         # --
01825         newlines.append(r'''
01826         FOREACH(lib ${libs})
01827         GET_FILENAME_COMPONENT(ext ${lib} EXT)
01828         IF(ext STREQUAL .la)
01829         GET_FILENAME_COMPONENT(lib ${lib} NAME_WE)
01830         STRING(REGEX REPLACE "^lib" "" lib ${lib})
01831         ENDIF(ext STREQUAL .la)
01832         SET(vars)
01833         SET(vars ${vars} -no-undefined)
01834         SET(vars ${vars} -lvtkWidgets)
01835         IF(WINDOWS)
01836         SET(vars ${vars} -module)
01837         SET(vars ${vars} -Wl,-E)
01838         SET(vars ${vars} -Xlinker)
01839         SET(vars ${vars} -export-dynamic)
01840         SET(vars ${vars} -lm)
01841         SET(vars ${vars} -lboost_thread)
01842         SET(vars ${vars} -lboost_signals)
01843         SET(vars ${vars} -pthread -lpthread -ldl)
01844         ENDIF(WINDOWS)
01845         FOREACH(v ${vars})
01846         IF(lib STREQUAL v)
01847         SET(lib)
01848         ENDIF(lib STREQUAL v)
01849         ENDFOREACH(v ${vars})
01850         SET(test OFF)
01851         IF(lib)
01852         STRING(REGEX MATCH "^-lQt" test ${lib})
01853         ENDIF(lib)
01854         IF(NOT test)
01855         SET(libadd ${libadd} ${lib})
01856         ENDIF(NOT test)
01857         ENDFOREACH(lib ${libs})
01858         TARGET_LINK_LIBRARIES(${name} ${libadd})
01859         ''')
01860         # --
01861         newlines.append(r'''
01862         IF(WINDOWS)
01863         SET(targets)
01864         SET(targets ${targets} MEFISTO2D)
01865         FOREACH(target ${targets})
01866         IF(name STREQUAL ${target})
01867         IF(CMAKE_BUILD_TYPE STREQUAL Debug)
01868         SET_TARGET_PROPERTIES(${name} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:MSVCRT")
01869         ENDIF(CMAKE_BUILD_TYPE STREQUAL Debug)
01870         ENDIF(name STREQUAL ${target})
01871         ENDFOREACH(target ${targets})
01872         ENDIF(WINDOWS)
01873         ''')
01874         # --
01875         return
    

Here is the caller graph for this function:

def am2cmake.CMakeFile.treatAttribution (   self,
  match,
  newlines 
)

Definition at line 1029 of file am2cmake.py.

01029 
01030     def treatAttribution(self, match, newlines):
01031         
01032         spaces = match.group("spaces")
01033         key = match.group("key")
01034         method = match.group("method")
01035         value = match.group("value")
01036         # print [spaces, key, method, value]
01037         
01038         # --
01039         # Open cmake SET command
01040         # --
01041         newlines.append(spaces + "SET(" + key)
01042         
01043         # --
01044         # If method is '+=', put the previous definition as first value
01045         # --
01046         if method == "+=":
01047             newlines.append("%s    ${%s}"%(spaces, key))
01048             pass
01049         
01050         # --
01051         fields = value.split()
01052         
01053         for i in range(len(fields)):
01054             newlines.append("%s    %s"%(spaces, fields[i]))
01055             pass
01056         
01057         # --
01058         if method == "+=":
01059             # --
01060             # The try: except KeyError is here if the +=
01061             # is an error which occurs in salome ...
01062             # --
01063             try:
01064                 self.__thedict__[key] += fields[:]
01065             except KeyError:
01066                 self.__thedict__[key] = fields[:]
01067                 pass
01068             pass
01069         else:
01070             self.__thedict__[key]  = fields[:]
01071             pass
01072         
01073         # --
01074         # Close cmake SET command
01075         # --
01076         
01077         newlines.append("%s)"%(spaces))
01078         
01079         return
    

Here is the caller graph for this function:

def am2cmake.CMakeFile.treatLine (   self,
  line,
  newlines,
  opened_ifs 
)

Definition at line 883 of file am2cmake.py.

00883 
00884     def treatLine(self, line, newlines, opened_ifs):
00885         
00886         # --
00887         # Print the comment above the line itself
00888         # --
00889         if line.find('#') >= 0:
00890             fields = line.split('#')
00891             line = fields[0]
00892             comment = '#'.join([''] + fields[1:])
00893             newlines.append(comment)
00894             if len(line) == 0:
00895                 return
00896             pass
00897         
00898         # --
00899         # If the line begins with 'include ', just comment it
00900         # --
00901         if line.find("include ") == 0:
00902             if line.find("include $(top_srcdir)/config/automake.common") == 0:
00903                 for l in [
00904                     "MAINTAINERCLEANFILES = Makefile.in",
00905                     "AM_CPPFLAGS=-I$(top_srcdir)/include -I$(top_builddir)/include",
00906                     "AM_FFLAGS=-I$(top_srcdir)/include  -I$(top_builddir)/include",
00907                     "AM_FCFLAGS=-I$(top_srcdir)/include  -I$(top_builddir)/include",
00908                     "AM_CPPFLAGS+=@HDF5_CPPFLAGS@",
00909                     "AM_LDFLAGS=@HDF5_LDFLAGS@",
00910                     ]:
00911                     self.treatLine(l, newlines, opened_ifs)
00912                     pass
00913                 pass
00914             else:
00915                 newlines.append("# " + line)
00916                 pass
00917             return
00918         
00919         # --
00920         # If the line begins with '-include', just comment it
00921         # --
00922         if line.find("-include") == 0:
00923             newlines.append("# " + line)
00924             return
00925         
00926         # --
00927         # If the line is a definition of a make rule, just comment it
00928         # --
00929         if line.count(':') == 1:
00930             newlines.append("# " + line)
00931             return
00932         
00933         # --
00934         # A particuliar case where there are two ":" on the same line
00935         # --
00936         if line.find('install-exec-local:') == 0:
00937             newlines.append("# " + line)
00938             return
00939         
00940         # --
00941         # If the line begin by a tabulation, consider it's a makefile command and comment it
00942         # --
00943         if line.find("\t") == 0:
00944             newlines.append("# " + line)
00945             return
00946         
00947         # --
00948         # --
00949         key = "-version-info"
00950         if line.find(key) >= 0:
00951             # --
00952             before = line.split(key)[0]
00953             after = line[len(before)+len(key):]
00954             sep = after[0]
00955             after = after[1:]
00956             version_info = after.split()[0]
00957             line = line.replace(key+sep+version_info, "")
00958             # --
00959             version_info = version_info.replace(':', '.')
00960             soversion_info = version_info.split('.')[0]
00961             newlines.append("SET(VERSION_INFO " + version_info + ")")
00962             newlines.append("SET(SOVERSION_INFO " + soversion_info + ")")
00963             # --
00964             pass
00965         
00966         # --
00967         # Replace the $(TOTO) by ${TOTO}
00968         # Replace the @TOTO@  by ${TOTO}
00969         # --
00970         line = p_dollar.sub(r"${\1}", line)
00971         line = p_arobas.sub(r"${\1}", line)
00972         
00973         # --
00974         line = line.replace(r"${top_builddir}", r"${CMAKE_BINARY_DIR}")
00975         line = line.replace(r"${top_srcdir}", r"${CMAKE_SOURCE_DIR}")
00976         line = line.replace(r"${srcdir}", r"${CMAKE_CURRENT_SOURCE_DIR}")
00977         line = line.replace(r"${builddir}", r"${CMAKE_CURRENT_BINARY_DIR}")
00978         line = line.replace(r"${datadir}", r"${CMAKE_INSTALL_PREFIX}/share")
00979         
00980         # --
00981         # Check if the line is a 'if' condition
00982         # If yes, replace it by a cmake grammar
00983         # --
00984         match = p_if.match(line)
00985         if match:
00986             theif = match.group("val")
00987             if theif[0] == "!":
00988                 theif = "NOT " + theif[1:]
00989                 pass
00990             line = p_if.sub(r"IF(%s)"%(theif), line)
00991             opened_ifs.append(theif)
00992             newlines.append(line)
00993             return
00994         
00995         # --
00996         # Check if the line is a 'else' condition
00997         # If yes, replace it by a cmake grammar
00998         # --
00999         match = p_else.match(line)
01000         if match:
01001             line = "ELSE(%s)"%(opened_ifs[-1])
01002             newlines.append(line)
01003             return
01004         
01005         # --
01006         # Check if the line is a 'endif' condition
01007         # If yes, replace it by a cmake grammar
01008         # --
01009         match = p_endif.match(line)
01010         if match:
01011             line = "ENDIF(%s)"%(opened_ifs[-1])
01012             opened_ifs[-1:] = []
01013             newlines.append(line)
01014             return
01015         
01016         # --
01017         # Check if the line is an attribution '=' or '+='
01018         # --
01019         match = p_attribution.match(line)
01020         if match:
01021             self.treatAttribution(match, newlines)
01022             return
01023         
01024         # --
01025         newlines.append(line)
01026         
01027         # --
01028         return
    

Here is the call graph for this function:

Here is the caller graph for this function:

def am2cmake.CMakeFile.writeEnvScript (   self,
  upmod 
)

Definition at line 2445 of file am2cmake.py.

02445 
02446     def writeEnvScript(self, upmod):
02447         from sys import platform, version_info
02448         p_version = """%s.%s"""%(version_info[0],version_info[1])
02449         python_path ="PYTHONPATH"
02450         path = ""
02451         begin = ""
02452         end = ""
02453         delim = ""
02454         cmd = ""
02455         pdir = ""
02456         omni = ""
02457        omni_py = ""
02458         if platform == "win32" :          
02459             path = "PATH"
02460             begin = "%"
02461             end = "%"
02462             delim = ";"
02463             cmd = "@SET "
02464             omni = "/x86_win32"
02465             omni_py = "/python"
02466             pdir = "PDIR"
02467         else:
02468             path = "LD_LIBRARY_PATH"
02469             begin = "\${"
02470             end = "}"
02471             delim = ":"
02472             cmd = "export "
02473             omni_py = "/python" + p_version + "/" + "site-packages"
02474             pdir = "INST_ROOT"
02475 
02476             
02477         path_ = begin + path + end
02478         root_dir_ = begin + upmod + "_ROOT_DIR" + end  
02479         python_path_ = begin + python_path + end
02480         _python_path_ = delim + python_path_+ "\n"
02481         _path_ = delim + path_+ "\n" 
02482         _pdir = begin + pdir + end 
02483            
02484         
02485         script = cmd + " " + python_path + "=" + root_dir_+"/lib/python" + p_version \
02486         + "/site-packages/salome" + _python_path_ 
02487         
02488         script = script + cmd + " " + python_path + "=" + root_dir_+"/bin/salome" + \
02489         _python_path_
02490 
02491         script = script + cmd + " "+ path + "=" + root_dir_+"/lib/salome"+ _path_
02492 
02493        if upmod == "KERNEL" :
02494             script = script + cmd + " " +  python_path + "=" + _pdir + \
02495             "/omniORB-4.1.5/lib" + omni + _python_path_
02496         
02497             script = script + cmd + " " + python_path + "=" + _pdir + \
02498             "/omniORB-4.1.5/lib" + omni_py + _python_path_
02499         
02500             script = script + cmd + " "+ path + "=" + _pdir+ "/omniORB-4.1.5/lib" + \
02501             omni + _path_
02502 
02503         if upmod == "GEOM" :
02504             script = self.writeEnvScript("KERNEL") + script
02505             script = self.writeEnvScript("GUI") + script
02506 
02507         if upmod == "SMESH" :
02508             script = self.writeEnvScript("GEOM") + script
02509 
        return script    

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2439 of file am2cmake.py.

02439 
02440     def writeListsFile(self):
02441         f = open(self.listsFile, "w")
02442         f.write(self.content)
02443         f.close()
02444         return


Member Data Documentation

Definition at line 425 of file am2cmake.py.

Definition at line 104 of file am2cmake.py.

Definition at line 460 of file am2cmake.py.

dictionary am2cmake.CMakeFile.d [static]
Initial value:
{
            "salomeadmux_DATA"                 :  "salome_adm/unix",
            "dist_salomeadmux_DATA"            :  "salome_adm/unix",
            "dist_salome_cmake_DATA"           :  "salome_adm/cmake_files",
            "dist_salomem4_DATA"               :  "salome_adm/unix/config_files",
            "dist_salome4depr_DATA"            :  "salome_adm/unix/config_files/DEPRECATED",
            "dist_admlocalm4_DATA"             :  "adm_local/unix/config_files",
            "dist_admlocal_cmake_DATA"         :  "adm_local/cmake_files",
            "salomeinclude_DATA"               :  "include/salome",
            "salomeinclude_HEADERS"            :  "include/salome",
            "nodist_salomeinclude_HEADERS"     :  "include/salome",
            "dist_salomeres_DATA"              :  "share/salome/resources/%s"%(resdir),
            "nodist_salomeres_DATA"            :  "share/salome/resources/%s"%(resdir),
            "nodist_salomeres_SCRIPTS"         :  "share/salome/resources/%s"%(resdir),
            "dist_salomescript_SCRIPTS"        :  "bin/salome",
            "dist_salomescript_DATA"           :  "bin/salome",
            "dist_salomescript_PYTHON"         :  "bin/salome",
            "dist_appliskel_SCRIPTS"           :  "bin/salome/appliskel",
            "dist_appliskel_PYTHON"            :  "bin/salome/appliskel",
            "nodist_salomescript_DATA"         :  "bin/salome",
            "salomepython_PYTHON"              :  "${salomepythondir}",
            "nodist_salomepython_PYTHON"       :  "${salomepythondir}",
            "dist_salomepython_DATA"           :  "${salomepythondir}",
            "sharedpkgpython_PYTHON"           :  "${salomepythondir}/shared_modules",
            "salomepypkg_PYTHON"               :  "${salomepypkgdir}",
            "mypkgpython_PYTHON"               :  "${mypkgpythondir}",
            "nodist_mypkgpython_PYTHON"        :  "${mypkgpythondir}",
            }

Definition at line 1730 of file am2cmake.py.

Definition at line 99 of file am2cmake.py.

string am2cmake.CMakeFile.doc_source = "${CMAKE_CURRENT_BINARY_DIR}/%s" [static]

Definition at line 1308 of file am2cmake.py.

string am2cmake.CMakeFile.extra_srcdir = "${CMAKE_CURRENT_SOURCE_DIR}/extra" [static]

Definition at line 1303 of file am2cmake.py.

Definition at line 100 of file am2cmake.py.

tuple am2cmake.CMakeFile.hxxmodule = self.the_root[:-len(key)] [static]

Definition at line 867 of file am2cmake.py.

tuple am2cmake.CMakeFile.hxxmodule = basename(hxxmodule) [static]

Definition at line 869 of file am2cmake.py.

string am2cmake.CMakeFile.key = "_SRC" [static]

Definition at line 863 of file am2cmake.py.

Definition at line 105 of file am2cmake.py.

Definition at line 101 of file am2cmake.py.

string am2cmake.CMakeFile.msg = "Source dir must finished with %s !" [static]

Definition at line 865 of file am2cmake.py.

am2cmake.CMakeFile.resdir = self.module [static]

Definition at line 1726 of file am2cmake.py.

Definition at line 98 of file am2cmake.py.

Definition at line 97 of file am2cmake.py.

string am2cmake.CMakeFile.tmp [static]
Initial value:
"""\tADD_CUSTOM_TARGET(dev_docs ${DOXYGEN_EXECUTABLE} -u
            COMMAND ${DOXYGEN_EXECUTABLE}
            COMMAND ${PYTHON_EXECUTABLE} -c "import os; os.remove(r'''${CMAKE_CURRENT_BINARY_DIR}/doxyfile.bak''')"  """

Definition at line 1294 of file am2cmake.py.

string am2cmake.CMakeFile.tmp1 = "" [static]

Definition at line 1297 of file am2cmake.py.

tuple am2cmake.CMakeFile.upmod = self.module.upper() [static]

Definition at line 1291 of file am2cmake.py.


The documentation for this class was generated from the following file: