Blame 0001-Enable-doxygen-been-properly-used-from-cmake-build-a.patch

c07ea6c
From c63f886c9d12b88fc65afcd379bb086984dd44c2 Mon Sep 17 00:00:00 2001
c07ea6c
From: Helio Chissini de Castro <helio@kde.org>
c07ea6c
Date: Tue, 18 Apr 2017 14:51:17 +0200
c07ea6c
Subject: [PATCH] Enable doxygen been properly used from cmake build and
c07ea6c
 install.
c07ea6c
c07ea6c
Current documentation lacks a proper directory handling and switch for
c07ea6c
Unix like systems.
c07ea6c
The option BUILD_DOCS are added as disable by default, even so the
c07ea6c
Doxyfile file is generated for a manual build.
c07ea6c
c07ea6c
Option HTML_OUTPUT are made cached to be properly replaced, as usually
c07ea6c
done by some Linux distributions
c07ea6c
c07ea6c
Microsoft CHM option is enabled if MSVC is detected.
c07ea6c
---
c07ea6c
 CMakeLists.txt                | 11 ++++++++++
c07ea6c
 doc/CMakeLists.txt            | 47 +++++++++++++++++++++++++++++++++++++++++++
c07ea6c
 doc/{Doxyfile => Doxyfile.in} | 46 ++++++++++--------------------------------
c07ea6c
 3 files changed, 69 insertions(+), 35 deletions(-)
c07ea6c
 create mode 100644 doc/CMakeLists.txt
c07ea6c
 rename doc/{Doxyfile => Doxyfile.in} (98%)
c07ea6c
c07ea6c
diff --git a/CMakeLists.txt b/CMakeLists.txt
c07ea6c
index 8455bb8..6989510 100644
c07ea6c
--- a/CMakeLists.txt
c07ea6c
+++ b/CMakeLists.txt
c07ea6c
@@ -40,6 +40,7 @@ cmake_minimum_required( VERSION 2.8 )
c07ea6c
 PROJECT( Assimp )
c07ea6c
 
c07ea6c
 OPTION(BUILD_SHARED_LIBS "Build package with shared libraries." ON)
c07ea6c
+
c07ea6c
 IF(NOT BUILD_SHARED_LIBS)
c07ea6c
   SET(LINK_SEARCH_START_STATIC TRUE)
c07ea6c
 ENDIF(NOT BUILD_SHARED_LIBS)
c07ea6c
@@ -58,6 +59,12 @@ SET(ASSIMP_PACKAGE_VERSION "0" CACHE STRING "the package-specific version used f
c07ea6c
 add_definitions( -DOPENDDL_NO_USE_CPP11 )
c07ea6c
 set_property( GLOBAL PROPERTY CXX_STANDARD 11 )
c07ea6c
 
c07ea6c
+OPTION ( BUILD_DOCS
c07ea6c
+   "Build documentation using Doxygen."
c07ea6c
+   OFF
c07ea6c
+)
c07ea6c
+add_subdirectory(doc)
c07ea6c
+
c07ea6c
 # Get the current working branch
c07ea6c
 EXECUTE_PROCESS(
c07ea6c
   COMMAND git rev-parse --abbrev-ref HEAD
c07ea6c
@@ -105,6 +112,10 @@ IF( CMAKE_COMPILER_IS_MINGW )
c07ea6c
   ADD_DEFINITIONS(-DASSIMP_BUILD_NO_IFC_IMPORTER )
c07ea6c
 ENDIF()
c07ea6c
 
c07ea6c
+IF( UNIX )
c07ea6c
+    include(GNUInstallDirs)
c07ea6c
+ENDIF( UNIX )
c07ea6c
+
c07ea6c
 IF((CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) AND NOT CMAKE_COMPILER_IS_MINGW)
c07ea6c
   IF (BUILD_SHARED_LIBS AND CMAKE_SIZEOF_VOID_P EQUAL 8) # -fPIC is only required for shared libs on 64 bit
c07ea6c
      SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
c07ea6c
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
c07ea6c
new file mode 100644
c07ea6c
index 0000000..0ad04cf
c07ea6c
--- /dev/null
c07ea6c
+++ b/doc/CMakeLists.txt
c07ea6c
@@ -0,0 +1,51 @@
c07ea6c
+# Only test for Doxygent if BUILD_DOCS are ON
c07ea6c
+# We will configure Doxygen output anyway in case
c07ea6c
+# of manual generation
c07ea6c
+if( BUILD_DOCS )
c07ea6c
+    find_package( Doxygen REQUIRED )
c07ea6c
+endif( BUILD_DOCS )
c07ea6c
+
c07ea6c
+set( HTML_OUTPUT "AssimpDoc_Html" CACHE STRING "Output directory for generated HTML documentation. Defaults to AssimpDoc_Html." )
c07ea6c
+
c07ea6c
+# Enable Microsoft CHM help style only on Windows
c07ea6c
+set( MICROSOFT_HELP_WORKSHOP "NO")
c07ea6c
+if( MSVC )
c07ea6c
+    set( MICROSOFT_HELP_WORKSHOP "YES" )
c07ea6c
+endif( MSVC )
c07ea6c
+
c07ea6c
+configure_file(
c07ea6c
+    ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
c07ea6c
+    ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
c07ea6c
+    @ONLY
c07ea6c
+)
c07ea6c
+
c07ea6c
+add_custom_target( 
c07ea6c
+    docs ALL
c07ea6c
+    DEPENDS docs.done
c07ea6c
+)
c07ea6c
+
c07ea6c
+add_custom_command(
c07ea6c
+    OUTPUT docs.done
c07ea6c
+    COMMAND ${DOXYGEN_EXECUTABLE}
c07ea6c
+    COMMAND ${CMAKE_COMMAND} -E touch docs.done
c07ea6c
+    COMMENT "Generating assimp documentation"
c07ea6c
+    VERBATIM
c07ea6c
+    )
c07ea6c
+
c07ea6c
+IF( UNIX )
c07ea6c
+    include(GNUInstallDirs)
c07ea6c
+ENDIF( UNIX )
c07ea6c
+
c07ea6c
+if( DEFINED CMAKE_INSTALL_DOCDIR )
c07ea6c
+    install(
c07ea6c
+        DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${HTML_OUTPUT}
c07ea6c
+        DESTINATION ${CMAKE_INSTALL_DOCDIR}
c07ea6c
+    )
c07ea6c
+    install(FILES
c07ea6c
+        ${CMAKE_CURRENT_SOURCE_DIR}/AssimpDoc_Html/AnimationOverview.png
c07ea6c
+        ${CMAKE_CURRENT_SOURCE_DIR}/AssimpDoc_Html/AnimationOverview.svg
c07ea6c
+        ${CMAKE_CURRENT_SOURCE_DIR}/AssimpDoc_Html/dragonsplash.png
c07ea6c
+        DESTINATION ${CMAKE_INSTALL_DOCDIR}/${HTML_OUTPUT}
c07ea6c
+    )
c07ea6c
+endif( DEFINED CMAKE_INSTALL_DOCDIR )
c07ea6c
+
c07ea6c
diff --git a/doc/Doxyfile b/doc/Doxyfile.in
c07ea6c
similarity index 98%
c07ea6c
rename from doc/Doxyfile
c07ea6c
rename to doc/Doxyfile.in
c07ea6c
index 64dd5d2..ebb6b72 100644
c07ea6c
--- a/doc/Doxyfile
c07ea6c
+++ b/doc/Doxyfile.in
c07ea6c
@@ -140,7 +140,8 @@ FULL_PATH_NAMES        = NO
c07ea6c
 # relative paths, which will be relative from the directory where doxygen is 
c07ea6c
 # started.
c07ea6c
 
c07ea6c
-STRIP_FROM_PATH        = 
c07ea6c
+STRIP_FROM_PATH        = @PROJECT_SOURCE_DIR@ \
c07ea6c
+                         @PROJECT_BINARY_DIR@
c07ea6c
 
c07ea6c
 # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of 
c07ea6c
 # the path mentioned in the documentation of a class, which tells 
c07ea6c
@@ -339,22 +340,6 @@ INLINE_SIMPLE_STRUCTS  = NO
c07ea6c
 
c07ea6c
 TYPEDEF_HIDES_STRUCT   = YES
c07ea6c
 
c07ea6c
-# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to 
c07ea6c
-# determine which symbols to keep in memory and which to flush to disk. 
c07ea6c
-# When the cache is full, less often used symbols will be written to disk. 
c07ea6c
-# For small to medium size projects (<1000 input files) the default value is 
c07ea6c
-# probably good enough. For larger projects a too small cache size can cause 
c07ea6c
-# doxygen to be busy swapping symbols to and from disk most of the time 
c07ea6c
-# causing a significant performance penalty. 
c07ea6c
-# If the system has enough physical memory increasing the cache will improve the 
c07ea6c
-# performance by keeping more symbols in memory. Note that the value works on 
c07ea6c
-# a logarithmic scale so increasing the size by one will roughly double the 
c07ea6c
-# memory usage. The cache size is given by this formula: 
c07ea6c
-# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, 
c07ea6c
-# corresponding to a cache size of 2^16 = 65536 symbols.
c07ea6c
-
c07ea6c
-SYMBOL_CACHE_SIZE      = 0
c07ea6c
-
c07ea6c
 # Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be 
c07ea6c
 # set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given 
c07ea6c
 # their name and scope. Since this can be an expensive process and often the 
c07ea6c
@@ -677,9 +662,12 @@ WARN_LOGFILE           =
c07ea6c
 # directories like "/usr/src/myproject". Separate the files or directories 
c07ea6c
 # with spaces.
c07ea6c
 
c07ea6c
-INPUT                  = ../include/ \
c07ea6c
-                         ../doc/dox.h \
c07ea6c
-                         ../code/BaseImporter.h
c07ea6c
+INPUT                  = @doxy_main_page@ \
c07ea6c
+                         @PROJECT_SOURCE_DIR@ \
c07ea6c
+                         @PROJECT_BINARY_DIR@ \
c07ea6c
+                         @PROJECT_SOURCE_DIR@/include/ \
c07ea6c
+                         @PROJECT_SOURCE_DIR@/doc/dox.h \
c07ea6c
+                         @PROJECT_SOURCE_DIR@/code/BaseImporter.h
c07ea6c
 
c07ea6c
 # This tag can be used to specify the character encoding of the source files 
c07ea6c
 # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is 
c07ea6c
@@ -919,7 +907,7 @@ GENERATE_HTML          = YES
c07ea6c
 # If a relative path is entered the value of OUTPUT_DIRECTORY will be 
c07ea6c
 # put in front of it. If left blank `html' will be used as the default path.
c07ea6c
 
c07ea6c
-HTML_OUTPUT            = AssimpDoc_Html
c07ea6c
+HTML_OUTPUT            = @HTML_OUTPUT@
c07ea6c
 
c07ea6c
 # The HTML_FILE_EXTENSION tag can be used to specify the file extension for 
c07ea6c
 # each generated HTML page (for example: .htm,.php,.asp). If it is left blank 
c07ea6c
@@ -953,7 +941,7 @@ HTML_FOOTER            =
c07ea6c
 # HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this 
c07ea6c
 # tag will in the future become obsolete.
c07ea6c
 
c07ea6c
-HTML_STYLESHEET        = style.css
c07ea6c
+# HTML_STYLESHEET        =  @CMAKE_CURRENT_SOURCE_DIR@/style.css
c07ea6c
 
c07ea6c
 # The HTML_EXTRA_STYLESHEET tag can be used to specify an additional 
c07ea6c
 # user-defined cascading style sheet that is included after the standard 
c07ea6c
@@ -1064,7 +1052,7 @@ DOCSET_PUBLISHER_NAME  = Publisher
c07ea6c
 # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) 
c07ea6c
 # of the generated HTML documentation.
c07ea6c
 
c07ea6c
-GENERATE_HTMLHELP      = YES
c07ea6c
+GENERATE_HTMLHELP      = @MICROSOFT_HELP_WORKSHOP@
c07ea6c
 
c07ea6c
 # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can 
c07ea6c
 # be used to specify the file name of the resulting .chm file. You 
c07ea6c
@@ -1504,18 +1492,6 @@ GENERATE_XML           = NO
c07ea6c
 
c07ea6c
 XML_OUTPUT             = xml
c07ea6c
 
c07ea6c
-# The XML_SCHEMA tag can be used to specify an XML schema, 
c07ea6c
-# which can be used by a validating XML parser to check the 
c07ea6c
-# syntax of the XML files.
c07ea6c
-
c07ea6c
-XML_SCHEMA             = 
c07ea6c
-
c07ea6c
-# The XML_DTD tag can be used to specify an XML DTD, 
c07ea6c
-# which can be used by a validating XML parser to check the 
c07ea6c
-# syntax of the XML files.
c07ea6c
-
c07ea6c
-XML_DTD                = 
c07ea6c
-
c07ea6c
 # If the XML_PROGRAMLISTING tag is set to YES Doxygen will 
c07ea6c
 # dump the program listings (including syntax highlighting 
c07ea6c
 # and cross-referencing information) to the XML output. Note that 
c07ea6c
-- 
c07ea6c
2.9.3
c07ea6c