ENDIF(EXISTS ${KERNEL_ROOT_DIR})
STRING(REPLACE "\\" "/" KERNEL_ROOT_DIR ${KERNEL_ROOT_DIR})
-INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPLATFORM.cmake)
+
+# directories for packages detection
+SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${KERNEL_ROOT_DIR}/salome_adm/cmake_files ${CMAKE_SOURCE_DIR}/adm_local/cmake_files)
+
+find_package(PLATFORM)
# Threads
find_package(Threads REQUIRED)
-# Python
-set(PYTHON_ROOT_DIR $ENV{PYTHON_ROOT_DIR} CACHE PATH "Path to Python directory")
-if(EXISTS ${PYTHON_ROOT_DIR})
- set(CMAKE_INCLUDE_PATH ${PYTHON_ROOT_DIR}/include)
- set(CMAKE_LIBRARY_PATH ${PYTHON_ROOT_DIR}/lib)
- set(CMAKE_PROGRAM_PATH ${PYTHON_ROOT_DIR}/bin)
-endif(EXISTS ${PYTHON_ROOT_DIR})
-find_package(PythonInterp REQUIRED)
-# Set PythonLibs_FIND_VERSION To avoid problems when several versions are in the system
-SET(PythonLibs_FIND_VERSION ${PYTHON_VERSION_STRING})
-find_package(PythonLibs REQUIRED)
-set(PYLOGLEVEL WARNING)
-
-# Swig
-set(SWIG_ROOT_DIR $ENV{SWIG_ROOT_DIR} CACHE PATH "Path to Swig directory")
-if(EXISTS ${SWIG_ROOT_DIR})
- set(CMAKE_INCLUDE_PATH ${SWIG_ROOT_DIR}/include)
- set(CMAKE_LIBRARY_PATH ${SWIG_ROOT_DIR}/lib)
- set(CMAKE_PROGRAM_PATH ${SWIG_ROOT_DIR}/bin)
-endif(EXISTS ${SWIG_ROOT_DIR})
-find_package(SWIG REQUIRED)
-
-# LIBXML2
-set(LIBXML2_ROOT_DIR $ENV{LIBXML2_ROOT_DIR} CACHE PATH "Path to LibXml2 directory")
-if(EXISTS ${LIBXML2_ROOT_DIR})
- set(CMAKE_INCLUDE_PATH ${LIBXML2_ROOT_DIR}/include)
- set(CMAKE_LIBRARY_PATH ${LIBXML2_ROOT_DIR}/lib)
- set(CMAKE_PROGRAM_PATH ${LIBXML2_ROOT_DIR}/bin)
-endif(EXISTS ${LIBXML2_ROOT_DIR})
-find_package(LibXml2 REQUIRED)
-if(${LIBXML2_VERSION_STRING} VERSION_LESS "2.7.6")
- message(FATAL_ERROR "LIbXml2 required version is 2.7.6, version is ${LIBXML2_VERSION_STRING} , please defined LIBXML2_ROOT_DIR as environment or cmake variable")
-endif(${LIBXML2_VERSION_STRING} VERSION_LESS "2.7.6")
-
-
-# HDF5
-set(HDF5_ROOT_DIR $ENV{HDF5_ROOT_DIR} CACHE PATH "Path to Hdf5 directory")
-if(EXISTS ${HDF5_ROOT_DIR})
- set(CMAKE_INCLUDE_PATH ${HDF5_ROOT_DIR}/include)
- set(CMAKE_LIBRARY_PATH ${HDF5_ROOT_DIR}/lib)
- set(CMAKE_PROGRAM_PATH ${HDF5_ROOT_DIR}/bin)
-endif(EXISTS ${HDF5_ROOT_DIR})
-find_package(HDF5 COMPONENTS C REQUIRED)
-if (HDF5_FOUND)
- set(HDF5_DEFINITIONS "-DH5_USE_16_API ${HDF5_DEFINITIONS}" )
- if(WINDOWS)
- set(HDF5_DEFINITIONS "-D_HDF5USEDLL_ ${HDF5_DEFINITIONS}" )
- endif(WINDOWS)
-endif(HDF5_FOUND)
-
-# MPI
+# required prerequisites from KERNEL
+
+find_package(SalomePYTHON)
+find_package(SalomeSWIG)
+find_package(SalomeLIBXML2)
+find_package(SalomeHDF5)
+find_package(SalomeBOOST)
+
+# required prerequisites for GUI
+
+find_package(SalomeQT4)
+find_package(SalomeSIP)
+find_package(SalomePYQT4)
+
+# optional prerequisites from KERNEL
+
if(SALOME_USE_MPI OR HDF5_IS_PARALLEL)
- set(MPI_ROOT_DIR $ENV{MPI_ROOT_DIR} CACHE PATH "Path to Mpi directory")
- if(EXISTS ${MPI_ROOT_DIR})
- set(CMAKE_INCLUDE_PATH ${MPI_ROOT_DIR}/include)
- set(CMAKE_LIBRARY_PATH ${MPI_ROOT_DIR}/lib)
- set(CMAKE_PROGRAM_PATH ${MPI_ROOT_DIR}/bin)
- endif(EXISTS ${MPI_ROOT_DIR})
- find_package(MPI REQUIRED)
- if(HDF5_IS_PARALLEL)
- set(HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIRS} ${MPI_C_INCLUDE_PATH} ${MPI_CXX_INCLUDE_PATH} )
- set(HDF5_LIBRARIES ${HDF5_LIBRARIES} ${MPI_C_LIBRARIES} ${MPI_CXX_LIBRARIES})
- endif(HDF5_IS_PARALLEL)
+ find_package(SalomeMPI)
endif(SALOME_USE_MPI OR HDF5_IS_PARALLEL)
-# Omniorb
if(SALOME_USE_CORBA)
- INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindOMNIORB.cmake)
+ find_package(OMNIORB)
endif(SALOME_USE_CORBA)
-# Boost
-set(Boost_ROOT_DIR $ENV{Boost_ROOT_DIR} CACHE PATH "Path to Boost directory")
-if(EXISTS ${Boost_ROOT_DIR})
- set(CMAKE_INCLUDE_PATH ${Boost_ROOT_DIR}/include)
- set(CMAKE_LIBRARY_PATH ${Boost_ROOT_DIR}/lib)
-endif(EXISTS ${Boost_ROOT_DIR})
-set(Boost_USE_STATIC_LIBS OFF)
-set(Boost_USE_MULTITHREADED ON)
-set(Boost_USE_STATIC_RUNTIME OFF)
-#find_package( Boost 1.49 REQUIRED )#COMPONENTS thread date_time signals filesystem system)
-find_package( Boost REQUIRED )#COMPONENTS thread date_time signals filesystem system)
-if(WINDOWS)
- set(BOOST_DEFINITIONS -DBOOST_DISABLE_ASSERTS)
-endif(WINDOWS)
-
-# CPPUNIT
if(SALOME_USE_TEST)
- set(CPPUNIT_ROOT_DIR $ENV{CPPUNIT_ROOT_DIR} CACHE PATH "Path to Cppunit directory")
- if(EXISTS ${CPPUNIT_ROOT_DIR})
- set(CMAKE_INCLUDE_PATH ${CPPUNIT_ROOT_DIR}/include)
- set(CMAKE_LIBRARY_PATH ${CPPUNIT_ROOT_DIR}/lib)
- set(CMAKE_PROGRAM_PATH ${CPPUNIT_ROOT_DIR}/bin)
- endif(EXISTS ${CPPUNIT_ROOT_DIR})
- INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindCPPUNIT.cmake)
+ find_package(SalomeCPPUNIT)
endif(SALOME_USE_TEST)
-# Doxygen and graphviz
if(SALOME_USE_DOC)
- set(DOXYGEN_ROOT_DIR $ENV{DOXYGEN_ROOT_DIR} CACHE PATH "Path to Doxygen directory")
- set(GRAPHVIZ_ROOT_DIR $ENV{GRAPHVIZ_ROOT_DIR} CACHE PATH "Path to Graphviz directory")
- if(EXISTS ${DOXYGEN_ROOT_DIR})
- set(CMAKE_PROGRAM_PATH ${DOXYGEN_ROOT_DIR}/bin)
- endif(EXISTS ${DOXYGEN_ROOT_DIR})
- if(EXISTS ${GRAPHVIZ_ROOT_DIR})
- set(CMAKE_PROGRAM_PATH ${GRAPHVIZ_ROOT_DIR}/bin)
- if(EXISTS ${DOXYGEN_ROOT_DIR})
- set(CMAKE_PROGRAM_PATH ${GRAPHVIZ_ROOT_DIR}/bin ${DOXYGEN_ROOT_DIR}/bin)
- endif(EXISTS ${DOXYGEN_ROOT_DIR})
- endif(EXISTS ${GRAPHVIZ_ROOT_DIR})
- find_package(Doxygen)
+ find_package(SalomeDOXYGEN)
+ find_package(SalomeSPHINX)
endif(SALOME_USE_DOC)
-# Sphinx
-if(SALOME_USE_DOC)
- set(SPHINX_ROOT_DIR $ENV{SPHINX_ROOT_DIR} CACHE PATH "Path to Sphinx directory")
- if(EXISTS ${SPHINX_ROOT_DIR})
- set(CMAKE_PROGRAM_PATH ${SPHINX_ROOT_DIR}/bin)
- endif(EXISTS ${SPHINX_ROOT_DIR})
- INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSPHINX.cmake)
-endif(SALOME_USE_DOC)
+if(SALOME_USE_LIBBATCH)
+ find_package(LIBBATCH)
+endif(SALOME_USE_LIBBATCH)
+
+
+# optional prerequisites for GUI
-# Qt 4
-#set(QT_MIN_VERSION 4.8.0)
-set(QT_ROOT_DIR $ENV{QT_ROOT_DIR} CACHE PATH "Path to Qt directory")
-if(EXISTS ${QT_ROOT_DIR})
- set(CMAKE_INCLUDE_PATH ${QT_ROOT_DIR}/include)
- set(CMAKE_LIBRARY_PATH ${QT_ROOT_DIR}/lib)
- set(CMAKE_PROGRAM_PATH ${QT_ROOT_DIR}/bin)
-endif(EXISTS ${QT_ROOT_DIR})
-find_package(Qt4 REQUIRED QtCore QtGui QtXml QtWebKit QtOpenGL)
-IF(NOT QT4_FOUND)
- MESSAGE(FATAL_ERROR "Qt4 not found, please set QT_ROOT_DIR environment or cmake variable")
-ELSE(NOT QT4_FOUND})
- INCLUDE(${QT_USE_FILE})
-ENDIF(NOT QT4_FOUND)
-
-# OpenCascade
if(SALOME_USE_OCCVIEWER)
- set(CAS_ROOT_DIR $ENV{CAS_ROOT_DIR} CACHE PATH "Path to OpenCascade directory")
- if(EXISTS ${CAS_ROOT_DIR})
- set(CMAKE_INCLUDE_PATH ${CAS_ROOT_DIR}/inc)
- set(CMAKE_PROGRAM_PATH ${CAS_ROOT_DIR}/bin)
- if(WINDOWS)
- if(CMAKE_BUILD_TYPE STREQUAL Debug)
- set(CMAKE_LIBRARY_PATH ${CAS_ROOT}/win32/libd)
- else(CMAKE_BUILD_TYPE STREQUAL Debug)
- set(CMAKE_LIBRARY_DIR ${CAS_ROOT}/win32/lib)
- endif(CMAKE_BUILD_TYPE STREQUAL Debug)
- else(WINDOWS)
- set(CMAKE_LIBRARY_PATH ${CAS_ROOT_DIR}/lib)
- endif(WINDOWS)
- endif(EXISTS ${CAS_ROOT_DIR})
- INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindCAS.cmake)
+ find_package(SalomeCAS)
endif(SALOME_USE_OCCVIEWER)
-# OpenGL
if(SALOME_USE_GLVIEWER)
find_package(OpenGL REQUIRED)
endif(SALOME_USE_GLVIEWER)
-# VTK
if(SALOME_USE_VTKVIEWER)
- set(PARAVIEW_ROOT_DIR $ENV{PARAVIEW_ROOT_DIR} CACHE PATH "Path to ParaView directory")
- set(PARAVIEW_VERSION $ENV{PARAVIEW_VERSION} CACHE STRING "Version of Paraview")
- if(EXISTS ${PARAVIEW_ROOT_DIR})
- set(VTK_DIR ${PARAVIEW_ROOT_DIR}/lib/paraview-${PARAVIEW_VERSION} CACHE PATH "Path to directory including VTKConfig.cmake")
- endif(EXISTS ${PARAVIEW_ROOT_DIR})
- find_package(VTK REQUIRED)
- if (VTK_FOUND)
- include(${VTK_USE_FILE})
- message(STATUS "VTK version is ${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}")
- message(STATUS "Kit VTK availables : ${VTK_KITS}")
- message(STATUS "VTK Library dir is : ${VTK_LIBRARY_DIRS}")
- set(CMAKE_LIBRARY_PATH ${VTK_LIBRARY_DIRS})
- set(VTK_LIBSWENEED vtkCommon vtkGraphics vtkImaging vtkFiltering vtkIO vtkRendering vtkHybrid vtkParallel vtkWidgets vtkInfovis vtkVolumeRendering)
- unset(VTK_LIBRARIES)
- foreach(VTK_LIB_NEEDED ${VTK_LIBSWENEED})
- unset(VTK_LIB CACHE)
- find_library(VTK_LIB ${VTK_LIB_NEEDED})
- set(VTK_LIBRARIES ${VTK_LIBRARIES} ${VTK_LIB})
- endforeach(VTK_LIB_NEEDED)
- find_library(vtkCommonPythonD vtkCommonPythonD)
- find_library(vtkGraphicsPythonD vtkGraphicsPythonD)
- find_library(vtkImagingPythonD vtkImagingPythonD)
- find_library(vtkPythonCore vtkPythonCore)
- endif(VTK_FOUND)
+ find_package(SalomeVTK)
endif(SALOME_USE_VTKVIEWER)
-# QWT
if(SALOME_USE_PLOT2DVIEWER)
- set(QWT_ROOT_DIR $ENV{QWT_ROOT_DIR} CACHE PATH "Path to Qwt directory")
- if(EXISTS ${QWT_ROOT_DIR})
- set(CMAKE_INCLUDE_PATH ${QWT_ROOT_DIR}/include)
- set(CMAKE_LIBRARY_PATH ${QWT_ROOT_DIR}/lib)
- set(CMAKE_PROGRAM_PATH ${QWT_ROOT_DIR}/bin)
- endif(EXISTS ${QWT_ROOT_DIR})
- INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindQWT.cmake)
+ find_package(SalomeQWT)
endif(SALOME_USE_PLOT2DVIEWER)
-# Sip
-set(SIP_ROOT_DIR $ENV{SIP_ROOT_DIR} CACHE PATH "Path to Sip directory")
-if(EXISTS ${SIP_ROOT_DIR})
- set(CMAKE_INCLUDE_PATH ${SIP_ROOT_DIR}/include/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} ${SIP_ROOT_DIR}/include)
- set(CMAKE_PROGRAM_PATH ${SIP_ROOT_DIR}/bin)
-endif(EXISTS ${SIP_ROOT_DIR})
-find_program(SIP_EXECUTABLE sip REQUIRED)
-find_path(SIP_INCLUDE_DIR sip.h REQUIRED HINTS /usr/include/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
-
-# PyQt4
-set(PYQT_ROOT_DIR $ENV{PYQT_ROOT_DIR} CACHE PATH "Path to PyQt4 directory")
-if(EXISTS ${PYQT_ROOT_DIR})
- set(CMAKE_INCLUDE_PATH ${PYQT_ROOT_DIR}/share/sip ${PYQT_ROOT_DIR}/sip)
- set(CMAKE_PROGRAM_PATH ${PYQT_ROOT_DIR}/bin)
-endif(EXISTS ${PYQT_ROOT_DIR})
-FIND_PROGRAM(PYQT_PYUIC_EXECUTABLE NAMES pyuic4 pyuic4.bat)
-FIND_PATH(PYQT_SIPS_DIR NAMES QtCore QtGui QtXml QtOpenGL QtAssistant QtDesigner QtNetwork QtSql QtSvg QtTest HINTS /usr/share/sip/PyQt4)
-SET(PYQT_PYTHONPATH "")
-if(EXISTS ${PYQT_ROOT_DIR})
- set(PYQT_PYTHONPATH ${PYQT_ROOT_DIR}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages)
-endif(EXISTS ${PYQT_ROOT_DIR})
-EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import sys; sys.path[:0] = ['${PYQT_PYTHONPATH}']; from PyQt4 import pyqtconfig; sys.stdout.write(pyqtconfig.Configuration().pyqt_sip_flags)"
- OUTPUT_VARIABLE PYQT_SIPFLAGS)
-SEPARATE_ARGUMENTS(PYQT_SIPFLAGS)
-SET(PYQT_SIPFLAGS ${PYQT_SIPFLAGS} -s .cc -c .
- -I ${PYQT_SIPS_DIR}
- -I ${PYQT_SIPS_DIR}/QtCore -I ${PYQT_SIPS_DIR}/QtGui -I ${PYQT_SIPS_DIR}/QtXml -I ${PYQT_SIPS_DIR}/QtOpenGL
- -I ${PYQT_SIPS_DIR}/QtAssistant -I ${PYQT_SIPS_DIR}/QtDesigner -I ${PYQT_SIPS_DIR}/QtNetwork -I ${PYQT_SIPS_DIR}/QtSql
- -I ${PYQT_SIPS_DIR}/QtSvg -I ${PYQT_SIPS_DIR}/QtTest )
-
EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import sys; t=sys.argv[-1].split(\".\") ; t[:]=(int(elt) for elt in t) ; sys.stdout.write(\"0x%02x%02x%02x\"%tuple(t))" ${VERSION}
OUTPUT_VARIABLE XVERSION)