1 # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License.
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Lesser General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this library; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
25 # A set of regular expressions used ...
28 p_multiline = re.compile(r"""
34 p_dollar = re.compile(r"""
36 (?P<val> # open the group val
37 [^)]* # the group contain 0 or more non ) characters
42 p_arobas = re.compile(r"""
44 (?P<val> # open the group val
45 [^@]* # the group contain 0 or more non @ characters
50 p_if = re.compile(r"""
51 ^ # beginning of the string
55 (?P<val> # open the group val
56 [^\s]+ # the group contain 1 or more non space characters
60 p_else = re.compile(r"""
61 ^ # beginning of the line
67 p_endif = re.compile(r"""
68 ^ # beginning of the line
74 p_attribution = re.compile(r"""
75 ^ # beginning of the line
76 (?P<spaces> # open the group spaces
79 (?P<key> # open the group key
80 \w+ # the group contain 1 or more alphanumeric characters
83 (?P<method> # open the group method
87 (?P<value> # open the group value
88 .* # 0 or more any characters
94 class CMakeFile(object):
96 def __init__(self, the_root, root, dirs, files, f, module):
98 self.the_root = the_root
104 from os.path import join
105 self.amFile = join(root, f)
106 self.listsFile = join(root, "CMakeLists.txt")
115 # Read the Makefile.am file
118 stream = open(amFile)
119 content = stream.read()
123 # Replace the composed lines separated by "\\n" by an unique line
125 content = p_multiline.sub(r' ', content)
128 content = content.replace("-no-undefined -version-info=0:0:0", "")
129 content = content.replace("-include SALOMEconfig.h", "")
132 # Compatibility medfile
134 content = content.replace("-no-undefined -version-info 0:0:0", "")
135 content = content.replace("-no-undefined -version-info 2:5:1", "")
138 # Compatibility netgen plugin
140 content = content.replace("../NETGEN/libNETGEN.la", "${NETGEN_LIBS}")
222 "SalomeCommunication",
224 "SalomeDSCContainer",
232 "SalomeLifeCycleCORBA",
234 "SalomeLoggerServer",
235 "SalomeNotification",
237 "SalomeResourcesManager",
239 "with_loggerTraceCollector",
291 "GEOMFiltersSelection",
315 "InterpGeometric2DAlg",
344 "SMESHFiltersSelection",
352 full_list = cas_list + kernel_list + gui_list
353 full_list += geom_list + med_list + smesh_list
359 # E.A. : sort by len before substitution ...
360 # Why ? Thing to "-lMEDWrapper" then "-lMEDWrapper_V2_1" substition
361 # And you understand ...
363 full_list.sort(cmp = lambda x, y : cmp(len(y), len(x)))
365 for key in full_list:
366 content = content.replace("-l%s"%(key), "${%s}"%(key))
370 # Split content in lines to treat each one separately
372 lines = content.split('\n')
375 # newlines contains the lines of the future CMakeLists.txt file
380 # opened_ifs is used to deals with nested conditionnals
385 # the __thedict__ dictionnary contains key, val
386 # of the Makefile.am file
388 self.__thedict__ = {}
391 # Initialize file ... mainly includes other cmake files
393 self.initialize(newlines)
396 # Do the job for each line
399 self.treatLine(line, newlines, opened_ifs)
403 # Finalize file ... it is in here the cmake job is done
405 self.finalize(newlines)
408 # Add a last CR at the end of the file
410 newlines.append('\n')
413 # Concatenate newlines into content
415 content = '\n'.join(newlines)
418 self.content = content
423 def initialize(self, newlines):
424 if self.root == self.the_root:
427 CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
428 IF(COMMAND cmake_policy)
429 cmake_policy(SET CMP0003 NEW)
430 ENDIF(COMMAND cmake_policy)
433 if self.module == "kernel":
435 INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindPLATFORM.cmake)
436 INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindPYTHON.cmake)
437 INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindOMNIORB.cmake)
438 INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindPTHREADS.cmake)
439 INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindHDF5.cmake)
440 INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindBOOST.cmake)
441 INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindLIBXML2.cmake)
442 INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindSWIG.cmake)
443 INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindCPPUNIT.cmake)
448 SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR})
449 INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPLATFORM.cmake)
450 INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPYTHON.cmake)
451 INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindOMNIORB.cmake)
452 INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPTHREADS.cmake)
453 INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindHDF5.cmake)
454 INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindBOOST.cmake)
455 INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindLIBXML2.cmake)
456 INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSWIG.cmake)
457 INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindCPPUNIT.cmake)
458 INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindKERNEL.cmake)
460 if self.module == "gui":
462 INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindCAS.cmake)
463 INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindQT4.cmake)
464 INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindOPENGL.cmake)
465 INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindVTK.cmake)
466 INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindQWT.cmake)
467 INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindSIPPYQT.cmake)
471 SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR})
472 INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindCAS.cmake)
473 INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindQT4.cmake)
474 INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindOPENGL.cmake)
475 INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindVTK.cmake)
476 INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindQWT.cmake)
477 INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindSIPPYQT.cmake)
478 INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindGUI.cmake)
480 if self.module == "med":
482 INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindMEDFILE.cmake)
485 if self.module == "smesh":
487 SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR})
488 SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR})
489 INCLUDE(${GEOM_ROOT_DIR}/adm_local/cmake_files/FindGEOM.cmake)
490 INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMEDFILE.cmake)
491 INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake)
494 if self.module == "netgenplugin":
496 SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR})
497 SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR})
498 SET(SMESH_ROOT_DIR $ENV{SMESH_ROOT_DIR})
499 INCLUDE(${GEOM_ROOT_DIR}/adm_local/cmake_files/FindGEOM.cmake)
500 INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake)
501 INCLUDE(${SMESH_ROOT_DIR}/adm_local/cmake_files/FindSMESH.cmake)
502 INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindNETGEN.cmake)
505 if self.module == "blsurfplugin":
507 SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR})
508 SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR})
509 SET(SMESH_ROOT_DIR $ENV{SMESH_ROOT_DIR})
510 INCLUDE(${GEOM_ROOT_DIR}/adm_local/cmake_files/FindGEOM.cmake)
511 INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake)
512 INCLUDE(${SMESH_ROOT_DIR}/adm_local/cmake_files/FindSMESH.cmake)
513 INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindBLSURF.cmake)
516 if self.module == "visu":
518 SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR})
519 INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake)
525 if self.module == "kernel":
530 set(XVERSION 0x040103)
532 elif self.module == "gui":
534 SET(GUI_ENABLE_CORBA ${CORBA_GEN})
535 SET(ENABLE_VTKVIEWER ON)
536 SET(ENABLE_SALOMEOBJECT ON)
537 SET(ENABLE_OCCVIEWER ON)
538 SET(ENABLE_GLVIEWER ON)
539 SET(ENABLE_PLOT2DVIEWER ON)
540 SET(ENABLE_PYCONSOLE ON)
541 SET(ENABLE_SUPERVGRAPHVIEWER ON)
542 # SET(ENABLE_QXGRAPHVIEWER ON)
545 elif self.module == "geom":
547 SET(GEOM_ENABLE_GUI ON)
550 elif self.module == "medfile":
552 SET(MED_NUM_MAJEUR 2)
553 SET(MED_NUM_MINEUR 3)
554 SET(MED_NUM_RELEASE 5)
557 SET(FLIBS -lgfortranbegin -lgfortran)
561 elif self.module == "med":
563 SET(MED_ENABLE_KERNEL ON)
564 SET(MED_ENABLE_GUI ON)
567 elif self.module == "smesh":
569 SET(SMESH_ENABLE_GUI ON)
572 elif self.module == "netgenplugin":
574 SET(NETGENPLUGIN_ENABLE_GUI ON)
577 elif self.module == "blsurfplugin":
579 SET(BLSURFPLUGIN_ENABLE_GUI ON)
594 def treatLine(self, line, newlines, opened_ifs):
597 # Print the comment above the line itself
599 if line.find('#') >= 0:
600 fields = line.split('#')
602 comment = '#'.join([''] + fields[1:])
603 newlines.append(comment)
609 # If the line begins with 'include ', just comment it
611 if line.find("include ") == 0:
612 newlines.append("# " + line)
616 # If the line begins with '-include', just comment it
618 if line.find("-include") == 0:
619 newlines.append("# " + line)
623 # If the line is a definition of a make rule, just comment it
625 if line.count(':') == 1:
626 newlines.append("# " + line)
632 if line.find('install-exec-local:') == 0:
633 newlines.append("# " + line)
637 # If the line begin by a tabulation, consider it's a makefile command and comment it
639 if line.find("\t") == 0:
640 newlines.append("# " + line)
644 # Replace the $(TOTO) by ${TOTO}
645 # Replace the @TOTO@ by ${TOTO}
647 line = p_dollar.sub(r"${\1}", line)
648 line = p_arobas.sub(r"${\1}", line)
651 line = line.replace(r"${top_builddir}", r"${CMAKE_BINARY_DIR}")
652 line = line.replace(r"${top_srcdir}", r"${CMAKE_SOURCE_DIR}")
653 line = line.replace(r"${srcdir}", r"${CMAKE_CURRENT_SOURCE_DIR}")
654 line = line.replace(r"${builddir}", r"${CMAKE_CURRENT_BINARY_DIR}")
655 line = line.replace(r"${datadir}", r"${CMAKE_INSTALL_PREFIX}/share")
658 # Check if the line is a 'if' condition
659 # If yes, replace it by a cmake grammar
661 match = p_if.match(line)
663 theif = match.group("val")
665 theif = "NOT " + theif[1:]
667 line = p_if.sub(r"IF(%s)"%(theif), line)
668 opened_ifs.append(theif)
669 newlines.append(line)
673 # Check if the line is a 'else' condition
674 # If yes, replace it by a cmake grammar
676 match = p_else.match(line)
678 line = "ELSE(%s)"%(opened_ifs[-1])
679 newlines.append(line)
683 # Check if the line is a 'endif' condition
684 # If yes, replace it by a cmake grammar
686 match = p_endif.match(line)
688 line = "ENDIF(%s)"%(opened_ifs[-1])
690 newlines.append(line)
694 # Check if the line is an attribution '=' or '+='
696 match = p_attribution.match(line)
698 self.treatAttribution(match, newlines)
702 newlines.append(line)
707 def treatAttribution(self, match, newlines):
709 spaces = match.group("spaces")
710 key = match.group("key")
711 method = match.group("method")
712 value = match.group("value")
713 # print [spaces, key, method, value]
716 # Open cmake SET command
718 newlines.append(spaces + "SET(" + key)
721 # If method is '+=', put the previous definition as first value
724 newlines.append("%s ${%s}"%(spaces, key))
728 fields = value.split()
729 for i in range(len(fields)):
730 newlines.append("%s %s"%(spaces, fields[i]))
736 # The try: except KeyError is here if the +=
737 # is an error which occurs in salome ...
740 self.__thedict__[key] += fields[:]
742 self.__thedict__[key] = fields[:]
746 self.__thedict__[key] = fields[:]
750 # Close cmake SET command
753 newlines.append("%s)"%(spaces))
757 def finalize(self, newlines):
760 # Convert the .in files in build dir
764 if f == "sstream.in":
766 if f in ["runContainer.in", "stopContainer.in"]:
767 if self.module == "med":
768 if self.root[-3:] == "csh":
772 if f == "SALOMEconfig.ref.in":
773 out = "SALOMEconfig.h"
778 SET(input ${CMAKE_CURRENT_SOURCE_DIR}/%s)
781 SET(output ${CMAKE_CURRENT_BINARY_DIR}/%s)
784 MESSAGE(STATUS "Creation of ${output}")
785 CONFIGURE_FILE(${input} ${output})
791 # convert the SUBDIRS in cmake grammar
793 if 1: # self.__thedict__.has_key("SUBDIRS"):
795 FOREACH(dir ${SUBDIRS})
796 IF(NOT dir STREQUAL .)
797 ADD_SUBDIRECTORY(${dir})
798 ENDIF(NOT dir STREQUAL .)
799 ENDFOREACH(dir ${SUBDIRS})
805 for key in ["lib_LTLIBRARIES", "noinst_LTLIBRARIES", "salomepyexec_LTLIBRARIES"]:
806 if self.__thedict__.has_key(key):
807 self.addLibTarget(key, newlines)
813 for key in ["bin_PROGRAMS"]:
814 if self.__thedict__.has_key(key):
815 self.addBinTarget(key, newlines)
821 if self.__thedict__.has_key("BASEIDL_FILES"):
822 if not self.__thedict__.has_key("IDL_FILES"):
823 self.__thedict__["IDL_FILES"] = self.__thedict__["BASEIDL_FILES"]
825 SET(IDL_FILES ${BASEIDL_FILES})
834 if self.__thedict__.has_key(key):
836 FOREACH(input ${IDL_FILES})
837 STRING(REGEX REPLACE ".idl" "" base ${input})
838 SET(src ${CMAKE_CURRENT_BINARY_DIR}/${base}SK.cc)
840 SET(dynsrc ${CMAKE_CURRENT_BINARY_DIR}/${base}DynSK.cc)
841 SET(outputs ${outputs} ${dynsrc})
844 COMMAND ${OMNIORB_IDL} ${IDLCXXFLAGS} ${OMNIORB_IDLCXXFLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/${input}
845 MAIN_DEPENDENCY ${input}
847 install(FILES ${input} DESTINATION idl/salome)
848 SET(IDL_HEADER ${CMAKE_CURRENT_BINARY_DIR}/${base}.hh)
849 install(FILES ${IDL_HEADER} DESTINATION include/salome)
850 INSTALL(CODE "SET(IDL_FILE ${input})")
851 INSTALL(CODE "SET(DIR lib/python${PYTHON_VERSION}/site-packages/salome)")
852 INSTALL(CODE "SET(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})")
853 INSTALL(CODE "SET(OMNIORB_IDL_PYTHON ${OMNIORB_IDL_PYTHON})")
856 FOREACH(f ${IDLPYFLAGS})
857 SET(flags "${flags} ${f}")
858 ENDFOREACH(f ${IDLPYFLAGS})
859 SET(IDLPYFLAGS ${flags})
860 STRING(REPLACE "\\\\" "/" IDLPYFLAGS ${IDLPYFLAGS})
861 INSTALL(CODE "SET(IDLPYFLAGS ${IDLPYFLAGS})")
864 if self.module == "kernel":
866 INSTALL(SCRIPT ${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/install_python_from_idl.cmake)
870 STRING(REPLACE "\\\\" "/" KERNEL_ROOT_DIR ${KERNEL_ROOT_DIR})
871 INSTALL(SCRIPT ${KERNEL_ROOT_DIR}/salome_adm/cmake_files/install_python_from_idl.cmake)
875 ENDFOREACH(input ${IDL_FILES})
881 for key in ["SWIG_SRC", "SWIGSOURCES", "SWIG_DEF"]:
882 if self.__thedict__.has_key(key):
884 SET(SWIG_SOURCES ${%s})
886 self.__thedict__["SWIG_SOURCES"] = self.__thedict__[key]
892 if self.__thedict__.has_key("SWIG_SOURCES"):
894 IF(SWIG_SOURCES MATCHES ";")
895 STRING(REGEX REPLACE ";.*" "" SWIG_SOURCES_FIRST "${SWIG_SOURCES}")
896 ELSE(SWIG_SOURCES MATCHES ";")
897 SET(SWIG_SOURCES_FIRST "${SWIG_SOURCES}")
898 ENDIF(SWIG_SOURCES MATCHES ";")
901 COMMAND ${SWIG_EXECUTABLE} ${SWIG_FLAGS} ${MY_SWIG_FLAGS} -o ${build_srcs} ${CMAKE_CURRENT_SOURCE_DIR}/${SWIG_SOURCES_FIRST}
902 MAIN_DEPENDENCY ${SWIG_SOURCES}
910 if self.__thedict__.has_key(key):
912 FOREACH(output ${MOC_FILES})
913 STRING(REGEX REPLACE _moc.cxx .h input ${output})
914 SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input})
915 SET(output ${CMAKE_CURRENT_BINARY_DIR}/${output})
918 COMMAND ${QT_MOC_EXECUTABLE} ${MOC_FLAGS} ${input} -o ${output}
919 MAIN_DEPENDENCY ${input}
921 ENDFOREACH(output ${MOC_FILES})
928 if self.__thedict__.has_key(key):
930 FOREACH(output ${UIC_FILES})
931 STRING(REPLACE "ui_" "" input ${output})
932 STRING(REPLACE ".h" ".ui" input ${input})
933 SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input})
934 SET(output ${CMAKE_CURRENT_BINARY_DIR}/${output})
937 COMMAND ${QT_UIC_EXECUTABLE} -o ${output} ${input}
938 MAIN_DEPENDENCY ${input}
940 ENDFOREACH(output ${UIC_FILES})
947 if self.__thedict__.has_key(key):
949 FOREACH(output ${QRC_FILES})
950 STRING(REGEX REPLACE "qrc_" "" input ${output})
951 STRING(REGEX REPLACE ".cxx" ".qrc" input ${input})
952 STRING(REGEX REPLACE ".qrc" "" name ${input})
953 SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input})
954 SET(output ${CMAKE_CURRENT_BINARY_DIR}/${output})
957 COMMAND ${QT_RCC_EXECUTABLE} ${input} -o ${output} -name ${name}
958 MAIN_DEPENDENCY ${input}
960 ENDFOREACH(output ${QRC_FILES})
967 if self.__thedict__.has_key(key):
969 FOREACH(input ${SIP_FILES})
970 SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input})
972 FOREACH(out ${SIP_SRC})
973 SET(output ${output} ${CMAKE_CURRENT_BINARY_DIR}/${out})
974 ENDFOREACH(out ${SIP_SRC})
977 COMMAND ${SIP_EXECUTABLE} ${PYQT_SIPFLAGS} ${input}
978 MAIN_DEPENDENCY ${input}
980 ENDFOREACH(input ${SIP_FILES})
985 # Treat the install targets
988 "salomeadmux_DATA" : "salome_adm/unix",
989 "dist_salomeadmux_DATA" : "salome_adm/unix",
990 "dist_salome_cmake_DATA" : "salome_adm/cmake_files",
991 "dist_salomem4_DATA" : "salome_adm/unix/config_files",
992 "dist_salome4depr_DATA" : "salome_adm/unix/config_files/DEPRECATED",
993 "dist_admlocalm4_DATA" : "adm_local/unix/config_files",
994 "dist_admlocal_cmake_DATA" : "adm_local/cmake_files",
995 "salomeinclude_DATA" : "include/salome",
996 "salomeinclude_HEADERS" : "include/salome",
997 "dist_salomeres_DATA" : "share/salome/resources/%s"%(self.module),
998 "nodist_salomeres_DATA" : "share/salome/resources/%s"%(self.module),
999 "nodist_salomeres_SCRIPTS" : "share/salome/resources/%s"%(self.module),
1000 "dist_salomescript_SCRIPTS" : "bin/salome",
1001 "dist_salomescript_DATA" : "bin/salome",
1002 "dist_salomescript_PYTHON" : "bin/salome",
1003 "nodist_salomescript_DATA" : "bin/salome",
1004 "salomepython_PYTHON" : "lib/python${PYTHON_VERSION}/site-packages/salome",
1005 "nodist_salomepython_PYTHON" : "lib/python${PYTHON_VERSION}/site-packages/salome",
1006 "sharedpkgpython_PYTHON" : "lib/python${PYTHON_VERSION}/site-packages/salome/shared_modules",
1008 if self.module == "medfile":
1010 "include_HEADERS" : "include",
1011 "nodist_include_HEADERS" : "include",
1012 "bin_SCRIPTS" : "bin",
1013 "doc_DATA" : "${docdir}",
1016 for key, value in d.items():
1017 if self.__thedict__.has_key(key):
1018 self.addInstallTarget(key, value, newlines)
1025 def setLibAdd(self, key, newlines):
1027 newlines.append(r'''
1031 newlines.append(r'''
1033 SET(libadd ${libadd} Userenv.lib Ws2_32.lib)
1035 SET(libadd ${libadd} -ldl -lpthread)
1039 newlines.append(r'''
1042 SET(targets ${targets} MEFISTO2D)
1043 FOREACH(target ${targets})
1044 IF(name STREQUAL ${target})
1045 SET(dir $ENV{F2CHOME})
1046 STRING(REPLACE "\\\\" "/" dir ${dir})
1047 SET(libadd ${libadd} ${dir}/LIBF77.lib)
1048 SET(libadd ${libadd} ${dir}/LIBI77.lib)
1049 ENDIF(name STREQUAL ${target})
1050 ENDFOREACH(target ${targets})
1054 newlines.append(r'''
1055 SET(libs ${${amname}_LIBADD} ${${amname}_LDADD} ${${amname}_LDFLAGS})
1057 if key == "bin_PROGRAMS":
1058 newlines.append(r'''
1059 SET(libs ${libs} ${LDADD})
1063 newlines.append(r'''
1064 FOREACH(lib ${libs})
1065 GET_FILENAME_COMPONENT(ext ${lib} EXT)
1066 IF(ext STREQUAL .la)
1067 GET_FILENAME_COMPONENT(lib ${lib} NAME_WE)
1068 STRING(REPLACE "lib" "" lib ${lib})
1069 ENDIF(ext STREQUAL .la)
1071 SET(vars -Xlinker -export-dynamic -module -Wl,-E)
1072 SET(vars ${vars} -lutil -lm)
1076 ENDIF(lib STREQUAL v)
1077 ENDFOREACH(v ${vars})
1079 SET(libadd ${libadd} ${lib})
1080 ENDFOREACH(lib ${libs})
1081 TARGET_LINK_LIBRARIES(${name} ${PTHREADS_LIBRARY} ${libadd})
1084 newlines.append(r'''
1087 SET(targets ${targets} SalomeHDFPersist)
1088 SET(targets ${targets} medC)
1089 SET(targets ${targets} medimport)
1090 SET(targets ${targets} medimportcxx)
1091 FOREACH(target ${targets})
1092 IF(name STREQUAL ${target})
1093 SET_TARGET_PROPERTIES(${name} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:LIBCMTD")
1094 ENDIF(name STREQUAL ${target})
1095 ENDFOREACH(target ${targets})
1097 SET(targets ${targets} MEFISTO2D)
1098 FOREACH(target ${targets})
1099 IF(name STREQUAL ${target})
1100 SET_TARGET_PROPERTIES(${name} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:MSVCRT")
1101 ENDIF(name STREQUAL ${target})
1102 ENDFOREACH(target ${targets})
1106 if self.module == "med":
1107 newlines.append(r'''
1109 SET_TARGET_PROPERTIES(${name} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:LIBCMTD")
1116 def setCompilationFlags(self, key, newlines):
1117 newlines.append(r'''
1121 SET(targets ${targets} SalomeIDLKernel)
1122 SET(targets ${targets} SalomeDS)
1123 SET(targets ${targets} SALOMEDS_Client_exe)
1124 SET(targets ${targets} SalomeIDLGEOM)
1125 SET(targets ${targets} GEOMEngine)
1126 SET(targets ${targets} MEDEngine)
1127 SET(targets ${targets} SMESHEngine)
1128 SET(targets ${targets} SMESH)
1129 FOREACH(target ${targets})
1130 IF(name STREQUAL ${target})
1131 SET(var ${var} -DNOGDI)
1132 ENDIF(name STREQUAL ${target})
1133 ENDFOREACH(target ${targets})
1137 newlines.append(r'''
1140 SET(targets ${targets} MEFISTO2D)
1141 FOREACH(target ${targets})
1142 IF(name STREQUAL ${target})
1143 SET(dir $ENV{F2CHOME})
1144 STRING(REPLACE "\\\\" "/" dir ${dir})
1145 SET(var ${var} -I${dir})
1146 ENDIF(name STREQUAL ${target})
1147 ENDFOREACH(target ${targets})
1151 newlines.append(r'''
1153 SET(var ${var} -D_USE_MATH_DEFINES)
1157 if self.module in ["geom", "med"]:
1158 newlines.append(r'''
1159 SET(var ${var} -I${CMAKE_CURRENT_SOURCE_DIR})
1160 SET(var ${var} -I${CMAKE_CURRENT_BINARY_DIR})
1163 if key == "bin_PROGRAMS":
1164 newlines.append(r'''
1165 SET(var ${var} ${AM_CPPFLAGS})
1166 SET(var ${var} ${AM_CXXFLAGS})
1169 newlines.append(r'''
1170 SET(var ${var} ${PLATFORM_CPPFLAGS})
1171 SET(var ${var} ${PTHREADS_INCLUDES})
1172 SET(var ${var} ${${amname}_CPPFLAGS})
1173 SET(var ${var} ${${amname}_CXXFLAGS})
1174 SET(var ${var} ${${amname}_CFLAGS})
1177 SET(flags "${flags} ${f}")
1178 ENDFOREACH(f ${var})
1179 SET_TARGET_PROPERTIES(${name} PROPERTIES COMPILE_FLAGS "${flags}")
1183 def addLibTarget(self, key, newlines):
1184 newlines.append(r'''
1185 FOREACH(amname ${%s})
1188 # Replace .la by _la ...
1190 newlines.append(r'''
1191 STRING(REPLACE .la _la amname ${amname})
1194 # Remove the _la for the cmake name
1196 newlines.append(r'''
1197 STRING(LENGTH ${amname} len)
1198 MATH(EXPR newlen "${len}-3")
1199 STRING(SUBSTRING ${amname} 0 ${newlen} name)
1202 # Does the target begins with lib ??
1203 # If yes, remove lib at beginning for cmake name
1205 newlines.append(r'''
1206 STRING(REGEX MATCH "^lib" BEGIN_WITH_lib ${name})
1208 STRING(LENGTH ${name} len)
1209 MATH(EXPR newlen "${len}-3")
1210 STRING(SUBSTRING ${name} 3 ${newlen} name)
1211 ENDIF(BEGIN_WITH_lib)
1214 # Does the target is an idl library
1216 newlines.append(r'''
1217 STRING(REGEX MATCH "IDL" ISIDL ${name})
1220 # Set the type of the library
1222 newlines.append(r'''
1234 # Set sources for the library
1236 newlines.append(r'''
1238 FOREACH(src ${${amname}_SOURCES} ${dist_${amname}_SOURCES})
1239 GET_FILENAME_COMPONENT(ext ${src} EXT)
1241 IF(src STREQUAL trte.f)
1242 SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${src})
1243 STRING(REPLACE ".f" ".c" src ${src})
1244 SET(src ${CMAKE_CURRENT_BINARY_DIR}/${src})
1248 COMMAND f2c ${input}
1249 MAIN_DEPENDENCY ${input}
1251 ELSE(src STREQUAL trte.f)
1252 SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${src})
1253 STRING(REPLACE ".f" ".o" src ${src})
1254 SET(src ${CMAKE_CURRENT_BINARY_DIR}/${src})
1263 COMMAND ${F77} -c -o ${output} ${input}
1264 MAIN_DEPENDENCY ${input}
1266 ENDIF(src STREQUAL trte.f)
1267 ENDIF(ext STREQUAL .f)
1268 SET(srcs ${srcs} ${src})
1269 ENDFOREACH(src ${${amname}_SOURCES} ${dist_${amname}_SOURCES})
1271 FOREACH(f ${nodist_${amname}_SOURCES} ${BUILT_SOURCES})
1272 GET_FILENAME_COMPONENT(ext ${f} EXT)
1273 IF(ext STREQUAL .py)
1274 ELSE(ext STREQUAL .py)
1275 SET(build_srcs ${build_srcs} ${CMAKE_CURRENT_BINARY_DIR}/${f})
1276 ENDIF(ext STREQUAL .py)
1277 ENDFOREACH(f ${nodist_${amname}_SOURCES})
1278 SET(srcs ${build_srcs} ${srcs})
1281 # Add the library to cmake
1283 newlines.append(r'''
1284 ADD_LIBRARY(${name} ${type} ${srcs})
1287 # The compilation flags
1289 self.setCompilationFlags(key, newlines)
1291 newlines.append(r'''
1292 SET_TARGET_PROPERTIES(${name} PROPERTIES VERSION 0.0.0 SOVERSION 0)
1293 FOREACH(lib medC med)
1294 IF(lib STREQUAL ${name})
1295 SET_TARGET_PROPERTIES(${name} PROPERTIES VERSION 1.1.5 SOVERSION 1)
1296 ENDIF(lib STREQUAL ${name})
1297 ENDFOREACH(lib medC med)
1300 from os.path import basename
1301 upper_name = basename(self.root).upper()
1303 if upper_name in ["2.1.X", "2.3.1"]:
1304 upper_name = "D_" + upper_name
1307 newlines.append(r'''
1308 SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL %s_EXPORTS)
1311 newlines.append(r'''
1312 IF(name STREQUAL SalomeLauncher)
1313 SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL SALOME%s_EXPORTS)
1314 ENDIF(name STREQUAL SalomeLauncher)
1316 newlines.append(r'''
1317 IF(name STREQUAL SalomeResourcesManager)
1318 SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL SALOME%s_EXPORTS)
1319 ENDIF(name STREQUAL SalomeResourcesManager)
1321 newlines.append(r'''
1322 IF(name STREQUAL GEOMObject)
1323 SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL GEOM_%s_EXPORTS)
1324 ENDIF(name STREQUAL GEOMObject)
1326 newlines.append(r'''
1327 IF(name STREQUAL medC)
1328 SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL MEDC_DLL_EXPORTS)
1329 ENDIF(name STREQUAL medC)
1331 newlines.append(r'''
1332 IF(name STREQUAL med)
1333 SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL MED_DLL_EXPORTS)
1334 ENDIF(name STREQUAL med)
1336 newlines.append(r'''
1337 IF(name STREQUAL medimport)
1338 SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL MEDIMPORT_DLL_EXPORTS)
1339 ENDIF(name STREQUAL medimport)
1341 newlines.append(r'''
1342 IF(name STREQUAL medimportcxx)
1343 SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL MEDIMPORTCXX_DLL_EXPORTS)
1344 ENDIF(name STREQUAL medimportcxx)
1347 newlines.append(r'''
1348 IF(name STREQUAL MEDWrapperBase)
1349 SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL MEDWRAPPER_BASE_EXPORTS)
1350 ENDIF(name STREQUAL MEDWrapperBase)
1352 newlines.append(r'''
1353 IF(name STREQUAL MEDWrapper_V2_1)
1354 SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL MEDWRAPPER_V2_1_EXPORTS)
1355 ENDIF(name STREQUAL MEDWrapper_V2_1)
1357 newlines.append(r'''
1358 IF(name STREQUAL med_V2_1)
1359 SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL MEDWRAPPER_V2_1_CORE_EXPORTS)
1360 ENDIF(name STREQUAL med_V2_1)
1362 newlines.append(r'''
1363 IF(name STREQUAL MEDWrapper_V2_2)
1364 SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL MEDWRAPPER_V2_2_EXPORTS)
1365 ENDIF(name STREQUAL MEDWrapper_V2_2)
1367 newlines.append(r'''
1368 IF(name STREQUAL MEDWrapper)
1369 SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL MEDWRAPPER_FACTORY_EXPORTS)
1370 ENDIF(name STREQUAL MEDWrapper)
1372 newlines.append(r'''
1373 IF(name STREQUAL interpkernelbases)
1374 SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL INTERPKERNELBASES_EXPORTS)
1375 ENDIF(name STREQUAL interpkernelbases)
1376 IF(name STREQUAL InterpGeometric2DAlg)
1377 SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL INTERPKERNELGEOMETRIC2D_EXPORTS)
1378 ENDIF(name STREQUAL InterpGeometric2DAlg)
1379 IF(name STREQUAL interpkernel)
1380 SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL INTERPKERNEL_EXPORTS)
1381 ENDIF(name STREQUAL interpkernel)
1382 IF(name STREQUAL MEDClientcmodule)
1383 SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL MEDCLIENT_EXPORTS)
1384 ENDIF(name STREQUAL MEDClientcmodule)
1387 newlines.append(r'''
1388 IF(name STREQUAL SMESHControls)
1389 SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL SMESHCONTROLS_EXPORTS)
1390 ENDIF(name STREQUAL SMESHControls)
1392 newlines.append(r'''
1393 IF(name STREQUAL MeshDriver)
1394 SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL MESHDRIVER_EXPORTS)
1395 ENDIF(name STREQUAL MeshDriver)
1397 newlines.append(r'''
1398 IF(name STREQUAL MeshDriverMED)
1399 SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL MESHDRIVERMED_EXPORTS)
1400 ENDIF(name STREQUAL MeshDriverMED)
1402 newlines.append(r'''
1403 IF(name STREQUAL MeshDriverDAT)
1404 SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL MESHDRIVERDAT_EXPORTS)
1405 ENDIF(name STREQUAL MeshDriverDAT)
1407 newlines.append(r'''
1408 IF(name STREQUAL MeshDriverUNV)
1409 SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL MESHDRIVERUNV_EXPORTS)
1410 ENDIF(name STREQUAL MeshDriverUNV)
1412 newlines.append(r'''
1413 IF(name STREQUAL MeshDriverSTL)
1414 SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL MESHDRIVERSTL_EXPORTS)
1415 ENDIF(name STREQUAL MeshDriverSTL)
1417 newlines.append(r'''
1418 IF(name STREQUAL MEFISTO2D)
1419 SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL MEFISTO2D_EXPORTS)
1420 ENDIF(name STREQUAL MEFISTO2D)
1422 newlines.append(r'''
1423 IF(name STREQUAL SMESHObject)
1424 SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL SMESHOBJECT_EXPORTS)
1425 ENDIF(name STREQUAL SMESHObject)
1427 newlines.append(r'''
1428 IF(name STREQUAL _libSMESH_Swig)
1429 SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL SMESH_SWIG_EXPORTS)
1430 ENDIF(name STREQUAL _libSMESH_Swig)
1432 newlines.append(r'''
1433 IF(name STREQUAL NETGENPluginGUI)
1434 SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL NETGENPLUGIN_GUI_EXPORTS)
1435 ENDIF(name STREQUAL NETGENPluginGUI)
1438 self.setLibAdd(key, newlines)
1440 if 1: # key != "noinst_LTLIBRARIES":
1441 if self.module == "medfile":
1442 newlines.append(r'''
1446 newlines.append(r'''
1447 SET(DEST lib/salome)
1450 newlines.append(r'''
1452 INSTALL(TARGETS ${name} DESTINATION ${DEST})
1454 if self.module == "geom":
1455 newlines.append(r'''
1457 STRING(REGEX MATCH "Export" ISExport ${name})
1459 INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME lib${name}.dll)
1461 STRING(REGEX MATCH "Import" ISImport ${name})
1463 INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME lib${name}.dll)
1468 newlines.append(r'''
1469 IF(name STREQUAL SalomePyQt)
1470 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so DESTINATION ${DEST} RENAME ${name}.so)
1471 ENDIF(name STREQUAL SalomePyQt)
1472 ELSE(BEGIN_WITH_lib)
1474 INSTALL(TARGETS ${name} DESTINATION lib/python${PYTHON_VERSION}/site-packages/salome)
1475 INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/lib/python${PYTHON_VERSION}/site-packages/salome/${name}.dll DESTINATION lib/python${PYTHON_VERSION}/site-packages/salome RENAME ${name}_d.pyd)
1477 GET_TARGET_PROPERTY(version ${name} VERSION)
1478 GET_TARGET_PROPERTY(soversion ${name} SOVERSION)
1479 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so.${version} DESTINATION lib/python${PYTHON_VERSION}/site-packages/salome RENAME ${name}.so.${version})
1480 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so.${version} DESTINATION lib/python${PYTHON_VERSION}/site-packages/salome RENAME ${name}.so.${soversion})
1481 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so.${version} DESTINATION lib/python${PYTHON_VERSION}/site-packages/salome RENAME ${name}.so)
1483 ENDIF(BEGIN_WITH_lib)
1487 newlines.append(r'''
1488 ENDFOREACH(amname ${%s})
1493 def addBinTarget(self, key, newlines):
1495 newlines.append(r'''
1496 FOREACH(amname ${bin_PROGRAMS})
1499 newlines.append(r'''
1500 SET(name "${amname}_exe")
1501 SET(srcs ${${amname}_SOURCES} ${dist_${amname}_SOURCES})
1502 LIST(LENGTH srcs nb)
1504 ADD_EXECUTABLE(${name} ${srcs})
1507 self.setCompilationFlags(key, newlines)
1509 self.setLibAdd(key, newlines)
1511 if self.module == "medfile":
1512 newlines.append(r'''
1516 newlines.append(r'''
1517 SET(DEST bin/salome)
1521 newlines.append(r'''
1523 INSTALL(TARGETS ${name} DESTINATION ${DEST})
1524 INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.exe DESTINATION ${DEST} RENAME ${amname}.exe)
1525 INSTALL(CODE "FILE(REMOVE ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.exe)")
1528 SET(PERMS ${PERMS} OWNER_READ OWNER_WRITE OWNER_EXECUTE)
1529 SET(PERMS ${PERMS} GROUP_READ GROUP_EXECUTE)
1530 SET(PERMS ${PERMS} WORLD_READ WORLD_EXECUTE)
1531 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${name} DESTINATION ${DEST} PERMISSIONS ${PERMS} RENAME ${amname})
1535 newlines.append(r'''
1539 newlines.append(r'''
1540 ENDFOREACH(amname ${bin_PROGRAMS})
1545 def addInstallTarget(self, key, destination, newlines):
1546 newlines.append(r"FOREACH(f ${%s})"%(key))
1547 newlines.append(r'''
1550 newlines.append(r'''
1551 STRING(COMPARE EQUAL ${f} SALOMEconfig.h.in test_SALOMEconfig.h.in)
1552 IF(test_SALOMEconfig.h.in)
1553 INSTALL(FILES SALOMEconfig.ref.in DESTINATION ${DEST} RENAME SALOMEconfig.h.in)
1554 ELSE(test_SALOMEconfig.h.in)
1555 SET(dummy dummy-NOTFOUND)
1556 MARK_AS_ADVANCED(dummy)
1557 # FILE(REMOVE ${CMAKE_INSTALL_PREFIX}/${DEST}/${f})
1558 FIND_FILE(dummy ${f} PATHS ${CMAKE_CURRENT_SOURCE_DIR} NO_DEFAULT_PATH)
1561 if key in ['dist_salomescript_SCRIPTS']:
1562 newlines.append(r'''
1564 SET(PERMS ${PERMS} OWNER_READ OWNER_WRITE OWNER_EXECUTE)
1565 SET(PERMS ${PERMS} GROUP_READ GROUP_EXECUTE)
1566 SET(PERMS ${PERMS} WORLD_READ WORLD_EXECUTE)
1567 INSTALL(FILES ${f} DESTINATION ${DEST} PERMISSIONS ${PERMS})
1570 newlines.append(r'''
1571 INSTALL(FILES ${f} DESTINATION ${DEST})
1574 newlines.append(r'''
1576 GET_FILENAME_COMPONENT(ext ${f} EXT)
1577 IF(ext STREQUAL .qm)
1578 STRING(REGEX REPLACE .qm .ts input ${f})
1580 if self.module in ["kernel", "gui"]:
1581 newlines.append(r'''
1582 SET(input ${CMAKE_CURRENT_SOURCE_DIR}/resources/${input})
1585 newlines.append(r'''
1586 SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input})
1589 newlines.append(r'''
1590 SET(output ${CMAKE_CURRENT_BINARY_DIR}/${f})
1591 # ADD_CUSTOM_COMMAND(
1593 # COMMAND ${QT_LRELEASE_EXECUTABLE} ${input} -qm ${output}
1594 # MAIN_DEPENDENCY ${input}
1596 EXECUTE_PROCESS(COMMAND ${QT_LRELEASE_EXECUTABLE} ${input} -qm ${output})
1597 ENDIF(ext STREQUAL .qm)
1598 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${f} DESTINATION ${DEST})
1600 ENDIF(test_SALOMEconfig.h.in)
1602 newlines.append(r"ENDFOREACH(f ${%s})"%(key))
1605 def writeListsFile(self):
1606 f = open(self.listsFile, "w")
1607 f.write(self.content)
1613 def convertAmFile(the_root, root, dirs, files, f, module):
1614 cmake = CMakeFile(the_root, root, dirs, files, f, module)
1615 cmake.writeListsFile()
1618 def usage(exit_status):
1619 from sys import exit
1620 from sys import argv
1621 print "Usage: %s --module"%(argv[0])
1625 if __name__ == "__main__":
1627 from sys import argv
1633 if module.find('--') != 0:
1637 if len(module) == 0:
1641 from os import getcwd
1645 for root, dirs, files in walk(the_root):
1646 from os.path import basename
1647 if basename(root) == "CVS": continue
1649 from os.path import basename
1650 if basename(f) == "Makefile.am":
1651 convertAmFile(the_root, root, dirs, files, f, module)