CMakeLists.txt 2.92 KB
Newer Older
Robert T. McGibbon's avatar
Robert T. McGibbon committed
1
2
set(STAGING_OUTPUT_FILES "") # Will contain all required package files
file(GLOB STAGING_INPUT_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
Robert T. McGibbon's avatar
Robert T. McGibbon committed
3
4
    "*.rst"
    "*.py"
Robert T. McGibbon's avatar
Robert T. McGibbon committed
5
    "_static/logo.png"
6
7
    "_static/custom.css"
    "_templates/navigation.html"
Robert T. McGibbon's avatar
Robert T. McGibbon committed
8
9
)

Robert T. McGibbon's avatar
Robert T. McGibbon committed
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
set(WRAPPER_DOXYGEN_DIR "${CMAKE_CURRENT_BINARY_DIR}/doxygen")
file(MAKE_DIRECTORY "${WRAPPER_DOXYGEN_DIR}")

configure_file(
    ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
    ${WRAPPER_DOXYGEN_DIR}/Doxyfile
    @ONLY
)

add_custom_command(
    OUTPUT "${WRAPPER_DOXYGEN_DIR}/xml/index.xml"
    COMMAND "${DOXYGEN_EXECUTABLE}"
    DEPENDS "${WRAPPER_DOXYGEN_DIR}/Doxyfile"
    WORKING_DIRECTORY "${WRAPPER_DOXYGEN_DIR}"
    COMMENT "Parsing OpenMM header files with Doxygen..."
)

Robert T. McGibbon's avatar
Robert T. McGibbon committed
27
28
29
30
31
32
33
34
35
36
37
38
foreach(INIT_FILE ${STAGING_INPUT_FILES})
    set(infile "${CMAKE_CURRENT_SOURCE_DIR}/${INIT_FILE}")
    set(outfile "${CMAKE_CURRENT_BINARY_DIR}/${INIT_FILE}")
    add_custom_command(
        OUTPUT "${outfile}"
        COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${infile}" "${outfile}"
        DEPENDS "${infile}"
        COMMENT "CMake-copying file ${infile} to ${outfile}")
    set(STAGING_OUTPUT_FILES ${STAGING_OUTPUT_FILES} "${outfile}")
endforeach(INIT_FILE ${STAGING_INPUT_FILES})

add_custom_command(
39
40
41
42
43
44
45
46
47
48
49
50
    OUTPUT  "${CMAKE_CURRENT_BINARY_DIR}/generated/"
    COMMAND "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_BINARY_DIR}/breathe-apidoc.py"
            "--generate=class"
            "--members"
            "--force"
            "--brief-titles"
            "--rename-output"
            "--remove-prefix='OpenMM::'"
            "--flat-output"
            "--public-only"
            "--quiet"
            "--output-dir=generated"
Robert T. McGibbon's avatar
Robert T. McGibbon committed
51
            "${WRAPPER_DOXYGEN_DIR}/xml/"
52
    DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/breathe-apidoc.py"
Robert T. McGibbon's avatar
Robert T. McGibbon committed
53
            "${WRAPPER_DOXYGEN_DIR}/xml/index.xml"
Robert T. McGibbon's avatar
Robert T. McGibbon committed
54
    )
Robert T. McGibbon's avatar
Robert T. McGibbon committed
55

56

Robert T. McGibbon's avatar
Robert T. McGibbon committed
57
58
add_custom_command(
    OUTPUT "${CMAKE_BINARY_DIR}/api-c++/index.html"
59
    COMMAND "${PYTHON_EXECUTABLE}" -m sphinx . "${CMAKE_BINARY_DIR}/api-c++" -W --keep-going # Promote warnings to errors to catch undocumented classes
Robert T. McGibbon's avatar
Robert T. McGibbon committed
60
61
    WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
    DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/conf.py"
62
            "${CMAKE_CURRENT_BINARY_DIR}/generated/"
Robert T. McGibbon's avatar
Robert T. McGibbon committed
63
            "${CMAKE_CURRENT_BINARY_DIR}/index.rst"
64
65
66
            "${CMAKE_CURRENT_BINARY_DIR}/forces.rst"
            "${CMAKE_CURRENT_BINARY_DIR}/integrators.rst"
            "${CMAKE_CURRENT_BINARY_DIR}/extras.rst"
Robert T. McGibbon's avatar
Robert T. McGibbon committed
67
            "${CMAKE_CURRENT_BINARY_DIR}/_static/logo.png"
68
69
            "${CMAKE_CURRENT_BINARY_DIR}/_static/custom.css"
            "${CMAKE_CURRENT_BINARY_DIR}/_templates/navigation.html"
Robert T. McGibbon's avatar
Robert T. McGibbon committed
70
            "${WRAPPER_DOXYGEN_DIR}/xml/index.xml"
Robert T. McGibbon's avatar
Robert T. McGibbon committed
71
72
73
74
75
76
77
78
79
)

file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/api-c++/)
add_custom_target(C++ApiDocs
        DEPENDS ${CMAKE_BINARY_DIR}/api-c++/index.html)
INSTALL(DIRECTORY "${CMAKE_BINARY_DIR}/api-c++/"
        DESTINATION "docs/api-c++/")
INSTALL(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../C++ API Reference.html"
        DESTINATION "docs/")