Index: CMakeLists.txt =================================================================== --- CMakeLists.txt +++ CMakeLists.txt @@ -1 +1,3 @@ cmake_minimum_required(VERSION 3.1) + +add_subdirectory(acxxel) Index: acxxel/CMakeLists.txt =================================================================== --- acxxel/CMakeLists.txt +++ acxxel/CMakeLists.txt @@ -2,18 +2,27 @@ option(ACXXEL_ENABLE_UNIT_TESTS "enable acxxel unit tests" ON) option(ACXXEL_ENABLE_EXAMPLES "enable acxxel examples" OFF) -option(ACXXEL_ENABLE_DOXYGEN "enable Doxygen for acxxel" OFF) option(ACXXEL_ENABLE_CUDA "enable CUDA for acxxel" ON) option(ACXXEL_ENABLE_OPENCL "enable OpenCL for acxxel" ON) -project(acxxel) +option( + ACXXEL_INCLUDE_DOCS + "Generate build targets for the acxxel docs" + ${LLVM_INCLUDE_DOCS}) + +if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) + project(acxxel) + set(ACXXEL_BUILT_STANDALONE TRUE) +endif() if(ACXXEL_ENABLE_CUDA) find_package(CUDA REQUIRED) include_directories(${CUDA_INCLUDE_DIRS}) find_library(CUDA_DRIVER_LIBRARY cuda) if(NOT CUDA_DRIVER_LIBRARY) - message(FATAL_ERROR "could not find libcuda, is the CUDA driver installed on your system?") + message( + FATAL_ERROR + "could not find libcuda, is the CUDA driver installed on your system?") endif(NOT CUDA_DRIVER_LIBRARY) set(ACXXEL_CUDA_SOURCES cuda_acxxel.cpp) set(ACXXEL_CUDA_LIBRARIES ${CUDA_DRIVER_LIBRARY} ${CUDA_LIBRARIES}) @@ -60,16 +69,6 @@ add_subdirectory(tests) endif() -if(ACXXEL_ENABLE_DOXYGEN) - find_package(Doxygen REQUIRED) - configure_file(Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) - add_custom_target( - acxxel-doc - ${DOXYGEN_EXECUTABLE} - ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile - WORKING_DIRECTORY - ${CMAKE_CURRENT_BINARY_DIR} - COMMENT - "Generating acxxel API documentation with Doxygen" - VERBATIM) +if(ACXXEL_INCLUDE_DOCS) + add_subdirectory(docs) endif() Index: acxxel/customdoxygen.css =================================================================== --- /dev/null +++ acxxel/customdoxygen.css @@ -1,20 +0,0 @@ -body { - background-color: #e0e0eb; -} - -div.header { - margin-left: auto; - margin-right: auto; - max-width: 60em; - padding-left: 2em; - padding-right: 2em; -} - -div.contents { - margin-left: auto; - margin-right: auto; - max-width: 60em; - background-color: white; - padding: 2em; - border-radius: 1em; -} Index: acxxel/docs/CMakeLists.txt =================================================================== --- /dev/null +++ acxxel/docs/CMakeLists.txt @@ -0,0 +1,31 @@ +if(ACXXEL_BUILT_STANDALONE) + find_package(Doxygen REQUIRED) +endif() + +if(DOXYGEN_FOUND) + if(LLVM_ENABLE_DOXYGEN OR ACXXEL_BUILT_STANDALONE) + configure_file(Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) + add_custom_target( + doxygen-acxxel + COMMAND + ${DOXYGEN_EXECUTABLE} + ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile + WORKING_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR} + COMMENT + "Generating acxxel doxygen documentation" + VERBATIM) + + if(LLVM_BUILD_DOCS) + add_dependencies(doxygen doxygen-acxxel) + endif() + + if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) + install( + DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/docs/html + DESTINATION + docs/html) + endif() + endif() +endif(DOXYGEN_FOUND) Index: acxxel/docs/Doxyfile.in =================================================================== --- acxxel/docs/Doxyfile.in +++ acxxel/docs/Doxyfile.in @@ -743,7 +743,7 @@ # spaces. # Note: If this tag is empty the current directory is searched. -INPUT = @CMAKE_CURRENT_SOURCE_DIR@ +INPUT = @CMAKE_CURRENT_SOURCE_DIR@/.. # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses @@ -811,7 +811,7 @@ # that contain example code fragments that are included (see the \include # command). -EXAMPLE_PATH = @CMAKE_CURRENT_SOURCE_DIR@/examples +EXAMPLE_PATH = @CMAKE_CURRENT_SOURCE_DIR@/../examples # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and @@ -1540,7 +1540,7 @@ # If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output. # The default value is: YES. -GENERATE_LATEX = YES +GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of