Skip to content

Commit

Permalink
Add Doxygen support to CMake build.
Browse files Browse the repository at this point in the history
Unfortunately the ``Doxyfile`` needs to be configured (Doxyfile.in ->
Doxyfile) for out of source builds which means the Makefile also had to
be taught to do this.

An option ``WITH_DOCS`` has been added so that setting up the build
system to be able to build documentation can be disabled. Note the
``doc`` target is not run by default because it is a phony target and
if it was added to all it would run everytime.


Former-commit-id: 27b90ca
  • Loading branch information
Dan Liew committed Jul 8, 2015
1 parent eda08f6 commit 3d5024a
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -155,6 +155,7 @@ src/test_*.s
*.guru
*.dSYM
.*.swp
Doxyfile

# jrk editor settings
.tm_properties
Expand Down
16 changes: 16 additions & 0 deletions CMakeLists.txt
Expand Up @@ -60,3 +60,19 @@ if (!WIN32)
add_subdirectory(apps)
add_subdirectory(tutorial)
endif()

option(WITH_DOCS "Enable building of documentation" ON)
if (WITH_DOCS)
find_package(Doxygen)
if (NOT DOXYGEN_FOUND)
message(FATAL_ERROR "Could not find Doxygen. Either install it or set WITH_DOCS to OFF")
endif()

configure_file(${CMAKE_SOURCE_DIR}/Doxyfile.in ${CMAKE_BINARY_DIR}/Doxyfile @ONLY)
# Note documentation is not built by default, the user needs to build the "doc" target
add_custom_target(doc
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Building Doxygen documentation"
)
endif()
6 changes: 3 additions & 3 deletions Doxyfile → Doxyfile.in
Expand Up @@ -38,7 +38,7 @@ PROJECT_NUMBER =
# If a relative path is entered, it will be relative to the location
# where doxygen was started. If left blank the current directory will be used.

OUTPUT_DIRECTORY = doc
OUTPUT_DIRECTORY = @CMAKE_BINARY_DIR@/doc

# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
# 4096 sub-directories (in 2 levels) under the output directory of each output
Expand Down Expand Up @@ -574,7 +574,7 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.

INPUT = src test
INPUT = "@CMAKE_SOURCE_DIR@/src" "@CMAKE_SOURCE_DIR@/test"

# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
Expand Down Expand Up @@ -631,7 +631,7 @@ EXCLUDE_SYMBOLS =
# directories that contain example code fragments that are included (see
# the \include command).

EXAMPLE_PATH = tutorial
EXAMPLE_PATH = @CMAKE_SOURCE_DIR@

# 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
Expand Down
8 changes: 7 additions & 1 deletion Makefile
Expand Up @@ -969,9 +969,15 @@ endif

.PHONY: doc
docs: doc
doc: src
doc: src Doxyfile
doxygen

Doxyfile: Doxyfile.in
@echo "Generating $@"
@sed -e "s#@CMAKE_BINARY_DIR@#$(shell pwd)#g" \
-e "s#@CMAKE_SOURCE_DIR@#$(shell pwd)#g" \
$< > $@

$(DISTRIB_DIR)/halide.tgz: $(BIN_DIR)/libHalide.a $(BIN_DIR)/libHalide.so include/Halide.h include/HalideRuntime.h
mkdir -p $(DISTRIB_DIR)/include $(DISTRIB_DIR)/bin $(DISTRIB_DIR)/tutorial $(DISTRIB_DIR)/tutorial/images $(DISTRIB_DIR)/tools
cp $(BIN_DIR)/libHalide.a $(BIN_DIR)/libHalide.so $(DISTRIB_DIR)/bin
Expand Down

0 comments on commit 3d5024a

Please sign in to comment.