Skip to content

Commit

Permalink
Fix issue #3520.
Browse files Browse the repository at this point in the history
  • Loading branch information
geektoni committed Feb 28, 2017
1 parent ec6860a commit f6af0c4
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
49 changes: 49 additions & 0 deletions cmake/FindMetaExamples.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,52 @@ function(find_meta_examples)

SET(META_EXAMPLES ${META_EXAMPLE_LISTINGS} PARENT_SCOPE)
endfunction()

function(find_excluded_meta_examples)
read_config_header(${shogun_INCLUDE_DIR}/shogun/lib/config.h)
is_set(${SHOGUN_CONFIG} HAVE_NLOPT)
is_set(${SHOGUN_CONFIG} USE_GPL_SHOGUN)
is_set(${SHOGUN_CONFIG} HAVE_LAPACK)
is_set(${SHOGUN_CONFIG} USE_SVMLIGHT)

# add the cookbook pages we want to exclude
IF(NOT HAVE_NLOPT)
LIST(APPEND EXCLUDED_META_EXAMPLES
examples/gaussian_processes/gaussian_process_regression.rst
)
ENDIF()

IF(NOT USE_GPL_SHOGUN)
LIST(APPEND EXCLUDED_META_EXAMPLES
examples/gaussian_processes/gaussian_process_regression.rst
examples/multiclass_classifier/multiclass_logisticregression.rst
)
ENDIF()

IF(NOT HAVE_LAPACK)
LIST(APPEND EXCLUDED_META_EXAMPLES
examples/regression/linear_ridge_regression.rst
examples/clustering/gmm.rst
examples/distance/mahalanobis.rst
)
ENDIF()

IF(NOT USE_SVMLIGHT)
LIST(APPEND EXCLUDED_META_EXAMPLES
examples/regression/multiple_kernel_learning.rst
)
ENDIF()

# Generate a string with all the meta examples separated by commas.
# This is made since Sphinx's exclude_patterns option wants
# the list's items separated by commas, but cmake's lists use
# semicolons instead.
# See: https://cmake.org/cmake/help/v3.3/command/list.html
# See: http://www.sphinx-doc.org/en/stable/invocation.html#id2
SET(TEMP "${EXCLUDED_META_EXAMPLES}")
STRING(REPLACE ".rst" ".rst," TEMP ${TEMP})
string(REGEX REPLACE ".rst,$" ".rst" TEMP ${TEMP})

SET(EXCLUDED_META_EXAMPLES ${TEMP} PARENT_SCOPE)

endfunction()
4 changes: 4 additions & 0 deletions doc/cookbook/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#PROJECT(sphinxdoc)
#cmake_minimum_required(VERSION 2.8.8)
include(FindMetaExamples)
find_excluded_meta_examples()

# configured documentation tools and intermediate build results
set(BINARY_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/_build")
Expand Down Expand Up @@ -56,6 +58,7 @@ add_custom_target(cookbook_sphinx_linkcheck
-c "${BINARY_BUILD_DIR}"
-d "${SPHINX_CACHE_DIR}"
-D generated_examples_path="${CMAKE_BINARY_DIR}/examples/meta/"
-D exclude_patterns="${EXCLUDED_META_EXAMPLES}"
"${BINARY_BUILD_DIR}"
"${SPHINX_HTML_DIR}"
COMMENT "Cookbook Sphinx validating external links"
Expand All @@ -69,6 +72,7 @@ add_custom_target(cookbook
-c "${BINARY_BUILD_DIR}"
-d "${SPHINX_CACHE_DIR}"
-D generated_examples_path="${CMAKE_BINARY_DIR}/examples/meta/"
-D exclude_patterns="${EXCLUDED_META_EXAMPLES}"
"${BINARY_BUILD_DIR}"
"${SPHINX_HTML_DIR}"
COMMENT "Cookbook Sphinx building HTML"
Expand Down

0 comments on commit f6af0c4

Please sign in to comment.