From e39bac46493db6425cd0ac3472e1ce6ea69c6130 Mon Sep 17 00:00:00 2001
From: Florent Pruvost <florent.pruvost@inria.fr>
Date: Wed, 4 Oct 2017 12:23:42 +0200
Subject: [PATCH] create a new target to force generation of sources, useful
 for generating the doc

---
 CMakeLists.txt                  |  5 +++++
 compute/CMakeLists.txt          |  5 +++++
 control/CMakeLists.txt          |  2 +-
 coreblas/compute/CMakeLists.txt |  6 ++++++
 coreblas/include/CMakeLists.txt |  1 +
 cudablas/compute/CMakeLists.txt |  5 +++++
 cudablas/include/CMakeLists.txt |  1 +
 doc/doxygen/CMakeLists.txt      |  2 +-
 doc/orgmode/CMakeLists.txt      |  4 ++--
 hqr                             |  2 +-
 include/CMakeLists.txt          |  1 +
 runtime/parsec/CMakeLists.txt   |  5 +++++
 runtime/quark/CMakeLists.txt    |  5 +++++
 runtime/starpu/CMakeLists.txt   |  5 +++++
 testing/CMakeLists.txt          | 10 ++++++++++
 timing/CMakeLists.txt           | 10 +++++++---
 16 files changed, 61 insertions(+), 8 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1a82be7e4..a7c90d043 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -999,6 +999,8 @@ list(REMOVE_DUPLICATES CHAMELEON_DEP) # WARNING: is it safe, respect order?
 # Check for the subdirectories
 # ----------------------------
 
+set(CHAMELEON_SOURCES_TARGETS "" CACHE INTERNAL "List of targets of sources")
+
 # include headers
 # ---------------
 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
@@ -1073,6 +1075,9 @@ if(CHAMELEON_ENABLE_TIMING)
 endif(CHAMELEON_ENABLE_TIMING)
 #------------------------------------------------------------------------------
 
+# Define a target which gathers all targets of sources
+# useful for generating the doc without compiling the binaries (objects, libraries)
+add_custom_target(chameleon_all_sources ALL DEPENDS ${CHAMELEON_SOURCES_TARGETS})
 
 ###############################################################################
 # Documentation #
diff --git a/compute/CMakeLists.txt b/compute/CMakeLists.txt
index 1f6592d69..1d6e88995 100644
--- a/compute/CMakeLists.txt
+++ b/compute/CMakeLists.txt
@@ -282,6 +282,11 @@ if(HAVE_ISO_C_BINDING)
        )
 endif(HAVE_ISO_C_BINDING)
 
+# Force generation of sources
+# ---------------------------
+add_custom_target(chameleon_sources ALL SOURCES "${CHAMELEON_SRCS};${CHAMELEON_SRCSF}")
+set(CHAMELEON_SOURCES_TARGETS "${CHAMELEON_SOURCES_TARGETS};chameleon_sources" CACHE INTERNAL "List of targets of sources")
+
 # Compile step
 # ------------
 add_library(chameleon ${CHAMELEON_SRCS} ${CHAMELEON_SRCSF})
diff --git a/control/CMakeLists.txt b/control/CMakeLists.txt
index 6813bbf27..0fd19f588 100644
--- a/control/CMakeLists.txt
+++ b/control/CMakeLists.txt
@@ -64,7 +64,7 @@ list(APPEND CHAMELEON_HDRS ${CHAMELEON_HDRS_GENERATED})
 # Force generation of headers
 # ---------------------------
 add_custom_target(control_include ALL SOURCES ${CHAMELEON_HDRS})
-
+set(CHAMELEON_SOURCES_TARGETS "${CHAMELEON_SOURCES_TARGETS};control_include" CACHE INTERNAL "List of targets of sources")
 
 # installation
 # ------------
diff --git a/coreblas/compute/CMakeLists.txt b/coreblas/compute/CMakeLists.txt
index f5f9ccc3b..04dade885 100644
--- a/coreblas/compute/CMakeLists.txt
+++ b/coreblas/compute/CMakeLists.txt
@@ -28,6 +28,7 @@
 
 # Generate the morse sources for all possible precisions
 # ------------------------------------------------------
+
 set(COREBLAS_SRCS_GENERATED "")
 set(ZSRC
     core_dzasum.c
@@ -104,6 +105,11 @@ set(COREBLAS_SRCS
     ${COREBLAS_SRCS_GENERATED}
     )
 
+# Force generation of sources
+# ---------------------------
+add_custom_target(coreblas_sources ALL SOURCES ${COREBLAS_SRCS})
+set(CHAMELEON_SOURCES_TARGETS "${CHAMELEON_SOURCES_TARGETS};coreblas_sources" CACHE INTERNAL "List of targets of sources")
+
 # Compile step
 # ------------
 add_library(coreblas ${COREBLAS_SRCS})
diff --git a/coreblas/include/CMakeLists.txt b/coreblas/include/CMakeLists.txt
index 771709713..038581e80 100644
--- a/coreblas/include/CMakeLists.txt
+++ b/coreblas/include/CMakeLists.txt
@@ -57,6 +57,7 @@ endforeach()
 # Force generation of headers
 # ---------------------------
 add_custom_target(coreblas_include ALL SOURCES ${COREBLAS_HDRS})
+set(CHAMELEON_SOURCES_TARGETS "${CHAMELEON_SOURCES_TARGETS};coreblas_include" CACHE INTERNAL "List of targets of sources")
 
 # Installation
 # ------------
diff --git a/cudablas/compute/CMakeLists.txt b/cudablas/compute/CMakeLists.txt
index b5c69b134..cf86aa875 100644
--- a/cudablas/compute/CMakeLists.txt
+++ b/cudablas/compute/CMakeLists.txt
@@ -88,6 +88,11 @@ if (CHAMELEON_USE_CUBLAS_V2)
     )
 endif (CHAMELEON_USE_CUBLAS_V2)
 
+# Force generation of sources
+# ---------------------------
+add_custom_target(cudablas_sources ALL SOURCES ${CUDABLAS_SRCS})
+set(CHAMELEON_SOURCES_TARGETS "${CHAMELEON_SOURCES_TARGETS};cudablas_sources" CACHE INTERNAL "List of targets of sources")
+
 # Compile step
 # ------------
 add_library(cudablas ${CUDABLAS_SRCS})
diff --git a/cudablas/include/CMakeLists.txt b/cudablas/include/CMakeLists.txt
index a722e3444..e6229966e 100644
--- a/cudablas/include/CMakeLists.txt
+++ b/cudablas/include/CMakeLists.txt
@@ -49,6 +49,7 @@ endforeach()
 # Force generation of headers
 # ---------------------------
 add_custom_target(cudablas_include ALL SOURCES ${CUDABLAS_HDRS})
+set(CHAMELEON_SOURCES_TARGETS "${CHAMELEON_SOURCES_TARGETS};cudablas_include" CACHE INTERNAL "List of targets of sources")
 
 # Installation
 # ------------
diff --git a/doc/doxygen/CMakeLists.txt b/doc/doxygen/CMakeLists.txt
index ec81c77bf..f66dcdfcc 100644
--- a/doc/doxygen/CMakeLists.txt
+++ b/doc/doxygen/CMakeLists.txt
@@ -77,7 +77,7 @@ if(DOXYGEN_EXECUTABLE)
     add_custom_target(doxygen-out ALL
                       DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/out-dev
                               #${CMAKE_CURRENT_BINARY_DIR}/out-usr
-                              chameleon
+                              chameleon_all_sources
                               )
 
     # Installation for html version
diff --git a/doc/orgmode/CMakeLists.txt b/doc/orgmode/CMakeLists.txt
index bdcd7910e..d189a3a49 100644
--- a/doc/orgmode/CMakeLists.txt
+++ b/doc/orgmode/CMakeLists.txt
@@ -83,8 +83,8 @@ if(EMACS_COMPILER)
                        DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/users_guide.org
                                ${CMAKE_CURRENT_BINARY_DIR}/version.org
                       )
-    add_custom_target(doc-html-users_guide ALL DEPENDS users_guide.html chameleon)
-    add_custom_target(doc-pdf-users_guide ALL DEPENDS users_guide.pdf chameleon)
+    add_custom_target(doc-html-users_guide ALL DEPENDS users_guide.html)
+    add_custom_target(doc-pdf-users_guide ALL DEPENDS users_guide.pdf)
 
     # Installation
     # ------------
diff --git a/hqr b/hqr
index 1e7bad3a5..2bc36789f 160000
--- a/hqr
+++ b/hqr
@@ -1 +1 @@
-Subproject commit 1e7bad3a5e56c28514f8121195ffefdda70335bb
+Subproject commit 2bc36789f26039bc6eefe03f6825a383847724f5
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index bcbfb84fa..4991492a9 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -69,6 +69,7 @@ endforeach()
 # ---------------------------
 add_custom_target(chameleon_include
   ALL SOURCES morse.h ${CHAMELEON_HDRS} )
+set(CHAMELEON_SOURCES_TARGETS "${CHAMELEON_SOURCES_TARGETS};chameleon_include" CACHE INTERNAL "List of targets of sources")
 
 # Installation
 # ------------
diff --git a/runtime/parsec/CMakeLists.txt b/runtime/parsec/CMakeLists.txt
index 714235ae9..03867a6ef 100644
--- a/runtime/parsec/CMakeLists.txt
+++ b/runtime/parsec/CMakeLists.txt
@@ -105,6 +105,11 @@ set(RUNTIME_SRCS
   ${RUNTIME_SRCS_GENERATED}
   )
 
+# Force generation of sources
+# ---------------------------
+add_custom_target(parsec_sources ALL SOURCES ${RUNTIME_SRCS})
+set(CHAMELEON_SOURCES_TARGETS "${CHAMELEON_SOURCES_TARGETS};runtime_parsec_include;parsec_sources" CACHE INTERNAL "List of targets of sources")
+
 # Add library
 # -----------
 add_library(chameleon_parsec ${RUNTIME_SRCS})
diff --git a/runtime/quark/CMakeLists.txt b/runtime/quark/CMakeLists.txt
index eeee4ac10..ffb21c741 100644
--- a/runtime/quark/CMakeLists.txt
+++ b/runtime/quark/CMakeLists.txt
@@ -106,6 +106,11 @@ set(RUNTIME_SRCS
   ${RUNTIME_SRCS_GENERATED}
   )
 
+# Force generation of sources
+# ---------------------------
+add_custom_target(quark_sources ALL SOURCES ${RUNTIME_SRCS})
+set(CHAMELEON_SOURCES_TARGETS "${CHAMELEON_SOURCES_TARGETS};runtime_quark_include;quark_sources" CACHE INTERNAL "List of targets of sources")
+
 # Add library
 # -----------
 add_library(chameleon_quark ${RUNTIME_SRCS})
diff --git a/runtime/starpu/CMakeLists.txt b/runtime/starpu/CMakeLists.txt
index ba66f9a32..f5f3e44da 100644
--- a/runtime/starpu/CMakeLists.txt
+++ b/runtime/starpu/CMakeLists.txt
@@ -122,6 +122,11 @@ set(RUNTIME_SRCS
   ${RUNTIME_SRCS_GENERATED}
   )
 
+# Force generation of sources
+# ---------------------------
+add_custom_target(starpu_sources ALL SOURCES ${RUNTIME_SRCS})
+set(CHAMELEON_SOURCES_TARGETS "${CHAMELEON_SOURCES_TARGETS};runtime_starpu_include;starpu_sources" CACHE INTERNAL "List of targets of sources")
+
 # Add library
 # -----------
 add_library(chameleon_starpu ${RUNTIME_SRCS})
diff --git a/testing/CMakeLists.txt b/testing/CMakeLists.txt
index 1b2e5d9e4..c90f3f3bd 100644
--- a/testing/CMakeLists.txt
+++ b/testing/CMakeLists.txt
@@ -44,6 +44,7 @@ precisions_rules_py(TESTING_HDRS_GENERATED "${ZHDR}"
     PRECISIONS "s;d;c;z;ds;zc" )
 
 add_custom_target(testing_include ALL SOURCES ${TESTING_HDRS_GENERATED})
+set(CHAMELEON_SOURCES_TARGETS "${CHAMELEON_SOURCES_TARGETS};testing_include" CACHE INTERNAL "List of targets of sources")
 
 # Generate morse testing sources for all possible precisions
 # ----------------------------------------------------------
@@ -168,6 +169,15 @@ foreach(_precision ${CHAMELEON_PRECISION} )
 
 endforeach()
 
+# Force generation of sources
+# ---------------------------
+set(TESTING_SRCS)
+foreach(_precision ${CHAMELEON_PRECISION})
+    list(APPEND TESTING_SRCS ${${_precision}SRC_GENERATED})
+endforeach()
+add_custom_target(testing_sources ALL SOURCES ${TESTING_SRCS})
+set(CHAMELEON_SOURCES_TARGETS "${CHAMELEON_SOURCES_TARGETS};testing_sources" CACHE INTERNAL "List of targets of sources")
+
 # Copy python scripts to use test drivers
 # ---------------------------------------
 # Copy launcher
diff --git a/timing/CMakeLists.txt b/timing/CMakeLists.txt
index 8f03c60b9..1a88529c2 100644
--- a/timing/CMakeLists.txt
+++ b/timing/CMakeLists.txt
@@ -45,6 +45,7 @@ set(TIMING_AUX_HDRS
 # Force generation of headers
 # ---------------------------
 add_custom_target(timing_include ALL SOURCES ${TIMING_AUX_HDRS})
+set(CHAMELEON_SOURCES_TARGETS "${CHAMELEON_SOURCES_TARGETS};timing_include" CACHE INTERNAL "List of targets of sources")
 
 if (NOT CHAMELEON_SIMULATION)
     # Generate the morse auxiliary sources for all possible precisions
@@ -57,9 +58,7 @@ if (NOT CHAMELEON_SIMULATION)
     precisions_rules_py(TIMING_AUX_SRCS_GENERATED "${ZSRC}"
                         PRECISIONS "${CHAMELEON_PRECISION}")
 
-    set(TIMING_SRCS
-        ${TIMING_AUX_SRCS_GENERATED}
-       )
+    set(TIMING_SRCS ${TIMING_AUX_SRCS_GENERATED})
 
     # Create libchameleon_timing.a
     # -----------------------------
@@ -150,6 +149,11 @@ endif(NOT CHAMELEON_SIMULATION)
 precisions_rules_py(TIMINGS "${ZSRC}"
                     PRECISIONS "${CHAMELEON_PRECISION}")
 
+# Force generation of sources
+# ---------------------------
+add_custom_target(timing_sources ALL SOURCES ${TIMINGS})
+set(CHAMELEON_SOURCES_TARGETS "${CHAMELEON_SOURCES_TARGETS};timing_sources" CACHE INTERNAL "List of targets of sources")
+
 # Add include and link directories
 # --------------------------------
 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
-- 
GitLab