diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f565e9bad9b622c8d74bdabd91ff47a368ce704..471495fe29415589e816743e2b1a2b461309cf1d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ project (SPM C Fortran) # Check if compiled independently or within another project if ( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) - set( BUILD_SUBPROJECT OFF ) + set( BUILD_AS_SUBPROJECT OFF ) option(BUILD_SHARED_LIBS "Build shared libraries" OFF) @@ -34,7 +34,13 @@ if ( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) include(CTest) 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() # Define a subproject name fr ctest @@ -84,22 +90,33 @@ include(RulesPrecisions) ### System parameter detection include(CheckSystem) -# PaStiX depends on CBLAS -#---------------------------- -find_package(CBLAS) # Should be REQUIRED for BLAS sequential only -if(CBLAS_FOUND) - message(STATUS "cblas: ${CBLAS_INCLUDE_DIRS}") - include_directories(${CBLAS_INCLUDE_DIRS}) -endif() - -find_package(LAPACKE) # Should be also REQUIRED +# SPM depends on Lapacke and CBLAS +#--------------------------------- +find_package(LAPACKE REQUIRED) if(LAPACKE_FOUND) message(STATUS "lapacke: ${LAPACKE_INCLUDE_DIRS}") include_directories(${LAPACKE_INCLUDE_DIRS}) 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 ( "${CMAKE_CURRENT_SOURCE_DIR}/include/spm_config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/src/spm_config.h") @@ -108,10 +125,8 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/src/spm_config.h" DESTINATION include include_directories(include) include_directories("${CMAKE_CURRENT_SOURCE_DIR}/src") include_directories("${CMAKE_CURRENT_BINARY_DIR}/src") -include_directories("${CMAKE_CURRENT_SOURCE_DIR}/drivers") ### reset variables -set(generated_sources "") set(generated_headers "") ### Generate the headers in all precisions @@ -134,6 +149,8 @@ add_custom_target(spm_headers_tgt DEPENDS ${spm_headers} ) ### Generate the sources in all precisions +set(generated_sources "") + set(SOURCES src/z_spm.c src/z_spm_2dense.c @@ -186,10 +203,8 @@ add_library(spm ) target_link_libraries(spm - ${LAPACKE_LIBRARIES} - ${LAPACK_SEQ_LIBRARIES} - ${CBLAS_LIBRARIES} - ${BLAS_SEQ_LIBRARIES} + ${LAPACKE_LIBRARIES_DEP} + ${CBLAS_LIBRARIES_DEP} ) add_dependencies(spm diff --git a/cmake_modules/morse_cmake b/cmake_modules/morse_cmake index f4ead635e331c6a43b81d9e0a56b082fe47be36c..0e9c7a8fe39c4a728c2a8346007e1afa207cd9b5 160000 --- a/cmake_modules/morse_cmake +++ b/cmake_modules/morse_cmake @@ -1 +1 @@ -Subproject commit f4ead635e331c6a43b81d9e0a56b082fe47be36c +Subproject commit 0e9c7a8fe39c4a728c2a8346007e1afa207cd9b5 diff --git a/include/spm_config.h.in b/include/spm_config.h.in index 3301b6c0450e78c5c0f37349dd990d88b2d372ed..64116e78a2fe790e06bcdbc41137dab6144c7942 100644 --- a/include/spm_config.h.in +++ b/include/spm_config.h.in @@ -44,6 +44,9 @@ /* Datatypes used */ #cmakedefine SPM_INT64 +/* Exploit the scotch version from the library compiling spm */ +#cmakedefine HAVE_SCOTCH + #if defined(HAVE_FALLTHROUGH) #define spm_attr_fallthrough __attribute__((fallthrough)) #else diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index ff6480bc2b82ecebfa5ae8a3183ed688a3d343b3..608ab0ab7a78604831546e6f8c8741a141445252 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -34,8 +34,8 @@ add_library(spm_test target_link_libraries( spm_test spm - ${LAPACKE_LIBRARIES} - ${LAPACK_SEQ_LIBRARIES} ) + ${LAPACKE_LIBRARIES_DEP} + ${CBLAS_LIBRARIES_DEP} ) ## Generate all test executables set (TESTS