Add sphinx as doc target.
This commit is contained in:
parent
ff3ff8d8b2
commit
52ba9d8ebe
|
@ -11,6 +11,7 @@ cmake_policy(SET CMP0048 NEW)
|
|||
project(wrmath VERSION 0.0.1 LANGUAGES CXX)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
||||
|
||||
# Don't warn on unused functions, because this is a library and not all
|
||||
# functions might be used.
|
||||
|
@ -33,16 +34,17 @@ include_directories(include)
|
|||
file(GLOB_RECURSE ${PROJECT_NAME}_HEADERS include/**.h)
|
||||
file(GLOB_RECURSE ${PROJECT_NAME}_SOURCES src/*.cc)
|
||||
|
||||
message("${${PROJECT_NAME}_SOURCES} -> libwrmath")
|
||||
|
||||
## BUILD
|
||||
|
||||
add_library(${PROJECT_NAME} ${${PROJECT_NAME}_SOURCES})
|
||||
|
||||
add_executable(euler2quat tools/euler2quat.cc)
|
||||
target_link_libraries(euler2quat ${PROJECT_NAME})
|
||||
set_target_properties(euler2quat PROPERTIES
|
||||
FOLDER bin
|
||||
RUNTIME_OUTPUT_DIRECTORY bin)
|
||||
|
||||
add_executable(quaternion tools/quaternion.cc)
|
||||
target_link_libraries(quaternion ${PROJECT_NAME})
|
||||
set_target_properties(quaternion PROPERTIES
|
||||
|
@ -51,16 +53,23 @@ set_target_properties(quaternion PROPERTIES
|
|||
|
||||
## INSTALL
|
||||
|
||||
install(TARGETS ${PROJECT_NAME} DESTINATION lib)
|
||||
install(TARGETS euler2quat DESTINATION bin)
|
||||
install(TARGETS quaternion DESTINATION bin)
|
||||
install(DIRECTORY include/${PROJECT_NAME}
|
||||
DESTINATION include/
|
||||
FILES_MATCHING PATTERN "*.h")
|
||||
install(DIRECTORY docs/sphinx/_build/html/
|
||||
DESTINATION share/doc/${PROJECT_NAME}
|
||||
FILES_MATCHING PATTERN "*.html")
|
||||
|
||||
|
||||
|
||||
## TEST
|
||||
|
||||
# From Modern CMake:
|
||||
# https://cliutils.gitlab.io/modern-cmake/chapters/testing/googletest.html
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/extern/googletest" "extern/googletest")
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/extern/googletest" "extern/googletest" EXCLUDE_FROM_ALL)
|
||||
include_directories("${gtest_SOURCE_DIR}/include")
|
||||
mark_as_advanced(
|
||||
BUILD_GMOCK BUILD_GTEST BUILD_SHARED_LIBS
|
||||
|
|
|
@ -10,7 +10,6 @@ set(CPACK_PACKAGE_VERSION_MINOR "${${PROJECT_NAME}_VERSION_MINOR}")
|
|||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The Shimmering Clarity C++ library")
|
||||
set(CPACK_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION})
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc++1 (>= 3.7.0-1)")
|
||||
# set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
|
||||
set(CPACK_DEBIAN_PACKAGE_SECTION devel)
|
||||
|
||||
# actually do the thing
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
# Via https://devblogs.microsoft.com/cppblog/clear-functional-c-documentation-with-sphinx-breathe-doxygen-cmake/
|
||||
|
||||
# Look for an executable called sphinx-build
|
||||
find_program(SPHINX_EXECUTABLE
|
||||
NAMES sphinx-build
|
||||
DOC "Path to sphinx-build executable")
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
# Handle standard arguments to find_package like REQUIRED and QUIET
|
||||
find_package_handle_standard_args(Sphinx
|
||||
"Failed to find sphinx-build executable"
|
||||
SPHINX_EXECUTABLE)
|
|
@ -15,3 +15,15 @@ add_custom_command(OUTPUT ${DOXYGEN_INDEX_FILE}
|
|||
COMMENT "Generating docs")
|
||||
|
||||
add_custom_target(Doxygen ALL DEPENDS ${DOXYGEN_INDEX_FILE})
|
||||
|
||||
find_package(Sphinx REQUIRED)
|
||||
|
||||
set(SPHINX_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/sphinx)
|
||||
set(SPHINX_BUILD ${CMAKE_CURRENT_BINARY_DIR}/docs)
|
||||
|
||||
add_custom_target(Sphinx ALL
|
||||
COMMAND
|
||||
${SPHINX_EXECUTABLE} -b html
|
||||
${SPHINX_SOURCE} ${SPHINX_BUILD}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMENT "Generating documentation with Sphinx")
|
||||
|
|
Loading…
Reference in New Issue