From 7e95890341926d3ecb14dba059ab0a8285a4a5f8 Mon Sep 17 00:00:00 2001 From: nge Date: Wed, 23 Jan 2013 17:49:37 +0000 Subject: [PATCH] 1. Be able to specify prereusite product by PRODUCT_ROOT_DIR. 2. usr_docs generated and installed at installation step (no make usr_docs" needed) --- CMakeLists.txt | 79 +++++++++++++++++++++++++++++------ doc/docutils/CMakeLists.txt | 26 +++++++----- doc/salome/gui/CMakeLists.txt | 11 ++--- 3 files changed, 88 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f067c34f..4ac10ef56 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # +PROJECT(SALOME_KERNEL) CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR) @@ -65,6 +66,12 @@ 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}) @@ -72,27 +79,49 @@ 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_DIR $ENV{LIBXML2_DIR} CACHE PATH "Path to LibXml2 directory") -if(EXISTS ${LIBXML2_DIR}) - set(CMAKE_INCLUDE_PATH ${LIBXML2_DIR}/include) - set(CMAKE_LIBRARY_PATH ${LIBXML2_DIR}/lib) -endif(EXISTS ${LIBXML2_DIR}) +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.8") - message(FATAL_ERROR "LIbXml2 required version is 2.7.8, version is ${LIBXML2_VERSION_STRING} , please defined LIBXML2_DIR as environment or cmake variable") + message(FATAL_ERROR "LIbXml2 required version is 2.7.8, version is ${LIBXML2_VERSION_STRING} , please defined LIBXML2_ROOT_DIR as environment or cmake variable") endif(${LIBXML2_VERSION_STRING} VERSION_LESS "2.7.8") # 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 -D_HDF5USEDLL_ ${HDF5_DEFINITIONS}" ) + set(HDF5_DEFINITIONS "-DH5_USE_16_API ${HDF5_DEFINITIONS}" ) + if(WINDOWS) + set(HDF5_DEFINITIONS "-D_HDF5USEDLL_ ${HDF5_DEFINITIONS}" ) + endif(WINDOWS) endif(HDF5_FOUND) # MPI 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} ) @@ -106,6 +135,11 @@ if(SALOME_USE_CORBA) 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) @@ -117,11 +151,28 @@ 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(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindCPPUNIT.cmake) endif(SALOME_USE_TEST) -# Doxygen +# 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) endif(SALOME_USE_DOC) @@ -132,6 +183,10 @@ endif(SALOME_USE_LIBBATCH) # 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(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindSPHINX.cmake) endif(SALOME_USE_DOC) @@ -184,12 +239,12 @@ IF(NOT WITHONLYLAUNCHER) ADD_SUBDIRECTORY(salome_adm) ENDIF(NOT WITHONLYLAUNCHER) -IF(SALOME_USE_DOC) - ADD_SUBDIRECTORY(doc) -ENDIF(SALOME_USE_DOC) - SET(input ${CMAKE_CURRENT_SOURCE_DIR}/KERNEL_version.h.in) SET(output ${CMAKE_CURRENT_BINARY_DIR}/KERNEL_version.h) MESSAGE(STATUS "Creation of ${output}") CONFIGURE_FILE(${input} ${output} @ONLY) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/KERNEL_version.h DESTINATION ${KERNEL_salomeinclude_HEADERS}) + +IF(SALOME_USE_DOC) + ADD_SUBDIRECTORY(doc) +ENDIF(SALOME_USE_DOC) diff --git a/doc/docutils/CMakeLists.txt b/doc/docutils/CMakeLists.txt index 71b6d67fb..f375abfc4 100755 --- a/doc/docutils/CMakeLists.txt +++ b/doc/docutils/CMakeLists.txt @@ -37,22 +37,24 @@ SET(ALLSPHINXOPTS SALOME_CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in" "${CMAKE_CURRENT_BINARY_DIR}/conf.py") IF(WINDOWS) - STRING(REPLACE "/" "\\" SCR "@SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}\\lib\\python2.6\\site-packages\\salome\;%PYTHONPATH% + STRING(REPLACE "/" "\\" SCR "@SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}\\lib\\python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}\\site-packages\\salome\;%PYTHONPATH% @SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}\\bin\\salome\;%PYTHONPATH% @SET PATH=${CMAKE_INSTALL_PREFIX}\\lib\\salome\;%PATH% - @SET PYTHONPATH=${OMNIORB_ROOT_USER}\\lib\\x86_win32\;%PYTHONPATH% - @SET PYTHONPATH=${OMNIORB_ROOT_USER}\\lib\\python\;%PYTHONPATH% - @SET PATH=${OMNIORB_ROOT_USER}\\lib\\x86_win32\;%PATH% + @SET PYTHONPATH=${OMNIORB_ROOT_DIR}\\lib\\x86_win32\;%PYTHONPATH% + @SET PYTHONPATH=${OMNIORB_ROOT_DIR}\\lib\\python\;%PYTHONPATH% + @SET PATH=${OMNIORB_ROOT_DIR}\\lib\\x86_win32\;%PATH% ") SET(EXT "bat") SET(CALL_STR "call") ELSE(WINDOWS) - SET(SCR "export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/lib/python2.6/site-packages/salome:\${PYTHONPATH} + SET(SCR " export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/salome:\${PYTHONPATH} export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/bin/salome:\${PYTHONPATH} export LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib/salome:\${LD_LIBRARY_PATH} - export PYTHONPATH=${OMNIORB_ROOT_USER}/lib:\${PYTHONPATH} - export PYTHONPATH=${OMNIORB_ROOT_USER}/lib/python2.6/site-packages:\${PYTHONPATH} - export LD_LIBRARY_PATH=${OMNIORB_ROOT_USER}/lib:\${LD_LIBRARY_PATH} + export PYTHONPATH=${OMNIORB_ROOT_DIR}/lib:\${PYTHONPATH} + export PYTHONPATH=${OMNIORB_ROOT_DIR}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages:\${PYTHONPATH} + export PYTHONPATH=${OMNIORBPY_ROOT_DIR}/lib:\${PYTHONPATH} + export PYTHONPATH=${OMNIORBPY_ROOT_DIR}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages:\${PYTHONPATH} + export LD_LIBRARY_PATH=${OMNIORB_ROOT_DIR}/lib:\${LD_LIBRARY_PATH} ") SET(EXT "sh") SET(CALL_STR ".") @@ -60,7 +62,9 @@ ENDIF(WINDOWS) FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/env_s.${EXT} "${SCR}") -ADD_CUSTOM_TARGET(html_docs ${CALL_STR} ${CMAKE_CURRENT_BINARY_DIR}/env_s.${EXT} && ${SPHINX_EXECUTABLE} -c ${CMAKE_BINARY_DIR}/doc/docutils -b html ${ALLSPHINXOPTS} html - COMMAND ${PYTHON_EXECUTABLE} -c \"import shutil\;shutil.rmtree('''${CMAKE_INSTALL_PREFIX}/share/doc/salome/tui/KERNEL/docutils''', True)\;shutil.copytree('''${CMAKE_CURRENT_BINARY_DIR}/html''', '''${CMAKE_INSTALL_PREFIX}/share/doc/salome/tui/KERNEL/docutils''')\" - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +ADD_CUSTOM_TARGET(html_docs ${CALL_STR} ${CMAKE_CURRENT_BINARY_DIR}/env_s.${EXT} && ${SPHINX_EXECUTABLE} -c ${CMAKE_BINARY_DIR}/doc/docutils -b html ${ALLSPHINXOPTS} docutils ) + +INSTALL(CODE "EXECUTE_PROCESS(COMMAND \"${CMAKE_COMMAND}\" --build ${CMAKE_CACHEFILE_DIR} --target html_docs)") +INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/docutils DESTINATION share/doc/salome/tui/KERNEL) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/doc/salome/tui/images/head.png DESTINATION share/doc/salome/tui/KERNEL) diff --git a/doc/salome/gui/CMakeLists.txt b/doc/salome/gui/CMakeLists.txt index 8bd8df903..8292cd85d 100755 --- a/doc/salome/gui/CMakeLists.txt +++ b/doc/salome/gui/CMakeLists.txt @@ -27,9 +27,10 @@ SET(docdir ${datadir}/doc/salome) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/doxyfile) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/static/header.html.in ${CMAKE_CURRENT_BINARY_DIR}/static/header.html) -ADD_CUSTOM_TARGET(usr_docs ${DOXYGEN_EXECUTABLE} - COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; shutil.rmtree(r'''${CMAKE_INSTALL_PREFIX}/share/doc/salome/gui/KERNEL''', True); shutil.copytree(r'''${CMAKE_CURRENT_BINARY_DIR}/KERNEL''', r'''${CMAKE_INSTALL_PREFIX}/share/doc/salome/gui/KERNEL'''); shutil.copy(r'''${CMAKE_CURRENT_SOURCE_DIR}/images/head.png''', r'''${CMAKE_INSTALL_PREFIX}/share/doc/salome/gui/KERNEL''')" - VERBATIM - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} -) +ADD_CUSTOM_TARGET(usr_docs ${DOXYGEN_EXECUTABLE}) + ADD_DEPENDENCIES(usr_docs html_docs) + +INSTALL(CODE "EXECUTE_PROCESS(COMMAND \"${CMAKE_COMMAND}\" --build ${CMAKE_CACHEFILE_DIR} --target usr_docs)") +INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/KERNEL DESTINATION share/doc/salome/gui) +INSTALL(FILES images/head.png DESTINATION share/doc/salome/gui/KERNEL) -- 2.39.2