Mentions légales du service

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

Add confirgutaion files

parent 896e0297
No related branches found
No related tags found
No related merge requests found
...@@ -8,19 +8,75 @@ ...@@ -8,19 +8,75 @@
# @date 2013-06-24 # @date 2013-06-24
# #
### ###
cmake_minimum_required (VERSION 3.0)
project (SPM C)
# Check if compiled independently or within another project
if ( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
set( BUILD_SUBPROJECT OFF )
option(BUILD_SHARED_LIBS
"Build shared libraries" OFF)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build, options are None, Debug, Release, RelWithDebInfo and MinSizeRel." FORCE)
endif(NOT CMAKE_BUILD_TYPE)
if (IS_DIRECTORY ${CMAKE_SOURCE_DIR}/cmake_modules/morse_cmake/modules)
set( MORSE_CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake_modules/morse_cmake/modules )
list(APPEND CMAKE_MODULE_PATH ${MORSE_CMAKE_MODULE_PATH})
include(MorseInit)
else()
message(FATAL_ERROR "Submodule cmake_morse not initialized - run `git submodule update --init`")
endif()
else()
set( BUILD_SUBPROJECT ON )
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules")
include(GenSPMPkgConfig)
# The current version number
set (SPM_VERSION_MAJOR 0)
set (SPM_VERSION_MINOR 1)
set (SPM_VERSION_MICRO 0)
set( SPM_VERSION "${SPM_VERSION_MAJOR}.${SPM_VERSION_MINOR}.${SPM_VERSION_MICRO}" )
# Define precision supported by MAGMA_MORSE
# -----------------------------------------
set( RP_SPM_DICTIONNARY ${MORSE_CMAKE_MODULE_PATH}/precision_generator/subs.py )
set( RP_SPM_PRECISIONS "s;d;c;z" )
include(RulesPrecisions)
include(RulesPrecisions) include(RulesPrecisions)
include(AddSourceFiles) include(AddSourceFiles)
# 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
if(LAPACKE_FOUND)
message(STATUS "lapacke: ${LAPACKE_INCLUDE_DIRS}")
include_directories(${LAPACKE_INCLUDE_DIRS})
endif()
include_directories(include)
include_directories("${CMAKE_CURRENT_BINARY_DIR}/src")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/drivers")
### reset variables ### reset variables
set(generated_sources "") set(generated_sources "")
set(generated_headers "") set(generated_headers "")
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/drivers")
### Generate the headers in all precisions ### Generate the headers in all precisions
set(HEADERS set(HEADERS
z_spm.h src/z_spm.h
) )
precisions_rules_py(generated_headers precisions_rules_py(generated_headers
...@@ -29,8 +85,8 @@ precisions_rules_py(generated_headers ...@@ -29,8 +85,8 @@ precisions_rules_py(generated_headers
set(spm_headers set(spm_headers
${generated_headers} ${generated_headers}
spm.h include/spm.h
spm_drivers.h include/spm_drivers.h
) )
add_custom_target(spm_headers_tgt add_custom_target(spm_headers_tgt
...@@ -38,21 +94,21 @@ add_custom_target(spm_headers_tgt ...@@ -38,21 +94,21 @@ add_custom_target(spm_headers_tgt
### Generate the sources in all precisions ### Generate the sources in all precisions
set(SOURCES set(SOURCES
z_spm.c src/z_spm.c
z_spm_2dense.c src/z_spm_2dense.c
z_spm_dof_extend.c src/z_spm_dof_extend.c
z_spm_norm.c src/z_spm_norm.c
z_spm_scal.c src/z_spm_scal.c
z_spm_convert_to_csc.c src/z_spm_convert_to_csc.c
z_spm_convert_to_csr.c src/z_spm_convert_to_csr.c
z_spm_convert_to_ijv.c src/z_spm_convert_to_ijv.c
z_spm_expand.c src/z_spm_expand.c
z_spm_genrhs.c src/z_spm_genrhs.c
z_spm_integer.c src/z_spm_integer.c
z_spm_laplacian.c src/z_spm_laplacian.c
z_spm_matrixvector.c src/z_spm_matrixvector.c
z_spm_print.c src/z_spm_print.c
) )
precisions_rules_py(generated_sources precisions_rules_py(generated_sources
...@@ -61,56 +117,56 @@ precisions_rules_py(generated_sources ...@@ -61,56 +117,56 @@ precisions_rules_py(generated_sources
set(spm_sources set(spm_sources
${generated_sources} ${generated_sources}
spm.c src/spm.c
spm_io.c src/spm_io.c
spm_integers.c src/spm_integers.c
spm_dof_extend.c src/spm_dof_extend.c
spm_read_driver.c src/spm_read_driver.c
spm_gen_fake_values.c src/spm_gen_fake_values.c
drivers/iohb.c src/drivers/iohb.c
drivers/mmio.c src/drivers/mmio.c
drivers/laplacian.c src/drivers/laplacian.c
drivers/readhb.c src/drivers/readhb.c
drivers/readijv.c src/drivers/readijv.c
drivers/readmm.c src/drivers/readmm.c
) )
if (PASTIX_WITH_FORTRAN) if (SPM_WITH_FORTRAN)
set(spm_sources set(spm_sources
${spm_sources} ${spm_sources}
drivers/skitf.f src/drivers/skitf.f
drivers/readrsa.c src/drivers/readrsa.c
) )
endif() endif()
add_library(pastix_spm add_library(spm
${spm_sources} ${spm_sources}
) )
target_link_libraries(pastix_spm target_link_libraries(spm
${LAPACKE_LIBRARIES} ${LAPACKE_LIBRARIES}
${LAPACK_SEQ_LIBRARIES} ${LAPACK_SEQ_LIBRARIES}
${CBLAS_LIBRARIES} ${CBLAS_LIBRARIES}
${BLAS_SEQ_LIBRARIES} ${BLAS_SEQ_LIBRARIES}
) )
add_dependencies(pastix_spm add_dependencies(spm
spm_headers_tgt spm_headers_tgt
) )
### Generate the lib ### Generate the lib
if (MPI_C_FOUND) if (MPI_C_FOUND)
set_target_properties(pastix_spm PROPERTIES COMPILE_FLAGS "${MPI_COMPILE_FLAGS}") set_target_properties(spm PROPERTIES COMPILE_FLAGS "${MPI_COMPILE_FLAGS}")
target_link_libraries(pastix_spm target_link_libraries(spm
${MPI_C_LIBRARIES} ${MPI_C_LIBRARIES}
) )
endif (MPI_C_FOUND) endif (MPI_C_FOUND)
install(TARGETS pastix_spm install(TARGETS spm
ARCHIVE DESTINATION lib ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib) LIBRARY DESTINATION lib)
install(FILES spm.h install(FILES include/spm.h
DESTINATION include ) DESTINATION include )
### Add documented files to the global property ### Add documented files to the global property
...@@ -122,12 +178,12 @@ add_documented_files( ...@@ -122,12 +178,12 @@ add_documented_files(
add_documented_files( add_documented_files(
# Headers # Headers
spm.h include/spm.h
#spm_drivers.h #spm_drivers.h
# Source files # Source files
spm.c src/spm.c
spm_io.c src/spm_io.c
spm_read_driver.c src/spm_read_driver.c
spm_dof_extend.c src/spm_dof_extend.c
spm_integers.c src/spm_integers.c
) )
#
# See https://cmake.org/pipermail/cmake/2010-March/035992.html
#
function(add_source_files)
set(oneValueArgs PROJECT_NAME DIRECTORY)
cmake_parse_arguments(add_source_files "" "${oneValueArgs}" "" ${ARGN})
get_property(is_defined GLOBAL PROPERTY ${PROJECT_NAME}_LIB_SRCS2 DEFINED)
if(NOT is_defined)
define_property(GLOBAL PROPERTY ${PROJECT_NAME}_LIB_SRCS2
BRIEF_DOCS "List of source files included in the PaStiX library"
FULL_DOCS "List of source files included in the PaStiX library")
endif()
if(NOT ${add_source_files_DIRECTORY} STREQUAL "")
set(_dir "${add_source_files_DIRECTORY}/")
else()
set(_dir "")
endif()
set(ARGN ${add_source_files_UNPARSED_ARGUMENTS})
# make absolute paths
set(SRCS)
foreach(s IN LISTS ARGN)
set(s "${_dir}${s}")
if(NOT IS_ABSOLUTE "${s}")
get_filename_component(s "${s}" ABSOLUTE)
endif()
list(APPEND SRCS "${s}")
endforeach()
# append to global list
set_property(GLOBAL APPEND PROPERTY ${PROJECT_NAME}_LIB_SRCS2 "${SRCS}")
endfunction(add_source_files)
#
# See https://cmake.org/pipermail/cmake/2010-March/035992.html
#
function(add_documented_files)
set(oneValueArgs PROJECT_NAME DIRECTORY)
cmake_parse_arguments(add_documented_files "" "${oneValueArgs}" "" ${ARGN})
get_property(is_defined GLOBAL PROPERTY ${PROJECT_NAME}_DOX_SRCS DEFINED)
if(NOT is_defined)
define_property(GLOBAL PROPERTY ${PROJECT_NAME}_DOX_SRCS
BRIEF_DOCS "List of documented source files"
FULL_DOCS "List of source files to be included into the in-code documentation")
endif()
if(NOT ${add_documented_files_DIRECTORY} STREQUAL "")
set(_dir "${add_documented_files_DIRECTORY}/")
else()
set(_dir "")
endif()
set(ARGN ${add_documented_files_UNPARSED_ARGUMENTS})
# make absolute paths
set(SRCS)
foreach(s IN LISTS ARGN)
set(s "${_dir}${s}")
if(NOT IS_ABSOLUTE "${s}")
get_filename_component(s "${s}" ABSOLUTE)
endif()
list(APPEND SRCS "${s}")
endforeach()
# append to global list
set_property(GLOBAL APPEND PROPERTY ${PROJECT_NAME}_DOX_SRCS "${SRCS}")
endfunction(add_documented_files)
###
#
# @copyright (c) 2009-2014 The University of Tennessee and The University
# of Tennessee Research Foundation.
# All rights reserved.
# @copyright (c) 2012-2017 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
###
#
# @file GenPkgConfig.cmake
#
# @project MORSE
# MORSE is a software package provided by:
# Inria Bordeaux - Sud-Ouest,
# Univ. of Tennessee,
# King Abdullah Univesity of Science and Technology
# Univ. of California Berkeley,
# Univ. of Colorado Denver.
#
# @version 0.9.1
# @author Cedric Castagnede
# @author Emmanuel Agullo
# @author Mathieu Faverge
# @author Florent Pruvost
# @date 10-11-2014
#
###
###
#
# CONVERT_LIBSTYLE_TO_PKGCONFIG: convert a libraries list to follow the pkg-config style
# used in CLEAN_LIB_LIST
#
###
# macro(CONVERT_LIBSTYLE_TO_PKGCONFIG _liblist)
# set(${_liblist}_CPY "${${_liblist}}")
# set(${_liblist} "")
# foreach(_dep ${${_liblist}_CPY})
# if (${_dep} MATCHES "^/")
# get_filename_component(dep_libname ${_dep} NAME)
# get_filename_component(dep_libdir ${_dep} DIRECTORY)
# string(REPLACE "lib" "" dep_libname "${dep_libname}")
# string(REPLACE ".so" "" dep_libname "${dep_libname}")
# string(REPLACE ".a" "" dep_libname "${dep_libname}")
# string(REPLACE ".dylib" "" dep_libname "${dep_libname}")
# string(REPLACE ".dll" "" dep_libname "${dep_libname}")
# list(APPEND ${_liblist} -L${dep_libdir} -l${dep_libname})
# elseif(NOT ${_dep} MATCHES "^-")
# list(APPEND ${_liblist} "-l${_dep}")
# else()
# list(APPEND ${_liblist} ${_dep})
# endif()
# endforeach()
# endmacro(CONVERT_LIBSTYLE_TO_PKGCONFIG)
###
#
# CLEAN_LIB_LIST: clean libraries lists to follow the pkg-config style
# used in GENERATE_PKGCONFIG_FILE
#
###
#macro(CLEAN_LIB_LIST _package)
# list(REMOVE_DUPLICATES ${_package}_PKGCONFIG_LIBS)
# list(REMOVE_DUPLICATES ${_package}_PKGCONFIG_LIBS_PRIVATE)
# list(REMOVE_DUPLICATES ${_package}_PKGCONFIG_REQUIRED)
# list(REMOVE_DUPLICATES ${_package}_PKGCONFIG_REQUIRED_PRIVATE)
# convert_libstyle_to_pkgconfig(${_package}_PKGCONFIG_LIBS)
# convert_libstyle_to_pkgconfig(${_package}_PKGCONFIG_LIBS_PRIVATE)
# string(REPLACE ";" " " ${_package}_PKGCONFIG_LIBS "${${_package}_PKGCONFIG_LIBS}")
# string(REPLACE ";" " " ${_package}_PKGCONFIG_LIBS_PRIVATE "${${_package}_PKGCONFIG_LIBS_PRIVATE}")
# string(REPLACE ";" " " ${_package}_PKGCONFIG_REQUIRED "${${_package}_PKGCONFIG_REQUIRED}")
# string(REPLACE ";" " " ${_package}_PKGCONFIG_REQUIRED_PRIVATE "${${_package}_PKGCONFIG_REQUIRED_PRIVATE}")
#endmacro(CLEAN_LIB_LIST)
###
#
# GENERATE_PKGCONFIG_FILE: generate files spm.pc
#
###
macro(GENERATE_SPM_PKGCONFIG_FILE)
set(SPM_PKGCONFIG_LIBS "-lspm")
set(SPM_PKGCONFIG_LIBS_PRIVATE "-lm")
set(SPM_PKGCONFIG_REQUIRED "")
set(SPM_PKGCONFIG_REQUIRED_PRIVATE "")
#clean_lib_list(SPM)
set(_output_spm_file "${CMAKE_BINARY_DIR}/spm.pc")
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/lib/pkgconfig/spm.pc.in"
"${_output_spm_file}"
@ONLY
)
install(
FILES ${_output_spm_file}
DESTINATION lib/pkgconfig
)
endmacro(GENERATE_SPM_PKGCONFIG_FILE)
###
#
# generate_env_file: generate files pastix.pc
#
###
macro(generate_env_file)
# Create .sh file
# ---------------
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/spm_env.sh.in"
"${CMAKE_BINARY_DIR}/bin/spm_env.sh" @ONLY)
# installation
# ------------
install(FILES "${CMAKE_BINARY_DIR}/bin/spm_env.sh"
DESTINATION bin)
endmacro(generate_env_file)
##
## @end file GenPkgConfig.cmake
##
...@@ -3,11 +3,11 @@ exec_prefix=${prefix} ...@@ -3,11 +3,11 @@ exec_prefix=${prefix}
libdir=${exec_prefix}/lib libdir=${exec_prefix}/lib
includedir=${exec_prefix}/include includedir=${exec_prefix}/include
Name: HQR Name: SPM
Description: Build and Visualize Trees for Hierachical QR Factorizations Description: SParse Matrix package
Version: @HQR_VERSION_MAJOR@.@HQR_VERSION_MINOR@.@HQR_VERSION_MICRO@ Version: @SPM_VERSION_MAJOR@.@SPM_VERSION_MINOR@.@SPM_VERSION_MICRO@
Cflags: -I${includedir} Cflags: -I${includedir}
Libs: -L${libdir} @HQR_PKGCONFIG_LIBS@ Libs: -L${libdir} @SPM_PKGCONFIG_LIBS@
Libs.private: @HQR_PKGCONFIG_LIBS_PRIVATE@ Libs.private: @SPM_PKGCONFIG_LIBS_PRIVATE@
Requires: @HQR_PKGCONFIG_REQUIRED@ Requires: @SPM_PKGCONFIG_REQUIRED@
Requires.private: @HQR_PKGCONFIG_REQUIRED_PRIVATE@ Requires.private: @SPM_PKGCONFIG_REQUIRED_PRIVATE@
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