3
0
mirror of https://github.com/triqs/dft_tools synced 2024-10-31 11:13:46 +01:00
dft_tools/doc/CMakeLists.txt
2013-09-08 22:13:04 +02:00

114 lines
4.5 KiB
CMake

# Should we use MathJax....
find_package(MathJax)
if (MATHJAX_PATH)
message(STATUS "Detected MathJax at ${MATHJAX_PATH}")
option(Sphinx_Math_Generator_MathJax " " ON)
else()
message(STATUS "MathJax not found automatically")
option(Sphinx_Math_Generator_MathJax " " OFF)
set(MATHJAX_PATH "MathJax" CACHE STRING "Path to the MathJax directory")
endif()
if (Sphinx_Math_Generator_MathJax)
set(SPHINX_MATH_GENERATOR "mathjax")
message(STATUS "Using MathJax")
else (Sphinx_Math_Generator_MathJax)
set(SPHINX_MATH_GENERATOR "pngmath")
message(STATUS "Not using MathJax")
endif (Sphinx_Math_Generator_MathJax)
# the local extensions....
file(COPY ../foreignlibs/breathe ../foreignlibs/doxylink ../foreignlibs/mpl ../foreignlibs/autocompile DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
# The compiler flags for autocompile
set(TRIQS_LIBRARY_ALL ${TRIQS_LIBRARY_BOOST} ${TRIQS_LIBRARY_PYTHON} ${TRIQS_LIBRARY_MPI} ${TRIQS_LIBRARY_HDF5} ${TRIQS_LIBRARY_LAPACK} ${TRIQS_LIBRARY_FFTW} ${TRIQS_LIBRARY_GMP} ${TRIQS_LIBRARY_GSL} )
set(TRIQS_INCLUDE_ALL ${TRIQS_INCLUDE_BOOST} ${TRIQS_INCLUDE_PYTHON} ${TRIQS_INCLUDE_MPI} ${TRIQS_INCLUDE_HDF5} ${TRIQS_INCLUDE_LAPACK} ${TRIQS_INCLUDE_FFTW} ${TRIQS_INCLUDE_GMP} ${TRIQS_INCLUDE_GSL} )
set( link_libs " ${TRIQS_LIBRARY_ALL}")
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
list (REMOVE_DUPLICATES link_libs)
endif( ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
string(REPLACE "debug" " " TMP "${link_libs}")
string(REPLACE "optimized" " " TMP "${TMP}")
set(DOC_AUTOCOMPILE_INCLUDE ${CMAKE_SOURCE_DIR} ${TRIQS_INCLUDE_ALL})
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(DOC_AUTOCOMPILE_LINK "${TRIQS_LIBRARY_BOOST} -L ${CMAKE_BINARY_DIR}/triqs -ltriqs ${TMP}")
set(DOC_AUTOCOMPILE_DEFINITIONS -std=c++0x -DBOOST_PP_VARIADICS=1 -stdlib=libc++ -I/System/Library/Frameworks/vecLib.framework/Versions/A/Headers)
else()
set(DOC_AUTOCOMPILE_LINK "${TRIQS_LIBRARY_BOOST} -L ${CMAKE_BINARY_DIR}/triqs -ltriqs ${TMP} -Wl,-rpath=${CMAKE_CURRENT_BINARY_DIR} ")
set(DOC_AUTOCOMPILE_DEFINITIONS -std=c++0x -DBOOST_PP_VARIADICS=1 )
endif()
set(DOC_AUTOCOMPILE_LD_LIBRARY_PATH "${CMAKE_BINARY_DIR}/triqs")
set(DOC_AUTOCOMPILE_DEFINITIONS ${DOC_AUTOCOMPILE_DEFINITIONS} -DTRIQS_BUILDING_LIBRARY -I ${CMAKE_BINARY_DIR}/Config )
# debug
#message( " Link libs ${DOC_AUTOCOMPILE_LINK}")
EXECUTE_PROCESS(COMMAND sh -c "ln -sf ${CMAKE_BINARY_DIR}/triqs/libtriqs.so ${CMAKE_CURRENT_BINARY_DIR}")
# Dive and find the doxygen sources
add_subdirectory(reference/c++)
# Build the doxygen
set(DOXYGEN_HTML_OUTPUT ./html/doxy_triqs)
find_package(Doxygen REQUIRED)
# debug
get_property(DOXYGEN_SOURCES GLOBAL PROPERTY DOXYGEN_SOURCES)
string(REPLACE ";" " " DOXYGEN_SOURCES_LIST "${DOXYGEN_SOURCES}")
#message(STATUS "Doxygen sources are ${DOXYGEN_SOURCES}")
# Prepare the Doxyfile
configure_file(${TRIQS_SOURCE_DIR}/cmake/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
# Generate the conf.py
FILE(GLOB_RECURSE SOURCES *.rst)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in ${CMAKE_CURRENT_BINARY_DIR}/conf.py)
EXECUTE_PROCESS(COMMAND sh -c "mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/html")
set(DOC_SOURCE ${CMAKE_CURRENT_SOURCE_DIR})
include(${TRIQS_SOURCE_DIR}/cmake/BuildSphinx.cmake)
# Set dependencies
GET_PROPERTY(PYTHON_DYNAMIC_MODULES_LIST GLOBAL PROPERTY PYTHON_DYNAMIC_MODULES_LIST)
foreach (mod ${PYTHON_DYNAMIC_MODULES_LIST})
add_dependencies(docs_sphinx ${mod})
endforeach (mod ${PYTHON_DYNAMIC_MODULES_LIST})
set(doxy_top ${CMAKE_CURRENT_BINARY_DIR}/doxy.log)
add_custom_command (OUTPUT ${doxy_top} DEPENDS ${DOXYGEN_SOURCES} COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile > ${doxy_top} )
add_custom_target(docs_doxy ALL DEPENDS ${doxy_top})
add_dependencies(docs_sphinx docs_doxy) # we must first have doxygen process the sources to link to them
add_dependencies(docs_sphinx triqs)
# Install
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/ COMPONENT documentation DESTINATION share/doc/triqs
FILES_MATCHING
PATTERN "*.html"
PATTERN "*.png"
PATTERN "*.jpg"
PATTERN "*.js"
PATTERN "_*"
PATTERN "*.png"
PATTERN "*.gif"
PATTERN "*.xsl"
PATTERN "*.css"
PATTERN "*.pdf"
PATTERN "*.py"
PATTERN "*.txt"
PATTERN "*.bib"
PATTERN "*.inv"
PATTERN ".svn" EXCLUDE
PATTERN "CVS" EXCLUDE
)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/themes/agogo DESTINATION share/triqs/themes)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/themes/triqs DESTINATION share/triqs/themes)
# PDF documentation
if (Build_PDF_Documentation)
add_dependencies(docs_sphinx_pdf triqs )
install(FILES ${sphinx_top_pdf} DESTINATION share/doc/triqs/)
endif()