Back to index

salome-med  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

Public Attributes

 the_root
 root
 dirs
 files
 module
 amFile
 listsFile
 content
 hxxmodule

Static Public Attributes

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"
string key = "IDL_FILES"
 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 2055 of file am2cmake.py.

02055 
02056     def addBinTarget(self, key, newlines):
02057         # --
02058         newlines.append(r'''
02059         FOREACH(amname ${%s})
02060         '''%(key))
02061         # --
02062         newlines.append(r'''
02063         SET(test ON)
02064         ''')
02065         if key == "check_PROGRAMS":
02066             newlines.append(r'''
02067             IF(bin_PROGRAMS)
02068             STRING(REGEX MATCH ${amname} is_present ${bin_PROGRAMS})
02069             IF(is_present)
02070             SET(test OFF)
02071             ENDIF(is_present)
02072             ENDIF(bin_PROGRAMS)
02073             ''')
02074             pass
02075         newlines.append(r'''
02076         IF(test)
02077         ''')
02078         # --
02079         newlines.append(r'''
02080         SET(name "${amname}_exe")
02081         SET(srcs ${${amname}_SOURCES} ${dist_${amname}_SOURCES})
02082         SET(l ${nodist_${amname}_SOURCES})
02083         FOREACH(f ${l})
02084         SET(src ${CMAKE_CURRENT_BINARY_DIR}/${f})
02085         SET(srcs ${srcs} ${src})
02086         ENDFOREACH(f ${l})
02087         LIST(LENGTH srcs nb)
02088         IF(nb)
02089         ADD_EXECUTABLE(${name} ${srcs})
02090         ''')
02091         # --
02092         self.setCompilationFlags(key, newlines)
02093         # --
02094         self.setLibAdd(key, newlines)
02095         # --
02096         if self.module in ["jobmanager", "medfile", "netgen"]:
02097             newlines.append(r'''
02098             SET(DEST bin)
02099             ''')
02100         else:
02101             newlines.append(r'''
02102             SET(DEST bin/salome)
02103             ''')
02104             pass
02105         # --
02106         if key == "bin_PROGRAMS":
02107             newlines.append(r'''
02108             IF(WINDOWS)
02109             INSTALL(TARGETS ${name} DESTINATION ${DEST})
02110             INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.exe DESTINATION ${DEST} RENAME ${amname}.exe)
02111             INSTALL(CODE "FILE(REMOVE ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.exe)")
02112             ELSE(WINDOWS)
02113             SET(PERMS)
02114             SET(PERMS ${PERMS} OWNER_READ OWNER_WRITE OWNER_EXECUTE)
02115             SET(PERMS ${PERMS} GROUP_READ GROUP_EXECUTE)
02116             SET(PERMS ${PERMS} WORLD_READ WORLD_EXECUTE)
02117             INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${name} DESTINATION ${DEST} PERMISSIONS ${PERMS} RENAME ${amname})
02118             ENDIF(WINDOWS)
02119             ''')
02120             pass
02121         # --
02122         newlines.append(r'''
02123         ENDIF(nb)
02124         ''')
02125         # --
02126         newlines.append(r'''
02127         ENDIF(test)
02128         ''')
02129         newlines.append(r'''
02130         ENDFOREACH(amname ${%s})
02131         '''%(key))
02132         # --
02133         return
    

Here is the call graph for this function:

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

Definition at line 2134 of file am2cmake.py.

02134 
02135     def addInstallTarget(self, key, destination, newlines):
02136         newlines.append(r"FOREACH(f ${%s})"%(key))
02137         newlines.append(r'''
02138         SET(DEST %s)
02139         '''%(destination))
02140         newlines.append(r'''
02141         STRING(COMPARE EQUAL ${f} SALOMEconfig.h.in test_SALOMEconfig.h.in)
02142         IF(test_SALOMEconfig.h.in)
02143         INSTALL(FILES SALOMEconfig.ref.in DESTINATION ${DEST} RENAME SALOMEconfig.h.in)
02144         ELSE(test_SALOMEconfig.h.in)
02145         SET(dummy dummy-NOTFOUND)
02146         MARK_AS_ADVANCED(dummy)
02147         # FILE(REMOVE ${CMAKE_INSTALL_PREFIX}/${DEST}/${f})
02148         FIND_FILE(dummy ${f} PATHS ${CMAKE_CURRENT_SOURCE_DIR} NO_DEFAULT_PATH)
02149         IF(dummy)
02150         ''')
02151         if key in ['dist_salomescript_SCRIPTS']:
02152             newlines.append(r'''
02153             SET(PERMS)
02154             SET(PERMS ${PERMS} OWNER_READ OWNER_WRITE OWNER_EXECUTE)
02155             SET(PERMS ${PERMS} GROUP_READ GROUP_EXECUTE)
02156             SET(PERMS ${PERMS} WORLD_READ WORLD_EXECUTE)
02157             INSTALL(FILES ${f} DESTINATION ${DEST} PERMISSIONS ${PERMS})
02158             ''')
02159         else:
02160             newlines.append(r'''
02161             GET_FILENAME_COMPONENT(ext ${f} EXT)
02162             IF(ext STREQUAL .py)
02163             IF(DEST STREQUAL bin/salome)
02164             SET(PERMS)
02165             SET(PERMS ${PERMS} OWNER_READ OWNER_WRITE OWNER_EXECUTE)
02166             SET(PERMS ${PERMS} GROUP_READ GROUP_EXECUTE)
02167             SET(PERMS ${PERMS} WORLD_READ WORLD_EXECUTE)
02168             INSTALL(FILES ${f} DESTINATION ${DEST} PERMISSIONS ${PERMS})
02169             ELSE(DEST STREQUAL bin/salome)
02170             INSTALL(FILES ${f} DESTINATION ${DEST})
02171             ENDIF(DEST STREQUAL bin/salome)
02172             ELSE(ext STREQUAL .py)
02173             INSTALL(FILES ${f} DESTINATION ${DEST})
02174             ENDIF(ext STREQUAL .py)
02175             ''')
02176             pass
02177         newlines.append(r'''
02178         ELSE(dummy)
02179         GET_FILENAME_COMPONENT(ext ${f} EXT)
02180         IF(ext STREQUAL .qm)
02181         STRING(REGEX REPLACE .qm .ts input ${f})
02182         ''')
02183         if self.module in ["kernel", "gui", "yacs"]:
02184             newlines.append(r'''
02185             SET(input ${CMAKE_CURRENT_SOURCE_DIR}/resources/${input})
02186             ''')
02187         else:
02188             newlines.append(r'''
02189             SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input})
02190             ''')
02191             pass
02192         newlines.append(r'''
02193         SET(output ${CMAKE_CURRENT_BINARY_DIR}/${f})
02194         # ADD_CUSTOM_COMMAND(
02195         # OUTPUT ${output}
02196         # COMMAND ${QT_LRELEASE_EXECUTABLE} ${input} -qm ${output}
02197         # MAIN_DEPENDENCY ${input}
02198         # )
02199         EXECUTE_PROCESS(COMMAND ${QT_LRELEASE_EXECUTABLE} ${input} -qm ${output})
02200         ENDIF(ext STREQUAL .qm)
02201         INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${f} DESTINATION ${DEST})
02202         ENDIF(dummy)
02203         ENDIF(test_SALOMEconfig.h.in)
02204         ''')
02205         newlines.append(r'''
02206         GET_FILENAME_COMPONENT(ext ${f} EXT)
02207         IF(ext STREQUAL .py)
02208         INSTALL(CODE "SET(PYTHON_FILE ${f})")
02209         INSTALL(CODE "SET(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})")
02210         INSTALL(CODE "SET(DEST ${DEST})")
02211         INSTALL(CODE "SET(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE})")
02212         ''')
02213         if self.module == "kernel":
02214             newlines.append('''
02215             IF(f STREQUAL SALOME_ContainerPy.py)
02216             ELSE(f STREQUAL SALOME_ContainerPy.py)
02217             IF(f STREQUAL am2cmake.py)
02218             ELSE(f STREQUAL am2cmake.py)
02219             IF(f STREQUAL copytree1.py)
02220             ELSE(f STREQUAL copytree1.py)
02221             INSTALL(SCRIPT ${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/install_and_compile_python_file.cmake)
02222             ENDIF(f STREQUAL copytree1.py)
02223             ENDIF(f STREQUAL am2cmake.py)
02224             ENDIF(f STREQUAL SALOME_ContainerPy.py)
02225             ''')
02226         else:
02227             newlines.append('''
02228             STRING(REPLACE "\\\\" "/" KERNEL_ROOT_DIR ${KERNEL_ROOT_DIR})
02229             INSTALL(SCRIPT ${KERNEL_ROOT_DIR}/salome_adm/cmake_files/install_and_compile_python_file.cmake)
02230             ''')
02231             pass
02232         newlines.append(r'''
02233         ENDIF(ext STREQUAL .py)
02234         ''') 
02235         newlines.append(r"ENDFOREACH(f ${%s})"%(key))
02236         return
    
def am2cmake.CMakeFile.addLibTarget (   self,
  key,
  newlines 
)

Definition at line 1795 of file am2cmake.py.

01795 
01796     def addLibTarget(self, key, newlines):
01797         newlines.append(r'''
01798         FOREACH(amname ${%s})
01799         '''%(key))
01800         # --
01801         # Replace .la by _la ...
01802         # --
01803         newlines.append(r'''
01804         STRING(REPLACE .la _la amname ${amname})
01805         ''')
01806         # --
01807         # Remove the _la for the cmake name
01808         # --
01809         newlines.append(r'''
01810         STRING(LENGTH ${amname} len)
01811         MATH(EXPR newlen "${len}-3")
01812         STRING(SUBSTRING ${amname} 0 ${newlen} name)
01813         ''')
01814         # --
01815         # Does the target begins with lib ??
01816         # If yes, remove lib at beginning for cmake name
01817         # --
01818         newlines.append(r'''
01819         STRING(REGEX MATCH "^lib" BEGIN_WITH_lib ${name})
01820         IF(BEGIN_WITH_lib)
01821         STRING(LENGTH ${name} len)
01822         MATH(EXPR newlen "${len}-3")
01823         STRING(SUBSTRING ${name} 3 ${newlen} name)
01824         ENDIF(BEGIN_WITH_lib)
01825         ''')
01826         # --
01827         # Does the target is an idl library
01828         # --
01829         newlines.append(r'''
01830         STRING(REGEX MATCH "IDL" ISIDL ${name})
01831         ''')
01832         # --
01833         # Set the type of the library
01834         # --
01835         newlines.append(r'''
01836         IF(ISIDL)
01837         IF(WINDOWS)
01838         SET(type STATIC)
01839         ELSE(WINDOWS)
01840         SET(type SHARED)
01841         ENDIF(WINDOWS)
01842         ELSE(ISIDL)
01843         SET(type SHARED)
01844         ENDIF(ISIDL)
01845         ''')
01846         if key == "noinst_LTLIBRARIES":
01847             newlines.append(r'''
01848             IF(WINDOWS)
01849             SET(type STATIC)
01850             ELSE(WINDOWS)
01851             SET(type STATIC)
01852             ENDIF(WINDOWS)
01853             ''')
01854             pass
01855         # --
01856         # Set sources for the library
01857         # --
01858         newlines.append(r'''
01859         SET(srcs)
01860         FOREACH(src ${${amname}_SOURCES} ${dist_${amname}_SOURCES})
01861         GET_FILENAME_COMPONENT(ext ${src} EXT)
01862         IF(ext STREQUAL .f)
01863         IF(src STREQUAL trte.f)
01864         SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${src})
01865         STRING(REPLACE ".f" ".c" src ${src})
01866         SET(src ${CMAKE_CURRENT_BINARY_DIR}/${src})
01867         SET(output ${src})
01868         SET(cmd f2c)
01869         IF(NOT WINDOWS)
01870         IF(CMAKE_SIZEOF_VOID_P STREQUAL 8)
01871         SET(cmd valgrind f2c)  # f2c seems to be buggy on 64 bits ... but with valgrind, it works :)
01872         ENDIF()
01873         ENDIF(NOT WINDOWS)
01874         ADD_CUSTOM_COMMAND(
01875         OUTPUT ${output}
01876         COMMAND ${cmd} ${input}
01877         MAIN_DEPENDENCY ${input}
01878         )
01879         ELSE(src STREQUAL trte.f)
01880         SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${src})
01881         STRING(REPLACE ".f" ".o" src ${src})
01882         SET(src ${CMAKE_CURRENT_BINARY_DIR}/${src})
01883         SET(output ${src})
01884         IF(WINDOWS)
01885         SET(F77 g77)
01886         ELSE(WINDOWS)
01887         SET(F77 gfortran)
01888         ENDIF(WINDOWS)
01889         ADD_CUSTOM_COMMAND(
01890         OUTPUT ${output}
01891         COMMAND ${F77} -c -o ${output} ${input}
01892         MAIN_DEPENDENCY ${input}
01893         )
01894         ENDIF(src STREQUAL trte.f)
01895         ENDIF(ext STREQUAL .f)
01896         SET(srcs ${srcs} ${src})
01897         ENDFOREACH(src ${${amname}_SOURCES} ${dist_${amname}_SOURCES})
01898         ''')
01899         newlines.append(r'''
01900         SET(l ${nodist_${amname}_SOURCES} ${UIC_FILES})
01901         FOREACH(f ${l})
01902         SET(src ${CMAKE_CURRENT_BINARY_DIR}/${f})
01903         SET(srcs ${srcs} ${src})
01904         ENDFOREACH(f ${l})
01905         ''')
01906         newlines.append(r'''
01907         SET(build_srcs)
01908         SET(l ${nodist_${amname}_SOURCES} ${BUILT_SOURCES})
01909         FOREACH(f ${l})
01910         GET_FILENAME_COMPONENT(ext ${f} EXT)
01911         IF(ext STREQUAL .py)
01912         SET(fff)
01913         ELSE(ext STREQUAL .py)
01914         SET(fff ${CMAKE_CURRENT_BINARY_DIR}/${f})
01915         ENDIF(ext STREQUAL .py)
01916         IF(fff)
01917         IF(build_srcs)
01918         LIST(FIND build_srcs ${fff} index)
01919         IF(NOT index EQUAL -1)
01920         SET(fff)
01921         ENDIF(NOT index EQUAL -1)
01922         ENDIF(build_srcs)
01923         ENDIF(fff)
01924         IF(fff)
01925         SET(build_srcs ${build_srcs} ${fff})
01926         ENDIF(fff)
01927         ENDFOREACH(f ${l})
01928         ''')
01929         # --
01930         # Add the library to cmake
01931         # --
01932         newlines.append(r'''
01933         ADD_LIBRARY(${name} ${type} ${srcs})
01934         ''')
01935         # --
01936         # The compilation flags
01937         # --
01938         self.setCompilationFlags(key, newlines)
01939         # --
01940         newlines.append(r'''
01941         SET_TARGET_PROPERTIES(${name} PROPERTIES VERSION ${VERSION_INFO} SOVERSION ${SOVERSION_INFO})
01942         ''')
01943         # --
01944         self.setLibAdd(key, newlines)
01945         # --
01946         if 1: # key != "noinst_LTLIBRARIES":
01947             newlines.append(r'''
01948             SET(key %s)
01949             '''%(key))
01950             newlines.append(r'''
01951             SET(test ON)
01952             IF(${key} STREQUAL noinst_LTLIBRARIES)
01953             SET(test OFF)
01954             ENDIF(${key} STREQUAL noinst_LTLIBRARIES)
01955             ''')
01956             if self.module == "netgen" :
01957                 newlines.append(r'''
01958                 IF(${key} STREQUAL noinst_LTLIBRARIES)
01959                 IF(WINDOWS)
01960                 SET(test ON)
01961                 ENDIF(WINDOWS)
01962                 ENDIF(${key} STREQUAL noinst_LTLIBRARIES)
01963                 ''')
01964                 pass
01965             newlines.append(r'''
01966             IF(test)
01967             ''')
01968             if self.module in ["medfile", "netgen"]:
01969                 newlines.append(r'''
01970                 SET(DEST lib)
01971                 ''')
01972             else:
01973                 newlines.append(r'''
01974                 SET(DEST lib/salome)
01975                 ''')
01976                 pass
01977             newlines.append(r'''
01978             IF(BEGIN_WITH_lib)
01979             INSTALL(TARGETS ${name} DESTINATION ${DEST})
01980             ''')
01981             if self.module == "gui":
01982                 newlines.append(r'''
01983                 FOREACH(lib SalomePyQt)
01984                 IF(name STREQUAL lib)
01985                 IF(WINDOWS)
01986                 IF(CMAKE_BUILD_TYPE STREQUAL Release)
01987                 INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME ${name}.pyd)
01988                 ELSE(CMAKE_BUILD_TYPE STREQUAL Release)
01989                 INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME ${name}_d.pyd)
01990                 ENDIF(CMAKE_BUILD_TYPE STREQUAL Release)
01991                 ELSE(WINDOWS)
01992                 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so DESTINATION ${DEST} RENAME ${name}.so)
01993                 ENDIF(WINDOWS)
01994                 ENDIF(name STREQUAL lib)
01995                 ENDFOREACH(lib SalomePyQt)
01996                 FOREACH(lib SalomePy)
01997                 IF(name STREQUAL lib)
01998                 IF(WINDOWS)
01999                 IF(CMAKE_BUILD_TYPE STREQUAL Release)
02000                 INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME lib${name}.pyd)
02001                 ELSE(CMAKE_BUILD_TYPE STREQUAL Release)
02002                 INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME lib${name}_d.pyd)
02003                 ENDIF(CMAKE_BUILD_TYPE STREQUAL Release)
02004                 ENDIF(WINDOWS)
02005                 ENDIF(name STREQUAL lib)
02006                 ENDFOREACH(lib SalomePy)
02007                 ''')
02008                 pass
02009             if self.module == "geom":
02010                 newlines.append(r'''
02011                 IF(WINDOWS)
02012                 STRING(REGEX MATCH "Export" ISExport ${name})
02013                 IF(ISExport)
02014                 INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME lib${name}.dll)
02015                 ENDIF(ISExport)
02016                 STRING(REGEX MATCH "Import" ISImport ${name})
02017                 IF(ISImport)
02018                 INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME lib${name}.dll)
02019                 ENDIF(ISImport)
02020                 ENDIF(WINDOWS)
02021                 ''')
02022                 pass
02023             newlines.append(r'''
02024             ELSE(BEGIN_WITH_lib)
02025             ''')
02026             newlines.append(r'''
02027             IF(WINDOWS)
02028             INSTALL(TARGETS ${name} DESTINATION ${salomepythondir})
02029             IF(CMAKE_BUILD_TYPE STREQUAL Release)
02030             INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${salomepythondir}/${name}.dll DESTINATION ${salomepythondir} RENAME ${name}.pyd)
02031             ELSE(CMAKE_BUILD_TYPE STREQUAL Release)
02032             INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${salomepythondir}/${name}.dll DESTINATION ${salomepythondir} RENAME ${name}_d.pyd)
02033             ENDIF(CMAKE_BUILD_TYPE STREQUAL Release)
02034             ELSE(WINDOWS)
02035             GET_TARGET_PROPERTY(version ${name} VERSION)
02036             GET_TARGET_PROPERTY(soversion ${name} SOVERSION)
02037             INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so.${version} DESTINATION ${salomepythondir} RENAME ${name}.so.${version})
02038             INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so.${version} DESTINATION ${salomepythondir} RENAME ${name}.so.${soversion})
02039             INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so.${version} DESTINATION ${salomepythondir} RENAME ${name}.so)
02040             ENDIF(WINDOWS)
02041             ''')
02042             newlines.append(r'''
02043             ENDIF(BEGIN_WITH_lib)
02044             ''')
02045             newlines.append(r'''
02046             ENDIF(test)
02047             ''')
02048             pass
02049         # --
02050         newlines.append(r'''
02051         ENDFOREACH(amname ${%s})
02052         '''%(key))
02053         # --
02054         return
    

Here is the call graph for this function:

def am2cmake.CMakeFile.finalize (   self,
  newlines 
)

Definition at line 1044 of file am2cmake.py.

01044 
01045     def finalize(self, newlines):
01046       
01047         # --
01048         # Convert the .in files in build dir
01049         # --
01050 
01051         import operator
01052         mod = self.module
01053         if mod in ['kernel', 'gui'] and self.root[-len('gui'):] == 'gui' or mod == 'med' and operator.contains(self.root, 'doxygen'):
01054             newlines.append(r'''
01055             SET(top_builddir
01056                 ${CMAKE_BINARY_DIR}
01057             )
01058             SET(top_srcdir 
01059                 ${CMAKE_SOURCE_DIR}
01060             )
01061             SET(srcdir 
01062                 ${CMAKE_CURRENT_SOURCE_DIR}
01063             )
01064             SET(builddir 
01065                 ${CMAKE_CURRENT_BINARY_DIR}
01066             )
01067             SET(datadir
01068                 ${CMAKE_INSTALL_PREFIX}/share
01069             )
01070             SET(docdir 
01071                 ${datadir}/doc/salome
01072             )
01073             ''')
01074             self.files.append("static/header.html.in")
01075         elif self.root[-len(mod):] == mod.upper() and operator.contains(self.root, 'doc') or mod in ['kernel', 'gui', 'geom', 'med', 'smesh', 'visu'] and self.root[-len('tui'):] == 'tui':
01076             newlines.append(r'''
01077             SET(top_builddir
01078                 ${CMAKE_BINARY_DIR}
01079             )
01080             SET(top_srcdir 
01081                 ${CMAKE_SOURCE_DIR}
01082             )
01083             SET(srcdir 
01084                 ${CMAKE_CURRENT_SOURCE_DIR}
01085             )
01086             SET(builddir 
01087                 ${CMAKE_CURRENT_BINARY_DIR}
01088             )
01089             SET(datadir
01090                 ${CMAKE_INSTALL_PREFIX}/share
01091             )
01092             SET(docdir 
01093                 ${datadir}/doc/salome
01094             )
01095             ''')
01096             self.files.append("static/header.html.in")
01097                         
01098             if mod in ['geom', 'smesh', 'visu'] and self.root[-len(mod):] == mod.upper():
01099               self.files.append("static/header_py.html.in")
01100      
01101         if self.module == "yacs":
01102             key = "salomegui"
01103             if self.root[-len(key):] == key:
01104                 self.files.append("resources/YACSCatalog.xml.in")
01105                 pass
01106             pass
01107         for f in self.files:
01108             if f[-3:] == ".in":
01109                 if self.module == 'yacs' and f == "Doxyfile.in":
01110                     continue
01111                 if f == "sstream.in":
01112                     continue
01113                 if f in ["runContainer.in", "stopContainer.in"]:
01114                     if self.module == "med":
01115                         if self.root[-3:] == "csh":
01116                             continue
01117                         pass
01118                     pass
01119                 if f == "SALOMEconfig.ref.in":
01120                     out = "SALOMEconfig.h"
01121                 else:
01122                     out = f[:-3]
01123                     pass
01124                 newlines.append(r'''
01125                 SET(input ${CMAKE_CURRENT_SOURCE_DIR}/%s)
01126                 '''%(f))
01127                 newlines.append(r'''
01128                 SET(output ${CMAKE_CURRENT_BINARY_DIR}/%s)
01129                 '''%(out))
01130                 newlines.append(r'''
01131                 MESSAGE(STATUS "Creation of ${output}")
01132                 CONFIGURE_FILE(${input} ${output})
01133                 ''')
01134                 pass
01135             pass
01136 
01137         # --
01138         # add commands for generating of user's documentation
01139         # --
01140   
01141         upmod = self.module.upper()
01142         doc_gui_destination = "${CMAKE_INSTALL_PREFIX}/share/doc/salome/gui/%s"%(upmod)
01143         doc_tui_destination = "${CMAKE_INSTALL_PREFIX}/share/doc/salome/tui/%s"%(upmod)
01144         doc_destination = "${CMAKE_INSTALL_PREFIX}/share/doc/salome"
01145         head_source = "${CMAKE_CURRENT_SOURCE_DIR}/images/head.png"
01146         if mod == 'kernel':
01147             copytree_src = "${CMAKE_SOURCE_DIR}/salome_adm/cmake_files"
01148         else:
01149             copytree_src = "$ENV{KERNEL_ROOT_DIR}/salome_adm/cmake_files"
01150         str = "import re \nimport sys \noutfile = open(sys.argv[1], 'wb') \nfor line in open(sys.argv[2], 'rb').readlines():"
01151         str += "\n    if re.match('class '+sys.argv[3]+'DC', line): \n        continue \n    line = re.sub(r'^\\\\s+\#', '#', line) \n    line = re.sub(r'^\\\\s+def', 'def', line) \n    line = re.sub(sys.argv[3]+'DC', sys.argv[3], line)"
01152         str += "\n    outfile.write(line) \noutfile.close()"
01153 
01154         if mod in ['kernel', 'gui'] and self.root[-len('gui'):] == 'gui' or mod == 'med' and operator.contains(self.root, 'doxygen'):
01155             if mod == 'med':
01156                 doc_source = "${CMAKE_CURRENT_BINARY_DIR}/doc_ref_user/html"
01157                 input = "Doxyfile_med_user"
01158             else:
01159                 doc_source = "${CMAKE_CURRENT_BINARY_DIR}/%s"%(upmod)
01160                 input = ""
01161             newlines.append("""\t    ADD_CUSTOM_TARGET(usr_docs ${DOXYGEN_EXECUTABLE} %s
01162             COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; sys.path.append(r'''%s'''); shutil.rmtree(r'''%s''', True); import copytree1; copytree1.copytree(r'''%s''', r'''%s'''); shutil.copy(r'''%s''', r'''%s''')"
01163             VERBATIM 
01164             WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}             
01165             )"""%(input, copytree_src, doc_gui_destination, doc_source, doc_gui_destination, head_source, doc_gui_destination))
01166                 
01167         if mod in ['geom', 'smesh', 'visu'] and self.root[-len(mod):] == upmod and operator.contains(self.root, 'doc'):
01168             ign = r"""'tempfile', '*usr_docs*', '*CMakeFiles*', '*.cmake', 'doxyfile*', '*.vcproj', 'static', 'Makefile*'"""
01169             if mod in ['geom', 'smesh']:
01170                 if mod == 'geom':
01171                     tmp = 'geompy'
01172                     input = "COMMAND ${DOXYGEN_EXECUTABLE} doxyfile_tui \n\t\t"
01173                 else:
01174                     tmp =  'smesh' 
01175                     input = ''
01176                 newlines.append(r"""
01177                 FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/tempfile "%s")
01178                 ADD_CUSTOM_TARGET(usr_docs ${PYTHON_EXECUTABLE} tempfile %s.py ${CMAKE_SOURCE_DIR}/src/%s_SWIG/%sDC.py %s
01179                 %sCOMMAND ${DOXYGEN_EXECUTABLE} doxyfile_py
01180                 COMMAND ${DOXYGEN_EXECUTABLE} doxyfile
01181                 COMMAND ${PYTHON_EXECUTABLE} -c "import os; os.remove(r'''%s.py''')"
01182                 COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; sys.path.append(r'''%s'''); shutil.rmtree(r'''%s''', True); import copytree1; copytree1.copytree(r'''${CMAKE_CURRENT_BINARY_DIR}''', r'''%s''', ignore=copytree1.ignore_patterns(%s)); shutil.copy(r'''%s''', r'''%s''')"
01183                 VERBATIM 
01184                 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}             
01185                 )"""%(str, tmp, upmod, tmp, tmp, input, tmp, copytree_src, doc_gui_destination, doc_gui_destination, ign, head_source, doc_gui_destination))
01186             else:
01187                 newlines.append("""\t    ADD_CUSTOM_TARGET(usr_docs ${DOXYGEN_EXECUTABLE} doxyfile_idl
01188                 COMMAND ${DOXYGEN_EXECUTABLE} doxyfile
01189                 COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; sys.path.append(r'''%s'''); shutil.rmtree(r'''%s''',True); import copytree1; copytree1.copytree(r'''${CMAKE_CURRENT_BINARY_DIR}''',r'''%s''', ignore=copytree1.ignore_patterns(%s)); shutil.copy(r'''%s''',r'''%s''')"
01190                 VERBATIM 
01191                 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}             
01192                 )"""%(copytree_src, doc_gui_destination, doc_gui_destination, ign, head_source, doc_gui_destination))

def am2cmake.CMakeFile.initialize (   self,
  newlines 
)

Definition at line 456 of file am2cmake.py.

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

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             ]
00250         gui_list = [
00251             "caf",
00252             "CAM",
00253             "CASCatch",
00254             "DDS",
00255             "Event",
00256             "GLViewer",
00257             "LightApp",
00258             "LogWindow",
00259             "ObjBrowser",
00260             "OCCViewer",
00261             "OpenGLUtils",
00262             "Plot2d",
00263             "PyConsole",
00264             "PyInterp",
00265             "QDS",
00266             "qtx",
00267             "QxScene",
00268             "SalomeApp",
00269             "SalomeAppTest",
00270             "SalomeIDLGUI",
00271             "SalomeObject",
00272             "SalomePrs",
00273             "SalomePyQtGUILight",
00274             "SalomePyQtGUI",
00275             "SalomePyQt",
00276             "SalomePy",
00277             "SalomeSession",
00278             "SalomeStyle",
00279             "SOCC",
00280             "SPlot2d",
00281             "std",
00282             "SUITApp",
00283             "suit",
00284             "SUPERVGraph",
00285             "SVTK",
00286             "ToolsGUI",
00287             "ViewerTools",
00288             "VTKViewer",
00289             ]
00290         geom_list = [
00291             "AdvancedGUI",
00292             "BasicGUI",
00293             "BlocksGUI",
00294             "BooleanGUI",
00295             "BREPExport",
00296             "BREPImport",
00297             "BuildGUI",
00298             "DisplayGUI",
00299             "DlgRef",
00300             "EntityGUI",
00301             "GenerationGUI",
00302             "GEOMAlgo",
00303             "GEOMArchimede",
00304             "GEOMBase",
00305             "GEOMbasic",
00306             "GEOMClient",
00307             "GEOMEngine",
00308             "GEOMFiltersSelection",
00309             "GEOMimpl",
00310             "GEOMObject",
00311             "GEOMSketcher",
00312             "GEOM",
00313             "GEOM_SupervEngine",
00314             "GEOMToolsGUI",
00315             "GroupGUI",
00316             "IGESExport",
00317             "IGESImport",
00318             "MeasureGUI",
00319             "NMTDS",
00320             "NMTTools",
00321             "OCC2VTK",
00322             "OperationGUI",
00323             "PrimitiveGUI",
00324             "RepairGUI",
00325             "SalomeIDLGEOM",
00326             "ShHealOper",
00327             "STEPExport",
00328             "STEPImport",
00329             "STLExport",
00330             "TransformationGUI",
00331             "VTKExport",
00332             ]
00333         med_list = [
00334             "interpkernel",
00335             "InterpKernelTest",
00336             "MEDClientcmodule",
00337             "medcouplingclient",
00338             "medcouplingcorba",
00339             "medcouplingremapper",
00340             "medcoupling",
00341             "MEDEngine",
00342             "medloader",
00343             "MEDMEMCppTest",
00344             "MEDMEMImpl",
00345             "medmem",
00346             "MED",
00347             "medsplitter",
00348             "MEDSPLITTERTest",
00349             "med_V2_1",
00350             "MEDWrapperBase",
00351             "MEDWrapper",
00352             "MEDWrapper_V2_1",
00353             "MEDWrapper_V2_2",
00354             "paramedcouplingcorba",
00355             "paramedloader",
00356             "paramedmemcompo",
00357             "paramedmem",
00358             "ParaMEDMEMTest",
00359             "SalomeIDLMED",
00360             "SalomeIDLMEDTests",
00361             ]
00362         smesh_list = [
00363             "GeomSelectionTools",
00364             "MEFISTO2D",
00365             "MeshDriverDAT",
00366             "MeshDriverMED",
00367             "MeshDriver",
00368             "MeshDriverSTL",
00369             "MeshDriverUNV",
00370             "SalomeIDLSMESH",
00371             "SMDS",
00372             "SMESHClient",
00373             "SMESHControls",
00374             "SMESHDS",
00375             "SMESHEngine",
00376             "SMESHFiltersSelection",
00377             "SMESHimpl",
00378             "SMESHObject",
00379             "SMESH",
00380             "StdMeshersEngine",
00381             "StdMeshersGUI",
00382             "StdMeshers",
00383             ]
00384         full_list  = cas_list + vtk_list
00385         full_list += kernel_list + gui_list
00386         full_list += geom_list + med_list + smesh_list
00387         # --
00388         # E.A. : sort by len before substitution ...
00389         # Why ? Thing to "-lMEDWrapper" then "-lMEDWrapper_V2_1" substition
00390         # And you understand ...
00391         # --
00392         full_list.sort(cmp = lambda x, y : cmp(len(y), len(x)))
00393         # --
00394         for key in full_list:
00395             content = content.replace("-l%s"%(key), "${%s}"%(key))
00396             pass
00397         
00398         # --
00399         # Split content in lines to treat each one separately
00400         # --
00401         lines = content.split('\n')
00402         
00403         # --
00404         # newlines contains the lines of the future CMakeLists.txt file
00405         # --
00406         newlines = []
00407         
00408         # --
00409         # opened_ifs is used to deals with nested conditionnals
00410         # --
00411         opened_ifs = []
00412         
00413         # --
00414         # the __thedict__ dictionnary contains key, val
00415         # of the Makefile.am file
00416         # --
00417         self.__thedict__ = {}
00418         
00419         # --
00420         # Initialize file ... mainly includes other cmake files
00421         # --
00422         self.initialize(newlines)
00423         
00424         # --
00425         # Do the job for each line
00426         # --
00427         for line in lines:
00428             self.treatLine(line, newlines, opened_ifs)
00429             pass
00430         
00431         # --
00432         # Finalize file ... it is in here the cmake job is done
00433         # --
00434         self.finalize(newlines)
00435         
00436         # --
00437         # Concatenate newlines into content
00438         # --
00439         content = '\n'.join(newlines)
00440         
00441         # --
00442         # Add a CR at end if necessary
00443         # --
00444         lines = content.split('\n')
00445         # lines = [ l.strip() for l in lines ]
00446         if len(lines[-1]) != 0:
00447             lines.append('')
00448             pass
00449         content = '\n'.join(lines)
00450         
00451         # --
00452         self.content = content
00453         
00454         # --
00455         return
    
def am2cmake.CMakeFile.setCompilationFlags (   self,
  key,
  newlines 
)

Definition at line 1679 of file am2cmake.py.

01679 
01680     def setCompilationFlags(self, key, newlines):
01681         newlines.append(r'''
01682         SET(var)
01683         IF(WINDOWS)
01684         SET(targets)
01685         SET(targets ${targets} SalomeIDLKernel)
01686         SET(targets ${targets} SalomeDS)
01687         SET(targets ${targets} SALOMEDSTest)
01688         SET(targets ${targets} SALOMEDS_Client_exe)
01689         SET(targets ${targets} SalomeIDLGEOM)
01690         SET(targets ${targets} GEOMEngine)
01691         SET(targets ${targets} MEDEngine)
01692         SET(targets ${targets} SMESHEngine)
01693         SET(targets ${targets} SMESH)
01694         SET(targets ${targets} StdMeshersEngine)
01695         SET(targets ${targets} VISUEngineImpl)
01696         FOREACH(target ${targets})
01697         IF(name STREQUAL ${target})
01698         SET(var ${var} -DNOGDI)
01699         ENDIF(name STREQUAL ${target})
01700         ENDFOREACH(target ${targets})
01701         ENDIF(WINDOWS)
01702         ''')
01703         # --
01704         if self.module in ["medfile", "yacs"]:
01705             newlines.append(r'''
01706             IF(WINDOWS)
01707             SET(var ${var} -DNOGDI)
01708             ENDIF(WINDOWS)
01709             ''')
01710             pass
01711         # --
01712         newlines.append(r'''
01713         IF(WINDOWS)
01714         SET(targets)
01715         SET(targets ${targets} MEFISTO2D)
01716         FOREACH(target ${targets})
01717         IF(name STREQUAL ${target})
01718         SET(dir $ENV{F2CHOME})
01719         STRING(REPLACE "\\\\" "/" dir ${dir})
01720         SET(var ${var} -I${dir})
01721         SET(var ${var} -DF2C_BUILD)
01722         ENDIF(name STREQUAL ${target})
01723         ENDFOREACH(target ${targets})
01724         ENDIF(WINDOWS)
01725         ''')
01726         # --
01727         if self.module in ["geom", "med"]:
01728             newlines.append(r'''
01729             SET(var ${var} -I${CMAKE_CURRENT_SOURCE_DIR})
01730             SET(var ${var} -I${CMAKE_CURRENT_BINARY_DIR})
01731             ''')
01732             pass
01733         newlines.append(r'''
01734         SET(var ${var} ${AM_CPPFLAGS})
01735         SET(var ${var} ${AM_CXXFLAGS})
01736         ''')
01737         # --
01738         newlines.append(r'''
01739         IF(type STREQUAL STATIC)
01740         SET(var ${var} -fPIC)
01741         ENDIF(type STREQUAL STATIC)
01742         ''')
01743         # --
01744         if self.module == "yacs":
01745             newlines.append(r'''
01746             SET(var ${var} -DYACS_PTHREAD)
01747             SET(var ${var} -DCMAKE_BUILD)
01748             SET(var ${var} -DSALOME_KERNEL)
01749             SET(var ${var} -DDSC_PORTS)
01750             SET(var ${var} -DOMNIORB)
01751             ''')
01752             pass
01753         newlines.append(r'''
01754   SET(var ${var} ${PLATFORM_CPPFLAGS})
01755   SET(var ${var} ${PTHREAD_CFLAGS})
01756   SET(var ${var} ${${amname}_CPPFLAGS})
01757   SET(var ${var} ${${amname}_CXXFLAGS})
01758   SET(var ${var} ${${amname}_CFLAGS})
01759         SET(vars)
01760         IF(WINDOWS)
01761         SET(vars ${vars} -include SALOMEconfig.h)
01762         SET(vars ${vars} -ftemplate-depth-32)
01763         SET(vars ${vars} -fPIC)
01764         SET(vars ${vars} -g)
01765         ENDIF(WINDOWS)
01766         SET(flags)
01767         FOREACH(f ${var})
01768         FOREACH(v ${vars})
01769         IF(f STREQUAL v)
01770         SET(f)
01771         ENDIF(f STREQUAL v)
01772         ENDFOREACH(v ${vars})
01773         IF(f)
01774         string(REGEX MATCH "^-I" test_include ${f})
01775         if(test_include)
01776         string(REGEX REPLACE "^-I" "" include_dir ${f})
01777         if(include_dir)
01778         if(include_dir STREQUAL /usr/include)
01779         else(include_dir STREQUAL /usr/include)
01780         string(REGEX MATCH "^\\." test_dot ${include_dir})
01781         if(test_dot)
01782         set(include_dir ${CMAKE_CURRENT_BINARY_DIR}/${include_dir})
01783         endif(test_dot)
01784         include_directories(${include_dir})
01785         endif(include_dir STREQUAL /usr/include)
01786         endif(include_dir)
01787         else(test_include)
01788         SET(flags "${flags} ${f}")
01789         endif(test_include)
01790         ENDIF(f)
01791         ENDFOREACH(f ${var})
01792         SET_TARGET_PROPERTIES(${name} PROPERTIES COMPILE_FLAGS "${flags}")
01793         ''')
01794         return
    

Here is the caller graph for this function:

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

Definition at line 1597 of file am2cmake.py.

01597 
01598     def setLibAdd(self, key, newlines):
01599         # --
01600         newlines.append(r'''
01601         SET(libadd)
01602         ''')
01603         # --
01604         newlines.append(r'''
01605         IF(WINDOWS)
01606         SET(targets)
01607         SET(targets ${targets} MEFISTO2D)
01608         FOREACH(target ${targets})
01609         IF(name STREQUAL ${target})
01610         SET(dir $ENV{F2CHOME})
01611         STRING(REPLACE "\\\\" "/" dir ${dir})
01612         SET(libadd ${libadd} ${dir}/LIBF77.lib)
01613         SET(libadd ${libadd} ${dir}/LIBI77.lib)
01614         ENDIF(name STREQUAL ${target})
01615         ENDFOREACH(target ${targets})
01616         ENDIF(WINDOWS)
01617         ''')
01618         # --
01619         newlines.append(r'''
01620         SET(libs ${PLATFORM_LIBADD} ${PLATFORM_LDFLAGS} ${LDADD} ${${amname}_LIBADD} ${${amname}_LDADD} ${${amname}_LDFLAGS})
01621         FOREACH(lib SALOMEBasics SalomeBatch)
01622         IF(name STREQUAL lib)
01623         SET(libs ${libs} ${PTHREAD_LIBS})
01624         ENDIF(name STREQUAL lib)
01625         ENDFOREACH(lib SALOMEBasics SalomeBatch)
01626         ''')
01627         # --
01628         newlines.append(r'''
01629         FOREACH(lib ${libs})
01630         GET_FILENAME_COMPONENT(ext ${lib} EXT)
01631         IF(ext STREQUAL .la)
01632         GET_FILENAME_COMPONENT(lib ${lib} NAME_WE)
01633         STRING(REGEX REPLACE "^lib" "" lib ${lib})
01634         ENDIF(ext STREQUAL .la)
01635         SET(vars)
01636         SET(vars ${vars} -no-undefined)
01637         SET(vars ${vars} -lvtkWidgets)
01638         IF(WINDOWS)
01639         SET(vars ${vars} -module)
01640         SET(vars ${vars} -Wl,-E)
01641         SET(vars ${vars} -Xlinker)
01642         SET(vars ${vars} -export-dynamic)
01643         SET(vars ${vars} -lm)
01644         SET(vars ${vars} -lboost_thread)
01645         SET(vars ${vars} -lboost_signals)
01646         SET(vars ${vars} -pthread -lpthread -ldl)
01647         ENDIF(WINDOWS)
01648         FOREACH(v ${vars})
01649         IF(lib STREQUAL v)
01650         SET(lib)
01651         ENDIF(lib STREQUAL v)
01652         ENDFOREACH(v ${vars})
01653         SET(test OFF)
01654         IF(lib)
01655         STRING(REGEX MATCH "^-lQt" test ${lib})
01656         ENDIF(lib)
01657         IF(NOT test)
01658         SET(libadd ${libadd} ${lib})
01659         ENDIF(NOT test)
01660         ENDFOREACH(lib ${libs})
01661         TARGET_LINK_LIBRARIES(${name} ${libadd})
01662         ''')
01663         # --
01664         newlines.append(r'''
01665         IF(WINDOWS)
01666         SET(targets)
01667         SET(targets ${targets} MEFISTO2D)
01668         FOREACH(target ${targets})
01669         IF(name STREQUAL ${target})
01670         IF(CMAKE_BUILD_TYPE STREQUAL Debug)
01671         SET_TARGET_PROPERTIES(${name} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:MSVCRT")
01672         ENDIF(CMAKE_BUILD_TYPE STREQUAL Debug)
01673         ENDIF(name STREQUAL ${target})
01674         ENDFOREACH(target ${targets})
01675         ENDIF(WINDOWS)
01676         ''')
01677         # --
01678         return
    

Here is the caller graph for this function:

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

Definition at line 994 of file am2cmake.py.

00994 
00995     def treatAttribution(self, match, newlines):
00996         
00997         spaces = match.group("spaces")
00998         key = match.group("key")
00999         method = match.group("method")
01000         value = match.group("value")
01001         # print [spaces, key, method, value]
01002         
01003         # --
01004         # Open cmake SET command
01005         # --
01006         newlines.append(spaces + "SET(" + key)
01007         
01008         # --
01009         # If method is '+=', put the previous definition as first value
01010         # --
01011         if method == "+=":
01012             newlines.append("%s    ${%s}"%(spaces, key))
01013             pass
01014         
01015         # --
01016         fields = value.split()
01017         for i in range(len(fields)):
01018             newlines.append("%s    %s"%(spaces, fields[i]))
01019             pass
01020         
01021         # --
01022         if method == "+=":
01023             # --
01024             # The try: except KeyError is here if the +=
01025             # is an error which occurs in salome ...
01026             # --
01027             try:
01028                 self.__thedict__[key] += fields[:]
01029             except KeyError:
01030                 self.__thedict__[key] = fields[:]
01031                 pass
01032             pass
01033         else:
01034             self.__thedict__[key]  = fields[:]
01035             pass
01036         
01037         # --
01038         # Close cmake SET command
01039         # --
01040         
01041         newlines.append("%s)"%(spaces))
01042         
01043         return
    

Here is the caller graph for this function:

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

Definition at line 848 of file am2cmake.py.

00848 
00849     def treatLine(self, line, newlines, opened_ifs):
00850         
00851         # --
00852         # Print the comment above the line itself
00853         # --
00854         if line.find('#') >= 0:
00855             fields = line.split('#')
00856             line = fields[0]
00857             comment = '#'.join([''] + fields[1:])
00858             newlines.append(comment)
00859             if len(line) == 0:
00860                 return
00861             pass
00862         
00863         # --
00864         # If the line begins with 'include ', just comment it
00865         # --
00866         if line.find("include ") == 0:
00867             if line.find("include $(top_srcdir)/config/automake.common") == 0:
00868                 for l in [
00869                     "MAINTAINERCLEANFILES = Makefile.in",
00870                     "AM_CPPFLAGS=-I$(top_srcdir)/include -I$(top_builddir)/include",
00871                     "AM_FFLAGS=-I$(top_srcdir)/include  -I$(top_builddir)/include",
00872                     "AM_FCFLAGS=-I$(top_srcdir)/include  -I$(top_builddir)/include",
00873                     "AM_CPPFLAGS+=@HDF5_CPPFLAGS@",
00874                     "AM_LDFLAGS=@HDF5_LDFLAGS@",
00875                     ]:
00876                     self.treatLine(l, newlines, opened_ifs)
00877                     pass
00878                 pass
00879             else:
00880                 newlines.append("# " + line)
00881                 pass
00882             return
00883         
00884         # --
00885         # If the line begins with '-include', just comment it
00886         # --
00887         if line.find("-include") == 0:
00888             newlines.append("# " + line)
00889             return
00890         
00891         # --
00892         # If the line is a definition of a make rule, just comment it
00893         # --
00894         if line.count(':') == 1:
00895             newlines.append("# " + line)
00896             return
00897         
00898         # --
00899         # A particuliar case where there are two ":" on the same line
00900         # --
00901         if line.find('install-exec-local:') == 0:
00902             newlines.append("# " + line)
00903             return
00904         
00905         # --
00906         # If the line begin by a tabulation, consider it's a makefile command and comment it
00907         # --
00908         if line.find("\t") == 0:
00909             newlines.append("# " + line)
00910             return
00911         
00912         # --
00913         # --
00914         key = "-version-info"
00915         if line.find(key) >= 0:
00916             # --
00917             before = line.split(key)[0]
00918             after = line[len(before)+len(key):]
00919             sep = after[0]
00920             after = after[1:]
00921             version_info = after.split()[0]
00922             line = line.replace(key+sep+version_info, "")
00923             # --
00924             version_info = version_info.replace(':', '.')
00925             soversion_info = version_info.split('.')[0]
00926             newlines.append("SET(VERSION_INFO " + version_info + ")")
00927             newlines.append("SET(SOVERSION_INFO " + soversion_info + ")")
00928             # --
00929             pass
00930         
00931         # --
00932         # Replace the $(TOTO) by ${TOTO}
00933         # Replace the @TOTO@  by ${TOTO}
00934         # --
00935         line = p_dollar.sub(r"${\1}", line)
00936         line = p_arobas.sub(r"${\1}", line)
00937         
00938         # --
00939         line = line.replace(r"${top_builddir}", r"${CMAKE_BINARY_DIR}")
00940         line = line.replace(r"${top_srcdir}", r"${CMAKE_SOURCE_DIR}")
00941         line = line.replace(r"${srcdir}", r"${CMAKE_CURRENT_SOURCE_DIR}")
00942         line = line.replace(r"${builddir}", r"${CMAKE_CURRENT_BINARY_DIR}")
00943         line = line.replace(r"${datadir}", r"${CMAKE_INSTALL_PREFIX}/share")
00944         
00945         # --
00946         # Check if the line is a 'if' condition
00947         # If yes, replace it by a cmake grammar
00948         # --
00949         match = p_if.match(line)
00950         if match:
00951             theif = match.group("val")
00952             if theif[0] == "!":
00953                 theif = "NOT " + theif[1:]
00954                 pass
00955             line = p_if.sub(r"IF(%s)"%(theif), line)
00956             opened_ifs.append(theif)
00957             newlines.append(line)
00958             return
00959         
00960         # --
00961         # Check if the line is a 'else' condition
00962         # If yes, replace it by a cmake grammar
00963         # --
00964         match = p_else.match(line)
00965         if match:
00966             line = "ELSE(%s)"%(opened_ifs[-1])
00967             newlines.append(line)
00968             return
00969         
00970         # --
00971         # Check if the line is a 'endif' condition
00972         # If yes, replace it by a cmake grammar
00973         # --
00974         match = p_endif.match(line)
00975         if match:
00976             line = "ENDIF(%s)"%(opened_ifs[-1])
00977             opened_ifs[-1:] = []
00978             newlines.append(line)
00979             return
00980         
00981         # --
00982         # Check if the line is an attribution '=' or '+='
00983         # --
00984         match = p_attribution.match(line)
00985         if match:
00986             self.treatAttribution(match, newlines)
00987             return
00988         
00989         # --
00990         newlines.append(line)
00991         
00992         # --
00993         return
    

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2237 of file am2cmake.py.

02237 
02238     def writeListsFile(self):
02239         f = open(self.listsFile, "w")
02240         f.write(self.content)
02241         f.close()
02242         return
    

Member Data Documentation

Definition at line 416 of file am2cmake.py.

Definition at line 104 of file am2cmake.py.

Definition at line 451 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",
            "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}",
            }

Definition at line 1544 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 1214 of file am2cmake.py.

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

Definition at line 1209 of file am2cmake.py.

Definition at line 100 of file am2cmake.py.

Definition at line 836 of file am2cmake.py.

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

Definition at line 1276 of file am2cmake.py.

Definition at line 105 of file am2cmake.py.

Definition at line 101 of file am2cmake.py.

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

Definition at line 1540 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 1200 of file am2cmake.py.

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

Definition at line 1203 of file am2cmake.py.

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

Definition at line 1197 of file am2cmake.py.


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