From 41211de972073acf7668ef693bc0ba1699ae166e Mon Sep 17 00:00:00 2001 From: ageay Date: Fri, 5 Jul 2013 14:42:07 +0000 Subject: [PATCH] New CMake implementation --- .../cmake_files/FindBOOST.cmake | 170 -- .../cmake_files/FindCPPUNIT.cmake | 151 -- .../cmake_files/FindCppUnit.cmake | 64 + ...ilePythonFile.cmake => FindGraphviz.cmake} | 26 +- .../cmake_files/FindHDF5.cmake | 211 -- .../cmake_files/FindMEDFILE.cmake | 103 - .../cmake_files/FindMPI.cmake | 153 -- .../cmake_files/FindPYTHON.cmake | 236 -- .../cmake_files/FindSWIG.cmake | 99 - .../cmake_files/FindSalomeCppUnit.cmake | 28 + .../cmake_files/FindSalomeDoxygen.cmake | 28 + .../cmake_files/FindSalomeGraphviz.cmake | 28 + .../cmake_files/FindSalomeHDF5.cmake | 69 + .../cmake_files/FindSalomeMPI.cmake | 31 + .../cmake_files/FindSalomeMedfile.cmake | 28 + .../cmake_files/FindSalomePython.cmake | 140 + .../cmake_files/FindSalomeSWIG.cmake | 27 + .../cmake_files/FindSalomeSphinx.cmake | 26 + .../cmake_files/FindSphinx.cmake | 37 + .../cmake_files/SalomeMacros.cmake | 427 +++ .../cmake_files/am2cmake.py | 2310 ----------------- 21 files changed, 948 insertions(+), 3444 deletions(-) delete mode 100755 adm_local_without_kernel/cmake_files/FindBOOST.cmake delete mode 100755 adm_local_without_kernel/cmake_files/FindCPPUNIT.cmake create mode 100644 adm_local_without_kernel/cmake_files/FindCppUnit.cmake rename adm_local_without_kernel/cmake_files/{InstallAndCompilePythonFile.cmake => FindGraphviz.cmake} (55%) mode change 100755 => 100644 delete mode 100755 adm_local_without_kernel/cmake_files/FindHDF5.cmake delete mode 100644 adm_local_without_kernel/cmake_files/FindMEDFILE.cmake delete mode 100644 adm_local_without_kernel/cmake_files/FindMPI.cmake delete mode 100755 adm_local_without_kernel/cmake_files/FindPYTHON.cmake delete mode 100755 adm_local_without_kernel/cmake_files/FindSWIG.cmake create mode 100644 adm_local_without_kernel/cmake_files/FindSalomeCppUnit.cmake create mode 100644 adm_local_without_kernel/cmake_files/FindSalomeDoxygen.cmake create mode 100644 adm_local_without_kernel/cmake_files/FindSalomeGraphviz.cmake create mode 100644 adm_local_without_kernel/cmake_files/FindSalomeHDF5.cmake create mode 100644 adm_local_without_kernel/cmake_files/FindSalomeMPI.cmake create mode 100644 adm_local_without_kernel/cmake_files/FindSalomeMedfile.cmake create mode 100644 adm_local_without_kernel/cmake_files/FindSalomePython.cmake create mode 100644 adm_local_without_kernel/cmake_files/FindSalomeSWIG.cmake create mode 100644 adm_local_without_kernel/cmake_files/FindSalomeSphinx.cmake create mode 100644 adm_local_without_kernel/cmake_files/FindSphinx.cmake create mode 100755 adm_local_without_kernel/cmake_files/SalomeMacros.cmake delete mode 100644 adm_local_without_kernel/cmake_files/am2cmake.py diff --git a/adm_local_without_kernel/cmake_files/FindBOOST.cmake b/adm_local_without_kernel/cmake_files/FindBOOST.cmake deleted file mode 100755 index fff9d21a1..000000000 --- a/adm_local_without_kernel/cmake_files/FindBOOST.cmake +++ /dev/null @@ -1,170 +0,0 @@ -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -# ------ - -MESSAGE(STATUS "Check for boost ...") - -# ------ - -IF(BOOST_IS_MANDATORY STREQUAL 0) - SET(BOOST_IS_MANDATORY 0) - SET(BOOST_IS_OPTIONAL 1) -ENDIF(BOOST_IS_MANDATORY STREQUAL 0) -IF(BOOST_IS_OPTIONAL STREQUAL 0) - SET(BOOST_IS_MANDATORY 1) - SET(BOOST_IS_OPTIONAL 0) -ENDIF(BOOST_IS_OPTIONAL STREQUAL 0) -IF(NOT BOOST_IS_MANDATORY AND NOT BOOST_IS_OPTIONAL) - SET(BOOST_IS_MANDATORY 1) - SET(BOOST_IS_OPTIONAL 0) -ENDIF(NOT BOOST_IS_MANDATORY AND NOT BOOST_IS_OPTIONAL) - -# ------ - -SET(BOOST_STATUS 1) -IF(WITHOUT_BOOST OR WITH_BOOST STREQUAL 0) - SET(BOOST_STATUS 0) - MESSAGE(STATUS "boost disabled from command line.") -ENDIF(WITHOUT_BOOST OR WITH_BOOST STREQUAL 0) - -# ------ - -IF(BOOST_STATUS) - IF(WITH_BOOST) - SET(BOOST_ROOT_USER ${WITH_BOOST}) - ELSE(WITH_BOOST) - SET(BOOST_ROOT_USER $ENV{BOOST_ROOT}) - IF(NOT BOOST_ROOT_USER) - SET(BOOST_ROOT_USER $ENV{BOOSTDIR}) - ENDIF(NOT BOOST_ROOT_USER) - ENDIF(WITH_BOOST) -ENDIF(BOOST_STATUS) - -# ----- - -IF(BOOST_STATUS) - IF(BOOST_ROOT_USER) - SET(BOOST_FIND_PATHS_OPTION NO_DEFAULT_PATH) - ELSE(BOOST_ROOT_USER) - SET(BOOST_FIND_PATHS_OPTION) - ENDIF(BOOST_ROOT_USER) -ENDIF(BOOST_STATUS) - -# ----- - -IF(BOOST_STATUS) - IF(BOOST_ROOT_USER) - SET(BOOST_INCLUDE_PATHS ${BOOST_ROOT_USER} ${BOOST_ROOT_USER}/include) - ELSE(BOOST_ROOT_USER) - SET(BOOST_INCLUDE_PATHS) - ENDIF(BOOST_ROOT_USER) - SET(BOOST_INCLUDE_TO_FIND boost/shared_ptr.hpp) - FIND_PATH(BOOST_INCLUDE_DIR ${BOOST_INCLUDE_TO_FIND} PATHS ${BOOST_INCLUDE_PATHS} ${BOOST_FIND_PATHS_OPTION}) - IF(BOOST_INCLUDE_DIR) - IF(BOOST_ROOT_USER) - SET(BOOST_CPPFLAGS -I${BOOST_INCLUDE_DIR})# to be removed - SET(BOOST_INCLUDE_DIRS ${BOOST_INCLUDE_DIR}) - ENDIF(BOOST_ROOT_USER) - MESSAGE(STATUS "${BOOST_INCLUDE_TO_FIND} found in ${BOOST_INCLUDE_DIR}") - ELSE(BOOST_INCLUDE_DIR) - SET(BOOST_STATUS 0) - IF(BOOST_ROOT_USER) - MESSAGE(STATUS "${BOOST_INCLUDE_TO_FIND} not found in ${BOOST_INCLUDE_PATHS}, check your BOOST installation.") - ELSE(BOOST_ROOT_USER) - MESSAGE(STATUS "${BOOST_INCLUDE_TO_FIND} not found on system, try to use WITH_BOOST option or BOOST_ROOT environment variable.") - ENDIF(BOOST_ROOT_USER) - ENDIF(BOOST_INCLUDE_DIR) -ENDIF(BOOST_STATUS) - -# ---- - -IF(BOOST_STATUS) - IF(BOOST_ROOT_USER) - SET(BOOST_LIB_PATHS ${BOOST_ROOT_USER}/lib) - ELSE(BOOST_ROOT_USER) - SET(BOOST_LIB_PATHS) - ENDIF(BOOST_ROOT_USER) -ENDIF(BOOST_STATUS) - -IF(WINDOWS) - SET(BOOST_ENABLE_DLL 1) -ELSE(WINDOWS) - SET(BOOST_ENABLE_DLL 0) -ENDIF(WINDOWS) - -IF(BOOST_STATUS) - SET(BOOST_LIBS) - FOREACH(name thread date_time signals filesystem system regex) - IF(WINDOWS) - IF(CMAKE_BUILD_TYPE STREQUAL Debug) - SET(EXTENSION -gd) - ELSE(CMAKE_BUILD_TYPE STREQUAL Debug) - SET(EXTENSION) - ENDIF(CMAKE_BUILD_TYPE STREQUAL Debug) - SET(LIB_NAMES) - SET(STATIC_LIB_NAMES) - FOREACH(version 1_35 1_38 1_42 1_46_1 1_49) - SET(LIB_NAMES ${LIB_NAMES} boost_${name}-vc90-mt${EXTENSION}-${version}) - SET(STATIC_LIB_NAMES ${STATIC_LIB_NAMES} libboost_${name}-vc90-mt${EXTENSION}-${version}) - ENDFOREACH(version 1_35 1_38 1_42 1_46_1 1_49) - FIND_LIBRARY(BOOST_LIB_${name} NAMES ${LIB_NAMES} PATHS ${BOOST_LIB_PATHS} ${BOOST_FIND_PATHS_OPTION}) - SET(BOOST_LIB_${name}_FOUNDED ${BOOST_LIB_${name}}) - IF(NOT BOOST_LIB_${name}) - FIND_LIBRARY(STATIC_BOOST_LIB_${name} NAMES ${STATIC_LIB_NAMES} PATHS ${BOOST_LIB_PATHS} ${BOOST_FIND_PATHS_OPTION}) - SET(BOOST_LIB_${name}_FOUNDED ${STATIC_BOOST_LIB_${name}}) - SET(BOOST_ENABLE_DLL 0) - ENDIF(NOT BOOST_LIB_${name}) - ELSE(WINDOWS) - FIND_LIBRARY(BOOST_LIB_${name} NAMES boost_${name} boost_${name}-mt PATHS ${BOOST_LIB_PATHS} ${BOOST_FIND_PATHS_OPTION}) - SET(BOOST_LIB_${name}_FOUNDED ${BOOST_LIB_${name}}) - ENDIF(WINDOWS) - IF(NOT BOOST_LIB_${name}_FOUNDED) - MESSAGE(STATUS "boost lib ${name} not found") - SET(BOOST_STATUS 0) - ENDIF(NOT BOOST_LIB_${name}_FOUNDED) - STRING(TOUPPER ${name} upname) - SET(BOOST_LIB_${upname} ${BOOST_LIB_${name}_FOUNDED}) - SET(BOOST_LIBS ${BOOST_LIBS} ${BOOST_LIB_${name}_FOUNDED}) - ENDFOREACH(name thread date_time signals filesystem system) -ENDIF(BOOST_STATUS) - -# ------ - -IF(BOOST_STATUS) - IF(WINDOWS) - SET(BOOST_CPPFLAGS ${BOOST_CPPFLAGS} -DBOOST_DISABLE_ASSERTS)# to be removed - SET(BOOST_DEFINITIONS -DBOOST_DISABLE_ASSERTS) - IF(BOOST_ENABLE_DLL) - SET(BOOST_CPPFLAGS ${BOOST_CPPFLAGS} -DBOOST_ALL_DYN_LINK)# to be removed - SET(BOOST_DEFINITIONS "${BOOST_DEFINITIONS} -DBOOST_ALL_DYN_LINK") - ENDIF(BOOST_ENABLE_DLL) - ENDIF(WINDOWS) -ELSE(BOOST_STATUS) - IF(BOOST_IS_MANDATORY) - MESSAGE(FATAL_ERROR "boost not found ... mandatory ... abort") - ELSE(BOOST_IS_MANDATORY) - MESSAGE(STATUS "boost not found ... optional ... disabled") - ENDIF(BOOST_IS_MANDATORY) -ENDIF(BOOST_STATUS) - -# ------ diff --git a/adm_local_without_kernel/cmake_files/FindCPPUNIT.cmake b/adm_local_without_kernel/cmake_files/FindCPPUNIT.cmake deleted file mode 100755 index 6f197939a..000000000 --- a/adm_local_without_kernel/cmake_files/FindCPPUNIT.cmake +++ /dev/null @@ -1,151 +0,0 @@ -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -# ------ - -MESSAGE(STATUS "Check for cppunit ...") - -# ------ - -IF(CPPUNIT_IS_MANDATORY STREQUAL 0) - SET(CPPUNIT_IS_MANDATORY 0) - SET(CPPUNIT_IS_OPTIONAL 1) -ENDIF(CPPUNIT_IS_MANDATORY STREQUAL 0) -IF(CPPUNIT_IS_OPTIONAL STREQUAL 0) - SET(CPPUNIT_IS_MANDATORY 1) - SET(CPPUNIT_IS_OPTIONAL 0) -ENDIF(CPPUNIT_IS_OPTIONAL STREQUAL 0) -IF(NOT CPPUNIT_IS_MANDATORY AND NOT CPPUNIT_IS_OPTIONAL) - SET(CPPUNIT_IS_MANDATORY 0) - SET(CPPUNIT_IS_OPTIONAL 1) -ENDIF(NOT CPPUNIT_IS_MANDATORY AND NOT CPPUNIT_IS_OPTIONAL) - -# ------ - -SET(CPPUNIT_STATUS 1) -IF(WITHOUT_CPPUNIT OR WITH_CPPUNIT STREQUAL 0) - SET(CPPUNIT_STATUS 0) - MESSAGE(STATUS "cppunit disabled from command line.") -ENDIF(WITHOUT_CPPUNIT OR WITH_CPPUNIT STREQUAL 0) - -# ------ - -IF(CPPUNIT_STATUS) - IF(WITH_CPPUNIT) - SET(CPPUNIT_ROOT_USER ${WITH_CPPUNIT}) - ELSE(WITH_CPPUNIT) - SET(CPPUNIT_ROOT_USER $ENV{CPPUNIT_ROOT}) - ENDIF(WITH_CPPUNIT) -ENDIF(CPPUNIT_STATUS) - -# ----- - -IF(CPPUNIT_STATUS) - IF(CPPUNIT_ROOT_USER) - SET(CPPUNIT_FIND_PATHS_OPTION NO_DEFAULT_PATH) - ELSE(CPPUNIT_ROOT_USER) - SET(CPPUNIT_FIND_PATHS_OPTION) - ENDIF(CPPUNIT_ROOT_USER) -ENDIF(CPPUNIT_STATUS) - -# ----- - -IF(CPPUNIT_STATUS) - IF(CPPUNIT_ROOT_USER) - SET(CPPUNIT_INCLUDE_PATHS ${CPPUNIT_ROOT_USER} ${CPPUNIT_ROOT_USER}/include) - ELSE(CPPUNIT_ROOT_USER) - SET(CPPUNIT_INCLUDE_PATHS) - ENDIF(CPPUNIT_ROOT_USER) - SET(CPPUNIT_INCLUDE_TO_FIND cppunit/extensions/HelperMacros.h) - FIND_PATH(CPPUNIT_INCLUDE_DIR ${CPPUNIT_INCLUDE_TO_FIND} PATHS ${CPPUNIT_INCLUDE_PATHS} ${CPPUNIT_FIND_PATHS_OPTION}) - IF(CPPUNIT_INCLUDE_DIR) - IF(CPPUNIT_ROOT_USER) - SET(CPPUNIT_INCLUDES -I${CPPUNIT_INCLUDE_DIR})# to be removed - IF(${CPPUNIT_INCLUDE_DIR} STREQUAL /usr/include) - SET(CPPUNIT_INCLUDE_DIRS) - ELSE(${CPPUNIT_INCLUDE_DIR} STREQUAL /usr/include) - SET(CPPUNIT_INCLUDE_DIRS ${CPPUNIT_INCLUDE_DIR}) - ENDIF(${CPPUNIT_INCLUDE_DIR} STREQUAL /usr/include) - ENDIF(CPPUNIT_ROOT_USER) - MESSAGE(STATUS "${CPPUNIT_INCLUDE_TO_FIND} found in ${CPPUNIT_INCLUDE_DIR}") - ELSE(CPPUNIT_INCLUDE_DIR) - SET(CPPUNIT_STATUS 0) - IF(CPPUNIT_ROOT_USER) - MESSAGE(STATUS "${CPPUNIT_INCLUDE_TO_FIND} not found in ${CPPUNIT_INCLUDE_PATHS}, check your CPPUNIT installation.") - ELSE(CPPUNIT_ROOT_USER) - MESSAGE(STATUS "${CPPUNIT_INCLUDE_TO_FIND} not found on system, try to use WITH_CPPUNIT option or CPPUNIT_ROOT environment variable.") - ENDIF(CPPUNIT_ROOT_USER) - ENDIF(CPPUNIT_INCLUDE_DIR) -ENDIF(CPPUNIT_STATUS) - -# ---- - -IF(CPPUNIT_STATUS) - IF(CPPUNIT_ROOT_USER) - SET(CPPUNIT_LIB_PATHS ${CPPUNIT_ROOT_USER}/lib) - ELSE(CPPUNIT_ROOT_USER) - SET(CPPUNIT_LIB_PATHS) - ENDIF(CPPUNIT_ROOT_USER) -ENDIF(CPPUNIT_STATUS) - -IF(CPPUNIT_STATUS) - IF(WINDOWS) - IF(CMAKE_BUILD_TYPE STREQUAL Debug) - FIND_LIBRARY(CPPUNIT_LIB cppunitd_dll PATHS ${CPPUNIT_LIB_PATHS} ${CPPUNIT_FIND_PATHS_OPTION}) - ELSE(CMAKE_BUILD_TYPE STREQUAL Debug) - FIND_LIBRARY(CPPUNIT_LIB cppunit_dll PATHS ${CPPUNIT_LIB_PATHS} ${CPPUNIT_FIND_PATHS_OPTION}) - ENDIF(CMAKE_BUILD_TYPE STREQUAL Debug) - ELSE(WINDOWS) - FIND_LIBRARY(CPPUNIT_LIB cppunit PATHS ${CPPUNIT_LIB_PATHS} ${CPPUNIT_FIND_PATHS_OPTION}) - ENDIF(WINDOWS) - SET(CPPUNIT_LIBS) - IF(CPPUNIT_LIB) - SET(CPPUNIT_LIBS ${CPPUNIT_LIBS} ${CPPUNIT_LIB}) - MESSAGE(STATUS "cppunit lib found: ${CPPUNIT_LIB}") - ELSE(CPPUNIT_LIB) - SET(CPPUNIT_STATUS 0) - IF(CPPUNIT_ROOT_USER) - MESSAGE(STATUS "cppunit lib not found in ${CPPUNIT_LIB_PATHS}, check your CPPUNIT installation.") - ELSE(CPPUNIT_ROOT_USER) - MESSAGE(STATUS "cppunit lib not found on system, try to use WITH_CPPUNIT option or CPPUNIT_ROOT environment variable.") - ENDIF(CPPUNIT_ROOT_USER) - ENDIF(CPPUNIT_LIB) -ENDIF(CPPUNIT_STATUS) - -# ---- - -IF(CPPUNIT_STATUS) - SET(CPPUNIT_IS_OK 1) - SET(CPPUNIT_DEFINITIONS) - IF(WINDOWS) - SET(CPPUNIT_INCLUDES ${CPPUNIT_INCLUDES} -DCPPUNIT_DLL) - SET(CPPUNIT_DEFINITIONS "-DCPPUNIT_DLL") - ENDIF(WINDOWS) -ELSE(CPPUNIT_STATUS) - IF(CPPUNIT_IS_MANDATORY) - MESSAGE(FATAL_ERROR "cppunit not found ... mandatory ... abort") - ELSE(CPPUNIT_IS_MANDATORY) - MESSAGE(STATUS "cppunit not found ... optional ... disabled") - ENDIF(CPPUNIT_IS_MANDATORY) -ENDIF(CPPUNIT_STATUS) - -# ------ diff --git a/adm_local_without_kernel/cmake_files/FindCppUnit.cmake b/adm_local_without_kernel/cmake_files/FindCppUnit.cmake new file mode 100644 index 000000000..4460b9d0d --- /dev/null +++ b/adm_local_without_kernel/cmake_files/FindCppUnit.cmake @@ -0,0 +1,64 @@ +# - Find CppUnit +# Sets the following variables: +# CPPUNIT_INCLUDE_DIRS - path to the CppUnit include directory +# CPPUNIT_LIBRARIES - path to the CppUnit libraries to be linked against +# CPPUNIT_DEFINITIONS - specific CppUnit definitions to be added +# +# The header cppunit/extensions/HelperMacros.h is looked for. +# The following libraries are searched +# cppunit_dll, or cppunitd_dll (Windows) +# cppunit (Linux) +# + +######################################################################### +# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +IF(NOT CppUnit_FIND_QUIETLY) + MESSAGE(STATUS "Looking for CppUnit ...") +ENDIF() + +# Headers +SET(CPPUNIT_INCLUDE_TO_FIND cppunit/extensions/HelperMacros.h) +FIND_PATH(CPPUNIT_INCLUDE_DIRS ${CPPUNIT_INCLUDE_TO_FIND}) + +# Libraries +IF(WINDOWS) + IF(CMAKE_BUILD_TYPE STREQUAL Debug) + FIND_LIBRARY(CPPUNIT_LIBRARIES cppunitd_dll) + ELSE(CMAKE_BUILD_TYPE STREQUAL Debug) + FIND_LIBRARY(CPPUNIT_LIBRARIES cppunit_dll) + ENDIF(CMAKE_BUILD_TYPE STREQUAL Debug) +ELSE(WINDOWS) + FIND_LIBRARY(CPPUNIT_LIBRARIES cppunit) +ENDIF(WINDOWS) + +# Global variables +SET(CPPUNIT_DEFINITIONS) +IF(WINDOWS) + SET(CPPUNIT_DEFINITIONS -DCPPUNIT_DLL) +ENDIF(WINDOWS) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(CppUnit REQUIRED_VARS CPPUNIT_INCLUDE_DIRS CPPUNIT_LIBRARIES) + + diff --git a/adm_local_without_kernel/cmake_files/InstallAndCompilePythonFile.cmake b/adm_local_without_kernel/cmake_files/FindGraphviz.cmake old mode 100755 new mode 100644 similarity index 55% rename from adm_local_without_kernel/cmake_files/InstallAndCompilePythonFile.cmake rename to adm_local_without_kernel/cmake_files/FindGraphviz.cmake index ceebf7f16..cf987bede --- a/adm_local_without_kernel/cmake_files/InstallAndCompilePythonFile.cmake +++ b/adm_local_without_kernel/cmake_files/FindGraphviz.cmake @@ -1,3 +1,11 @@ +# - Graphviz detection +# +# Output variable: GRAPHVIZ_EXECUTABLE +# +# The executable 'dot' is looked for and returned in the above variable. +# + +########################################################################### # Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, @@ -19,15 +27,11 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # +########################################################################### + +FIND_PROGRAM(GRAPHVIZ_EXECUTABLE dot) + +# Handle the standard arguments of the find_package() command: +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Graphviz REQUIRED_VARS GRAPHVIZ_EXECUTABLE) -MACRO(INSTALL_AND_COMPILE_PYTHON_FILE PYFILE2COMPINST PYFILELOC) - INSTALL(CODE "SET(PYTHON_FILE ${f})") - FOREACH(input ${PYFILE2COMPINST}) - GET_FILENAME_COMPONENT(inputname ${input} NAME) - INSTALL(FILES ${input} DESTINATION ${CMAKE_INSTALL_PREFIX}/${PYFILELOC}) - INSTALL(CODE "MESSAGE(STATUS \"py compiling ${CMAKE_INSTALL_PREFIX}/${PYFILELOC}/${inputname}\")") - INSTALL(CODE "SET(CMD \"import py_compile ; py_compile.compile('${CMAKE_INSTALL_PREFIX}/${PYFILELOC}/${inputname}')\")") - INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c \"\${CMD}\")") - INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -O -c \"\${CMD}\")") - ENDFOREACH(input ${PYFILE2COMPINST}) -ENDMACRO(INSTALL_AND_COMPILE_PYTHON_FILE PYFILE2COMPINST PYFILELOC) diff --git a/adm_local_without_kernel/cmake_files/FindHDF5.cmake b/adm_local_without_kernel/cmake_files/FindHDF5.cmake deleted file mode 100755 index 33c532c8e..000000000 --- a/adm_local_without_kernel/cmake_files/FindHDF5.cmake +++ /dev/null @@ -1,211 +0,0 @@ -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -# ------ - -MESSAGE(STATUS "Check for hdf5 ...") - -# ------ - -IF(HDF5_IS_MANDATORY STREQUAL 0) - SET(HDF5_IS_MANDATORY 0) - SET(HDF5_IS_OPTIONAL 1) -ENDIF(HDF5_IS_MANDATORY STREQUAL 0) -IF(HDF5_IS_OPTIONAL STREQUAL 0) - SET(HDF5_IS_MANDATORY 1) - SET(HDF5_IS_OPTIONAL 0) -ENDIF(HDF5_IS_OPTIONAL STREQUAL 0) -IF(NOT HDF5_IS_MANDATORY AND NOT HDF5_IS_OPTIONAL) - SET(HDF5_IS_MANDATORY 1) - SET(HDF5_IS_OPTIONAL 0) -ENDIF(NOT HDF5_IS_MANDATORY AND NOT HDF5_IS_OPTIONAL) - -# ------ - -SET(HDF5_STATUS 1) -IF(WITHOUT_HDF5 OR WITH_HDF5 STREQUAL 0) - SET(HDF5_STATUS 0) - MESSAGE(STATUS "hdf5 disabled from command line.") -ENDIF(WITHOUT_HDF5 OR WITH_HDF5 STREQUAL 0) - -# ------ - -IF(HDF5_STATUS) - IF(WITH_HDF5) - SET(HDF5_ROOT_USER ${WITH_HDF5}) - ENDIF(WITH_HDF5) - IF(NOT HDF5_ROOT_USER) - SET(HDF5_ROOT_USER $ENV{HDF5_ROOT}) - ENDIF(NOT HDF5_ROOT_USER) - IF(NOT HDF5_ROOT_USER) - SET(HDF5_ROOT_USER $ENV{HDF5HOME}) - ENDIF(NOT HDF5_ROOT_USER) -ENDIF(HDF5_STATUS) - -# ------ - -IF(HDF5_STATUS) - IF(NOT HDF5_ROOT_USER) - FIND_PROGRAM(HDF5_DUMP h5dump) - IF(HDF5_DUMP) - MESSAGE(STATUS "h5dump found: ${HDF5_DUMP}") - IF(HDF5_DUMP STREQUAL /usr/bin/h5dump) - ELSE(HDF5_DUMP STREQUAL /usr/bin/h5dump) - SET(HDF5_ROOT_USER ${HDF5_DUMP}) - GET_FILENAME_COMPONENT(HDF5_ROOT_USER ${HDF5_ROOT_USER} PATH) - GET_FILENAME_COMPONENT(HDF5_ROOT_USER ${HDF5_ROOT_USER} PATH) - ENDIF(HDF5_DUMP STREQUAL /usr/bin/h5dump) - ELSE(HDF5_DUMP) - MESSAGE(STATUS "h5dump not found, try to use WITH_HDF5 option or HDF5_ROOT (or HDF5HOME) environment variable") - SET(HDF5_STATUS 0) - ENDIF(HDF5_DUMP) - ENDIF(NOT HDF5_ROOT_USER) -ENDIF(HDF5_STATUS) - -# ------ - -IF(HDF5_STATUS) - IF(HDF5_ROOT_USER) - SET(HDF5_FIND_PATHS_OPTION NO_DEFAULT_PATH) - ELSE(HDF5_ROOT_USER) - SET(HDF5_FIND_PATHS_OPTION) - ENDIF(HDF5_ROOT_USER) -ENDIF(HDF5_STATUS) - -# ------ - -IF(HDF5_STATUS) - IF(HDF5_ROOT_USER) - SET(HDF5_INCLUDE_PATHS ${HDF5_ROOT_USER}/include) - ELSE(HDF5_ROOT_USER) - SET(HDF5_INCLUDE_PATHS) - ENDIF(HDF5_ROOT_USER) - SET(HDF5_INCLUDE_TO_FIND H5public.h) - FIND_PATH(HDF5_INCLUDE_DIR ${HDF5_INCLUDE_TO_FIND} PATHS ${HDF5_INCLUDE_PATHS} ${HDF5_FIND_PATHS_OPTION}) - IF(HDF5_INCLUDE_DIR) - IF(HDF5_ROOT_USER) - SET(HDF5_INCLUDES -I${HDF5_INCLUDE_DIR})# to be removed - IF(${HDF5_INCLUDE_DIR} STREQUAL /usr/include) - SET(HDF5_INCLUDE_DIRS) - ELSE(${HDF5_INCLUDE_DIR} STREQUAL /usr/include) - SET(HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR}) - ENDIF(${HDF5_INCLUDE_DIR} STREQUAL /usr/include) - ENDIF(HDF5_ROOT_USER) - SET(HDF5_DEFINITIONS "-DH5_USE_16_API -D_HDF5USEDLL_") - SET(HDF5_INCLUDES -DH5_USE_16_API -D_HDF5USEDLL_ ${HDF5_INCLUDES})# to be removed - MESSAGE(STATUS "${HDF5_INCLUDE_TO_FIND} found in ${HDF5_INCLUDE_DIR}") - ELSE(HDF5_INCLUDE_DIR) - SET(HDF5_STATUS 0) - IF(HDF5_ROOT_USER) - MESSAGE(STATUS "${HDF5_INCLUDE_TO_FIND} not found in ${HDF5_INCLUDE_PATHS}, check your HDF5 installation.") - ELSE(HDF5_ROOT_USER) - MESSAGE(STATUS "${HDF5_INCLUDE_TO_FIND} not found on system, try to use WITH_HDF5 option or HDF5_ROOT (or HDF5HOME) environment variable.") - ENDIF(HDF5_ROOT_USER) - ENDIF(HDF5_INCLUDE_DIR) -ENDIF(HDF5_STATUS) - -# ---- - -IF(HDF5_STATUS) - IF(HDF5_ROOT_USER) - IF(WINDOWS) - SET(HDF5_LIB_PATHS ${HDF5_ROOT_USER}/dll ${HDF5_ROOT_USER}/lib) - ELSE(WINDOWS) - SET(HDF5_LIB_PATHS ${HDF5_ROOT_USER}/lib) - ENDIF(WINDOWS) - ELSE(HDF5_ROOT_USER) - SET(HDF5_LIB_PATHS) - ENDIF(HDF5_ROOT_USER) - IF(WINDOWS) - IF(CMAKE_BUILD_TYPE STREQUAL Release) - FIND_LIBRARY(HDF5_LIB hdf5dll PATHS ${HDF5_LIB_PATHS} ${HDF5_FIND_PATHS_OPTION}) - ELSE(CMAKE_BUILD_TYPE STREQUAL Release) - FIND_LIBRARY(HDF5_LIB hdf5ddll PATHS ${HDF5_LIB_PATHS} ${HDF5_FIND_PATHS_OPTION}) - ENDIF(CMAKE_BUILD_TYPE STREQUAL Release) - ELSE(WINDOWS) - FIND_LIBRARY(HDF5_LIB hdf5 PATHS ${HDF5_LIB_PATHS} ${HDF5_FIND_PATHS_OPTION}) - ENDIF(WINDOWS) - SET(HDF5_LIBS) - IF(HDF5_LIB) - SET(HDF5_LIBS ${HDF5_LIBS} ${HDF5_LIB}) - MESSAGE(STATUS "hdf5 lib found: ${HDF5_LIB}") - ELSE(HDF5_LIB) - SET(HDF5_STATUS 0) - IF(HDF5_ROOT_USER) - MESSAGE(STATUS "hdf5 lib not found in ${HDF5_LIB_PATHS}, check your HDF5 installation.") - ELSE(HDF5_ROOT_USER) - MESSAGE(STATUS "hdf5 lib not found on system, try to use WITH_HDF5 option or HDF5_ROOT (or HDF5HOME) environment variable.") - ENDIF(HDF5_ROOT_USER) - ENDIF(HDF5_LIB) -ENDIF(HDF5_STATUS) - -IF(HDF5_STATUS) - FILE(TO_NATIVE_PATH "${HDF5_INCLUDE_DIR}/H5public.h" HDF5_H5PUBLIC_FILE) - EXECUTE_PROCESS( - COMMAND ${PYTHON_EXECUTABLE} -c "import re,sys ; f=file(sys.argv[1]) ; s=f.read() ; c=re.compile('^#[\\s]*include[\\s]*\\\"(?P[A-Za-z0-9\\-]+\\.h)\\\"',re.M) ; sys.stdout.write(c.search(s).group('nm'))" - ${HDF5_H5PUBLIC_FILE} - OUTPUT_VARIABLE HDF5_H5PUBLIC_DEFS_FILE - ) - FILE(TO_NATIVE_PATH "${HDF5_INCLUDE_DIR}/${HDF5_H5PUBLIC_DEFS_FILE}" HDF5_H5PUBLIC_DEFS_FILE) - EXECUTE_PROCESS( - COMMAND ${PYTHON_EXECUTABLE} -c "import re,sys ; f=file(sys.argv[1]) ; s=f.read() ; c=re.compile('^#[\\s]*define[\\s]+H5_HAVE_PARALLEL[\\s]+(?P[\\d]+)',re.M) ; m=c.search(s); exec('if m: sys.stdout.write(m.group(\\'nm\\'))') ; exec('if not m: sys.stdout.write(\\'0\\')')" - ${HDF5_H5PUBLIC_DEFS_FILE} - OUTPUT_VARIABLE HDF5_HAVE_PARALLEL - ) - IF(HDF5_HAVE_PARALLEL) - MESSAGE(STATUS "hdf5 is parallel") - SET(HDF5_INCLUDES ${HDF5_INCLUDES} -I${MPI_INCLUDE_DIRS}) # to remove after "cmakeization" - SET(HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIRS} ${MPI_INCLUDE_DIRS}) - SET(HDF5_DEFINITIONS "${HDF5_DEFINITIONS} ${MPI_DEFINITIONS}") - SET(HDF5_LIBS ${HDF5_LIBS} ${MPI_LIBS}) - ENDIF(HDF5_HAVE_PARALLEL) -ENDIF(HDF5_STATUS) - -# ---- - -IF(HDF5_STATUS) - SET(HDF5_CPPFLAGS ${HDF5_INCLUDES})# to be removed -ELSE(HDF5_STATUS) - IF(HDF5_IS_MANDATORY) - MESSAGE(FATAL_ERROR "hdf5 not found ... mandatory ... abort") - ELSE(HDF5_IS_MANDATORY) - MESSAGE(STATUS "hdf5 not found ... optional ... disabled") - ENDIF(HDF5_IS_MANDATORY) -ENDIF(HDF5_STATUS) - -# ------ - -#SET(ZLIB_ROOT $ENV{ZLIB_ROOT}) -#STRING(LENGTH "${ZLIB_ROOT}" NB) -#IF(${NB} GREATER 0) -# FIND_LIBRARY(ZLIB_LIBS zlib ${ZLIB_ROOT}/lib) -# SET(HDF5_LIBS ${HDF5_LIBS} ${ZLIB_LIBS}) -#ENDIF(${NB} GREATER 0) - -#SET(SZIP_ROOT $ENV{SZIP_ROOT}) -#STRING(LENGTH "${SZIP_ROOT}" NB) -#IF(${NB} GREATER 0) -# FIND_LIBRARY(SZIP_LIBS szlib ${SZIP_ROOT}/lib) -# SET(HDF5_LIBS ${HDF5_LIBS} ${SZIP_LIBS}) -#ENDIF(${NB} GREATER 0) - -# ------ diff --git a/adm_local_without_kernel/cmake_files/FindMEDFILE.cmake b/adm_local_without_kernel/cmake_files/FindMEDFILE.cmake deleted file mode 100644 index 74e5adcbe..000000000 --- a/adm_local_without_kernel/cmake_files/FindMEDFILE.cmake +++ /dev/null @@ -1,103 +0,0 @@ -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -# ------ - -MESSAGE(STATUS "Check for medfile ...") - -# ------ - -SET(MED_ENABLE_MED3 ON) - -# ------ - -SET(MED3HOME $ENV{MED3HOME}) -IF(NOT MED3HOME) - FIND_PROGRAM(MDUMP mdump) - IF(MDUMP) - MESSAGE(STATUS "mdump found: ${MDUMP}") - SET(MED3HOME ${MDUMP}) - GET_FILENAME_COMPONENT(MED3HOME ${MED3HOME} PATH) - GET_FILENAME_COMPONENT(MED3HOME ${MED3HOME} PATH) - ELSE(MDUMP) - MESSAGE(STATUS "mdump not found, try to use MED3HOME environment variable or check your PATH") - SET(MED_ENABLE_MED3 OFF) - ENDIF(MDUMP) -ENDIF(NOT MED3HOME) - -IF(MED_ENABLE_MED3) - MESSAGE(STATUS "Searching medfile in ${MED3HOME}") -ENDIF(MED_ENABLE_MED3) - -IF(MED_ENABLE_MED3) - FIND_PATH(MED3_INCLUDE_DIR med.h ${MED3HOME}/include) - IF(MED3_INCLUDE_DIR) - SET(MED3_INCLUDES ${HDF5_INCLUDES} -I${MED3_INCLUDE_DIR} -D${MACHINE})#to be removed - SET(MED3_DEFINITIONS "-D${MACHINE}") - IF(${MED3HOME} STREQUAL /usr) - SET(MED3_INCLUDE_DIRS) - ELSE(${MED3HOME} STREQUAL /usr) - SET(MED3_INCLUDE_DIRS ${MED3_INCLUDE_DIR}) - ENDIF(${MED3HOME} STREQUAL /usr) - MESSAGE(STATUS "med.h found in ${MED3_INCLUDE_DIR}") - ELSE(MED3_INCLUDE_DIR) - MESSAGE(STATUS "med.h not found in ${MED3HOME}/include, check your installation.") - SET(MED_ENABLE_MED3 OFF) - ENDIF(MED3_INCLUDE_DIR) -ENDIF(MED_ENABLE_MED3) - -SET(MED3_LIBS_C_ONLY) -FOREACH(name medC) - IF(MED_ENABLE_MED3) - FIND_LIBRARY(${name}_LIB ${name} ${MED3HOME}/lib) - IF(${name}_LIB) - MESSAGE(STATUS "${name} lib found: ${${name}_LIB}") - SET(MED3_LIBS_C_ONLY ${MED3_LIBS} ${${name}_LIB}) - ELSE(${name}_LIB) - MESSAGE(STATUS "${name} lib not found in ${MED3HOME}/lib, check your installation.") - SET(MED_ENABLE_MED3 OFF) - ENDIF(${name}_LIB) - ENDIF(MED_ENABLE_MED3) -ENDFOREACH(name medC) - -SET(MED3_HAS_FORTRAN_BINDINGS 0) -IF(MED_ENABLE_MED3) - FIND_LIBRARY(med_LIB med ${MED3HOME}/lib) - IF(med_LIB) - MESSAGE(STATUS "med lib found: ${med_LIB}") - SET(MED3_LIBS ${MED3_LIBS_C_ONLY} ${med_LIB}) - SET(MED3_HAS_FORTRAN_BINDINGS 1) - ELSE(med_LIB) - MESSAGE(STATUS "med lib not found in ${MED3HOME}/lib") - ENDIF(med_LIB) - - FIND_LIBRARY(medimport_LIB medimport ${MED3HOME}/lib) - IF(medimport_LIB) - MESSAGE(STATUS "medimport lib found: ${medimport_LIB}") - SET(MED3_LIBS ${MED3_LIBS} ${medimport_LIB}) - ELSE(medimport_LIB) - MESSAGE(STATUS "medimport lib not found in ${MED3HOME}/lib") - SET(MED3_HAS_FORTRAN_BINDINGS 0) - ENDIF(medimport_LIB) -ENDIF(MED_ENABLE_MED3) - -IF(MED_ENABLE_MED3) -ELSE(MED_ENABLE_MED3) - MESSAGE(STATUS "medfile not found ... optional ... disabled") -ENDIF(MED_ENABLE_MED3) diff --git a/adm_local_without_kernel/cmake_files/FindMPI.cmake b/adm_local_without_kernel/cmake_files/FindMPI.cmake deleted file mode 100644 index 00d6f88a9..000000000 --- a/adm_local_without_kernel/cmake_files/FindMPI.cmake +++ /dev/null @@ -1,153 +0,0 @@ -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -# ------ -# -MESSAGE(STATUS "Check for MPI ...") - -# ------ - -SET(MPI_STATUS 1) -IF(WITHOUT_MPI OR WITH_MPI STREQUAL 0) - SET(MPI_STATUS 0) - MESSAGE(STATUS "mpi disabled from command line.") -ENDIF(WITHOUT_MPI OR WITH_MPI STREQUAL 0) - -IF(WITH_MPI) - SET(MPI_ROOT_USER ${WITH_MPI}) -ELSE(WITH_MPI) - SET(MPI_ROOT_USER $ENV{MPI_ROOT}) -ENDIF(WITH_MPI) - -IF(NOT MPI_ROOT_USER) - FIND_PROGRAM(MPICC mpicc) - IF(MPICC) - MESSAGE(STATUS "mpicc found: ${MPICC}") - SET(MPI_ROOT ${MPICC}) - GET_FILENAME_COMPONENT(MPI_ROOT ${MPI_ROOT} PATH) - GET_FILENAME_COMPONENT(MPI_ROOT ${MPI_ROOT} PATH) - IF(MPICC STREQUAL /usr/bin/mpicc) - ELSE(MPICC STREQUAL /usr/bin/mpicc) - SET(MPI_ROOT_USER ${MPI_ROOT}) - ENDIF(MPICC STREQUAL /usr/bin/mpicc) - ENDIF(MPICC) -ELSE(NOT MPI_ROOT_USER) - SET(MPI_ROOT ${MPI_ROOT_USER}) -ENDIF(NOT MPI_ROOT_USER) - -# ------ - -IF(NOT MPI_ROOT) - MESSAGE(STATUS "MPI not found, try to use WITH_MPI option or MPI_ROOT environment variable.") - SET(MPI_STATUS 0) -ENDIF(NOT MPI_ROOT) - -# ------ - -IF(MPI_STATUS) - MESSAGE(STATUS "Check MPI in ${MPI_ROOT}") - - SET(MPI_INCLUDE_TO_FIND mpi.h) - - IF(MPI_ROOT_USER) - SET(MPI_ROOT ${MPI_ROOT_USER}) - SET(MPI_INCLUDE_PATHS ${MPI_ROOT} ${MPI_ROOT}/include) - FIND_PATH(MPI_INCLUDES ${MPI_INCLUDE_TO_FIND} PATHS ${MPI_INCLUDE_PATHS} NO_DEFAULT_PATH) - IF(NOT MPI_INCLUDES) - MESSAGE(STATUS "MPI include ${MPI_INCLUDE_TO_FIND} not found in ${MPI_INCLUDE_PATHS}, check your MPI installation.") - SET(MPI_STATUS 0) - ENDIF(NOT MPI_INCLUDES) - ELSE(MPI_ROOT_USER) - FIND_PATH(MPI_INCLUDES ${MPI_INCLUDE_TO_FIND}) - IF(NOT MPI_INCLUDES) - MESSAGE(STATUS "MPI include ${MPI_INCLUDE_TO_FIND} not found on system, try to use WITH_MPI option or MPI_ROOT environment variable.") - SET(MPI_STATUS 0) - ENDIF(NOT MPI_INCLUDES) - GET_FILENAME_COMPONENT(MPI_ROOT ${MPI_INCLUDES} PATH) - ENDIF(MPI_ROOT_USER) - - MESSAGE(STATUS "MPI include ${MPI_INCLUDE_TO_FIND} found in ${MPI_INCLUDES}") - - SET(MPI_INCLUDE_DIR ${MPI_INCLUDES}) - SET(MPI_INCLUDE_DIRS ${MPI_INCLUDES}) - SET(MPI_INCLUDES -I${MPI_INCLUDES})# to remove - - # ------ - - IF(WINDOWS) - FIND_LIBRARY(MPI_LIB_THREAD libboost_thread-vc90-mt-gd-1_35 ${MPI_ROOT}/lib) - FIND_LIBRARY(MPI_LIB_DATE_TIME libboost_date_time-vc90-mt-gd-1_35 ${MPI_ROOT}/lib) - ELSE(WINDOWS) - SET(MPI_LIB_FOUND 0) - FOREACH(lib mpi_cxx mpi mpich) - FIND_LIBRARY(MPI_LIB_${lib} ${lib} ${MPI_ROOT}/lib) - IF(MPI_LIB_${lib}) - SET(MPI_LIB_FOUND 1) - ENDIF(MPI_LIB_${lib}) - ENDFOREACH(lib mpi_cxx mpi mpich) - IF(MPI_LIB_FOUND) - IF(MPI_LIB_mpi_cxx AND MPI_LIB_mpi) - SET(MPI_LIBS ${MPI_LIB_mpi_cxx} ${MPI_LIB_mpi}) - SET(MPI_INCLUDES ${MPI_INCLUDES} -DOMPI_IGNORE_CXX_SEEK)# to remove - SET(MPI_DEFINITIONS -DOMPI_IGNORE_CXX_SEEK) - ELSEIF(MPI_LIB_mpi_cxx) - SET(MPI_LIBS ${MPI_LIB_mpi_cxx}) - SET(MPI_INCLUDES ${MPI_INCLUDES} -DOMPI_IGNORE_CXX_SEEK)# to remove - SET(MPI_DEFINITIONS -DOMPI_IGNORE_CXX_SEEK) - ELSEIF(MPI_LIB_mpi) - SET(MPI_LIBS ${MPI_LIB_mpi}) - SET(MPI_INCLUDES ${MPI_INCLUDES} -DOMPI_IGNORE_CXX_SEEK)# to remove - SET(MPI_DEFINITIONS -DOMPI_IGNORE_CXX_SEEK) - ELSEIF(MPI_LIB_mpich) - SET(MPI_LIBS ${MPI_LIB_mpich}) - SET(MPI_INCLUDES ${MPI_INCLUDES} -DMPICH_IGNORE_CXX_SEEK)# to remove - SET(MPI_DEFINITIONS -DMPICH_IGNORE_CXX_SEEK) - ENDIF() - ELSE(MPI_LIB_FOUND) - MESSAGE(STATUS "MPI lib not found, check your MPI installation.") - SET(MPI_STATUS 0) - ENDIF(MPI_LIB_FOUND) - ENDIF(WINDOWS) - MESSAGE(STATUS "MPI libs: ${MPI_LIBS}") -ENDIF(MPI_STATUS) - -# ------ - -IF(MPI_STATUS) - include(CheckSymbolExists) - SET(CMAKE_REQUIRED_LIBRARIES ${MPI_LIBS}) - CHECK_SYMBOL_EXISTS(MPI_Publish_name ${MPI_INCLUDE_DIR}/mpi.h MPI2_IS_OK) - IF(MPI2_IS_OK) - MESSAGE(STATUS "Your mpi implemtentation is compatible with mpi2 ... adding -DHAVE_MPI2") - SET(MPI_INCLUDES ${MPI_INCLUDES} -DHAVE_MPI2)# to remove - SET(MPI_DEFINITIONS "${MPI_DEFINITIONS} -DHAVE_MPI2") - ENDIF(MPI2_IS_OK) -ENDIF(MPI_STATUS) - -# ------ - -IF(MPI_STATUS) - SET(MPI_IS_OK ON) -ELSE(MPI_STATUS) - IF(MPI_IS_MANDATORY) - MESSAGE(FATAL_ERROR "MPI not found but mandatory") - ELSE(MPI_IS_MANDATORY) - MESSAGE(STATUS "MPI not found. Build procedure depending of mpi will be disable") - ENDIF(MPI_IS_MANDATORY) -ENDIF(MPI_STATUS) diff --git a/adm_local_without_kernel/cmake_files/FindPYTHON.cmake b/adm_local_without_kernel/cmake_files/FindPYTHON.cmake deleted file mode 100755 index 143345565..000000000 --- a/adm_local_without_kernel/cmake_files/FindPYTHON.cmake +++ /dev/null @@ -1,236 +0,0 @@ -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -# ------ - -MESSAGE(STATUS "Check for python ...") - -# ------ - -IF(PYTHON_IS_MANDATORY STREQUAL 0) - SET(PYTHON_IS_MANDATORY 0) - SET(PYTHON_IS_OPTIONAL 1) -ENDIF(PYTHON_IS_MANDATORY STREQUAL 0) -IF(PYTHON_IS_OPTIONAL STREQUAL 0) - SET(PYTHON_IS_MANDATORY 1) - SET(PYTHON_IS_OPTIONAL 0) -ENDIF(PYTHON_IS_OPTIONAL STREQUAL 0) -IF(NOT PYTHON_IS_MANDATORY AND NOT PYTHON_IS_OPTIONAL) - SET(PYTHON_IS_MANDATORY 1) - SET(PYTHON_IS_OPTIONAL 0) -ENDIF(NOT PYTHON_IS_MANDATORY AND NOT PYTHON_IS_OPTIONAL) - -# ------ - -SET(PYTHON_STATUS 1) -IF(WITHOUT_PYTHON OR WITH_PYTHON STREQUAL 0) - SET(PYTHON_STATUS 0) - MESSAGE(STATUS "python disabled from command line.") -ENDIF(WITHOUT_PYTHON OR WITH_PYTHON STREQUAL 0) - -# ------ - -IF(PYTHON_STATUS) - IF(WITH_PYTHON) - SET(PYTHON_ROOT_USER ${WITH_PYTHON}) - ENDIF(WITH_PYTHON) - IF(NOT PYTHON_ROOT_USER) - SET(PYTHON_ROOT_USER $ENV{PYTHON_ROOT}) - ENDIF(NOT PYTHON_ROOT_USER) - IF(NOT PYTHON_ROOT_USER) - SET(PYTHON_ROOT_USER $ENV{PYTHONHOME}) - ENDIF(NOT PYTHON_ROOT_USER) -ENDIF(PYTHON_STATUS) - -# ------ - -IF(PYTHON_STATUS) - IF(PYTHON_ROOT_USER) - SET(PYTHON_FIND_PATHS_OPTION NO_DEFAULT_PATH) - ELSE(PYTHON_ROOT_USER) - SET(PYTHON_FIND_PATHS_OPTION) - ENDIF(PYTHON_ROOT_USER) -ENDIF(PYTHON_STATUS) - -# ------ - -IF(PYTHON_STATUS) - IF(WINDOWS) - IF(CMAKE_BUILD_TYPE STREQUAL Release) - SET(PYTHON_EXECUTABLE_TO_FIND python) - ELSE(CMAKE_BUILD_TYPE STREQUAL Release) - SET(PYTHON_EXECUTABLE_TO_FIND python_d) - ENDIF(CMAKE_BUILD_TYPE STREQUAL Release) - ELSE(WINDOWS) - SET(PYTHON_EXECUTABLE_TO_FIND python) - ENDIF(WINDOWS) - IF(NOT PYTHON_ROOT_USER) - SET(PYTHON_EXECUTABLE_PATHS) - ELSE(NOT PYTHON_ROOT_USER) - IF(WINDOWS) - SET(PYTHON_EXECUTABLE_PATHS ${PYTHON_ROOT_USER}) - ELSE(WINDOWS) - SET(PYTHON_EXECUTABLE_PATHS ${PYTHON_ROOT_USER}/bin) - ENDIF(WINDOWS) - ENDIF(NOT PYTHON_ROOT_USER) - FIND_PROGRAM(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE_TO_FIND} PATHS ${PYTHON_EXECUTABLE_PATHS} ${PYTHON_FIND_PATHS_OPTION}) - IF(PYTHON_EXECUTABLE) - MESSAGE(STATUS "python found: ${PYTHON_EXECUTABLE}") - IF(PYTHON_EXECUTABLE STREQUAL /usr/bin/python) - ELSE(PYTHON_EXECUTABLE STREQUAL /usr/bin/python) - SET(PYTHON_ROOT_USER ${PYTHON_EXECUTABLE}) - GET_FILENAME_COMPONENT(PYTHON_ROOT_USER ${PYTHON_ROOT_USER} PATH) - IF(NOT WINDOWS) - GET_FILENAME_COMPONENT(PYTHON_ROOT_USER ${PYTHON_ROOT_USER} PATH) - ENDIF(NOT WINDOWS) - ENDIF(PYTHON_EXECUTABLE STREQUAL /usr/bin/python) - ELSE(PYTHON_EXECUTABLE) - IF(PYTHON_ROOT_USER) - MESSAGE(STATUS "${PYTHON_EXECUTABLE_TO_FIND} not found in ${PYTHON_EXECUTABLE_PATHS}, check your PYTHON installation.") - ELSE(PYTHON_ROOT_USER) - MESSAGE(STATUS "${PYTHON_EXECUTABLE_TO_FIND} not found on system, try to use WITH_PYTHON option or PYTHON_ROOT environment variable.") - ENDIF(PYTHON_ROOT_USER) - SET(PYTHON_STATUS 0) - ENDIF(PYTHON_EXECUTABLE) -ENDIF(PYTHON_STATUS) - -# ------ - -IF(PYTHON_STATUS) - EXECUTE_PROCESS( - COMMAND ${PYTHON_EXECUTABLE} -c "import sys; sys.stdout.write(sys.version[:3])" - OUTPUT_VARIABLE PYTHON_VERSION - ) -ENDIF(PYTHON_STATUS) - -# ------ - -IF(PYTHON_STATUS) - IF(PYTHON_ROOT_USER) - SET(PYTHON_FIND_PATHS_OPTION NO_DEFAULT_PATH) - ELSE(PYTHON_ROOT_USER) - SET(PYTHON_FIND_PATHS_OPTION) - ENDIF(PYTHON_ROOT_USER) -ENDIF(PYTHON_STATUS) - -# ------ - -IF(PYTHON_STATUS) - IF(PYTHON_ROOT_USER) - SET(PYTHON_INCLUDE_PATHS ${PYTHON_ROOT_USER}/include ${PYTHON_ROOT_USER}/include/python${PYTHON_VERSION}) - ELSE(PYTHON_ROOT_USER) - SET(PYTHON_INCLUDE_PATHS /usr/include/python${PYTHON_VERSION}) - ENDIF(PYTHON_ROOT_USER) - SET(PYTHON_INCLUDE_TO_FIND Python.h) - FIND_PATH(PYTHON_INCLUDE_DIR ${PYTHON_INCLUDE_TO_FIND} PATHS ${PYTHON_INCLUDE_PATHS} ${PYTHON_FIND_PATHS_OPTION}) - SET(PYTHON_DEFINITIONS) - IF(PYTHON_INCLUDE_DIR) - SET(PYTHON_INCLUDES -I${PYTHON_INCLUDE_DIR})# to remove - SET(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIR}) - IF(WINDOWS) - IF(CMAKE_BUILD_TYPE STREQUAL Release) - ELSE(CMAKE_BUILD_TYPE STREQUAL Release) - SET(PYTHON_INCLUDES ${PYTHON_INCLUDES} -DHAVE_DEBUG_PYTHON)# to remove - SET(PYTHON_DEFINITIONS "-DHAVE_DEBUG_PYTHON") - ENDIF(CMAKE_BUILD_TYPE STREQUAL Release) - ENDIF(WINDOWS) - MESSAGE(STATUS "${PYTHON_INCLUDE_TO_FIND} found in ${PYTHON_INCLUDE_DIR}") - ELSE(PYTHON_INCLUDE_DIR) - SET(PYTHON_STATUS 0) - IF(PYTHON_ROOT_USER) - MESSAGE(STATUS "${PYTHON_INCLUDE_TO_FIND} not found in ${PYTHON_INCLUDE_PATHS}, check your PYTHON installation.") - ELSE(PYTHON_ROOT_USER) - MESSAGE(STATUS "${PYTHON_INCLUDE_TO_FIND} not found on system, try to use WITH_PYTHON option or PYTHON_ROOT environment variable.") - ENDIF(PYTHON_ROOT_USER) - ENDIF(PYTHON_INCLUDE_DIR) -ENDIF(PYTHON_STATUS) - -# ---- - -IF(PYTHON_STATUS) - IF(PYTHON_ROOT_USER) - IF(WINDOWS) - SET(PYTHON_LIB_PATHS ${PYTHON_ROOT_USER}/libs) - ELSE(WINDOWS) - SET(PYTHON_LIB_PATHS ${PYTHON_ROOT_USER}/lib ${PYTHON_ROOT_USER}/lib/python${PYTHON_VERSION}/config) - ENDIF(WINDOWS) - ELSE(PYTHON_ROOT_USER) - SET(PYTHON_LIB_PATHS) - ENDIF(PYTHON_ROOT_USER) - IF(WINDOWS) - STRING(REPLACE "." "" PYTHON_VERSION_WITHOUT_DOT ${PYTHON_VERSION}) - IF(CMAKE_BUILD_TYPE STREQUAL Release) - FIND_LIBRARY(PYTHON_LIB python${PYTHON_VERSION_WITHOUT_DOT} PATHS ${PYTHON_LIB_PATHS} ${PYTHON_FIND_PATHS_OPTION}) - ELSE(CMAKE_BUILD_TYPE STREQUAL Release) - FIND_LIBRARY(PYTHON_LIB python${PYTHON_VERSION_WITHOUT_DOT}_d PATHS ${PYTHON_LIB_PATHS} ${PYTHON_FIND_PATHS_OPTION}) - ENDIF(CMAKE_BUILD_TYPE STREQUAL Release) - ELSE(WINDOWS) - FIND_LIBRARY(PYTHON_LIB python${PYTHON_VERSION} PATHS ${PYTHON_LIB_PATHS} ${PYTHON_FIND_PATHS_OPTION}) - ENDIF(WINDOWS) - SET(PYTHON_LIBS) - IF(PYTHON_LIB) - SET(PYTHON_LIBS ${PYTHON_LIBS} ${PYTHON_LIB}) - MESSAGE(STATUS "python lib found: ${PYTHON_LIB}") - ELSE(PYTHON_LIB) - SET(PYTHON_STATUS 0) - IF(PYTHON_ROOT_USER) - MESSAGE(STATUS "python lib not found in ${PYTHON_LIB_PATHS}, check your PYTHON installation.") - ELSE(PYTHON_ROOT_USER) - MESSAGE(STATUS "python lib not found on system, try to use WITH_PYTHON option or PYTHON_ROOT environment variable.") - ENDIF(PYTHON_ROOT_USER) - ENDIF(PYTHON_LIB) -ENDIF(PYTHON_STATUS) - -# ---- - -SET(NUMPY_STATUS 0) -IF(PYTHON_STATUS) - EXECUTE_PROCESS( - COMMAND ${PYTHON_EXECUTABLE} -c "import numpy ; import sys ; sys.stdout.write(numpy.get_include())" - OUTPUT_VARIABLE NUMPY_INCLUDE_DIR - ERROR_QUIET - ) - IF(NUMPY_INCLUDE_DIR) - SET(NUMPY_STATUS 1) - ENDIF(NUMPY_INCLUDE_DIR) - IF(NUMPY_STATUS) - SET(PYTHON_INCLUDES ${PYTHON_INCLUDES} -DWITH_NUMPY -I${NUMPY_INCLUDE_DIR})# to remove - SET(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS} ${NUMPY_INCLUDE_DIR}) - SET(PYTHON_DEFINITIONS "${PYTHON_DEFINITIONS} -DWITH_NUMPY") - MESSAGE(STATUS "numpy found : ${NUMPY_INCLUDE_DIR}") - ELSE(NUMPY_STATUS) - MESSAGE(STATUS "numpy not found") - ENDIF(NUMPY_STATUS) -ENDIF(PYTHON_STATUS) - -# ---- - -IF(PYTHON_STATUS) - SET(PYTHON_CPPFLAGS ${PYTHON_INCLUDES})# to remove - SET(PYLOGLEVEL WARNING) -ELSE(PYTHON_STATUS) - IF(PYTHON_IS_MANDATORY) - MESSAGE(FATAL_ERROR "python not found ... mandatory ... abort") - ELSE(PYTHON_IS_MANDATORY) - MESSAGE(STATUS "python not found ... optional ... disabled") - ENDIF(PYTHON_IS_MANDATORY) -ENDIF(PYTHON_STATUS) diff --git a/adm_local_without_kernel/cmake_files/FindSWIG.cmake b/adm_local_without_kernel/cmake_files/FindSWIG.cmake deleted file mode 100755 index 60f5658a5..000000000 --- a/adm_local_without_kernel/cmake_files/FindSWIG.cmake +++ /dev/null @@ -1,99 +0,0 @@ -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -# ------ - -MESSAGE(STATUS "Check for swig ...") - -# ------ - -IF(SWIG_IS_MANDATORY STREQUAL 0) - SET(SWIG_IS_MANDATORY 0) - SET(SWIG_IS_OPTIONAL 1) -ENDIF(SWIG_IS_MANDATORY STREQUAL 0) -IF(SWIG_IS_OPTIONAL STREQUAL 0) - SET(SWIG_IS_MANDATORY 1) - SET(SWIG_IS_OPTIONAL 0) -ENDIF(SWIG_IS_OPTIONAL STREQUAL 0) -IF(NOT SWIG_IS_MANDATORY AND NOT SWIG_IS_OPTIONAL) - SET(SWIG_IS_MANDATORY 1) - SET(SWIG_IS_OPTIONAL 0) -ENDIF(NOT SWIG_IS_MANDATORY AND NOT SWIG_IS_OPTIONAL) - -# ------ - -SET(SWIG_STATUS 1) -IF(WITHOUT_SWIG OR WITH_SWIG STREQUAL 0) - SET(SWIG_STATUS 0) - MESSAGE(STATUS "swig disabled from command line.") -ENDIF(WITHOUT_SWIG OR WITH_SWIG STREQUAL 0) - -# ------ - -IF(SWIG_STATUS) - IF(WITH_SWIG) - SET(SWIG_ROOT_USER ${WITH_SWIG}) - ENDIF(WITH_SWIG) - IF(NOT SWIG_ROOT_USER) - SET(SWIG_ROOT_USER $ENV{SWIG_ROOT}) - ENDIF(NOT SWIG_ROOT_USER) - IF(NOT SWIG_ROOT_USER) - SET(SWIG_ROOT_USER $ENV{SWIGHOME}) - ENDIF(NOT SWIG_ROOT_USER) -ENDIF(SWIG_STATUS) - -# ------ - -IF(SWIG_STATUS) - SET(SWIG_EXECUTABLE_TO_FIND swig) - IF(SWIG_ROOT_USER) - FIND_PROGRAM(SWIG_EXECUTABLE ${SWIG_EXECUTABLE_TO_FIND} PATHS ${SWIG_ROOT_USER}/bin NO_DEFAULT_PATH) - ELSE(SWIG_ROOT_USER) - FIND_PROGRAM(SWIG_EXECUTABLE ${SWIG_EXECUTABLE_TO_FIND}) - ENDIF(SWIG_ROOT_USER) - IF(SWIG_EXECUTABLE) - MESSAGE(STATUS "${SWIG_EXECUTABLE_TO_FIND} found: ${SWIG_EXECUTABLE}") - ELSE(SWIG_EXECUTABLE) - MESSAGE(STATUS "${SWIG_EXECUTABLE_TO_FIND} not found, try to use WITH_SWIG option or SWIG_ROOT (or SWIGHOME) environment variable") - SET(SWIG_STATUS 0) - ENDIF(SWIG_EXECUTABLE) -ENDIF(SWIG_STATUS) - -# ---- - -IF(SWIG_STATUS) - SET(SWIG_FLAGS -c++ -python -shadow) -ELSE(SWIG_STATUS) - IF(SWIG_IS_MANDATORY) - MESSAGE(FATAL_ERROR "swig not found ... mandatory ... abort") - ELSE(SWIG_IS_MANDATORY) - MESSAGE(STATUS "swig not found ... optional ... disabled") - ENDIF(SWIG_IS_MANDATORY) -ENDIF(SWIG_STATUS) - -# ---- - -IF(NUMPY_STATUS) - SET(SWIG_FLAGS ${SWIG_FLAGS} -DWITH_NUMPY=WITH_NUMPY) -ENDIF(NUMPY_STATUS) - -# ---- diff --git a/adm_local_without_kernel/cmake_files/FindSalomeCppUnit.cmake b/adm_local_without_kernel/cmake_files/FindSalomeCppUnit.cmake new file mode 100644 index 000000000..fddffa311 --- /dev/null +++ b/adm_local_without_kernel/cmake_files/FindSalomeCppUnit.cmake @@ -0,0 +1,28 @@ +# Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# Author: Adrien Bruneton +# + +# CppUnit detection for Salome +# +# !! Please read the generic detection procedure in SalomeMacros.cmake !! +# + +SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(CppUnit CPPUNIT_INCLUDE_DIRS 1) +MARK_AS_ADVANCED(CPPUNIT_INCLUDE_DIRS CPPUNIT_LIBRARIES) diff --git a/adm_local_without_kernel/cmake_files/FindSalomeDoxygen.cmake b/adm_local_without_kernel/cmake_files/FindSalomeDoxygen.cmake new file mode 100644 index 000000000..430f1b438 --- /dev/null +++ b/adm_local_without_kernel/cmake_files/FindSalomeDoxygen.cmake @@ -0,0 +1,28 @@ +# Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# Author: Adrien Bruneton +# + +# Doxygen detection for salome +# +# !! Please read the generic detection procedure in SalomeMacros.cmake !! +# + +SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Doxygen DOXYGEN_EXECUTABLE 2) +#MARK_AS_ADVANCED() diff --git a/adm_local_without_kernel/cmake_files/FindSalomeGraphviz.cmake b/adm_local_without_kernel/cmake_files/FindSalomeGraphviz.cmake new file mode 100644 index 000000000..e9b02f7bb --- /dev/null +++ b/adm_local_without_kernel/cmake_files/FindSalomeGraphviz.cmake @@ -0,0 +1,28 @@ +# Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# Author: Adrien Bruneton +# + +# Graphviz detection for salome +# +# !! Please read the generic detection procedure in SalomeMacros.cmake !! +# + +SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Graphviz GRAPHVIZ_EXECUTABLE 2) +MARK_AS_ADVANCED(GRAPHVIZ_EXECUTABLE) diff --git a/adm_local_without_kernel/cmake_files/FindSalomeHDF5.cmake b/adm_local_without_kernel/cmake_files/FindSalomeHDF5.cmake new file mode 100644 index 000000000..b00b1b421 --- /dev/null +++ b/adm_local_without_kernel/cmake_files/FindSalomeHDF5.cmake @@ -0,0 +1,69 @@ +# Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# Author: Adrien Bruneton +# + +# HDF5 detection for Salome +# +# !! Please read the generic detection procedure in SalomeMacros.cmake !! +# +# --- HDF5 specificities ---- +# MPI root directory used for HDF5 compilation is exposed into MPI_ROOT_DIR_EXP +# + +SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(HDF5 HDF5_INCLUDE_DIR 1) +MARK_AS_ADVANCED(FORCE HDF5_INCLUDE_DIR HDF5_LIB) + +## +## 7. Specific to HDF5 only: +## Expose MPI configuration to the rest of the world +## +IF(HDF5_ENABLE_PARALLEL OR HDF5_IS_PARALLEL) + # Set only one reference boolean variable: + # (unfortunately what is found in /usr/share/cmake/Modules/FindHDF5.cmake + # and in the native HDF5-config.cmake differ!) + SET(HDF5_IS_PARALLEL TRUE) + + # HDF5 was compiled with MPI support + # Unfortunately HDF5 doesn't expose its MPI configuration easily ... + # We sniff the properties of the HDF5 target which should also be there: + GET_PROPERTY(_lib_lst TARGET hdf5 PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES_NOCONFIG) + FOREACH(s ${_lib_lst}) + STRING(FIND "${s}" "mpi." _res) # should cover WIN(?) and LINUX + IF(_res GREATER -1) + GET_FILENAME_COMPONENT(_tmp "${s}" PATH) # go up to levels + GET_FILENAME_COMPONENT(MPI_ROOT_DIR_EXP "${_tmp}" PATH) + BREAK() + ENDIF() + ENDFOREACH() + IF(NOT SalomeHDF5_FIND_QUIETLY) + MESSAGE(STATUS "HDF5 was compiled with MPI: ${MPI_ROOT_DIR_EXP}") + ENDIF() +ENDIF() + +## Add definitions +ADD_DEFINITIONS(-DH5_USE_16_API) +IF(WIN32) + ADD_DEFINITIONS(-D_HDF5USEDLL_) +ENDIF() + +## Ensure SALOME uses MPI if HDF5 was parallel: +IF(HDF5_IS_PARALLEL AND NOT SALOME_USE_MPI) + MESSAGE(FATAL_ERROR "HDF5 is compiled with MPI, you have to set SALOME_USE_MPI to ON") +ENDIF() diff --git a/adm_local_without_kernel/cmake_files/FindSalomeMPI.cmake b/adm_local_without_kernel/cmake_files/FindSalomeMPI.cmake new file mode 100644 index 000000000..2d0df7a84 --- /dev/null +++ b/adm_local_without_kernel/cmake_files/FindSalomeMPI.cmake @@ -0,0 +1,31 @@ +# Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# Author: Adrien Bruneton +# + +# MPI detection for Salome +# +# !! Please read the generic detection procedure in SalomeMacros.cmake !! +# + +SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(MPI MPIEXEC 2) +MARK_AS_ADVANCED(MPI_EXTRA_LIBRARY MPI_LIBRARY) + +SET(MPI_INCLUDE_DIRS ${MPI_C_INCLUDE_PATH} ${MPI_CXX_INCLUDE_PATH}) +SET(MPI_LIBRARIES ${MPI_C_LIBRARIES} ${MPI_CXX_LIBRARIES}) diff --git a/adm_local_without_kernel/cmake_files/FindSalomeMedfile.cmake b/adm_local_without_kernel/cmake_files/FindSalomeMedfile.cmake new file mode 100644 index 000000000..10e45a635 --- /dev/null +++ b/adm_local_without_kernel/cmake_files/FindSalomeMedfile.cmake @@ -0,0 +1,28 @@ +# Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# Author: Adrien Bruneton +# + +# Medfile detection dor Salome +# +# !! Please read the generic detection procedure in SalomeMacros.cmake !! +# + +SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(medfile MEDFILE_ROOT_DIR_EXP 0) +#MARK_AS_ADVANCED() \ No newline at end of file diff --git a/adm_local_without_kernel/cmake_files/FindSalomePython.cmake b/adm_local_without_kernel/cmake_files/FindSalomePython.cmake new file mode 100644 index 000000000..754248dcf --- /dev/null +++ b/adm_local_without_kernel/cmake_files/FindSalomePython.cmake @@ -0,0 +1,140 @@ +# Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# Author: Adrien Bruneton +# + +# Python libraries and interpreter detection for SALOME +# +# !! Please read the generic detection procedure in SalomeMacros.cmake !! +# +# The interpreter is found first, and if OK, the corresponding libraries are searched. +# We ensure the version of the libraries matches the one of the interpreter. +# + +# 1. Load environment or any previously detected Python +IF(DEFINED ENV{PYTHON_ROOT_DIR}) + FILE(TO_CMAKE_PATH "$ENV{PYTHON_ROOT_DIR}" _PYTHON_ROOT_DIR_ENV) + SET(_dflt_value "${_PYTHON_ROOT_DIR_ENV}") +ELSE() + # will be blank if no Python was previously loaded + SET(_dflt_value "${PYTHON_ROOT_DIR_EXP}") +ENDIF() + +# Make cache entry +SET(PYTHON_ROOT_DIR "${_dflt_value}" CACHE PATH "Path to Python directory (interpreter and libs)") + +# 2. Find package - config mode first (i.e. looking for XYZ-config.cmake) +IF(EXISTS "${PYTHON_ROOT_DIR}") + # Hope to find direclty a CMake config file there + SET(_CONF_DIR "${PYTHON_ROOT_DIR}/share/cmake") + + # Try find_package in config mode with a hard-coded guess. This + # has the priority. + FIND_PACKAGE(Python CONFIG QUIET PATHS "${_CONF_DIR}") + MARK_AS_ADVANCED(Python_DIR) + + IF (NOT PYTHON_FOUND) + LIST(APPEND CMAKE_PREFIX_PATH "${PYTHON_ROOT_DIR}") + ELSE() + MESSAGE(STATUS "Found Python in CONFIG mode!") + ENDIF() +ENDIF() + +# Otherwise try the standard way (module mode, with the standard CMake Find*** macro): +SALOME_FIND_PACKAGE(SalomePython PythonInterp MODULE) +SET(_found1 ${PYTHONINTERP_FOUND}) + +IF (PYTHONINTERP_FOUND) + # Now ensure we find the Python libraries matching the interpreter: + # This uses the variable PYTHON_EXECUTABLE + GET_FILENAME_COMPONENT(_python_dir "${PYTHON_EXECUTABLE}" PATH) + GET_FILENAME_COMPONENT(CMAKE_INCLUDE_PATH "${_python_dir}/../include/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}" ABSOLUTE) + GET_FILENAME_COMPONENT(CMAKE_LIBRARY_PATH "${_python_dir}/../lib" ABSOLUTE) + # For a Windows install, this might look more like this: + IF(WIN32) + LIST(APPEND CMAKE_LIBRARY_PATH "${_python_dir}/libs" ABSOLUTE) + LIST(APPEND CMAKE_INCLUDE_PATH "${_python_dir}/include" ABSOLUTE) + ENDIF() + # Override the EXACT and VERSION settings of the SalomePython module + # to force the next call to SALOME_FIND_PACKAGE() to find the exact matching + # version: + SET(_old_EXACT ${SalomePython_FIND_VERSION_EXACT}) + SET(_old_VERSION "${SalomePython_FIND_VERSION}") + SET(SalomePython_FIND_VERSION_EXACT TRUE) + SET(SalomePython_FIND_VERSION "${PYTHON_VERSION_STRING}") + # Prepare call to FIND_PACKAGE(PythonLibs) and ensure priority is given to + # the location found for the interpreter: + GET_FILENAME_COMPONENT(_tmp "${_python_dir}" PATH) +# SET(PYTHON_LIBRARY ${_tmp}/lib) +# SET(PYTHON_INCLUDE_DIR ${_tmp}/include) + SALOME_FIND_PACKAGE(SalomePython PythonLibs MODULE) + # Restore variables: + SET(SalomePython_FIND_VERSION_EXACT ${_old_EXACT}) + SET(SalomePython_FIND_VERSION "${_old_VERSION}") +ENDIF() + +# Set the FOUND flag for SalomePython: +SET(SALOMEPYTHON_FOUND FALSE) +IF (_found1 AND PYTHONLIBS_FOUND) + SET(SALOMEPYTHON_FOUND TRUE) +ENDIF() + +IF (SALOMEPYTHON_FOUND) + MESSAGE(STATUS "Python interpreter and Python libraries found:") + MESSAGE(STATUS "Python libraries: ${PYTHON_LIBRARY}") + MESSAGE(STATUS "Python include dir: ${PYTHON_INCLUDE_DIR}") + + # 3. Set the root dir which was finally retained + # For Python this is the grand-parent of the + # include directory: + GET_FILENAME_COMPONENT(_tmp_ROOT_DIR "${PYTHON_INCLUDE_DIR}" PATH) + IF(NOT WIN32) + GET_FILENAME_COMPONENT(_tmp_ROOT_DIR "${_tmp_ROOT_DIR}" PATH) + ENDIF() + + # 4. Warn if CMake found something not located under ENV(XYZ_ROOT_DIR) + IF(DEFINED ENV{PYTHON_ROOT_DIR}) + SALOME_CHECK_EQUAL_PATHS(_res "${_tmp_ROOT_DIR}" "${_PYTHON_ROOT_DIR_ENV}") + IF(NOT _res) + MESSAGE(WARNING "Python was found, but not a the path given by the " +"environment PYTHON_ROOT_DIR! Is the variable correctly set?") + ELSE() + MESSAGE(STATUS "Python found directory matches what was specified in the PYTHON_ROOT_DIR, all good!") + ENDIF() + ENDIF() + + # 5. Conflict detection + # 5.1 From another prerequisite using Python + IF(PYTHON_ROOT_DIR_EXP) + SALOME_CHECK_EQUAL_PATHS(_res "${_tmp_ROOT_DIR}" "${PYTHON_ROOT_DIR_EXP}") + IF(NOT _res) + MESSAGE(WARNING "Warning: Python: detected version conflicts with a previously found Python!" + "The two paths are " ${_tmp_ROOT_DIR} " vs " ${PYTHON_ROOT_DIR_EXP}) + ELSE() + MESSAGE(STATUS "Python directory matches what was previously exposed by another prereq, all good!") + ENDIF() + ENDIF() + + # 6. Specifics + ## None here +ELSE() + MESSAGE(STATUS "Python was only partially (or not at all) found .") +ENDIF() + + diff --git a/adm_local_without_kernel/cmake_files/FindSalomeSWIG.cmake b/adm_local_without_kernel/cmake_files/FindSalomeSWIG.cmake new file mode 100644 index 000000000..80c7b6595 --- /dev/null +++ b/adm_local_without_kernel/cmake_files/FindSalomeSWIG.cmake @@ -0,0 +1,27 @@ +# Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# Author: Adrien Bruneton +# + +# SWIG detection for SALOME +# +# !! Please read the generic detection procedure in SalomeMacros.cmake !! +# +SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(SWIG SWIG_EXECUTABLE 2) +MARK_AS_ADVANCED(SWIG_EXECUTABLE SWIG_VERSION) diff --git a/adm_local_without_kernel/cmake_files/FindSalomeSphinx.cmake b/adm_local_without_kernel/cmake_files/FindSalomeSphinx.cmake new file mode 100644 index 000000000..3aa6527e7 --- /dev/null +++ b/adm_local_without_kernel/cmake_files/FindSalomeSphinx.cmake @@ -0,0 +1,26 @@ +# Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# Sphinx detection for Salome +# +# !! Please read the generic detection procedure in SalomeMacros.cmake !! +# + +SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Sphinx SPHINX_EXECUTABLE 2) +MARK_AS_ADVANCED(SPHINX_EXECUTABLE) diff --git a/adm_local_without_kernel/cmake_files/FindSphinx.cmake b/adm_local_without_kernel/cmake_files/FindSphinx.cmake new file mode 100644 index 000000000..ac0c954ee --- /dev/null +++ b/adm_local_without_kernel/cmake_files/FindSphinx.cmake @@ -0,0 +1,37 @@ +# - Sphinx detection +# +# Output variable: SPHINX_EXECUTABLE +# +# The executable 'sphinx-build' is looked for and returned in the above variable. +# + +########################################################################### +# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +########################################################################### + +FIND_PROGRAM(SPHINX_EXECUTABLE sphinx-build) + +# Handle the standard arguments of the find_package() command: +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Sphinx REQUIRED_VARS SPHINX_EXECUTABLE) + diff --git a/adm_local_without_kernel/cmake_files/SalomeMacros.cmake b/adm_local_without_kernel/cmake_files/SalomeMacros.cmake new file mode 100755 index 000000000..34730369c --- /dev/null +++ b/adm_local_without_kernel/cmake_files/SalomeMacros.cmake @@ -0,0 +1,427 @@ +# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# Author: A.Geay, V. Sandler, A. Bruneton +# + +#---------------------------------------------------------------------------- +# LIST_CONTAINS is a macro useful for determining whether a list has a +# particular entry +#---------------------------------------------------------------------------- +MACRO(LIST_CONTAINS var value) + SET(${var}) + FOREACH(value2 ${ARGN}) + IF(${value} STREQUAL "${value2}") + SET(${var} TRUE) + ENDIF (${value} STREQUAL "${value2}") + ENDFOREACH (value2) +ENDMACRO(LIST_CONTAINS) + +#---------------------------------------------------------------------------- +# The PARSE_ARGUMENTS macro will take the arguments of another macro and +# define several variables. +# +# USAGE: PARSE_ARGUMENTS(prefix arg_names options arg1 arg2...) +# +# ARGUMENTS: +# +# prefix: IN: a prefix to put on all variables it creates. +# +# arg_names: IN: a list of names. +# For each item in arg_names, PARSE_ARGUMENTS will create a +# variable with that name, prefixed with prefix_. Each variable will be filled +# with the arguments that occur after the given arg_name is encountered +# up to the next arg_name or the end of the arguments. All options are +# removed from these lists. PARSE_ARGUMENTS also creates a +# prefix_DEFAULT_ARGS variable containing the list of all arguments up +# to the first arg_name encountered. +# +# options: IN: a list of options. +# For each item in options, PARSE_ARGUMENTS will create a +# variable with that name, prefixed with prefix_. So, for example, if prefix is +# MY_MACRO and options is OPTION1;OPTION2, then PARSE_ARGUMENTS will +# create the variables MY_MACRO_OPTION1 and MY_MACRO_OPTION2. These +# variables will be set to true if the option exists in the command line +# or false otherwise. +# arg_names and options lists should be quoted. +# +# The rest of PARSE_ARGUMENTS are arguments from another macro to be parsed. +#---------------------------------------------------------------------------- +MACRO(PARSE_ARGUMENTS prefix arg_names option_names) + SET(DEFAULT_ARGS) + FOREACH(arg_name ${arg_names}) + SET(${prefix}_${arg_name}) + ENDFOREACH(arg_name) + FOREACH(option ${option_names}) + SET(${prefix}_${option} FALSE) + ENDFOREACH(option) + SET(current_arg_name DEFAULT_ARGS) + SET(current_arg_list) + FOREACH(arg ${ARGN}) + LIST_CONTAINS(is_arg_name ${arg} ${arg_names}) + IF (is_arg_name) + SET(${prefix}_${current_arg_name} ${current_arg_list}) + SET(current_arg_name ${arg}) + SET(current_arg_list) + ELSE (is_arg_name) + LIST_CONTAINS(is_option ${arg} ${option_names}) + IF (is_option) + SET(${prefix}_${arg} TRUE) + ELSE (is_option) + SET(current_arg_list ${current_arg_list} ${arg}) + ENDIF (is_option) + ENDIF (is_arg_name) + ENDFOREACH(arg) + SET(${prefix}_${current_arg_name} ${current_arg_list}) +ENDMACRO(PARSE_ARGUMENTS) + +#---------------------------------------------------------------------------- +# SALOME_INSTALL_SCRIPTS is a macro useful for installing scripts. +# +# USAGE: SALOME_INSTALL_SCRIPTS(file_list path [WORKING_DIRECTORY dir] [DEF_PERMS]) +# +# ARGUMENTS: +# file_list: IN : list of files to be installed. This list should be quoted. +# path: IN : full pathname for installing. +# +# By default files to be installed as executable scripts. +# If DEF_PERMS option is provided, than permissions for installed files are +# only OWNER_WRITE, OWNER_READ, GROUP_READ, and WORLD_READ. +#---------------------------------------------------------------------------- +MACRO(SALOME_INSTALL_SCRIPTS file_list path) + PARSE_ARGUMENTS(SALOME_INSTALL_SCRIPTS "WORKING_DIRECTORY" "DEF_PERMS" ${ARGN}) + SET(PERMS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) + IF(NOT SALOME_INSTALL_SCRIPTS_DEF_PERMS) + SET(PERMS ${PERMS} OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE) + ENDIF(NOT SALOME_INSTALL_SCRIPTS_DEF_PERMS) + FOREACH(file ${file_list}) + SET(PREFIX "") + IF(SALOME_INSTALL_SCRIPTS_WORKING_DIRECTORY) + SET(PREFIX "${SALOME_INSTALL_SCRIPTS_WORKING_DIRECTORY}/") + ENDIF(SALOME_INSTALL_SCRIPTS_WORKING_DIRECTORY) + INSTALL(FILES ${PREFIX}${file} DESTINATION ${path} PERMISSIONS ${PERMS}) + GET_FILENAME_COMPONENT(ext ${file} EXT) + IF(ext STREQUAL .py) + INSTALL(CODE "MESSAGE(STATUS \"py compiling ${CMAKE_INSTALL_PREFIX}/${path}/${file}\")") + INSTALL(CODE "SET(CMD \"import py_compile ; py_compile.compile('${CMAKE_INSTALL_PREFIX}/${path}/${file}')\")") + INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c \"\${CMD}\")") + INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -O -c \"\${CMD}\")") + ENDIF(ext STREQUAL .py) + ENDFOREACH(file ${file_list}) +ENDMACRO(SALOME_INSTALL_SCRIPTS) + +#---------------------------------------------------------------------------- +# SALOME_INSTALL_SCRIPTS is a macro useful for installing executable scripts. +# ARGUMENTS: +# PYFILE2COMPINST: IN : list of python files to be installed. +# PYFILELOC: IN : full pathname for installing. +# Permissions of installed files: OWNER_WRITE, OWNER_READ, GROUP_READ, and WORLD_READ +#---------------------------------------------------------------------------- +MACRO(INSTALL_AND_COMPILE_PYTHON_FILE PYFILE2COMPINST PYFILELOC) + INSTALL(CODE "SET(PYTHON_FILE ${f})") + FOREACH(input ${PYFILE2COMPINST}) + GET_FILENAME_COMPONENT(inputname ${input} NAME) + INSTALL(FILES ${input} DESTINATION ${CMAKE_INSTALL_PREFIX}/${PYFILELOC}) + INSTALL(CODE "MESSAGE(STATUS \"py compiling ${CMAKE_INSTALL_PREFIX}/${PYFILELOC}/${inputname}\")") + INSTALL(CODE "SET(CMD \"import py_compile ; py_compile.compile('${CMAKE_INSTALL_PREFIX}/${PYFILELOC}/${inputname}')\")") + INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c \"\${CMD}\")") + INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -O -c \"\${CMD}\")") + ENDFOREACH(input ${PYFILE2COMPINST}) +ENDMACRO(INSTALL_AND_COMPILE_PYTHON_FILE PYFILE2COMPINST PYFILELOC) + +#---------------------------------------------------------------------------- +# SALOME_CONFIGURE_FILE is a macro useful for copying a file to another location +# and modify its contents. +# +# USAGE: SALOME_CONFIGURE_FILE(in_file out_file [INSTALL dir]) +# +# ARGUMENTS: +# in_file: IN : input file with full paths. +# out_file: IN : output file with full paths. +# If INSTALL is specified, then 'out_file' will be installed to the 'dir' directory. +#---------------------------------------------------------------------------- +MACRO(SALOME_CONFIGURE_FILE IN_FILE OUT_FILE) + MESSAGE(STATUS "Creation of ${OUT_FILE}") + CONFIGURE_FILE(${IN_FILE} ${OUT_FILE} @ONLY) + PARSE_ARGUMENTS(SALOME_CONFIGURE_FILE "INSTALL" "" ${ARGN}) + IF(SALOME_CONFIGURE_FILE_INSTALL) + INSTALL(FILES ${OUT_FILE} DESTINATION ${SALOME_CONFIGURE_FILE_INSTALL}) + ENDIF(SALOME_CONFIGURE_FILE_INSTALL) +ENDMACRO(SALOME_CONFIGURE_FILE) + + +####################################################################################### +# Useful macros for SALOME own package detection system +# + +### +# SALOME_CHECK_EQUAL_PATHS(result path1 path2) +# Check if two paths are identical, resolving links. If the paths do not exist a simple +# text comparison is performed. +# result is a boolean. +### +MACRO(SALOME_CHECK_EQUAL_PATHS varRes path1 path2) + SET("${varRes}" OFF) + IF(EXISTS "${path1}") + GET_FILENAME_COMPONENT(_tmp1 "${path1}" REALPATH) + ELSE() + SET(_tmp1 "${path1}") + ENDIF() + + IF(EXISTS "${path2}") + GET_FILENAME_COMPONENT(_tmp2 "${path2}" REALPATH) + ELSE() + SET(_tmp2 "${path2}") + ENDIF() + + IF("${_tmp1}" STREQUAL "${_tmp2}") + SET("${varRes}" ON) + ENDIF() +# MESSAGE(${${varRes}}) +ENDMACRO() + + +#### +# SALOME_FIND_PACKAGE(englobingPackageName standardPackageName modus [onlyTryQuietly]) +# +# example: SALOME_FIND_PACKAGE(SalomeVTK VTK CONFIG) +# +# Encapsulate the call to the standard FIND_PACKAGE(standardPackageName) passing all the options +# given when calling the command FIND_PACKAGE(SalomeXYZ). Those options are stored implicitly in +# CMake variables: xyz__FIND_QUIETLY, xyz_FIND_REQUIRED, etc ... +# +# Modus is either MODULE or CONFIG (cf standard FIND_PACKAGE() documentation). +# The last argument is optional and if set to TRUE will force the search to be OPTIONAL and QUIET. +# +# This macro is to be called from within the FindSalomeXXXX.cmake file. +# +#### +MACRO(SALOME_FIND_PACKAGE englobPkg stdPkg mode) + SET(_OPT_ARG ${ARGV3}) + # Only bother if the package was not already found: + # Some old packages use the lower case version - standard should be to always use + # upper case: + STRING(TOUPPER ${stdPkg} stdPkgUC) + IF(NOT (${stdPkg}_FOUND OR ${stdPkgUC}_FOUND)) + IF(${englobPkg}_FIND_QUIETLY OR _OPT_ARG) + SET(_tmp_quiet "QUIET") + ELSE() + SET(_tmp_quiet) + ENDIF() + IF(${englobPkg}_FIND_REQUIRED AND NOT _OPT_ARG) + SET(_tmp_req "REQUIRED") + ELSE() + SET(_tmp_req) + ENDIF() + IF(${englobPkg}_FIND_VERSION_EXACT) + SET(_tmp_exact "EXACT") + ELSE() + SET(_tmp_exact) + ENDIF() + + # Call the CMake FIND_PACKAGE() command: + STRING(TOLOWER ${stdPkg} _pkg_lc) + IF(("${mode}" STREQUAL "NO_MODULE") OR ("${mode}" STREQUAL "CONFIG")) + # Hope to find direclty a CMake config file, indicating the SALOME CMake file + # paths (the command already look in places like "share/cmake", etc ... by default) + # Note the options NO_CMAKE_BUILDS_PATH, NO_CMAKE_PACKAGE_REGISTRY to avoid (under Windows) + # looking into a previous CMake build done via a GUI, or into the Win registry. + # See documentation of FIND_PACKAGE() for full details. + + # Do we need to call the signature using components? + IF(${englobPkg}_FIND_COMPONENTS) + FIND_PACKAGE(${stdPkg} ${${englobPkg}_FIND_VERSION} ${_tmp_exact} + NO_MODULE ${_tmp_quiet} ${_tmp_req} COMPONENTS ${${englobPkg}_FIND_COMPONENTS} + PATH_SUFFIXES "salome_adm/cmake_files" "adm_local/cmake_files" + NO_CMAKE_BUILDS_PATH NO_CMAKE_PACKAGE_REGISTRY NO_CMAKE_SYSTEM_PACKAGE_REGISTRY) + ELSE() + FIND_PACKAGE(${stdPkg} ${${englobPkg}_FIND_VERSION} ${_tmp_exact} + NO_MODULE ${_tmp_quiet} ${_tmp_req} + PATH_SUFFIXES "salome_adm/cmake_files" "adm_local/cmake_files" + NO_CMAKE_BUILDS_PATH NO_CMAKE_PACKAGE_REGISTRY NO_CMAKE_SYSTEM_PACKAGE_REGISTRY) + ENDIF() + MARK_AS_ADVANCED(${stdPkg}_DIR) + + ELSEIF("${mode}" STREQUAL "MODULE") + + # Do we need to call the signature using components? + IF(${englobPkg}_FIND_COMPONENTS) + FIND_PACKAGE(${stdPkg} ${${englobPkg}_FIND_VERSION} ${_tmp_exact} + MODULE ${_tmp_quiet} ${_tmp_req} COMPONENTS ${${englobPkg}_FIND_COMPONENTS}) + ELSE() + FIND_PACKAGE(${stdPkg} ${${englobPkg}_FIND_VERSION} ${_tmp_exact} + MODULE ${_tmp_quiet} ${_tmp_req}) + ENDIF() + + ELSE() + + MESSAGE(FATAL_ERROR "Invalid mode argument in the call to the macro SALOME_FIND_PACKAGE. Should be CONFIG or MODULE.") + + ENDIF() + + ENDIF() +ENDMACRO() + + +#################################################################### +# SALOME_FIND_PACKAGE_DETECT_CONFLICTS(pkg referenceVariable upCount ...) +# pkg : name of the system package to be detected +# referenceVariable: variable containing a path that can be browsed up to +# retrieve the package root directory (xxx_ROOT_DIR) +# upCount : number of times we have to go up from the path +# to obtain the package root directory. +# : an optional list of components to be found. +# +# For example: SALOME_FIND_PACKAGE_DETECT_CONFLICTS(SWIG SWIG_EXECUTABLE 2) +# +# Generic detection (and conflict check) procedure for package XYZ: +# 1. Load a potential env variable XYZ_ROOT_DIR as a default choice for the cache entry XYZ_ROOT_DIR +# If empty, load a potential XYZ_ROOT_DIR_EXP as default value (path exposed by another package depending +# directly on XYZ) +# 2. Invoke FIND_PACKAGE() in this order: +# * in CONFIG mode first (if possible): priority is given to a potential +# "XYZ-config.cmake" file +# * then switch to the standard MODULE mode, appending on CMAKE_PREFIX_PATH +# the above XYZ_ROOT_DIR variable +# 3. Extract the path actually found into a temp variable _XYZ_TMP_DIR +# 4. Warn if XYZ_ROOT_DIR is set and doesn't match what was found (e.g. when CMake found the system installation +# instead of what is pointed to by XYZ_ROOT_DIR - happens when a typo in the content of XYZ_ROOT_DIR). +# 5. Conflict detection: +# * check the temp variable against a potentially existing XYZ_ROOT_DIR_EXP +# 6. Finally expose what was *actually* found in XYZ_ROOT_DIR. +# 7. Specific stuff: for example exposing a prerequisite of XYZ to the rest of the world for future +# conflict detection. This is added after the call to the macro by the callee. +# +MACRO(SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS pkg referenceVariable upCount) + ## + ## 0. Initialization + ## + + # Package name, upper case + STRING(TOUPPER ${pkg} pkg_UC) + + ## + ## 1. Load environment or any previously detected root dir for the package + ## + IF(DEFINED ENV{${pkg_UC}_ROOT_DIR}) + FILE(TO_CMAKE_PATH "$ENV{${pkg_UC}_ROOT_DIR}" _${pkg_UC}_ROOT_DIR_ENV) + SET(_dflt_value "${_${pkg_UC}_ROOT_DIR_ENV}") + ELSE() + # will be blank if no package was previously loaded: + SET(_dflt_value "${${pkg_UC}_ROOT_DIR_EXP}") + ENDIF() + + # Detect if the variable has been set on the command line or elsewhere: + IF(DEFINED ${pkg_UC}_ROOT_DIR) + SET(_var_already_there TRUE) + ELSE() + SET(_var_already_there FALSE) + ENDIF() + # Make cache entry + SET(${pkg_UC}_ROOT_DIR "${_dflt_value}" CACHE PATH "Path to ${pkg_UC} directory") + + ## + ## 2. Find package - try CONFIG mode first (i.e. looking for XYZ-config.cmake) + ## + + # Override the variable - don't append to it, as it would give precedence + # to what was stored there before! + SET(CMAKE_PREFIX_PATH "${${pkg_UC}_ROOT_DIR}") + + # Try find_package in config mode. This has the priority, but is + # performed QUIET and not REQUIRED: + SALOME_FIND_PACKAGE("Salome${pkg}" ${pkg} NO_MODULE TRUE) + + IF (${pkg_UC}_FOUND OR ${pkg}_FOUND) + MESSAGE(STATUS "Found ${pkg} in CONFIG mode!") + ENDIF() + + # Otherwise try the standard way (module mode, with the standard CMake Find*** macro): + SALOME_FIND_PACKAGE("Salome${pkg}" ${pkg} MODULE) + + # Set the "FOUND" variable for the SALOME wrapper: + IF(${pkg_UC}_FOUND OR ${pkg}_FOUND) + SET(SALOME${pkg_UC}_FOUND TRUE) + ELSE() + SET(SALOME${pkg_UC}_FOUND FALSE) + ENDIF() + + IF (${pkg_UC}_FOUND OR ${pkg}_FOUND) + ## 3. Set the root dir which was finally retained by going up "upDir" times + ## from the given reference path. The variable "referenceVariable" may be a list. + ## In this case we take its first element. + LIST(LENGTH ${referenceVariable} _tmp_len) + IF(_tmp_len) + LIST(GET ${referenceVariable} 0 _tmp_ROOT_DIR) + ELSE() + # Note the double de-reference of "referenceVariable": + SET(_tmp_ROOT_DIR "${${referenceVariable}}") + ENDIF() + IF(${upCount}) + MATH(EXPR _rge "${upCount}-1") + FOREACH(_unused RANGE ${_rge}) + GET_FILENAME_COMPONENT(_tmp_ROOT_DIR "${_tmp_ROOT_DIR}" PATH) + ENDFOREACH() + ENDIF() + + ## + ## 4. Warn if CMake found something not located under ENV(XYZ_ROOT_DIR) + ## + IF(DEFINED ENV{${pkg_UC}_ROOT_DIR}) + SALOME_CHECK_EQUAL_PATHS(_res "${_tmp_ROOT_DIR}" "${_${pkg_UC}_ROOT_DIR_ENV}") + IF(NOT _res) + MESSAGE(WARNING "${pkg} was found, but not at the path given by the " + "environment ${pkg_UC}_ROOT_DIR! Is the variable correctly set? " + "The two paths are: ${_tmp_ROOT_DIR} and: ${_${pkg_UC}_ROOT_DIR_ENV}") + + ELSE() + MESSAGE(STATUS "${pkg} found directory matches what was specified in the ${pkg_UC}_ROOT_DIR variable, all good!") + ENDIF() + ELSE() + IF(NOT _var_already_there) + MESSAGE(STATUS "Variable ${pkg_UC}_ROOT_DIR was not explicitly defined. " + "An installation was found anyway: ${_tmp_ROOT_DIR}") + ENDIF() + ENDIF() + + ## + ## 5. Conflict detection + ## From another prerequisite using the package: + ## + IF(${pkg_UC}_ROOT_DIR_EXP) + SALOME_CHECK_EQUAL_PATHS(_res "${_tmp_ROOT_DIR}" "${${pkg_UC}_ROOT_DIR_EXP}") + IF(NOT _res) + MESSAGE(WARNING "Warning: ${pkg}: detected version conflicts with a previously found ${pkg}!" + " The two paths are " ${_tmp_ROOT_DIR} " vs " ${${pkg_UC}_ROOT_DIR_EXP}) + ELSE() + MESSAGE(STATUS "${pkg} directory matches what was previously exposed by another prereq, all good!") + ENDIF() + ENDIF() + + ## + ## 6. Save the detected installation + ## + SET(${pkg_UC}_ROOT_DIR "${_tmp_ROOT_DIR}") + + ELSE() + MESSAGE(STATUS "${pkg} was not found.") + ENDIF() + + SET(Salome${pkg}_FOUND "${pkg}_FOUND") +ENDMACRO(SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS) + diff --git a/adm_local_without_kernel/cmake_files/am2cmake.py b/adm_local_without_kernel/cmake_files/am2cmake.py deleted file mode 100644 index 4118dcb03..000000000 --- a/adm_local_without_kernel/cmake_files/am2cmake.py +++ /dev/null @@ -1,2310 +0,0 @@ -# -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -import re - -# ---- -# A set of regular expressions used ... -# ---- - -p_multiline = re.compile(r""" -\\ # One backslash -\s* # 0 or more space -\n # One CR -""", re.VERBOSE) - -p_dollar = re.compile(r""" -\$\( # a $ then a ( -(?P # open the group val -[^)]* # the group contain 0 or more non ) characters -) # close the group -\) # a ) at the end -""", re.VERBOSE) - -p_arobas = re.compile(r""" -@ # a @ -(?P # open the group val -[^@]* # the group contain 0 or more non @ characters -) # close the group -@ # a @ at the end -""", re.VERBOSE) - -p_if = re.compile(r""" -^ # beginning of the string -\s* # 0 or more space -if # an if -\s+ # 1 or more space -(?P # open the group val -.+ # the group contain 1 or more non space characters -) # close the group -""", re.VERBOSE) - -p_else = re.compile(r""" -^ # beginning of the line -\s* # 0 or more space -else # -\s* # 0 or more space -""", re.VERBOSE) - -p_endif = re.compile(r""" -^ # beginning of the line -\s* # 0 or more space -endif # a endif -\s* # 0 or more space -""", re.VERBOSE) - -p_attribution = re.compile(r""" -^ # beginning of the line -(?P # open the group spaces -\s* # 0 or more space -) # close the group -(?P # open the group key -\w+ # the group contain 1 or more alphanumeric characters -) # close the group -\s* # 0 or more space -(?P # open the group method -\+? # 0 or 1 + -= # One = -) # close the group -(?P # open the group value -.* # 0 or more any characters -) # close the group -""", re.VERBOSE) - -# ----- - -class CMakeFile(object): - - def __init__(self, the_root, root, dirs, files, f, module): - # - self.the_root = the_root - self.root = root - self.dirs = dirs - self.files = files - self.module = module - # - from os.path import join - self.amFile = join(root, f) - self.listsFile = join(root, "CMakeLists.txt") - # - self.parseFile() - # - return - - def parseFile(self): - - # -- - # Read the Makefile.am file - # -- - amFile = self.amFile - stream = open(amFile) - content = stream.read() - stream.close() - - # -- - # Replace the composed lines separated by "\\n" by an unique line - # -- - content = p_multiline.sub(r' ', content) - - # -- - # Compatibility netgen plugin - # -- - content = content.replace("../NETGEN/libNETGEN.la", "${NETGEN_LIBS}") - - # -- - cas_list = [ - "BinLPlugin", - "BinPlugin", - "BinTObjPlugin", - "BinXCAFPlugin", - "FWOSPlugin", - "PTKernel", - "StdLPlugin", - "StdPlugin", - "TKAdvTools", - "TKBin", - "TKBinL", - "TKBinTObj", - "TKBinXCAF", - "TKBO", - "TKBool", - "TKBRep", - "TKCAF", - "TKCDF", - "TKernel", - "TKFeat", - "TKFillet", - "TKG2d", - "TKG3d", - "TKGeomAlgo", - "TKGeomBase", - "TKHLR", - "TKIGES", - "TKLCAF", - "TKMath", - "TKMesh", - "TKMeshVS", - "TKNIS", - "TKOffset", - "TKOpenGl", - "TKPCAF", - "TKPLCAF", - "TKPrim", - "TKPShape", - "TKService", - "TKShapeSchema", - "TKShHealing", - "TKStdLSchema", - "TKStdSchema", - "TKSTEP", - "TKSTEP209", - "TKSTEPAttr", - "TKSTEPBase", - "TKSTL", - "TKTObj", - "TKTopAlgo", - "TKV2d", - "TKV3d", - "TKVRML", - "TKXCAF", - "TKXCAFSchema", - "TKXDEIGES", - "TKXDESTEP", - "TKXMesh", - "TKXml", - "TKXmlL", - "TKXmlTObj", - "TKXmlXCAF", - "TKXSBase", - "XCAFPlugin", - "XmlLPlugin", - "XmlPlugin", - "XmlTObjPlugin", - "XmlXCAFPlugin", - ] - vtk_list = [ - "vtkCommonPythonD", - "vtkGraphicsPythonD", - "vtkImagingPythonD", - "vtkPythonCore", - ] - kernel_list = [ - "CalciumC", - "DF", - "Launcher", - "LifeCycleCORBATest", - "NamingServiceTest", - "OpUtil", - "Registry", - "ResourcesManager", - "SALOMEBasics", - "SalomeCatalog", - "SalomeCommunication", - "SalomeContainer", - "SalomeDatastream", - "SalomeDSCContainer", - "SalomeDSClient", - "SalomeDSCSupervBasic", - "SalomeDSCSuperv", - "SalomeDSImpl", - "SALOMEDSImplTest", - "SalomeDS", - "SALOMEDSTest", - "SalomeGenericObj", - "SalomeHDFPersist", - "SalomeIDLKernel", - "SalomeLauncher", - "SalomeLifeCycleCORBA", - "SALOMELocalTrace", - "SALOMELocalTraceTest", - "SalomeLoggerServer", - "SalomeMPIContainer", - "SalomeNotification", - "SalomeNS", - "SalomeResourcesManager", - "SalomeTestComponentEngine", - "SalomeTestMPIComponentEngine", - "SALOMETraceCollectorTest", - "TOOLSDS", - "UtilsTest", - "with_loggerTraceCollector", - ] - gui_list = [ - "caf", - "CAM", - "CASCatch", - "DDS", - "Event", - "GLViewer", - "LightApp", - "LogWindow", - "ObjBrowser", - "OCCViewer", - "OpenGLUtils", - "Plot2d", - "PyConsole", - "PyInterp", - "QDS", - "qtx", - "QxScene", - "SalomeApp", - "SalomeAppTest", - "SalomeIDLGUI", - "SalomeObject", - "SalomePrs", - "SalomePyQtGUILight", - "SalomePyQtGUI", - "SalomePyQt", - "SalomePy", - "SalomeSession", - "SalomeStyle", - "SOCC", - "SPlot2d", - "std", - "SUITApp", - "suit", - "SUPERVGraph", - "SVTK", - "ToolsGUI", - "ViewerTools", - "VTKViewer", - ] - geom_list = [ - "AdvancedGUI", - "BasicGUI", - "BlocksGUI", - "BooleanGUI", - "BREPExport", - "BREPImport", - "BuildGUI", - "DisplayGUI", - "DlgRef", - "EntityGUI", - "GenerationGUI", - "GEOMAlgo", - "GEOMArchimede", - "GEOMBase", - "GEOMbasic", - "GEOMClient", - "GEOMEngine", - "GEOMFiltersSelection", - "GEOMimpl", - "GEOMObject", - "GEOMSketcher", - "GEOM", - "GEOM_SupervEngine", - "GEOMToolsGUI", - "GroupGUI", - "IGESExport", - "IGESImport", - "MeasureGUI", - "NMTDS", - "NMTTools", - "OCC2VTK", - "OperationGUI", - "PrimitiveGUI", - "RepairGUI", - "SalomeIDLGEOM", - "ShHealOper", - "STEPExport", - "STEPImport", - "STLExport", - "TransformationGUI", - "VTKExport", - ] - med_list = [ - "interpkernel", - "InterpKernelTest", - "MEDClientcmodule", - "medcouplingclient", - "medcouplingcorba", - "medcouplingremapper", - "medcoupling", - "MEDEngine", - "medloader", - "MEDMEMCppTest", - "MEDMEMImpl", - "medmem", - "MED", - "medsplitter", - "MEDSPLITTERTest", - "paramedcouplingcorba", - "paramedloader", - "paramedmemcompo", - "paramedmem", - "ParaMEDMEMTest", - "SalomeIDLMED", - "SalomeIDLMEDTests", - ] - smesh_list = [ - "GeomSelectionTools", - "MEFISTO2D", - "MeshDriverDAT", - "MeshDriverMED", - "MeshDriver", - "MeshDriverSTL", - "MeshDriverUNV", - "SalomeIDLSMESH", - "SMDS", - "SMESHClient", - "SMESHControls", - "SMESHDS", - "SMESHEngine", - "SMESHFiltersSelection", - "SMESHimpl", - "SMESHObject", - "SMESH", - "StdMeshersEngine", - "StdMeshersGUI", - "StdMeshers", - ] - full_list = cas_list + vtk_list - full_list += kernel_list + gui_list - full_list += geom_list + med_list + smesh_list - # -- - # E.A. : sort by len before substitution ... - # Why ? Thing to "-lMEDWrapper" then "-lMEDWrapper_V2_1" substition - # And you understand ... - # -- - full_list.sort(cmp = lambda x, y : cmp(len(y), len(x))) - # -- - for key in full_list: - content = content.replace("-l%s"%(key), "${%s}"%(key)) - pass - - # -- - # Split content in lines to treat each one separately - # -- - lines = content.split('\n') - - # -- - # newlines contains the lines of the future CMakeLists.txt file - # -- - newlines = [] - - # -- - # opened_ifs is used to deals with nested conditionnals - # -- - opened_ifs = [] - - # -- - # the __thedict__ dictionnary contains key, val - # of the Makefile.am file - # -- - self.__thedict__ = {} - - # -- - # Initialize file ... mainly includes other cmake files - # -- - self.initialize(newlines) - - # -- - # Do the job for each line - # -- - for line in lines: - self.treatLine(line, newlines, opened_ifs) - pass - - # -- - # Finalize file ... it is in here the cmake job is done - # -- - self.finalize(newlines) - - # -- - # Concatenate newlines into content - # -- - content = '\n'.join(newlines) - - # -- - # Add a CR at end if necessary - # -- - lines = content.split('\n') - # lines = [ l.strip() for l in lines ] - if len(lines[-1]) != 0: - lines.append('') - pass - content = '\n'.join(lines) - - # -- - self.content = content - - # -- - return - - def initialize(self, newlines): - if self.root == self.the_root: - # -- - newlines.append(""" - CMAKE_MINIMUM_REQUIRED(VERSION 2.4.7 FATAL_ERROR) - IF(COMMAND cmake_policy) - cmake_policy(SET CMP0003 NEW) - ENDIF(COMMAND cmake_policy) - """) - # -- - newlines.append(""" - ENABLE_TESTING() - """) - # -- - newlines.append(""" - SET(MODULE %s) - """%(self.module.upper())) - # -- - if self.module == "netgen": - newlines.append(""" - INCLUDE(${CMAKE_SOURCE_DIR}/cmake/FindPLATFORM.cmake) - INCLUDE(${CMAKE_SOURCE_DIR}/cmake/FindCAS.cmake) - """) - else: - if self.module == "kernel": - newlines.append(""" - INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindPLATFORM.cmake) - INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindPYTHON.cmake) - INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindOMNIORB.cmake) - INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindPTHREADS.cmake) - INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindHDF5.cmake) - INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindBOOST.cmake) - INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindLIBXML2.cmake) - INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindSWIG.cmake) - INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindCPPUNIT.cmake) - INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindDOXYGEN.cmake) - INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindMPI.cmake) - INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindLIBBATCH.cmake) - """) - pass - else: - if self.module == "med": - newlines.append(""" - SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR}) - IF(KERNEL_ROOT_DIR) - INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPLATFORM.cmake) - INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPYTHON.cmake) - INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindOMNIORB.cmake) - INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPTHREADS.cmake) - INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindHDF5.cmake) - INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindBOOST.cmake) - INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindLIBXML2.cmake) - INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSWIG.cmake) - INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindCPPUNIT.cmake) - INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindDOXYGEN.cmake) - INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindMPI.cmake) - INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindLIBBATCH.cmake) - INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindKERNEL.cmake) - ELSE(KERNEL_ROOT_DIR) - INCLUDE(${CMAKE_SOURCE_DIR}/adm_local_without_kernel/cmake_files/FindPLATFORM.cmake) - INCLUDE(${CMAKE_SOURCE_DIR}/adm_local_without_kernel/cmake_files/FindMPI.cmake) - ENDIF(KERNEL_ROOT_DIR) - """) - else: - newlines.append(""" - SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR}) - INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPLATFORM.cmake) - INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPYTHON.cmake) - INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindOMNIORB.cmake) - INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPTHREADS.cmake) - INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindHDF5.cmake) - INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindBOOST.cmake) - INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindLIBXML2.cmake) - INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSWIG.cmake) - INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindCPPUNIT.cmake) - INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindDOXYGEN.cmake) - INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindMPI.cmake) - INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindLIBBATCH.cmake) - INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindKERNEL.cmake) - """) - pass - if self.module == "gui": - newlines.append(""" - INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindCAS.cmake) - INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindQT4.cmake) - INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindOPENGL.cmake) - INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindVTK.cmake) - INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindQWT.cmake) - INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindSIPPYQT.cmake) - """) - else: - newlines.append(""" - SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR}) - IF(GUI_ROOT_DIR) - INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindCAS.cmake) - INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindQT4.cmake) - INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindOPENGL.cmake) - INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindVTK.cmake) - INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindQWT.cmake) - INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindSIPPYQT.cmake) - INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindGUI.cmake) - ENDIF(GUI_ROOT_DIR) - """) - if self.module == "med": - newlines.append(""" - INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindMEDFILE.cmake) - IF(WINDOWS) - INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindXDR.cmake) - ENDIF(WINDOWS) - """) - pass - if self.module == "smesh": - newlines.append(""" - SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR}) - SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR}) - INCLUDE(${GEOM_ROOT_DIR}/adm_local/cmake_files/FindGEOM.cmake) - INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMEDFILE.cmake) - INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake) - """) - pass - if self.module == "netgenplugin": - newlines.append(""" - SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR}) - SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR}) - SET(SMESH_ROOT_DIR $ENV{SMESH_ROOT_DIR}) - INCLUDE(${GEOM_ROOT_DIR}/adm_local/cmake_files/FindGEOM.cmake) - INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake) - INCLUDE(${SMESH_ROOT_DIR}/adm_local/cmake_files/FindSMESH.cmake) - INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindNETGEN.cmake) - """) - pass - if self.module == "blsurfplugin": - newlines.append(""" - SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR}) - SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR}) - SET(SMESH_ROOT_DIR $ENV{SMESH_ROOT_DIR}) - INCLUDE(${GEOM_ROOT_DIR}/adm_local/cmake_files/FindGEOM.cmake) - INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake) - INCLUDE(${SMESH_ROOT_DIR}/adm_local/cmake_files/FindSMESH.cmake) - INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindBLSURF.cmake) - """) - pass - if self.module in ["ghs3dplugin", "hexoticplugin"]: - newlines.append(""" - SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR}) - SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR}) - SET(SMESH_ROOT_DIR $ENV{SMESH_ROOT_DIR}) - INCLUDE(${GEOM_ROOT_DIR}/adm_local/cmake_files/FindGEOM.cmake) - INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake) - INCLUDE(${SMESH_ROOT_DIR}/adm_local/cmake_files/FindSMESH.cmake) - """) - pass - if self.module == "ghs3dprlplugin": - newlines.append(""" - SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR}) - SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR}) - SET(SMESH_ROOT_DIR $ENV{SMESH_ROOT_DIR}) - INCLUDE(${GEOM_ROOT_DIR}/adm_local/cmake_files/FindGEOM.cmake) - INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMEDFILE.cmake) - INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake) - INCLUDE(${SMESH_ROOT_DIR}/adm_local/cmake_files/FindSMESH.cmake) - """) - pass - if self.module == "visu": - newlines.append(""" - SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR}) - INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake) - """) - pass - if self.module == "yacs": - newlines.append(""" - INCLUDE(${CMAKE_SOURCE_DIR}/adm/cmake/FindEXPAT.cmake) - INCLUDE(${CMAKE_SOURCE_DIR}/adm/cmake/FindGRAPHVIZ.cmake) - """) - pass - if self.module == "hxx2salome": - newlines.append(""" - SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR}) - INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMEDFILE.cmake) - INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake) - """) - pass - pass - pass - pass - # -- - newlines.append(""" - SET(DOXYGEN_IS_OK 0) - """) - if self.module not in ['med']: - newlines.append(""" - IF(WINDOWS) - SET(CPPUNIT_IS_OK 0) - ENDIF(WINDOWS) - """) - pass - # -- - if self.module == "kernel": - newlines.append(""" - SET(WITH_LOCAL 1) - SET(WITH_BATCH 1) - SET(CALCIUM_IDL_INT_F77 long) - SET(CALCIUM_CORBA_INT_F77 CORBA::Long) - SET(LONG_OR_INT int) - """) - elif self.module == "gui": - newlines.append(""" - SET(GUI_ENABLE_CORBA ${CORBA_GEN}) - SET(ENABLE_VTKVIEWER ON) - SET(ENABLE_SALOMEOBJECT ON) - SET(ENABLE_OCCVIEWER ON) - SET(ENABLE_GLVIEWER ON) - SET(ENABLE_PLOT2DVIEWER ON) - SET(ENABLE_PYCONSOLE ON) - SET(ENABLE_SUPERVGRAPHVIEWER ON) - SET(ENABLE_QXGRAPHVIEWER ON) - """) - pass - elif self.module == "jobmanager": - newlines.append(""" - IF(GUI_ROOT_DIR) - SET(HAS_GUI ON) - ENDIF(GUI_ROOT_DIR) - """) - pass - elif self.module == "geom": - newlines.append(""" - IF(GUI_ROOT_DIR) - SET(GEOM_ENABLE_GUI ON) - ENDIF(GUI_ROOT_DIR) - """) - pass - elif self.module == "medfile": - newlines.append(""" - SET(MED_NUM_MAJEUR 3) - SET(MED_NUM_MINEUR 0) - SET(MED_NUM_RELEASE 3) - SET(LONG_OR_INT int) - IF(NOT WINDOWS) - SET(FLIBS -lgfortranbegin -lgfortran) - ENDIF(NOT WINDOWS) - """) - pass - elif self.module == "med": - newlines.append(""" - IF(KERNEL_ROOT_DIR) - SET(MED_ENABLE_KERNEL ON) - IF(NOT WINDOWS) - SET(MED_ENABLE_SPLITTER ON) - ENDIF(NOT WINDOWS) - ENDIF(KERNEL_ROOT_DIR) - IF(GUI_ROOT_DIR) - SET(MED_ENABLE_GUI ON) - ENDIF(GUI_ROOT_DIR) - """) - pass - elif self.module == "smesh": - newlines.append(""" - IF(GUI_ROOT_DIR) - SET(SMESH_ENABLE_GUI ON) - ENDIF(GUI_ROOT_DIR) - """) - pass - elif self.module == "netgen": - newlines.append(""" - SET(OCCFLAGS ${CAS_CPPFLAGS}) - SET(OCCLIBS ${CAS_LDPATH}) - SET(OCCLIBS ${OCCLIBS} ${TKernel} ${TKGeomBase} ${TKMath} ${TKG2d} ${TKG3d} ${TKXSBase} ${TKOffset} ${TKFillet} ${TKShHealing}) - SET(OCCLIBS ${OCCLIBS} ${TKMesh} ${TKMeshVS} ${TKTopAlgo} ${TKGeomAlgo} ${TKBool} ${TKPrim} ${TKBO} ${TKIGES} ${TKBRep}) - SET(OCCLIBS ${OCCLIBS} ${TKSTEPBase} ${TKSTEP} ${TKSTL} ${TKSTEPAttr} ${TKSTEP209} ${TKXDESTEP} ${TKXDEIGES} ${TKXCAF} ${TKLCAF} ${FWOSPlugin}) - """) - pass - elif self.module == "netgenplugin": - newlines.append(""" - IF(GUI_ROOT_DIR) - SET(NETGENPLUGIN_ENABLE_GUI ON) - ENDIF(GUI_ROOT_DIR) - """) - pass - elif self.module == "blsurfplugin": - newlines.append(""" - IF(GUI_ROOT_DIR) - SET(BLSURFPLUGIN_ENABLE_GUI ON) - ENDIF(GUI_ROOT_DIR) - """) - pass - elif self.module == "ghs3dplugin": - newlines.append(""" - IF(GUI_ROOT_DIR) - SET(GHS3DPLUGIN_ENABLE_GUI ON) - ENDIF(GUI_ROOT_DIR) - """) - pass - elif self.module == "hexoticplugin": - newlines.append(""" - IF(GUI_ROOT_DIR) - SET(HEXOTICPLUGIN_ENABLE_GUI ON) - ENDIF(GUI_ROOT_DIR) - """) - pass - elif self.module == "ghs3dprlplugin": - newlines.append(""" - IF(GUI_ROOT_DIR) - SET(GHS3DPRLPLUGIN_ENABLE_GUI ON) - ENDIF(GUI_ROOT_DIR) - """) - pass - elif self.module == "yacs": - newlines.append(""" - SET(SALOME_KERNEL ON) - SET(HAS_GUI ON) - SET(WITH_QT4 ON) - """) - pass - # -- - newlines.append(""" - set(VERSION 6.3.1) - set(XVERSION 0x060301) - """) - pass - # -- - newlines.append(""" - SET(VERSION_INFO 0.0.0) - SET(SOVERSION_INFO 0) - SET(SUBDIRS) - SET(AM_CPPFLAGS) - SET(AM_CXXFLAGS) - SET(LDADD) - SET(pythondir lib/python${PYTHON_VERSION}/site-packages) - SET(salomepythondir ${pythondir}/salome) - SET(salomepypkgdir ${salomepythondir}/salome) - """) - if self.module == "netgen": - newlines.append(r''' - SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DNO_PARALLEL_THREADS -DOCCGEOMETRY -I${CMAKE_BINARY_DIR} -I${CMAKE_CURRENT_SOURCE_DIR}) - ''') - elif self.module == "kernel": - newlines.append(r''' - SET(AM_CPPFLAGS ${AM_CPPFLAGS} -DHAVE_SALOME_CONFIG -I${CMAKE_BINARY_DIR}/salome_adm/unix -include SALOMEconfig.h) - SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DHAVE_SALOME_CONFIG -I${CMAKE_BINARY_DIR}/salome_adm/unix -include SALOMEconfig.h) - ''') - else: - if self.module not in ["yacs"]: - newlines.append(r''' - IF(KERNEL_ROOT_DIR) - SET(AM_CPPFLAGS ${AM_CPPFLAGS} -DHAVE_SALOME_CONFIG -I${KERNEL_ROOT_DIR}/include/salome -include SALOMEconfig.h) - SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DHAVE_SALOME_CONFIG -I${KERNEL_ROOT_DIR}/include/salome -include SALOMEconfig.h) - ENDIF(KERNEL_ROOT_DIR) - ''') - pass - if self.module == "gui": - newlines.append(r''' - IF(KERNEL_ROOT_DIR) - SET(AM_CPPFLAGS ${AM_CPPFLAGS} -DWITH_SALOMEDS_OBSERVER) - SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DWITH_SALOMEDS_OBSERVER) - ENDIF(KERNEL_ROOT_DIR) - ''') - pass - if self.module in ["smesh", "netgenplugin", "blsurfplugin", "ghs3dplugin", "hexoticplugin"]: - newlines.append(r''' - SET(AM_CPPFLAGS ${AM_CPPFLAGS} -DWITH_SMESH_CANCEL_COMPUTE) - SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DWITH_SMESH_CANCEL_COMPUTE) - ''') - pass - if self.module == "ghs3dplugin": - # TODO: Auto-detect TetGen-GHS3D version automatically - newlines.append(r''' - SET(AM_CPPFLAGS ${AM_CPPFLAGS} -DGHS3D_VERSION=42) - SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DGHS3D_VERSION=42) - ''') - pass - if self.module == "hxx2salome": - key = "_SRC" - if self.the_root[-len(key):] != key: - msg = "Source dir must finished with %s !"%(key) - raise Exception(msg) - hxxmodule = self.the_root[:-len(key)] - from os.path import basename - hxxmodule = basename(hxxmodule) - hxxmodule = hxxmodule.lower() - self.hxxmodule = hxxmodule - newlines.append(r''' - SET(HXXCPP_ROOT_DIR $ENV{%sCPP_ROOT_DIR}) - SET(AM_CPPFLAGS ${AM_CPPFLAGS} -I${HXXCPP_ROOT_DIR}/include) - SET(AM_CXXFLAGS ${AM_CXXFLAGS} -I${HXXCPP_ROOT_DIR}/include) - SET(LDADD ${LDADD} -L${HXXCPP_ROOT_DIR}/lib) - '''%(hxxmodule.upper())) - pass - pass - # -- - return - - def treatLine(self, line, newlines, opened_ifs): - - # -- - # Print the comment above the line itself - # -- - if line.find('#') >= 0: - fields = line.split('#') - line = fields[0] - comment = '#'.join([''] + fields[1:]) - newlines.append(comment) - if len(line) == 0: - return - pass - - # -- - # If the line begins with 'include ', just comment it - # -- - if line.find("include ") == 0: - if line.find("include $(top_srcdir)/config/automake.common") == 0: - for l in [ - "MAINTAINERCLEANFILES = Makefile.in", - "AM_CPPFLAGS=-I$(top_srcdir)/include -I$(top_builddir)/include", - "AM_FFLAGS=-I$(top_srcdir)/include -I$(top_builddir)/include", - "AM_FCFLAGS=-I$(top_srcdir)/include -I$(top_builddir)/include", - "AM_CPPFLAGS+=@HDF5_CPPFLAGS@", - "AM_LDFLAGS=@HDF5_LDFLAGS@", - ]: - self.treatLine(l, newlines, opened_ifs) - pass - pass - else: - newlines.append("# " + line) - pass - return - - # -- - # If the line begins with '-include', just comment it - # -- - if line.find("-include") == 0: - newlines.append("# " + line) - return - - # -- - # If the line is a definition of a make rule, just comment it - # -- - if line.count(':') == 1: - newlines.append("# " + line) - return - - # -- - # A particuliar case where there are two ":" on the same line - # -- - if line.find('install-exec-local:') == 0: - newlines.append("# " + line) - return - - # -- - # If the line begin by a tabulation, consider it's a makefile command and comment it - # -- - if line.find("\t") == 0: - newlines.append("# " + line) - return - - # -- - # -- - key = "-version-info" - if line.find(key) >= 0: - # -- - before = line.split(key)[0] - after = line[len(before)+len(key):] - sep = after[0] - after = after[1:] - version_info = after.split()[0] - line = line.replace(key+sep+version_info, "") - # -- - version_info = version_info.replace(':', '.') - soversion_info = version_info.split('.')[0] - newlines.append("SET(VERSION_INFO " + version_info + ")") - newlines.append("SET(SOVERSION_INFO " + soversion_info + ")") - # -- - pass - - # -- - # Replace the $(TOTO) by ${TOTO} - # Replace the @TOTO@ by ${TOTO} - # -- - line = p_dollar.sub(r"${\1}", line) - line = p_arobas.sub(r"${\1}", line) - - # -- - line = line.replace(r"${top_builddir}", r"${CMAKE_BINARY_DIR}") - line = line.replace(r"${top_srcdir}", r"${CMAKE_SOURCE_DIR}") - line = line.replace(r"${srcdir}", r"${CMAKE_CURRENT_SOURCE_DIR}") - line = line.replace(r"${builddir}", r"${CMAKE_CURRENT_BINARY_DIR}") - line = line.replace(r"${datadir}", r"${CMAKE_INSTALL_PREFIX}/share") - - # -- - # Check if the line is a 'if' condition - # If yes, replace it by a cmake grammar - # -- - match = p_if.match(line) - if match: - theif = match.group("val") - if theif[0] == "!": - theif = "NOT " + theif[1:] - pass - line = p_if.sub(r"IF(%s)"%(theif), line) - opened_ifs.append(theif) - newlines.append(line) - return - - # -- - # Check if the line is a 'else' condition - # If yes, replace it by a cmake grammar - # -- - match = p_else.match(line) - if match: - line = "ELSE(%s)"%(opened_ifs[-1]) - newlines.append(line) - return - - # -- - # Check if the line is a 'endif' condition - # If yes, replace it by a cmake grammar - # -- - match = p_endif.match(line) - if match: - line = "ENDIF(%s)"%(opened_ifs[-1]) - opened_ifs[-1:] = [] - newlines.append(line) - return - - # -- - # Check if the line is an attribution '=' or '+=' - # -- - match = p_attribution.match(line) - if match: - self.treatAttribution(match, newlines) - return - - # -- - newlines.append(line) - - # -- - return - - def treatAttribution(self, match, newlines): - - spaces = match.group("spaces") - key = match.group("key") - method = match.group("method") - value = match.group("value") - # print [spaces, key, method, value] - - # -- - # Open cmake SET command - # -- - newlines.append(spaces + "SET(" + key) - - # -- - # If method is '+=', put the previous definition as first value - # -- - if method == "+=": - newlines.append("%s ${%s}"%(spaces, key)) - pass - - # -- - fields = value.split() - for i in range(len(fields)): - newlines.append("%s %s"%(spaces, fields[i])) - pass - - # -- - if method == "+=": - # -- - # The try: except KeyError is here if the += - # is an error which occurs in salome ... - # -- - try: - self.__thedict__[key] += fields[:] - except KeyError: - self.__thedict__[key] = fields[:] - pass - pass - else: - self.__thedict__[key] = fields[:] - pass - - # -- - # Close cmake SET command - # -- - - newlines.append("%s)"%(spaces)) - - return - - def finalize(self, newlines): - - # -- - # Convert the .in files in build dir - # -- - - import operator - mod = self.module - if mod in ['kernel', 'gui'] and self.root[-len('gui'):] == 'gui' or mod == 'med' and operator.contains(self.root, 'doxygen'): - newlines.append(r''' - SET(top_builddir - ${CMAKE_BINARY_DIR} - ) - SET(top_srcdir - ${CMAKE_SOURCE_DIR} - ) - SET(srcdir - ${CMAKE_CURRENT_SOURCE_DIR} - ) - SET(builddir - ${CMAKE_CURRENT_BINARY_DIR} - ) - SET(datadir - ${CMAKE_INSTALL_PREFIX}/share - ) - SET(docdir - ${datadir}/doc/salome - ) - ''') - self.files.append("static/header.html.in") - 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': - newlines.append(r''' - SET(top_builddir - ${CMAKE_BINARY_DIR} - ) - SET(top_srcdir - ${CMAKE_SOURCE_DIR} - ) - SET(srcdir - ${CMAKE_CURRENT_SOURCE_DIR} - ) - SET(builddir - ${CMAKE_CURRENT_BINARY_DIR} - ) - SET(datadir - ${CMAKE_INSTALL_PREFIX}/share - ) - SET(docdir - ${datadir}/doc/salome - ) - ''') - self.files.append("static/header.html.in") - - if mod in ['geom', 'smesh', 'visu'] and self.root[-len(mod):] == mod.upper(): - self.files.append("static/header_py.html.in") - - if self.module == "yacs": - key = "salomegui" - if self.root[-len(key):] == key: - self.files.append("resources/YACSCatalog.xml.in") - pass - pass - for f in self.files: - if f[-3:] == ".in": - if self.module == 'yacs' and f == "Doxyfile.in": - continue - if f == "sstream.in": - continue - if f in ["runContainer.in", "stopContainer.in"]: - if self.module == "med": - if self.root[-3:] == "csh": - continue - pass - pass - if f == "SALOMEconfig.ref.in": - out = "SALOMEconfig.h" - else: - out = f[:-3] - pass - newlines.append(r''' - SET(input ${CMAKE_CURRENT_SOURCE_DIR}/%s) - '''%(f)) - newlines.append(r''' - SET(output ${CMAKE_CURRENT_BINARY_DIR}/%s) - '''%(out)) - newlines.append(r''' - MESSAGE(STATUS "Creation of ${output}") - CONFIGURE_FILE(${input} ${output}) - ''') - pass - pass - - # -- - # add commands for generating of user's documentation - # -- - - upmod = self.module.upper() - doc_gui_destination = "${CMAKE_INSTALL_PREFIX}/share/doc/salome/gui/%s"%(upmod) - doc_tui_destination = "${CMAKE_INSTALL_PREFIX}/share/doc/salome/tui/%s"%(upmod) - doc_destination = "${CMAKE_INSTALL_PREFIX}/share/doc/salome" - head_source = "${CMAKE_CURRENT_SOURCE_DIR}/images/head.png" - if mod == 'kernel': - copytree_src = "${CMAKE_SOURCE_DIR}/salome_adm/cmake_files" - else: - copytree_src = "$ENV{KERNEL_ROOT_DIR}/salome_adm/cmake_files" - str = "import re \nimport sys \noutfile = open(sys.argv[1], 'wb') \nfor line in open(sys.argv[2], 'rb').readlines():" - 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)" - str += "\n outfile.write(line) \noutfile.close()" - - if mod in ['kernel', 'gui'] and self.root[-len('gui'):] == 'gui' or mod == 'med' and operator.contains(self.root, 'doxygen'): - if mod == 'med': - doc_source = "${CMAKE_CURRENT_BINARY_DIR}/doc_ref_user/html" - input = "Doxyfile_med_user" - else: - doc_source = "${CMAKE_CURRENT_BINARY_DIR}/%s"%(upmod) - input = "" - newlines.append("""\t ADD_CUSTOM_TARGET(usr_docs ${DOXYGEN_EXECUTABLE} %s - 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''')" - VERBATIM - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - )"""%(input, copytree_src, doc_gui_destination, doc_source, doc_gui_destination, head_source, doc_gui_destination)) - - if mod in ['geom', 'smesh', 'visu'] and self.root[-len(mod):] == upmod and operator.contains(self.root, 'doc'): - ign = r"""'tempfile', '*usr_docs*', '*CMakeFiles*', '*.cmake', 'doxyfile*', '*.vcproj', 'static', 'Makefile*'""" - if mod in ['geom', 'smesh']: - if mod == 'geom': - tmp = 'geompy' - input = "COMMAND ${DOXYGEN_EXECUTABLE} doxyfile_tui \n\t\t" - else: - tmp = 'smesh' - input = '' - newlines.append(r""" - FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/tempfile "%s") - ADD_CUSTOM_TARGET(usr_docs ${PYTHON_EXECUTABLE} tempfile %s.py ${CMAKE_SOURCE_DIR}/src/%s_SWIG/%sDC.py %s - %sCOMMAND ${DOXYGEN_EXECUTABLE} doxyfile_py - COMMAND ${DOXYGEN_EXECUTABLE} doxyfile - COMMAND ${PYTHON_EXECUTABLE} -c "import os; os.remove(r'''%s.py''')" - 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''')" - VERBATIM - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - )"""%(str, tmp, upmod, tmp, tmp, input, tmp, copytree_src, doc_gui_destination, doc_gui_destination, ign, head_source, doc_gui_destination)) - else: - newlines.append("""\t ADD_CUSTOM_TARGET(usr_docs ${DOXYGEN_EXECUTABLE} doxyfile_idl - COMMAND ${DOXYGEN_EXECUTABLE} doxyfile - 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''')" - VERBATIM - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - )"""%(copytree_src, doc_gui_destination, doc_gui_destination, ign, head_source, doc_gui_destination)) - - # -- - # add commands for generating of developer's documentation - # -- - - upmod = self.module.upper() - if mod in ['kernel', 'gui', 'med', 'smesh', 'visu'] and self.root[-len('tui'):] == 'tui': - if mod == 'kernel': - tmp = """\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''')" """ - tmp1="" - else: - tmp = """\tADD_CUSTOM_TARGET(dev_docs ${DOXYGEN_EXECUTABLE}""" - if mod == 'visu': - tmp1= r"""\n COMMAND ${PYTHON_EXECUTABLE} -c "from shutil import copy; copy(r'''${CMAKE_CURRENT_SOURCE_DIR}/images/visuscreen.png''', r'''%s''')" """%(doc_tui_destination) - elif mod == 'smesh': - extra_srcdir = "${CMAKE_CURRENT_SOURCE_DIR}/extra" - tmp1= """\n COMMAND ${PYTHON_EXECUTABLE} -c "from shutil import copy; copy(r'''${CMAKE_CURRENT_SOURCE_DIR}/images/smeshscreen.png''', r'''%s'''); copy(r'''%s/AddNetgenInSalome2.pdf''', r'''%s'''); copy(r'''%s/PluginMeshers.html''', r'''%s''')" - COMMAND ${PYTHON_EXECUTABLE} -c "from shutil import copy; copy(r'''%s/AddNetgenInSalome2.ps''', r'''%s'''); copy(r'''%s/AddNetgenInSalome2.sxw''', r'''%s''')" """%(doc_tui_destination, extra_srcdir,doc_destination, extra_srcdir,doc_destination, extra_srcdir,doc_destination,extra_srcdir,doc_destination) - else: - tmp1="" - doc_source = "${CMAKE_CURRENT_BINARY_DIR}/%s"%(upmod) - newlines.append(tmp + """ - 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''')" """%(copytree_src, doc_tui_destination, doc_source, doc_tui_destination, head_source, doc_tui_destination) + tmp1 + """ - VERBATIM - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - )""") - if mod == 'geom' and self.root[-len('tui'):] == 'tui': - tmp = 'geompy' - doc_source = "${CMAKE_CURRENT_BINARY_DIR}/%s"%(upmod) - newlines.append(r""" - FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/tempfile "%s") - ADD_CUSTOM_TARGET(dev_docs ${PYTHON_EXECUTABLE} tempfile ${CMAKE_BINARY_DIR}/src/%s_SWIG/%s.py ${CMAKE_SOURCE_DIR}/src/%s_SWIG/%sDC.py %s - COMMAND ${DOXYGEN_EXECUTABLE} doxyfile - COMMAND ${PYTHON_EXECUTABLE} -c "import os; os.remove(r'''${CMAKE_BINARY_DIR}/src/%s_SWIG/%s.py''')" - 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'''); shutil.copy(r'''${CMAKE_CURRENT_SOURCE_DIR}/images/geomscreen.png''', r'''%s''')" - VERBATIM - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - )"""%(str, upmod, tmp, upmod, tmp, tmp, upmod, tmp, copytree_src, doc_tui_destination, doc_source, doc_tui_destination, head_source, doc_tui_destination, doc_tui_destination)) - - # -- - # convert the SUBDIRS in cmake grammar - # -- - if 1: # self.__thedict__.has_key("SUBDIRS"): - newlines.append(r''' - FOREACH(dir ${SUBDIRS}) - IF(NOT dir STREQUAL .) - ADD_SUBDIRECTORY(${dir}) - ENDIF(NOT dir STREQUAL .) - ENDFOREACH(dir ${SUBDIRS}) - ''') - pass - - # -- - # -- - for key in ["lib_LTLIBRARIES", "noinst_LTLIBRARIES", "salomepyexec_LTLIBRARIES"]: - if self.__thedict__.has_key(key): - self.addLibTarget(key, newlines) - pass - pass - - # -- - # -- - for key in ["bin_PROGRAMS", "check_PROGRAMS"]: - if self.__thedict__.has_key(key): - self.addBinTarget(key, newlines) - pass - pass - - # -- - # -- - if self.__thedict__.has_key("BASEIDL_FILES"): - if not self.__thedict__.has_key("IDL_FILES"): - self.__thedict__["IDL_FILES"] = self.__thedict__["BASEIDL_FILES"] - newlines.append(''' - SET(IDL_FILES ${BASEIDL_FILES}) - ''') - pass - pass - - # -- - # -- - - key = "IDL_FILES" - if self.__thedict__.has_key(key): - if self.module == "kernel": - newlines.append(''' - SET(IDL_FILES ${IDL_FILES} Calcium_Ports.idl) - ''') - pass - newlines.append(''' - FOREACH(input ${IDL_FILES}) - STRING(REGEX REPLACE ".idl" "" base ${input}) - SET(src ${CMAKE_CURRENT_BINARY_DIR}/${base}SK.cc) - SET(outputs ${src}) - SET(dynsrc ${CMAKE_CURRENT_BINARY_DIR}/${base}DynSK.cc) - SET(outputs ${outputs} ${dynsrc}) - SET(inc ${CMAKE_CURRENT_BINARY_DIR}/${base}.hh) - SET(outputs ${outputs} ${inc}) - IF(input STREQUAL Calcium_Ports.idl) - SET(input ${CMAKE_CURRENT_BINARY_DIR}/${input}) - ELSE(input STREQUAL Calcium_Ports.idl) - SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input}) - ENDIF(input STREQUAL Calcium_Ports.idl) - SET(flags ${IDLCXXFLAGS} ${OMNIORB_IDLCXXFLAGS}) - STRING(REGEX MATCH "-bcxx" ISBCXX ${flags}) - IF(NOT ISBCXX) - SET(flags -bcxx ${flags}) - ENDIF(NOT ISBCXX) - ADD_CUSTOM_COMMAND( - OUTPUT ${outputs} - COMMAND ${OMNIORB_IDL} ${flags} ${input} - MAIN_DEPENDENCY ${input} - ) - ''') - newlines.append(''' - install(FILES ${input} DESTINATION idl/salome) - ''') - if self.module not in ["pyhello"]: - newlines.append(''' - SET(IDL_HEADER ${CMAKE_CURRENT_BINARY_DIR}/${base}.hh) - install(FILES ${IDL_HEADER} DESTINATION include/salome) - ''') - pass - newlines.append(''' - INSTALL(CODE "SET(IDL_FILE ${input})") - INSTALL(CODE "SET(DIR ${salomepythondir})") - IF(WINDOWS) - INSTALL(CODE "SET(DIR bin/salome)") - ENDIF(WINDOWS) - INSTALL(CODE "SET(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})") - INSTALL(CODE "SET(OMNIORB_IDL_PYTHON ${OMNIORB_IDL_PYTHON})") - # -- - SET(flags) - FOREACH(f ${IDLPYFLAGS}) - SET(flags "${flags} ${f}") - ENDFOREACH(f ${IDLPYFLAGS}) - STRING(REGEX MATCH "-bpython" ISBPYTHON ${flags}) - IF(NOT ISBPYTHON) - SET(flags "-bpython ${flags}") - ENDIF(NOT ISBPYTHON) - SET(IDLPYFLAGS ${flags}) - STRING(REPLACE "\\\\" "/" IDLPYFLAGS ${IDLPYFLAGS}) - INSTALL(CODE "SET(IDLPYFLAGS ${IDLPYFLAGS})") - # -- - ''') - if self.module == "kernel": - newlines.append(''' - INSTALL(SCRIPT ${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/install_python_from_idl.cmake) - ''') - else: - newlines.append(''' - STRING(REPLACE "\\\\" "/" KERNEL_ROOT_DIR ${KERNEL_ROOT_DIR}) - INSTALL(SCRIPT ${KERNEL_ROOT_DIR}/salome_adm/cmake_files/install_python_from_idl.cmake) - ''') - pass - newlines.append(''' - ENDFOREACH(input ${IDL_FILES}) - ''') - pass - - # -- - # -- - for key in ["SWIG_SRC", "SWIGSOURCES", "SWIG_DEF"]: - if self.__thedict__.has_key(key): - newlines.append(''' - SET(SWIG_SOURCES ${%s}) - '''%(key)) - self.__thedict__["SWIG_SOURCES"] = self.__thedict__[key] - pass - pass - - # -- - # -- - if self.__thedict__.has_key("SWIG_SOURCES"): - newlines.append(''' - IF(SWIG_SOURCES MATCHES ";") - STRING(REGEX REPLACE ";.*" "" SWIG_SOURCES_FIRST "${SWIG_SOURCES}") - ELSE(SWIG_SOURCES MATCHES ";") - SET(SWIG_SOURCES_FIRST "${SWIG_SOURCES}") - ENDIF(SWIG_SOURCES MATCHES ";") - SET(flags) - FOREACH(f ${SWIG_FLAGS} ${MY_SWIG_FLAGS}) - SET(test ON) - IF(flags) - LIST(FIND flags ${f} index) - IF(NOT index EQUAL -1) - SET(test OFF) - ENDIF(NOT index EQUAL -1) - ENDIF(flags) - IF(test) - SET(flags ${flags} ${f}) - ENDIF(test) - ENDFOREACH(f ${SWIG_FLAGS} ${MY_SWIG_FLAGS}) - ADD_CUSTOM_COMMAND( - OUTPUT ${build_srcs} - COMMAND ${SWIG_EXECUTABLE} ${flags} -o ${build_srcs} ${CMAKE_CURRENT_SOURCE_DIR}/${SWIG_SOURCES_FIRST} - MAIN_DEPENDENCY ${SWIG_SOURCES} - ) - ''') - pass - - # -- - # -- - if self.__thedict__.has_key("BUILT_SOURCES"): - newlines.append(''' - FOREACH(f ${BUILT_SOURCES}) - IF(f MATCHES "WRAP.cxx$") - # STRING(REGEX REPLACE "WRAP.cxx" "WRAP.h" inc ${f}) - STRING(REGEX REPLACE "WRAP.cxx" ".i" input ${f}) - ADD_CUSTOM_COMMAND( - OUTPUT ${f} # ${inc} - COMMAND ${SWIG_EXECUTABLE} ${SWIG_FLAGS} ${SWIG_PYTHON_INCLUDES} ${MYSWIG_FLAGS} -o ${f} ${CMAKE_CURRENT_SOURCE_DIR}/${input} - MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/${input} - ) - ENDIF(f MATCHES "WRAP.cxx$") - ENDFOREACH(f ${BUILT_SOURCES}) - ''') - pass - - # -- - # -- - key = "MOC_FILES" - if self.__thedict__.has_key(key): - newlines.append(''' - FOREACH(output ${MOC_FILES}) - ''') - if self.module in ["jobmanager", "yacs"]: - newlines.append(''' - STRING(REGEX REPLACE _moc.cxx .hxx input ${output}) - ''') - else: - newlines.append(''' - STRING(REGEX REPLACE _moc.cxx .h input ${output}) - ''') - pass - newlines.append(''' - SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input}) - SET(output ${CMAKE_CURRENT_BINARY_DIR}/${output}) - ADD_CUSTOM_COMMAND( - OUTPUT ${output} - COMMAND ${QT_MOC_EXECUTABLE} ${MOC_FLAGS} ${input} -o ${output} - MAIN_DEPENDENCY ${input} - ) - ENDFOREACH(output ${MOC_FILES}) - ''') - pass - - # -- - # -- - key = "UIC_FILES" - if self.__thedict__.has_key(key): - newlines.append(''' - FOREACH(output ${UIC_FILES}) - STRING(REPLACE "ui_" "" input ${output}) - STRING(REPLACE ".h" ".ui" input ${input}) - SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input}) - SET(output ${CMAKE_CURRENT_BINARY_DIR}/${output}) - ADD_CUSTOM_COMMAND( - OUTPUT ${output} - COMMAND ${QT_UIC_EXECUTABLE} -o ${output} ${input} - MAIN_DEPENDENCY ${input} - ) - ENDFOREACH(output ${UIC_FILES}) - ''') - pass - - # -- - # -- - key = "QRC_FILES" - if self.__thedict__.has_key(key): - newlines.append(''' - FOREACH(output ${QRC_FILES}) - STRING(REGEX REPLACE "qrc_" "" input ${output}) - STRING(REGEX REPLACE ".cxx" ".qrc" input ${input}) - STRING(REGEX REPLACE ".qrc" "" name ${input}) - SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input}) - SET(output ${CMAKE_CURRENT_BINARY_DIR}/${output}) - ADD_CUSTOM_COMMAND( - OUTPUT ${output} - COMMAND ${QT_RCC_EXECUTABLE} ${input} -o ${output} -name ${name} - MAIN_DEPENDENCY ${input} - ) - ENDFOREACH(output ${QRC_FILES}) - ''') - pass - - # -- - # -- - key = "SIP_FILES" - if self.__thedict__.has_key(key): - newlines.append(''' - FOREACH(input ${SIP_FILES}) - SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input}) - SET(output) - FOREACH(out ${SIP_SRC}) - SET(output ${output} ${CMAKE_CURRENT_BINARY_DIR}/${out}) - ENDFOREACH(out ${SIP_SRC}) - ADD_CUSTOM_COMMAND( - OUTPUT ${output} - COMMAND ${SIP_EXECUTABLE} ${PYQT_SIPFLAGS} ${input} - MAIN_DEPENDENCY ${input} - ) - ENDFOREACH(input ${SIP_FILES}) - ''') - pass - - # -- - # For make check - # -- - for key in ["TESTS"]: - if self.__thedict__.has_key(key): - newlines.append(''' - SET(UNIT_TEST_PROG ${%s}) - '''%(key)) - self.__thedict__["UNIT_TEST_PROG"] = self.__thedict__[key] - pass - pass - key = "UNIT_TEST_PROG" - if self.__thedict__.has_key(key): - newlines.append(''' - FOREACH(input ${UNIT_TEST_PROG}) - GET_FILENAME_COMPONENT(ext ${input} EXT) - IF(ext STREQUAL .py) - SET(test ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${input}) - ELSE(ext STREQUAL .py) - IF(WINDOWS) - SET(test ${CMAKE_CURRENT_BINARY_DIR}/${input}_exe.exe) - ELSE() - SET(test ${CMAKE_CURRENT_BINARY_DIR}/${input}_exe) - ENDIF() - ENDIF(ext STREQUAL .py) - ADD_TEST(${input} ${test}) - SET(fail_regex "KO") - SET_PROPERTY(TEST ${input} PROPERTY FAIL_REGULAR_EXPRESSION "${fail_regex}") - # IF(NOT WINDOWS) - # ADD_TEST(${input}_valgrind valgrind ${test}) - # SET_PROPERTY(TEST ${input}_valgrind PROPERTY FAIL_REGULAR_EXPRESSION "${fail_regex}") - # SET_PROPERTY(TEST ${input}_valgrind PROPERTY PASS_REGULAR_EXPRESSION "no leaks are possible") - # ENDIF() - ENDFOREACH(input ${UNIT_TEST_PROG}) - ''') - pass - - # -- - # Treat the install targets - # -- - resdir = self.module - if resdir == "hxx2salome": - resdir = self.hxxmodule - pass - d = { - "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}", - } - if self.module == "jobmanager": - d["bin_SCRIPTS"] = "bin" - pass - if self.module == "medfile": - d = { - "include_HEADERS" : "include", - "nodist_include_HEADERS" : "include", - "bin_SCRIPTS" : "bin", - "doc_DATA" : "${docdir}", - } - pass - if self.module == "netgen": - d = { - "include_HEADERS" : "include", - "noinst_HEADERS" : "share/netgen/include", - "dist_pkgdata_DATA" : "share/netgen", - "dist_doc_DATA" : "share/doc/netgen", - } - pass - for key, value in d.items(): - if self.__thedict__.has_key(key): - self.addInstallTarget(key, value, newlines) - pass - pass - - # -- - return - - def setLibAdd(self, key, newlines): - # -- - newlines.append(r''' - SET(libadd) - ''') - # -- - newlines.append(r''' - IF(WINDOWS) - SET(targets) - SET(targets ${targets} MEFISTO2D) - FOREACH(target ${targets}) - IF(name STREQUAL ${target}) - SET(dir $ENV{F2CHOME}) - STRING(REPLACE "\\\\" "/" dir ${dir}) - SET(libadd ${libadd} ${dir}/LIBF77.lib) - SET(libadd ${libadd} ${dir}/LIBI77.lib) - ENDIF(name STREQUAL ${target}) - ENDFOREACH(target ${targets}) - ENDIF(WINDOWS) - ''') - # -- - newlines.append(r''' - SET(libs ${PLATFORM_LIBADD} ${PLATFORM_LDFLAGS} ${LDADD} ${${amname}_LIBADD} ${${amname}_LDADD} ${${amname}_LDFLAGS}) - FOREACH(lib SALOMEBasics SalomeBatch) - IF(name STREQUAL lib) - SET(libs ${libs} ${PTHREAD_LIBS}) - ENDIF(name STREQUAL lib) - ENDFOREACH(lib SALOMEBasics SalomeBatch) - ''') - # -- - newlines.append(r''' - FOREACH(lib ${libs}) - GET_FILENAME_COMPONENT(ext ${lib} EXT) - IF(ext STREQUAL .la) - GET_FILENAME_COMPONENT(lib ${lib} NAME_WE) - STRING(REGEX REPLACE "^lib" "" lib ${lib}) - ENDIF(ext STREQUAL .la) - SET(vars) - SET(vars ${vars} -no-undefined) - SET(vars ${vars} -lvtkWidgets) - IF(WINDOWS) - SET(vars ${vars} -module) - SET(vars ${vars} -Wl,-E) - SET(vars ${vars} -Xlinker) - SET(vars ${vars} -export-dynamic) - SET(vars ${vars} -lm) - SET(vars ${vars} -lboost_thread) - SET(vars ${vars} -lboost_signals) - SET(vars ${vars} -pthread -lpthread -ldl) - ENDIF(WINDOWS) - FOREACH(v ${vars}) - IF(lib STREQUAL v) - SET(lib) - ENDIF(lib STREQUAL v) - ENDFOREACH(v ${vars}) - SET(test OFF) - IF(lib) - STRING(REGEX MATCH "^-lQt" test ${lib}) - ENDIF(lib) - IF(NOT test) - SET(libadd ${libadd} ${lib}) - ENDIF(NOT test) - ENDFOREACH(lib ${libs}) - TARGET_LINK_LIBRARIES(${name} ${libadd}) - ''') - # -- - newlines.append(r''' - IF(WINDOWS) - SET(targets) - SET(targets ${targets} MEFISTO2D) - FOREACH(target ${targets}) - IF(name STREQUAL ${target}) - IF(CMAKE_BUILD_TYPE STREQUAL Debug) - SET_TARGET_PROPERTIES(${name} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:MSVCRT") - ENDIF(CMAKE_BUILD_TYPE STREQUAL Debug) - ENDIF(name STREQUAL ${target}) - ENDFOREACH(target ${targets}) - ENDIF(WINDOWS) - ''') - # -- - return - - def setCompilationFlags(self, key, newlines): - newlines.append(r''' - SET(var) - IF(WINDOWS) - SET(targets) - SET(targets ${targets} SalomeIDLKernel) - SET(targets ${targets} SalomeDS) - SET(targets ${targets} SALOMEDSTest) - SET(targets ${targets} SALOMEDS_Client_exe) - SET(targets ${targets} SalomeIDLGEOM) - SET(targets ${targets} GEOMEngine) - SET(targets ${targets} MEDEngine) - SET(targets ${targets} SMESHEngine) - SET(targets ${targets} SMESH) - SET(targets ${targets} StdMeshersEngine) - SET(targets ${targets} VISUEngineImpl) - FOREACH(target ${targets}) - IF(name STREQUAL ${target}) - SET(var ${var} -DNOGDI) - ENDIF(name STREQUAL ${target}) - ENDFOREACH(target ${targets}) - ENDIF(WINDOWS) - ''') - # -- - if self.module in ["medfile", "yacs"]: - newlines.append(r''' - IF(WINDOWS) - SET(var ${var} -DNOGDI) - ENDIF(WINDOWS) - ''') - pass - # -- - newlines.append(r''' - IF(WINDOWS) - SET(targets) - SET(targets ${targets} MEFISTO2D) - FOREACH(target ${targets}) - IF(name STREQUAL ${target}) - SET(dir $ENV{F2CHOME}) - STRING(REPLACE "\\\\" "/" dir ${dir}) - SET(var ${var} -I${dir}) - SET(var ${var} -DF2C_BUILD) - ENDIF(name STREQUAL ${target}) - ENDFOREACH(target ${targets}) - ENDIF(WINDOWS) - ''') - # -- - if self.module in ["geom", "med"]: - newlines.append(r''' - SET(var ${var} -I${CMAKE_CURRENT_SOURCE_DIR}) - SET(var ${var} -I${CMAKE_CURRENT_BINARY_DIR}) - ''') - pass - newlines.append(r''' - SET(var ${var} ${AM_CPPFLAGS}) - SET(var ${var} ${AM_CXXFLAGS}) - ''') - # -- - newlines.append(r''' - IF(type STREQUAL STATIC) - SET(var ${var} -fPIC) - ENDIF(type STREQUAL STATIC) - ''') - # -- - if self.module == "yacs": - newlines.append(r''' - SET(var ${var} -DYACS_PTHREAD) - SET(var ${var} -DCMAKE_BUILD) - SET(var ${var} -DSALOME_KERNEL) - SET(var ${var} -DDSC_PORTS) - SET(var ${var} -DOMNIORB) - ''') - pass - newlines.append(r''' - SET(var ${var} ${PLATFORM_CPPFLAGS}) - SET(var ${var} ${PTHREAD_CFLAGS}) - SET(var ${var} ${${amname}_CPPFLAGS}) - SET(var ${var} ${${amname}_CXXFLAGS}) - SET(var ${var} ${${amname}_CFLAGS}) - SET(vars) - IF(WINDOWS) - SET(vars ${vars} -include SALOMEconfig.h) - SET(vars ${vars} -ftemplate-depth-32) - SET(vars ${vars} -fPIC) - SET(vars ${vars} -g) - ENDIF(WINDOWS) - SET(flags) - FOREACH(f ${var}) - FOREACH(v ${vars}) - IF(f STREQUAL v) - SET(f) - ENDIF(f STREQUAL v) - ENDFOREACH(v ${vars}) - IF(f) - string(REGEX MATCH "^-I" test_include ${f}) - if(test_include) - string(REGEX REPLACE "^-I" "" include_dir ${f}) - if(include_dir) - if(include_dir STREQUAL /usr/include) - else(include_dir STREQUAL /usr/include) - string(REGEX MATCH "^\\." test_dot ${include_dir}) - if(test_dot) - set(include_dir ${CMAKE_CURRENT_BINARY_DIR}/${include_dir}) - endif(test_dot) - include_directories(${include_dir}) - endif(include_dir STREQUAL /usr/include) - endif(include_dir) - else(test_include) - SET(flags "${flags} ${f}") - endif(test_include) - ENDIF(f) - ENDFOREACH(f ${var}) - SET_TARGET_PROPERTIES(${name} PROPERTIES COMPILE_FLAGS "${flags}") - ''') - return - - def addLibTarget(self, key, newlines): - newlines.append(r''' - FOREACH(amname ${%s}) - '''%(key)) - # -- - # Replace .la by _la ... - # -- - newlines.append(r''' - STRING(REPLACE .la _la amname ${amname}) - ''') - # -- - # Remove the _la for the cmake name - # -- - newlines.append(r''' - STRING(LENGTH ${amname} len) - MATH(EXPR newlen "${len}-3") - STRING(SUBSTRING ${amname} 0 ${newlen} name) - ''') - # -- - # Does the target begins with lib ?? - # If yes, remove lib at beginning for cmake name - # -- - newlines.append(r''' - STRING(REGEX MATCH "^lib" BEGIN_WITH_lib ${name}) - IF(BEGIN_WITH_lib) - STRING(LENGTH ${name} len) - MATH(EXPR newlen "${len}-3") - STRING(SUBSTRING ${name} 3 ${newlen} name) - ENDIF(BEGIN_WITH_lib) - ''') - # -- - # Does the target is an idl library - # -- - newlines.append(r''' - STRING(REGEX MATCH "IDL" ISIDL ${name}) - ''') - # -- - # Set the type of the library - # -- - newlines.append(r''' - IF(ISIDL) - IF(WINDOWS) - SET(type STATIC) - ELSE(WINDOWS) - SET(type SHARED) - ENDIF(WINDOWS) - ELSE(ISIDL) - SET(type SHARED) - ENDIF(ISIDL) - ''') - if key == "noinst_LTLIBRARIES": - newlines.append(r''' - IF(WINDOWS) - SET(type STATIC) - ELSE(WINDOWS) - SET(type STATIC) - ENDIF(WINDOWS) - ''') - pass - # -- - # Set sources for the library - # -- - newlines.append(r''' - SET(srcs) - FOREACH(src ${${amname}_SOURCES} ${dist_${amname}_SOURCES}) - GET_FILENAME_COMPONENT(ext ${src} EXT) - IF(ext STREQUAL .f) - IF(src STREQUAL trte.f) - SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${src}) - STRING(REPLACE ".f" ".c" src ${src}) - SET(src ${CMAKE_CURRENT_BINARY_DIR}/${src}) - SET(output ${src}) - SET(cmd f2c) - IF(NOT WINDOWS) - IF(CMAKE_SIZEOF_VOID_P STREQUAL 8) - SET(cmd valgrind f2c) # f2c seems to be buggy on 64 bits ... but with valgrind, it works :) - ENDIF() - ENDIF(NOT WINDOWS) - ADD_CUSTOM_COMMAND( - OUTPUT ${output} - COMMAND ${cmd} ${input} - MAIN_DEPENDENCY ${input} - ) - ELSE(src STREQUAL trte.f) - SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${src}) - STRING(REPLACE ".f" ".o" src ${src}) - SET(src ${CMAKE_CURRENT_BINARY_DIR}/${src}) - SET(output ${src}) - IF(WINDOWS) - SET(F77 g77) - ELSE(WINDOWS) - SET(F77 gfortran) - ENDIF(WINDOWS) - ADD_CUSTOM_COMMAND( - OUTPUT ${output} - COMMAND ${F77} -c -o ${output} ${input} - MAIN_DEPENDENCY ${input} - ) - ENDIF(src STREQUAL trte.f) - ENDIF(ext STREQUAL .f) - SET(srcs ${srcs} ${src}) - ENDFOREACH(src ${${amname}_SOURCES} ${dist_${amname}_SOURCES}) - ''') - newlines.append(r''' - SET(l ${nodist_${amname}_SOURCES} ${UIC_FILES}) - FOREACH(f ${l}) - SET(src ${CMAKE_CURRENT_BINARY_DIR}/${f}) - SET(srcs ${srcs} ${src}) - ENDFOREACH(f ${l}) - ''') - newlines.append(r''' - SET(build_srcs) - SET(l ${nodist_${amname}_SOURCES} ${BUILT_SOURCES}) - FOREACH(f ${l}) - GET_FILENAME_COMPONENT(ext ${f} EXT) - IF(ext STREQUAL .py) - SET(fff) - ELSE(ext STREQUAL .py) - SET(fff ${CMAKE_CURRENT_BINARY_DIR}/${f}) - ENDIF(ext STREQUAL .py) - IF(fff) - IF(build_srcs) - LIST(FIND build_srcs ${fff} index) - IF(NOT index EQUAL -1) - SET(fff) - ENDIF(NOT index EQUAL -1) - ENDIF(build_srcs) - ENDIF(fff) - IF(fff) - SET(build_srcs ${build_srcs} ${fff}) - ENDIF(fff) - ENDFOREACH(f ${l}) - ''') - # -- - # Add the library to cmake - # -- - newlines.append(r''' - ADD_LIBRARY(${name} ${type} ${srcs}) - ''') - # -- - # The compilation flags - # -- - self.setCompilationFlags(key, newlines) - # -- - newlines.append(r''' - SET_TARGET_PROPERTIES(${name} PROPERTIES VERSION ${VERSION_INFO} SOVERSION ${SOVERSION_INFO}) - ''') - # -- - self.setLibAdd(key, newlines) - # -- - if 1: # key != "noinst_LTLIBRARIES": - newlines.append(r''' - SET(key %s) - '''%(key)) - newlines.append(r''' - SET(test ON) - IF(${key} STREQUAL noinst_LTLIBRARIES) - SET(test OFF) - ENDIF(${key} STREQUAL noinst_LTLIBRARIES) - ''') - if self.module == "netgen" : - newlines.append(r''' - IF(${key} STREQUAL noinst_LTLIBRARIES) - IF(WINDOWS) - SET(test ON) - ENDIF(WINDOWS) - ENDIF(${key} STREQUAL noinst_LTLIBRARIES) - ''') - pass - newlines.append(r''' - IF(test) - ''') - if self.module in ["medfile", "netgen"]: - newlines.append(r''' - SET(DEST lib) - ''') - else: - newlines.append(r''' - SET(DEST lib/salome) - ''') - pass - newlines.append(r''' - IF(BEGIN_WITH_lib) - INSTALL(TARGETS ${name} DESTINATION ${DEST}) - ''') - if self.module == "gui": - newlines.append(r''' - FOREACH(lib SalomePyQt) - IF(name STREQUAL lib) - IF(WINDOWS) - IF(CMAKE_BUILD_TYPE STREQUAL Release) - INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME ${name}.pyd) - ELSE(CMAKE_BUILD_TYPE STREQUAL Release) - INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME ${name}_d.pyd) - ENDIF(CMAKE_BUILD_TYPE STREQUAL Release) - ELSE(WINDOWS) - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so DESTINATION ${DEST} RENAME ${name}.so) - ENDIF(WINDOWS) - ENDIF(name STREQUAL lib) - ENDFOREACH(lib SalomePyQt) - FOREACH(lib SalomePy) - IF(name STREQUAL lib) - IF(WINDOWS) - IF(CMAKE_BUILD_TYPE STREQUAL Release) - INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME lib${name}.pyd) - ELSE(CMAKE_BUILD_TYPE STREQUAL Release) - INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME lib${name}_d.pyd) - ENDIF(CMAKE_BUILD_TYPE STREQUAL Release) - ENDIF(WINDOWS) - ENDIF(name STREQUAL lib) - ENDFOREACH(lib SalomePy) - ''') - pass - if self.module == "geom": - newlines.append(r''' - IF(WINDOWS) - STRING(REGEX MATCH "Export" ISExport ${name}) - IF(ISExport) - INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME lib${name}.dll) - ENDIF(ISExport) - STRING(REGEX MATCH "Import" ISImport ${name}) - IF(ISImport) - INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME lib${name}.dll) - ENDIF(ISImport) - ENDIF(WINDOWS) - ''') - pass - newlines.append(r''' - ELSE(BEGIN_WITH_lib) - ''') - newlines.append(r''' - IF(WINDOWS) - INSTALL(TARGETS ${name} DESTINATION ${salomepythondir}) - IF(CMAKE_BUILD_TYPE STREQUAL Release) - INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${salomepythondir}/${name}.dll DESTINATION ${salomepythondir} RENAME ${name}.pyd) - ELSE(CMAKE_BUILD_TYPE STREQUAL Release) - INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${salomepythondir}/${name}.dll DESTINATION ${salomepythondir} RENAME ${name}_d.pyd) - ENDIF(CMAKE_BUILD_TYPE STREQUAL Release) - ELSE(WINDOWS) - GET_TARGET_PROPERTY(version ${name} VERSION) - GET_TARGET_PROPERTY(soversion ${name} SOVERSION) - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so.${version} DESTINATION ${salomepythondir} RENAME ${name}.so.${version}) - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so.${version} DESTINATION ${salomepythondir} RENAME ${name}.so.${soversion}) - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so.${version} DESTINATION ${salomepythondir} RENAME ${name}.so) - ENDIF(WINDOWS) - ''') - newlines.append(r''' - ENDIF(BEGIN_WITH_lib) - ''') - newlines.append(r''' - ENDIF(test) - ''') - pass - # -- - newlines.append(r''' - ENDFOREACH(amname ${%s}) - '''%(key)) - # -- - return - - def addBinTarget(self, key, newlines): - # -- - newlines.append(r''' - FOREACH(amname ${%s}) - '''%(key)) - # -- - newlines.append(r''' - SET(test ON) - ''') - if key == "check_PROGRAMS": - newlines.append(r''' - IF(bin_PROGRAMS) - STRING(REGEX MATCH ${amname} is_present ${bin_PROGRAMS}) - IF(is_present) - SET(test OFF) - ENDIF(is_present) - ENDIF(bin_PROGRAMS) - ''') - pass - newlines.append(r''' - IF(test) - ''') - # -- - newlines.append(r''' - SET(name "${amname}_exe") - SET(srcs ${${amname}_SOURCES} ${dist_${amname}_SOURCES}) - SET(l ${nodist_${amname}_SOURCES}) - FOREACH(f ${l}) - SET(src ${CMAKE_CURRENT_BINARY_DIR}/${f}) - SET(srcs ${srcs} ${src}) - ENDFOREACH(f ${l}) - LIST(LENGTH srcs nb) - IF(nb) - ADD_EXECUTABLE(${name} ${srcs}) - ''') - # -- - self.setCompilationFlags(key, newlines) - # -- - self.setLibAdd(key, newlines) - # -- - if self.module in ["jobmanager", "medfile", "netgen"]: - newlines.append(r''' - SET(DEST bin) - ''') - else: - newlines.append(r''' - SET(DEST bin/salome) - ''') - pass - # -- - if key == "bin_PROGRAMS": - newlines.append(r''' - IF(WINDOWS) - INSTALL(TARGETS ${name} DESTINATION ${DEST}) - INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.exe DESTINATION ${DEST} RENAME ${amname}.exe) - INSTALL(CODE "FILE(REMOVE ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.exe)") - ELSE(WINDOWS) - SET(PERMS) - SET(PERMS ${PERMS} OWNER_READ OWNER_WRITE OWNER_EXECUTE) - SET(PERMS ${PERMS} GROUP_READ GROUP_EXECUTE) - SET(PERMS ${PERMS} WORLD_READ WORLD_EXECUTE) - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${name} DESTINATION ${DEST} PERMISSIONS ${PERMS} RENAME ${amname}) - ENDIF(WINDOWS) - ''') - pass - # -- - newlines.append(r''' - ENDIF(nb) - ''') - # -- - newlines.append(r''' - ENDIF(test) - ''') - newlines.append(r''' - ENDFOREACH(amname ${%s}) - '''%(key)) - # -- - return - - def addInstallTarget(self, key, destination, newlines): - newlines.append(r"FOREACH(f ${%s})"%(key)) - newlines.append(r''' - SET(DEST %s) - '''%(destination)) - newlines.append(r''' - STRING(COMPARE EQUAL ${f} SALOMEconfig.h.in test_SALOMEconfig.h.in) - IF(test_SALOMEconfig.h.in) - INSTALL(FILES SALOMEconfig.ref.in DESTINATION ${DEST} RENAME SALOMEconfig.h.in) - ELSE(test_SALOMEconfig.h.in) - SET(dummy dummy-NOTFOUND) - MARK_AS_ADVANCED(dummy) - # FILE(REMOVE ${CMAKE_INSTALL_PREFIX}/${DEST}/${f}) - FIND_FILE(dummy ${f} PATHS ${CMAKE_CURRENT_SOURCE_DIR} NO_DEFAULT_PATH) - IF(dummy) - ''') - if key in ['dist_salomescript_SCRIPTS']: - newlines.append(r''' - SET(PERMS) - SET(PERMS ${PERMS} OWNER_READ OWNER_WRITE OWNER_EXECUTE) - SET(PERMS ${PERMS} GROUP_READ GROUP_EXECUTE) - SET(PERMS ${PERMS} WORLD_READ WORLD_EXECUTE) - INSTALL(FILES ${f} DESTINATION ${DEST} PERMISSIONS ${PERMS}) - ''') - else: - newlines.append(r''' - GET_FILENAME_COMPONENT(ext ${f} EXT) - IF(ext STREQUAL .py) - IF(DEST STREQUAL bin/salome) - SET(PERMS) - SET(PERMS ${PERMS} OWNER_READ OWNER_WRITE OWNER_EXECUTE) - SET(PERMS ${PERMS} GROUP_READ GROUP_EXECUTE) - SET(PERMS ${PERMS} WORLD_READ WORLD_EXECUTE) - INSTALL(FILES ${f} DESTINATION ${DEST} PERMISSIONS ${PERMS}) - ELSE(DEST STREQUAL bin/salome) - INSTALL(FILES ${f} DESTINATION ${DEST}) - ENDIF(DEST STREQUAL bin/salome) - ELSE(ext STREQUAL .py) - INSTALL(FILES ${f} DESTINATION ${DEST}) - ENDIF(ext STREQUAL .py) - ''') - pass - newlines.append(r''' - ELSE(dummy) - GET_FILENAME_COMPONENT(ext ${f} EXT) - IF(ext STREQUAL .qm) - STRING(REGEX REPLACE .qm .ts input ${f}) - ''') - if self.module in ["kernel", "gui", "yacs"]: - newlines.append(r''' - SET(input ${CMAKE_CURRENT_SOURCE_DIR}/resources/${input}) - ''') - else: - newlines.append(r''' - SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input}) - ''') - pass - newlines.append(r''' - SET(output ${CMAKE_CURRENT_BINARY_DIR}/${f}) - # ADD_CUSTOM_COMMAND( - # OUTPUT ${output} - # COMMAND ${QT_LRELEASE_EXECUTABLE} ${input} -qm ${output} - # MAIN_DEPENDENCY ${input} - # ) - EXECUTE_PROCESS(COMMAND ${QT_LRELEASE_EXECUTABLE} ${input} -qm ${output}) - ENDIF(ext STREQUAL .qm) - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${f} DESTINATION ${DEST}) - ENDIF(dummy) - ENDIF(test_SALOMEconfig.h.in) - ''') - newlines.append(r''' - GET_FILENAME_COMPONENT(ext ${f} EXT) - IF(ext STREQUAL .py) - INSTALL(CODE "SET(PYTHON_FILE ${f})") - INSTALL(CODE "SET(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})") - INSTALL(CODE "SET(DEST ${DEST})") - INSTALL(CODE "SET(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE})") - ''') - if self.module == "kernel": - newlines.append(''' - IF(f STREQUAL SALOME_ContainerPy.py) - ELSE(f STREQUAL SALOME_ContainerPy.py) - IF(f STREQUAL am2cmake.py) - ELSE(f STREQUAL am2cmake.py) - IF(f STREQUAL copytree1.py) - ELSE(f STREQUAL copytree1.py) - INSTALL(SCRIPT ${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/install_and_compile_python_file.cmake) - ENDIF(f STREQUAL copytree1.py) - ENDIF(f STREQUAL am2cmake.py) - ENDIF(f STREQUAL SALOME_ContainerPy.py) - ''') - else: - newlines.append(''' - STRING(REPLACE "\\\\" "/" KERNEL_ROOT_DIR ${KERNEL_ROOT_DIR}) - INSTALL(SCRIPT ${KERNEL_ROOT_DIR}/salome_adm/cmake_files/install_and_compile_python_file.cmake) - ''') - pass - newlines.append(r''' - ENDIF(ext STREQUAL .py) - ''') - newlines.append(r"ENDFOREACH(f ${%s})"%(key)) - return - - def writeListsFile(self): - f = open(self.listsFile, "w") - f.write(self.content) - f.close() - return - - pass - -def convertAmFile(the_root, root, dirs, files, f, module): - cmake = CMakeFile(the_root, root, dirs, files, f, module) - cmake.writeListsFile() - return - -def usage(exit_status): - from sys import exit - from sys import argv - print "Usage: %s --module"%(argv[0]) - exit(exit_status) - return - -if __name__ == "__main__": - # - from sys import argv - if len(argv) != 2: - usage(1) - pass - # - module = argv[1] - if module.find('--') != 0: - usage(1) - pass - module = module[2:] - if len(module) == 0: - usage(1) - pass - # - from os import getcwd - the_root = getcwd() - # - nok = 0 - # - from os import walk - for root, dirs, files in walk(the_root): - # -- - # E.A. : Remove 'CVS' in dirs - # E.A. : It allows to not recurse in CVS dirs - # E.A. : See os module python documentation - # -- - try: - dirs.remove('CVS') - except ValueError: - pass - # -- - if "Makefile.am.cmake" in files: - if "Makefile.am" in files: - files.remove("Makefile.am") - pass - pass - # -- - from sys import stdout - for f in files: - if f in ["Makefile.am", "Makefile.am.cmake"]: - convertAmFile(the_root, root, dirs, files, f, module) - nok += 1 - pass - pass - pass - # - if nok: - if nok == 1: - msg = "%s file has been converted to cmake"%(nok) - else: - msg = "%s files have been converted to cmake"%(nok) - pass - stdout.write(msg) - stdout.write("\n") - stdout.flush() - pass - pass -- 2.39.2