From 2825b6e1317377b7b9de79705df364408a51778b Mon Sep 17 00:00:00 2001
From: Mathieu Faverge <mathieu.faverge@inria.fr>
Date: Mon, 31 Jul 2017 19:22:45 +0200
Subject: [PATCH] Move the check for simulation to the higher level

---
 CMakeLists.txt                  | 45 +++++++++++++--------------------
 coreblas/CMakeLists.txt         |  6 ++---
 coreblas/compute/CMakeLists.txt | 27 ++++++++------------
 3 files changed, 30 insertions(+), 48 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1f50d75be..1a82be7e4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -614,7 +614,7 @@ endif(NOT CHAMELEON_SIMULATION)
 # -------------------------------
 if( CHAMELEON_SCHED_STARPU )
 
-  set(CHAMELEON_STARPU_VERSION "1.1" CACHE STRING "oldest STARPU version desired")
+    set(CHAMELEON_STARPU_VERSION "1.1" CACHE STRING "oldest STARPU version desired")
 
     # create list of components in order to make a single call to find_package(starpu...)
     if(NOT CHAMELEON_SIMULATION)
@@ -1006,57 +1006,46 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
 include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
 
-
-###############################################################################
-# Coreblas library (kernels for CPUs) #
-#######################################
-
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/coreblas/include)
-include_directories(${CMAKE_CURRENT_BINARY_DIR}/coreblas/include)
-add_subdirectory(coreblas)
-#------------------------------------------------------------------------------
-
-
-###############################################################################
-# Cudablas library (kernels for CUDAs) #
-########################################
-
-if(CHAMELEON_USE_CUDA)
+if (NOT CHAMELEON_SIMULATION)
+  ###############################################################################
+  # Coreblas library (kernels for CPUs) #
+  #######################################
+  include_directories(${CMAKE_CURRENT_SOURCE_DIR}/coreblas/include)
+  include_directories(${CMAKE_CURRENT_BINARY_DIR}/coreblas/include)
+  add_subdirectory(coreblas)
+
+  ###############################################################################
+  # Cudablas library (kernels for CUDAs) #
+  ########################################
+  if(CHAMELEON_USE_CUDA)
     include_directories(${CMAKE_CURRENT_SOURCE_DIR}/cudablas/include)
     include_directories(${CMAKE_CURRENT_BINARY_DIR}/cudablas/include)
     add_subdirectory(cudablas)
+  endif()
+
 endif()
-#------------------------------------------------------------------------------
 
 ###############################################################################
 # Add HQR library #
 ###################
 add_subdirectory(hqr)
 include_directories(hqr/include)
-#------------------------------------------------------------------------------
 
 ###############################################################################
 # Main library #
 ################
-
 add_subdirectory(include)
 add_subdirectory(control)
 add_subdirectory(compute)
-#------------------------------------------------------------------------------
-
 
 ###############################################################################
-# Runtime library #
-###################
-
+# Runtimes libraries #
+######################
 add_subdirectory(runtime)
-#------------------------------------------------------------------------------
-
 
 ###############################################################################
 # Executables and Tests #
 #########################
-
 enable_testing()
 include(CTest)
 
diff --git a/coreblas/CMakeLists.txt b/coreblas/CMakeLists.txt
index df58613de..20762027a 100644
--- a/coreblas/CMakeLists.txt
+++ b/coreblas/CMakeLists.txt
@@ -27,10 +27,8 @@
 ###
 
 add_subdirectory(include)
-if (NOT CHAMELEON_SIMULATION)
-    add_subdirectory(compute)
-    add_subdirectory(eztrace_module)
-endif()
+add_subdirectory(compute)
+add_subdirectory(eztrace_module)
 
 ###
 ### END CMakeLists.txt
diff --git a/coreblas/compute/CMakeLists.txt b/coreblas/compute/CMakeLists.txt
index a28fbc2fc..c863f49da 100644
--- a/coreblas/compute/CMakeLists.txt
+++ b/coreblas/compute/CMakeLists.txt
@@ -109,26 +109,21 @@ set(COREBLAS_SRCS
 add_library(coreblas ${COREBLAS_SRCS})
 list(INSERT CHAMELEON_DEP 0 -lcoreblas)
 add_dependencies(coreblas coreblas_include)
-set_property(TARGET coreblas PROPERTY LINKER_LANGUAGE Fortran)
-set_property(TARGET coreblas PROPERTY INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
+#set_property(TARGET coreblas PROPERTY LINKER_LANGUAGE Fortran)
+#set_property(TARGET coreblas PROPERTY INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
 
-if(NOT CHAMELEON_SIMULATION)
-  target_link_libraries(coreblas ${LAPACKE_LIBRARIES} ${CBLAS_LIBRARIES})
-endif(NOT CHAMELEON_SIMULATION)
+target_link_libraries(coreblas
+  ${LAPACKE_LIBRARIES}
+  ${LAPACK_SEQ_LIBRARIES}
+  ${CBLAS_LIBRARIES}
+  ${BLAS_SEQ_LIBRARIES}
+  )
 
-# # Dependencies step
-# # -----------------
-# foreach(_external_package "blas" "cblas" "lapack" "lapacke")
-#     string(TOUPPER "${_external_package}" _NAMEVAR)
-#     if(${_NAMEVAR}_EP)
-#         add_dependencies(coreblas ${_external_package}_build)
-#     endif()
-# endforeach()
-
-# installation
+# Installation
 # ------------
 install(TARGETS coreblas
-        DESTINATION lib)
+  ARCHIVE DESTINATION lib
+  LIBRARY DESTINATION lib)
 
 ###
 ### END CMakeLists.txt
-- 
GitLab