From 4a4c73fdca6f0a23dfc654055e6358be63f34726 Mon Sep 17 00:00:00 2001
From: Mathieu Faverge <mathieu.faverge@inria.fr>
Date: Wed, 13 Sep 2017 15:04:52 +0200
Subject: [PATCH] Fix issues reported by @sylvand

---
 cmake_modules/GenPkgConfig.cmake       |  2 +-
 example/CMakeLists.txt                 |  4 +-
 example/basic_zposv/CMakeLists.txt     | 50 ++++++---------
 example/lapack_to_morse/CMakeLists.txt |  6 +-
 example/out_of_core/CMakeLists.txt     |  2 +-
 testing/CMakeLists.txt                 | 87 ++++++++++----------------
 testing/lin/CMakeLists.txt             | 12 ++--
 timing/CMakeLists.txt                  |  2 +-
 8 files changed, 68 insertions(+), 97 deletions(-)

diff --git a/cmake_modules/GenPkgConfig.cmake b/cmake_modules/GenPkgConfig.cmake
index 7d6b218c5..85c8cfc11 100644
--- a/cmake_modules/GenPkgConfig.cmake
+++ b/cmake_modules/GenPkgConfig.cmake
@@ -98,7 +98,7 @@ MACRO(GENERATE_PKGCONFIG_FILE)
     set(CUDABLAS_PKGCONFIG_LIBS_PRIVATE  "")
 
     # A list of packages required by this package
-    set(CHAMELEON_PKGCONFIG_REQUIRED "")
+    set(CHAMELEON_PKGCONFIG_REQUIRED "hqr")
     set(COREBLAS_PKGCONFIG_REQUIRED  "")
     set(CUDABLAS_PKGCONFIG_REQUIRED  "")
 
diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt
index 92aa83143..e4958b8bb 100755
--- a/example/CMakeLists.txt
+++ b/example/CMakeLists.txt
@@ -22,7 +22,9 @@
 #  @date 17-10-2014
 #
 ###
-
+if (CHAMELEON_SIMULATION)
+  message(ERROR "example directory should not be included when simulation is enabled")
+endif()
 
 add_subdirectory(basic_zposv)
 
diff --git a/example/basic_zposv/CMakeLists.txt b/example/basic_zposv/CMakeLists.txt
index 7fe4f8d57..13052cb59 100644
--- a/example/basic_zposv/CMakeLists.txt
+++ b/example/basic_zposv/CMakeLists.txt
@@ -66,37 +66,27 @@ elseif(CHAMELEON_SCHED_QUARK)
     link_directories(${QUARK_LIBRARY_DIRS})
 endif()
 
-if(NOT CHAMELEON_SIMULATION)
-
-    if(CHAMELEON_USE_CUDA)
-        list(APPEND libs_for_examples
-        cudablas)
-    endif()
-    if(CHAMELEON_USE_CUDA)
-        link_directories(${CUDA_LIBRARY_DIRS})
-    endif()
-
-    list(APPEND libs_for_examples
-         coreblas
-         ${LAPACKE_LIBRARIES}
-         ${CBLAS_LIBRARIES}
-         ${LAPACK_SEQ_LIBRARIES}
-         ${BLAS_SEQ_LIBRARIES}
-         ${EXTRA_LIBRARIES}
-    )
-
-    link_directories(${LAPACKE_LIBRARY_DIRS})
-    link_directories(${LAPACK_LIBRARY_DIRS})
-    link_directories(${CBLAS_LIBRARY_DIRS})
-    link_directories(${BLAS_LIBRARY_DIRS})
-
-else()
+if(CHAMELEON_USE_CUDA)
+  list(APPEND libs_for_examples
+    cudablas)
+endif()
+if(CHAMELEON_USE_CUDA)
+  link_directories(${CUDA_LIBRARY_DIRS})
+endif()
 
-    list(APPEND libs_for_examples
-         ${EXTRA_LIBRARIES}
-    )
+list(APPEND libs_for_examples
+  coreblas
+  ${LAPACKE_LIBRARIES}
+  ${CBLAS_LIBRARIES}
+  ${LAPACK_SEQ_LIBRARIES}
+  ${BLAS_SEQ_LIBRARIES}
+  ${EXTRA_LIBRARIES}
+  )
 
-endif()
+link_directories(${LAPACKE_LIBRARY_DIRS})
+link_directories(${LAPACK_LIBRARY_DIRS})
+link_directories(${CBLAS_LIBRARY_DIRS})
+link_directories(${BLAS_LIBRARY_DIRS})
 
 # message(STATUS "libs timings: ${libs_for_examples}")
 foreach(_example ${EXAMPLES})
@@ -105,7 +95,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 lib/chameleon/example/basic_zposv)
+            DESTINATION bin/example/basic_zposv )
 endforeach()
 
 #-------- Tests ---------
diff --git a/example/lapack_to_morse/CMakeLists.txt b/example/lapack_to_morse/CMakeLists.txt
index 3a343cd37..2dc43491a 100644
--- a/example/lapack_to_morse/CMakeLists.txt
+++ b/example/lapack_to_morse/CMakeLists.txt
@@ -19,8 +19,6 @@
 #  @date 2014-10-13
 #
 ###
-
-
 include_directories(${CMAKE_CURRENT_BINARY_DIR})
 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
 
@@ -94,14 +92,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}/lib/chameleon/example/lapack_to_morse)
+            DESTINATION bin/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}/lib/chameleon/example/lapack_to_morse)
+        DESTINATION bin/example/lapack_to_morse)
 
 #-------- Tests ---------
 include(CTestLists.cmake)
diff --git a/example/out_of_core/CMakeLists.txt b/example/out_of_core/CMakeLists.txt
index 22fbc165b..2efda2d3f 100644
--- a/example/out_of_core/CMakeLists.txt
+++ b/example/out_of_core/CMakeLists.txt
@@ -65,7 +65,7 @@ foreach(_ooc ${OOC_SOURCES})
     endif()
     target_link_libraries(${_name_exe} ${libs_for_ooc})
     install(TARGETS ${_name_exe}
-            DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/chameleon/example/out_of_core)
+            DESTINATION bin/example/out_of_core)
 endforeach()
 
 #-------- Tests ---------
diff --git a/testing/CMakeLists.txt b/testing/CMakeLists.txt
index 9eacfad54..1b2e5d9e4 100644
--- a/testing/CMakeLists.txt
+++ b/testing/CMakeLists.txt
@@ -25,7 +25,9 @@
 #  @date 13-07-2012
 #
 ###
-
+if (CHAMELEON_SIMULATION)
+  message(ERROR "testing directory should not be included when simulation is enabled")
+endif()
 
 # Check for subdirectories
 # ------------------------
@@ -106,32 +108,28 @@ list(APPEND libs_for_tests
   chameleon
   )
 
-if(NOT CHAMELEON_SIMULATION)
-
-    if(CHAMELEON_USE_CUDA)
-        list(APPEND libs_for_tests
-        cudablas)
-    endif()
-    if(CHAMELEON_USE_CUDA)
-        link_directories(${CUDA_LIBRARY_DIRS})
-    endif()
-
-    list(APPEND libs_for_tests
-    coreblas
-    ${LAPACKE_LIBRARIES}
-    ${TMG_LIBRARIES}
-    ${LAPACK_LIBRARIES}
-    ${CBLAS_LIBRARIES}
-    ${BLAS_LIBRARIES}
-    )
+if(CHAMELEON_USE_CUDA)
+  list(APPEND libs_for_tests
+    cudablas)
+endif()
+if(CHAMELEON_USE_CUDA)
+  link_directories(${CUDA_LIBRARY_DIRS})
+endif()
 
-    link_directories(${LAPACKE_LIBRARY_DIRS})
-    link_directories(${TMG_LIBRARY_DIRS})
-    link_directories(${LAPACK_LIBRARY_DIRS})
-    link_directories(${CBLAS_LIBRARY_DIRS})
-    link_directories(${BLAS_LIBRARY_DIRS})
+list(APPEND libs_for_tests
+  coreblas
+  ${LAPACKE_LIBRARIES}
+  ${TMG_LIBRARIES}
+  ${LAPACK_LIBRARIES}
+  ${CBLAS_LIBRARIES}
+  ${BLAS_LIBRARIES}
+  )
 
-endif()
+link_directories(${LAPACKE_LIBRARY_DIRS})
+link_directories(${TMG_LIBRARY_DIRS})
+link_directories(${LAPACK_LIBRARY_DIRS})
+link_directories(${CBLAS_LIBRARY_DIRS})
+link_directories(${BLAS_LIBRARY_DIRS})
 
 list(APPEND libs_for_tests
   hqr
@@ -166,41 +164,20 @@ foreach(_precision ${CHAMELEON_PRECISION} )
     target_link_libraries(${_precision}testing ${libs_for_tests})
 
     install(TARGETS ${_precision}testing
-            DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/chameleon/testing)
+            DESTINATION bin/testing)
 
 endforeach()
 
 # Copy python scripts to use test drivers
 # ---------------------------------------
-if(CHAMELEON_SCHED_STARPU)
-    # Copy launcher
-    add_custom_target(testing_launcher_starpu ALL
-                     COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/chameleon_testing.py
-                                                      ${CMAKE_CURRENT_BINARY_DIR}/chameleon_testing.py)
-    # install file
-    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/chameleon_testing.py
-            DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/chameleon/testing)
-endif()
-
-if(CHAMELEON_SCHED_PARSEC)
-    # Copy launcher
-    add_custom_target(testing_launcher_parsec ALL
-                     COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/chameleon_testing.py
-                                                      ${CMAKE_CURRENT_BINARY_DIR}/chameleon_testing.py)
-    # install file
-    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/chameleon_testing.py
-            DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/chameleon/testing)
-endif()
-
-if(CHAMELEON_SCHED_QUARK)
-    # Copy launcher
-    add_custom_target(testing_launcher_quark ALL
-                     COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/chameleon_testing.py
-                                                      ${CMAKE_CURRENT_BINARY_DIR}/chameleon_testing.py)
-    # install file
-    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/chameleon_testing.py
-            DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/chameleon/testing)
-endif()
+# Copy launcher
+add_custom_target(testing_launcher ALL
+  COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/chameleon_testing.py
+  ${CMAKE_CURRENT_BINARY_DIR}/chameleon_testing.py)
+
+# install file
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/chameleon_testing.py
+  DESTINATION bin/testing )
 
 #-------- Tests ---------
 include(CTestLists.cmake)
diff --git a/testing/lin/CMakeLists.txt b/testing/lin/CMakeLists.txt
index c20363975..704f35048 100644
--- a/testing/lin/CMakeLists.txt
+++ b/testing/lin/CMakeLists.txt
@@ -167,28 +167,32 @@ if(CHAMELEON_PREC_S)
     add_executable(morse_xlintsts ${ALINTST} ${SLINTST} ${SCLNTST})
     set_property(TARGET morse_xlintsts PROPERTY LINKER_LANGUAGE Fortran)
     target_link_libraries(morse_xlintsts ${libs_for_tests})
-    install(TARGETS morse_xlintsts DESTINATION ${CMAKE_INSTALL_PREFIX}/testing/lin)
+    install(TARGETS morse_xlintsts
+      DESTINATION bin/testing/lin)
 endif()
 
 if(CHAMELEON_PREC_S)
     add_executable(morse_xlintstd ${ALINTST} ${DLINTST} ${DZLNTST})
     set_property(TARGET morse_xlintstd PROPERTY LINKER_LANGUAGE Fortran)
     target_link_libraries(morse_xlintstd ${libs_for_tests})
-    install(TARGETS morse_xlintstd DESTINATION ${CMAKE_INSTALL_PREFIX}/testing/lin)
+    install(TARGETS morse_xlintstd
+      DESTINATION bin/testing/lin)
 endif()
 
 if(CHAMELEON_PREC_C)
     add_executable(morse_xlintstc ${ALINTST} ${CLINTST} ${SCLNTST})
     set_property(TARGET morse_xlintstc PROPERTY LINKER_LANGUAGE Fortran)
     target_link_libraries(morse_xlintstc ${libs_for_tests})
-    install(TARGETS morse_xlintstc DESTINATION ${CMAKE_INSTALL_PREFIX}/testing/lin)
+    install(TARGETS morse_xlintstc
+      DESTINATION bin/testing/lin)
 endif()
 
 if(CHAMELEON_PREC_Z)
     add_executable(morse_xlintstz ${ALINTST} ${ZLINTST} ${DZLNTST})
     set_property(TARGET morse_xlintstz PROPERTY LINKER_LANGUAGE Fortran)
     target_link_libraries(morse_xlintstz ${libs_for_tests})
-    install(TARGETS morse_xlintstz DESTINATION ${CMAKE_INSTALL_PREFIX}/testing/lin)
+    install(TARGETS morse_xlintstz
+      DESTINATION bin/testing/lin)
 endif()
 
 # Copy launcher
diff --git a/timing/CMakeLists.txt b/timing/CMakeLists.txt
index 3e13f9574..8f03c60b9 100644
--- a/timing/CMakeLists.txt
+++ b/timing/CMakeLists.txt
@@ -216,7 +216,7 @@ foreach(_timing ${TIMINGS})
     set_property(TARGET ${_name_exe} PROPERTY LINKER_LANGUAGE Fortran)
     target_link_libraries(${_name_exe} ${libs_for_timings})
     install(TARGETS ${_name_exe}
-            DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/chameleon/timing)
+            DESTINATION bin/timing)
 endforeach()
 
 #-------- Tests ---------
-- 
GitLab