From c4067d51bd3d157ac6d57226e1c98c3870650361 Mon Sep 17 00:00:00 2001
From: Florent Pruvost <florent.pruvost@inria.fr>
Date: Fri, 30 Jan 2015 10:50:51 +0000
Subject: [PATCH] change installation directories for headers, executables and
 docs. Make it relative to chameleon to avoid a bloody mess in system dirs

---
 cmake_modules/morse/find/FindCHAMELEON.cmake |  2 +-
 control/CMakeLists.txt                       |  2 +-
 coreblas/include/CMakeLists.txt              |  2 +-
 docs/doxygen/CMakeLists.txt                  |  8 ++++----
 docs/texinfo/CMakeLists.txt                  | 15 +++++++--------
 example/basic_zposv/CMakeLists.txt           |  2 +-
 example/lapack_to_morse/CMakeLists.txt       |  4 ++--
 include/CMakeLists.txt                       |  2 +-
 lib/pkgconfig/chameleon-quark.pc.in          |  2 +-
 lib/pkgconfig/chameleon-starpu.pc.in         |  4 ++--
 simucore/simucblas/CMakeLists.txt            |  2 +-
 simucore/simulapacke/CMakeLists.txt          |  2 +-
 testing/CMakeLists.txt                       |  6 +++---
 timing/CMakeLists.txt                        |  8 ++++----
 14 files changed, 30 insertions(+), 31 deletions(-)

diff --git a/cmake_modules/morse/find/FindCHAMELEON.cmake b/cmake_modules/morse/find/FindCHAMELEON.cmake
index e32ee50b7..80a7dc94d 100644
--- a/cmake_modules/morse/find/FindCHAMELEON.cmake
+++ b/cmake_modules/morse/find/FindCHAMELEON.cmake
@@ -341,7 +341,7 @@ if(NOT CHAMELEON_FOUND OR NOT CHAMELEON_LIBRARIES)
             find_path(CHAMELEON_morse.h_DIRS
               NAMES morse.h
               HINTS ${CHAMELEON_DIR}
-              PATH_SUFFIXES include)
+              PATH_SUFFIXES include/chameleon)
         else()
             set(CHAMELEON_morse.h_DIRS "CHAMELEON_morse.h_DIRS-NOTFOUND")
             find_path(CHAMELEON_morse.h_DIRS
diff --git a/control/CMakeLists.txt b/control/CMakeLists.txt
index 8566502db..c983713c0 100644
--- a/control/CMakeLists.txt
+++ b/control/CMakeLists.txt
@@ -78,7 +78,7 @@ endforeach()
 # installation
 # ------------
 install(FILES ${HDR_INSTALL}
-        DESTINATION include)
+        DESTINATION include/chameleon)
 
 ###
 ### END CMakeLists.txt
diff --git a/coreblas/include/CMakeLists.txt b/coreblas/include/CMakeLists.txt
index 26c2f3b1d..654ee3121 100644
--- a/coreblas/include/CMakeLists.txt
+++ b/coreblas/include/CMakeLists.txt
@@ -59,7 +59,7 @@ endforeach()
 # installation
 # ------------
 install(FILES ${HDR_INSTALL}
-        DESTINATION include)
+        DESTINATION include/chameleon)
 
 ###
 ### END CMakeLists.txt
diff --git a/docs/doxygen/CMakeLists.txt b/docs/doxygen/CMakeLists.txt
index 2150f1249..b5761406b 100644
--- a/docs/doxygen/CMakeLists.txt
+++ b/docs/doxygen/CMakeLists.txt
@@ -110,11 +110,11 @@ if(DOXYGEN_EXECUTABLE)
         if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../../../scratch)
             install(FILES       ${CMAKE_CURRENT_BINARY_DIR}/out/latex/refman.pdf
                     RENAME      magma-morse-devguide-${MAGMA_VERSION_NUMBER}.pdf
-                    DESTINATION share/pdf)
+                    DESTINATION share/chameleon/pdf)
         else()
             install(FILES       ${CMAKE_CURRENT_BINARY_DIR}/out/latex/refman.pdf
                     RENAME      magma-morse-usersguide-${MAGMA_VERSION_NUMBER}.pdf
-                    DESTINATION share/pdf)
+                    DESTINATION share/chameleon/pdf)
         endif()
 
     endif()
@@ -122,12 +122,12 @@ if(DOXYGEN_EXECUTABLE)
     # Installation for html version
     # -----------------------------
     install(DIRECTORY   ${CMAKE_CURRENT_BINARY_DIR}/out/html
-            DESTINATION share/doxygen)
+            DESTINATION share/chameleon/doxygen)
 
     # Installation for man version
     # ----------------------------
     install(DIRECTORY   ${CMAKE_CURRENT_BINARY_DIR}/out/man
-            DESTINATION share/)
+            DESTINATION share/chameleon)
 
 else()
     message(STATUS "Looking for doxygen - not found")
diff --git a/docs/texinfo/CMakeLists.txt b/docs/texinfo/CMakeLists.txt
index 0a7fc0909..5ecc73aff 100644
--- a/docs/texinfo/CMakeLists.txt
+++ b/docs/texinfo/CMakeLists.txt
@@ -22,6 +22,7 @@
 #  @author Cedric Castagnede
 #  @author Emmanuel Agullo
 #  @author Mathieu Faverge
+#  @author Florent Pruvost
 #  @date 13-07-2012
 #
 ###
@@ -54,7 +55,7 @@ set(FIGURES_HTML
     potri_async.png
     morse_header.png
     )
-    
+
 foreach(_fig ${FIGURES})
     configure_file(${CMAKE_CURRENT_SOURCE_DIR}/figures/${_fig}
                    ${CMAKE_CURRENT_BINARY_DIR}/${_fig}
@@ -92,17 +93,16 @@ if(MAKEINFO_COMPILER)
     # Installation
     # ------------
     install(FILES ${CMAKE_CURRENT_BINARY_DIR}/users_guide.info
-            DESTINATION share/info)
+            DESTINATION share/chameleon/info)
     install(FILES ${CMAKE_CURRENT_BINARY_DIR}/users_guide.html
-            DESTINATION share/html)
+            DESTINATION share/chameleon/html)
     foreach(_fig ${FIGURES_HTML})
         install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_fig}
-                DESTINATION share/html)
-    endforeach()           
+                DESTINATION share/chameleon/html)
+    endforeach()
 
 else(MAKEINFO_COMPILER)
     message(STATUS "Looking for makeinfo - not found")
-
 endif(MAKEINFO_COMPILER)
 
 # Looking for texi2dvi
@@ -122,11 +122,10 @@ if(TEXI2DVI_COMPILER AND TEX_COMPILER)
     # Installation
     # ------------
     install(FILES ${CMAKE_CURRENT_BINARY_DIR}/users_guide.pdf
-            DESTINATION share/pdf)
+            DESTINATION share/chameleon/pdf)
 
 else()
     message(STATUS "Looking for texi2dvi - not found")
-
 endif()
 
 ###
diff --git a/example/basic_zposv/CMakeLists.txt b/example/basic_zposv/CMakeLists.txt
index fa03267e2..e545f7581 100644
--- a/example/basic_zposv/CMakeLists.txt
+++ b/example/basic_zposv/CMakeLists.txt
@@ -118,7 +118,7 @@ foreach(_example ${EXAMPLES})
     set_property(TARGET ${_name_exe} PROPERTY LINKER_LANGUAGE Fortran)
     target_link_libraries(${_name_exe} ${libs_for_examples})
     install(TARGETS ${_name_exe}
-            DESTINATION ${CMAKE_INSTALL_PREFIX}/example/basic_zposv)
+            DESTINATION lib/chameleon/example/basic_zposv)
 endforeach()
 
 #-------- Tests ---------
diff --git a/example/lapack_to_morse/CMakeLists.txt b/example/lapack_to_morse/CMakeLists.txt
index c4aef4faa..e531b183e 100644
--- a/example/lapack_to_morse/CMakeLists.txt
+++ b/example/lapack_to_morse/CMakeLists.txt
@@ -159,14 +159,14 @@ foreach(_ltm ${LTM_SOURCES})
     set_property(TARGET ${_name_exe} PROPERTY LINKER_LANGUAGE Fortran)
     target_link_libraries(${_name_exe} ${libs_for_ltm})
     install(TARGETS ${_name_exe}
-            DESTINATION ${CMAKE_INSTALL_PREFIX}/example/lapack_to_morse)
+            DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/chameleon/example/lapack_to_morse)
 endforeach()
 
 add_executable(step0 step0.c)
 set_property(TARGET step0 PROPERTY LINKER_LANGUAGE Fortran)
 target_link_libraries(step0 ${libs_for_step0})
 install(TARGETS step0
-        DESTINATION ${CMAKE_INSTALL_PREFIX}/example/lapack_to_morse)
+        DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/chameleon/example/lapack_to_morse)
 
 #-------- Tests ---------
 include(CTestLists.cmake)
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index fae48f518..b982cae52 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -79,7 +79,7 @@ endforeach()
 # installation
 # ------------
 install(FILES ${HDR_INSTALL}
-        DESTINATION include)
+        DESTINATION include/chameleon)
 
 ###
 ### END CMakeLists.txt
diff --git a/lib/pkgconfig/chameleon-quark.pc.in b/lib/pkgconfig/chameleon-quark.pc.in
index 1d3057edd..c53513b1a 100644
--- a/lib/pkgconfig/chameleon-quark.pc.in
+++ b/lib/pkgconfig/chameleon-quark.pc.in
@@ -1,7 +1,7 @@
 prefix=@CMAKE_INSTALL_PREFIX@
 exec_prefix=${prefix}
 libdir=${exec_prefix}/lib
-includedir=${exec_prefix}/include
+includedir=${exec_prefix}/include/chameleon
 
 Name: chameleon
 Description: Dense Linear Algebra for Scalable Multi-core Architectures and GPGPUs
diff --git a/lib/pkgconfig/chameleon-starpu.pc.in b/lib/pkgconfig/chameleon-starpu.pc.in
index 9cfa66a20..c53513b1a 100644
--- a/lib/pkgconfig/chameleon-starpu.pc.in
+++ b/lib/pkgconfig/chameleon-starpu.pc.in
@@ -1,12 +1,12 @@
 prefix=@CMAKE_INSTALL_PREFIX@
 exec_prefix=${prefix}
 libdir=${exec_prefix}/lib
-includedir=${exec_prefix}/include
+includedir=${exec_prefix}/include/chameleon
 
 Name: chameleon
 Description: Dense Linear Algebra for Scalable Multi-core Architectures and GPGPUs
 Version: @CHAMELEON_VERSION_MAJOR@.@CHAMELEON_VERSION_MINOR@.@CHAMELEON_VERSION_PATCH@
-Cflags: -I${includedir} 
+Cflags: -I${includedir}
 Libs: -L${libdir} @CHAMELEON_PKGCONFIG_LIBS@
 Libs.private: @CHAMELEON_PKGCONFIG_LIBS_PRIVATE@
 Requires: @CHAMELEON_PKGCONFIG_REQUIRED@
diff --git a/simucore/simucblas/CMakeLists.txt b/simucore/simucblas/CMakeLists.txt
index c27a33da3..383c031da 100644
--- a/simucore/simucblas/CMakeLists.txt
+++ b/simucore/simucblas/CMakeLists.txt
@@ -56,7 +56,7 @@ set_property(TARGET simucblas PROPERTY LINKER_LANGUAGE Fortran)
 # installation
 # ------------
 install(FILES ${SIMUCBLAS_HDRS}
-        DESTINATION include)
+        DESTINATION include/chameleon)
 install(TARGETS simucblas
         DESTINATION lib)
 
diff --git a/simucore/simulapacke/CMakeLists.txt b/simucore/simulapacke/CMakeLists.txt
index 299e391f6..e5a75ed25 100644
--- a/simucore/simulapacke/CMakeLists.txt
+++ b/simucore/simulapacke/CMakeLists.txt
@@ -55,7 +55,7 @@ set_property(TARGET simulapacke PROPERTY LINKER_LANGUAGE Fortran)
 # installation
 # ------------
 install(FILES ${SIMULAPACKE_HDRS}
-        DESTINATION include)
+        DESTINATION include/chameleon)
 install(TARGETS simulapacke
         DESTINATION lib)
 
diff --git a/testing/CMakeLists.txt b/testing/CMakeLists.txt
index a7081726b..7af1c2fa3 100644
--- a/testing/CMakeLists.txt
+++ b/testing/CMakeLists.txt
@@ -194,7 +194,7 @@ foreach(_precision ${CHAMELEON_PRECISION} )
     target_link_libraries(${_precision}testing ${libs_for_tests})
 
     install(TARGETS ${_precision}testing
-            DESTINATION ${CMAKE_INSTALL_PREFIX}/testing)
+            DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/chameleon/testing)
 
 endforeach()
 
@@ -207,7 +207,7 @@ if(CHAMELEON_SCHED_STARPU)
                                                       ${CMAKE_CURRENT_BINARY_DIR}/morse_testing_starpu.py)
     # install file
     install(FILES ${CMAKE_CURRENT_BINARY_DIR}/morse_testing_starpu.py
-            DESTINATION ${CMAKE_INSTALL_PREFIX}/testing)
+            DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/chameleon/testing)
 endif()
 
 if(CHAMELEON_SCHED_QUARK)
@@ -217,7 +217,7 @@ if(CHAMELEON_SCHED_QUARK)
                                                       ${CMAKE_CURRENT_BINARY_DIR}/morse_testing_quark.py)
     # install file
     install(FILES ${CMAKE_CURRENT_BINARY_DIR}/morse_testing_quark.py
-            DESTINATION ${CMAKE_INSTALL_PREFIX}/testing)
+            DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/chameleon/testing)
 endif()
 
 #-------- Tests ---------
diff --git a/timing/CMakeLists.txt b/timing/CMakeLists.txt
index ebb123624..2e0366eec 100644
--- a/timing/CMakeLists.txt
+++ b/timing/CMakeLists.txt
@@ -189,7 +189,7 @@ if(NOT CHAMELEON_SIMULATION)
     ${HWLOC_LIBRARIES}
     ${EXTRA_LIBRARIES}
     )
-    
+
     link_directories(${LAPACKE_LIBRARY_DIRS})
     link_directories(${LAPACK_LIBRARY_DIRS})
     link_directories(${CBLAS_LIBRARY_DIRS})
@@ -199,12 +199,12 @@ else()
 
     list(APPEND libs_for_timings
     coreblas
-    simulapacke    
+    simulapacke
     simucblas
     ${HWLOC_LIBRARIES}
     ${EXTRA_LIBRARIES}
     )
-    
+
 endif()
 
 link_directories(${HWLOC_LIBRARY_DIRS})
@@ -232,7 +232,7 @@ foreach(_timing ${TIMINGS})
     target_link_libraries(${_name_exe} ${libs_for_timings})
 
     install(TARGETS ${_name_exe}
-            DESTINATION ${CMAKE_INSTALL_PREFIX}/timing)
+            DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/chameleon/timing)
 endforeach()
 
 #-------- Tests ---------
-- 
GitLab