Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 97fdacc3 authored by Mathieu Faverge's avatar Mathieu Faverge
Browse files

update the cmake module

parent a72016b6
No related branches found
No related tags found
1 merge request!5Hotfix/updates from pastix
...@@ -13,7 +13,7 @@ project (SPM C Fortran) ...@@ -13,7 +13,7 @@ project (SPM C Fortran)
# Check if compiled independently or within another project # Check if compiled independently or within another project
if ( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) if ( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
set( BUILD_SUBPROJECT OFF ) set( BUILD_AS_SUBPROJECT OFF )
option(BUILD_SHARED_LIBS option(BUILD_SHARED_LIBS
"Build shared libraries" OFF) "Build shared libraries" OFF)
...@@ -34,7 +34,13 @@ if ( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) ...@@ -34,7 +34,13 @@ if ( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
include(CTest) include(CTest)
else() else()
set( BUILD_SUBPROJECT ON ) set( BUILD_AS_SUBPROJECT ON )
# Check if within pastix which provides Scotch
if (PASTIX_ORDERING_SCOTCH)
set(HAVE_SCOTCH ON)
endif()
endif() endif()
# Define a subproject name fr ctest # Define a subproject name fr ctest
...@@ -84,22 +90,33 @@ include(RulesPrecisions) ...@@ -84,22 +90,33 @@ include(RulesPrecisions)
### System parameter detection ### System parameter detection
include(CheckSystem) include(CheckSystem)
# PaStiX depends on CBLAS # SPM depends on Lapacke and CBLAS
#---------------------------- #---------------------------------
find_package(CBLAS) # Should be REQUIRED for BLAS sequential only find_package(LAPACKE REQUIRED)
if(CBLAS_FOUND)
message(STATUS "cblas: ${CBLAS_INCLUDE_DIRS}")
include_directories(${CBLAS_INCLUDE_DIRS})
endif()
find_package(LAPACKE) # Should be also REQUIRED
if(LAPACKE_FOUND) if(LAPACKE_FOUND)
message(STATUS "lapacke: ${LAPACKE_INCLUDE_DIRS}") message(STATUS "lapacke: ${LAPACKE_INCLUDE_DIRS}")
include_directories(${LAPACKE_INCLUDE_DIRS}) include_directories(${LAPACKE_INCLUDE_DIRS})
endif() endif()
#Configuration header find_package(CBLAS REQUIRED)
#-------------------- if(CBLAS_FOUND)
message(STATUS "cblas: ${CBLAS_INCLUDE_DIRS}")
include_directories(${CBLAS_INCLUDE_DIRS})
endif()
### Store dependencies not handled with pkg-config
set( DEPS_LIBRARIES
${LAPACKE_LIBRARIES_DEP}
${CBLAS_LIBRARIES_DEP}
)
list(APPEND CMAKE_INSTALL_RPATH
${LAPACKE_LIBRARY_DIRS_DEP}
${CBLAS_LIBRARY_DIRS_DEP}
)
# Configuration header
#---------------------
configure_file ( configure_file (
"${CMAKE_CURRENT_SOURCE_DIR}/include/spm_config.h.in" "${CMAKE_CURRENT_SOURCE_DIR}/include/spm_config.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/src/spm_config.h") "${CMAKE_CURRENT_BINARY_DIR}/src/spm_config.h")
...@@ -108,10 +125,8 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/src/spm_config.h" DESTINATION include ...@@ -108,10 +125,8 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/src/spm_config.h" DESTINATION include
include_directories(include) include_directories(include)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/src") include_directories("${CMAKE_CURRENT_SOURCE_DIR}/src")
include_directories("${CMAKE_CURRENT_BINARY_DIR}/src") include_directories("${CMAKE_CURRENT_BINARY_DIR}/src")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/drivers")
### reset variables ### reset variables
set(generated_sources "")
set(generated_headers "") set(generated_headers "")
### Generate the headers in all precisions ### Generate the headers in all precisions
...@@ -134,6 +149,8 @@ add_custom_target(spm_headers_tgt ...@@ -134,6 +149,8 @@ add_custom_target(spm_headers_tgt
DEPENDS ${spm_headers} ) DEPENDS ${spm_headers} )
### Generate the sources in all precisions ### Generate the sources in all precisions
set(generated_sources "")
set(SOURCES set(SOURCES
src/z_spm.c src/z_spm.c
src/z_spm_2dense.c src/z_spm_2dense.c
...@@ -186,10 +203,8 @@ add_library(spm ...@@ -186,10 +203,8 @@ add_library(spm
) )
target_link_libraries(spm target_link_libraries(spm
${LAPACKE_LIBRARIES} ${LAPACKE_LIBRARIES_DEP}
${LAPACK_SEQ_LIBRARIES} ${CBLAS_LIBRARIES_DEP}
${CBLAS_LIBRARIES}
${BLAS_SEQ_LIBRARIES}
) )
add_dependencies(spm add_dependencies(spm
......
Subproject commit f4ead635e331c6a43b81d9e0a56b082fe47be36c Subproject commit 0e9c7a8fe39c4a728c2a8346007e1afa207cd9b5
...@@ -44,6 +44,9 @@ ...@@ -44,6 +44,9 @@
/* Datatypes used */ /* Datatypes used */
#cmakedefine SPM_INT64 #cmakedefine SPM_INT64
/* Exploit the scotch version from the library compiling spm */
#cmakedefine HAVE_SCOTCH
#if defined(HAVE_FALLTHROUGH) #if defined(HAVE_FALLTHROUGH)
#define spm_attr_fallthrough __attribute__((fallthrough)) #define spm_attr_fallthrough __attribute__((fallthrough))
#else #else
......
...@@ -34,8 +34,8 @@ add_library(spm_test ...@@ -34,8 +34,8 @@ add_library(spm_test
target_link_libraries( spm_test target_link_libraries( spm_test
spm spm
${LAPACKE_LIBRARIES} ${LAPACKE_LIBRARIES_DEP}
${LAPACK_SEQ_LIBRARIES} ) ${CBLAS_LIBRARIES_DEP} )
## Generate all test executables ## Generate all test executables
set (TESTS set (TESTS
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment