Commits (1)
......@@ -3,7 +3,7 @@
# @copyright (c) 2009-2014 The University of Tennessee and The University
# of Tennessee Research Foundation.
# All rights reserved.
# @copyright (c) 2012-2015 Inria. All rights reserved.
# @copyright (c) 2012-2017 Inria. All rights reserved.
# @copyright (c) 2012-2016 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
###
......@@ -39,7 +39,7 @@
# STARPU_INCLUDE_DIRS_DEP - starpu + dependencies include directories
# STARPU_LIBRARY_DIRS_DEP - starpu + dependencies link directories
# STARPU_LIBRARIES_DEP - starpu libraries + dependencies
# STARPU_VERSION_STRING - A human-readable string containing the version of the package found
# STARPU_VERSION - A human-readable string containing the version of the package found
# STARPU_VERSION_MAJOR - The major version of the package found
# STARPU_VERSION_MINOR - The minor version of the package found
# The user can give specific paths where to find the libraries adding cmake
......@@ -55,7 +55,7 @@
# Copyright 2012-2013 Emmanuel Agullo
# Copyright 2012-2013 Mathieu Faverge
# Copyright 2012 Cedric Castagnede
# Copyright 2013 Florent Pruvost
# Copyright 2013-2017 Florent Pruvost
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file MORSE-Copyright.txt for details.
......@@ -211,11 +211,18 @@ find_package(PkgConfig QUIET)
if(PKG_CONFIG_EXECUTABLE AND NOT STARPU_GIVEN_BY_USER)
pkg_search_module(STARPU_SHM libstarpu)
set (STARPU_VERSION_LIST "1.3;1.2;1.1;1.0")
foreach(_version ${STARPU_VERSION_LIST})
pkg_search_module(STARPU_SHM starpu-${_version})
if (STARPU_SHM_FOUND)
set(STARPU_VERSION "${_version}" CACHE INTERNAL "StarPU version found")
break()
endif()
endforeach()
set(STARPU_INCLUDE_DIRS "${STARPU_SHM_STATIC_INCLUDE_DIRS}")
set(STARPU_LIBRARY_DIRS "${STARPU_SHM_STATIC_LIBRARY_DIRS}")
if(STARPU_LOOK_FOR_MPI AND MPI_FOUND)
pkg_search_module(STARPU_MPI libstarpumpi)
pkg_search_module(STARPU_MPI starpumpi-${STARPU_VERSION})
endif()
if (NOT STARPU_FIND_QUIETLY)
if (STARPU_SHM_FOUND AND STARPU_SHM_LIBRARIES)
......@@ -243,14 +250,14 @@ if(PKG_CONFIG_EXECUTABLE AND NOT STARPU_GIVEN_BY_USER)
" the PKG_CONFIG_PATH environment variable.${ColourReset}")
endif()
endif()
endif()
# check if the version found respects the minimum required
if (STARPU_FIND_VERSION_EXACT)
if( NOT (STARPU_FIND_VERSION_MAJOR STREQUAL STARPU_VERSION_MAJOR) OR
NOT (STARPU_FIND_VERSION_MINOR STREQUAL STARPU_VERSION_MINOR) )
if(STARPU_FIND_REQUIRED AND NOT STARPU_FIND_QUIETLY)
message(FATAL_ERROR
"STARPU version found is ${STARPU_VERSION_STRING}"
if(NOT STARPU_FIND_QUIETLY)
message(WARNING
"STARPU version found is ${STARPU_VERSION}"
" when required is ${STARPU_FIND_VERSION}")
endif()
endif()
......@@ -258,14 +265,16 @@ if(PKG_CONFIG_EXECUTABLE AND NOT STARPU_GIVEN_BY_USER)
# if the version found is older than the required then error
if( (STARPU_FIND_VERSION_MAJOR STRGREATER STARPU_VERSION_MAJOR) OR
(STARPU_FIND_VERSION_MINOR STRGREATER STARPU_VERSION_MINOR) )
if(STARPU_FIND_REQUIRED AND NOT STARPU_FIND_QUIETLY)
message(FATAL_ERROR
"STARPU version found is ${STARPU_VERSION_STRING}"
if(NOT STARPU_FIND_QUIETLY)
message(WARNING
"STARPU version found is ${STARPU_VERSION}"
" when required is ${STARPU_FIND_VERSION} or newer")
endif()
endif()
endif()
endif()
if(STARPU_MPI_LIBRARIES)
if (STARPU_LOOK_FOR_SIMGRID)
# Cmake does not fetch explicit libfxt.a static paths from pkg-config...
......@@ -390,8 +399,8 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND)
string(REGEX REPLACE
"(.*)define([ \t]*)${_PACKAGE}_MINOR_VERSION([ \t]*)([0-9]+)(.*)"
"\\4" ${_PACKAGE}_VERSION_MINOR "${_file}")
set(${_PACKAGE}_VERSION_STRING
"${${_PACKAGE}_VERSION_MAJOR}.${${_PACKAGE}_VERSION_MINOR}" CACHE PATH "StarPU version found in starpu_config.h")
set(${_PACKAGE}_VERSION
"${${_PACKAGE}_VERSION_MAJOR}.${${_PACKAGE}_VERSION_MINOR}" CACHE INTERNAL "StarPU version found")
#message(STATUS "${_PACKAGE}_VERSION_MAJOR = -${${_PACKAGE}_VERSION_MAJOR}-")
#message(STATUS "${_PACKAGE}_VERSION_MINOR = -${${_PACKAGE}_VERSION_MINOR}-")
......@@ -406,9 +415,9 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND)
if (STARPU_FIND_VERSION_MAJOR AND STARPU_FIND_VERSION_MINOR)
if( NOT (STARPU_FIND_VERSION_MAJOR STREQUAL STARPU_VERSION_MAJOR) OR
NOT (STARPU_FIND_VERSION_MINOR STREQUAL STARPU_VERSION_MINOR) )
if(STARPU_FIND_REQUIRED AND NOT STARPU_FIND_QUIETLY)
message(FATAL_ERROR
"STARPU version found is ${STARPU_VERSION_STRING} "
if(NOT STARPU_FIND_QUIETLY)
message(WARNING
"STARPU version found is ${STARPU_VERSION} "
"when required is ${STARPU_FIND_VERSION}")
endif()
endif()
......@@ -418,23 +427,23 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND)
# if the version found is older than the required then error
if( (STARPU_FIND_VERSION_MAJOR STRGREATER STARPU_VERSION_MAJOR) OR
(STARPU_FIND_VERSION_MINOR STRGREATER STARPU_VERSION_MINOR) )
if(STARPU_FIND_REQUIRED AND NOT STARPU_FIND_QUIETLY)
message(FATAL_ERROR
"STARPU version found is ${STARPU_VERSION_STRING} "
if(NOT STARPU_FIND_QUIETLY)
message(WARNING
"STARPU version found is ${STARPU_VERSION} "
"when required is ${STARPU_FIND_VERSION} or newer")
endif()
endif()
endif()
endif()
else()
if(STARPU_FIND_REQUIRED AND NOT STARPU_FIND_QUIETLY)
if(STARPU_FIND_REQUIRED)
message(FATAL_ERROR
"STARPU version has not been found using starpu_config.h"
" located in ${STARPU_starpu_config.h_INCLUDE_DIRS}")
endif()
endif()
else()
if(STARPU_FIND_REQUIRED AND NOT STARPU_FIND_QUIETLY)
if(STARPU_FIND_REQUIRED)
message(FATAL_ERROR
"starpu_config.h has not been found while required to get StarPU version")
endif()
......@@ -563,10 +572,10 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND)
# ----------------------------------------------
# create list of libs to find
set(STARPU_libs_to_find "starpu-${STARPU_VERSION_STRING}")
set(STARPU_SHM_libs_to_find "starpu-${STARPU_VERSION_STRING}")
set(STARPU_libs_to_find "starpu-${STARPU_VERSION}")
set(STARPU_SHM_libs_to_find "starpu-${STARPU_VERSION}")
if (STARPU_LOOK_FOR_MPI OR MPI_FOUND)
list(INSERT STARPU_libs_to_find 0 "starpumpi-${STARPU_VERSION_STRING}")
list(INSERT STARPU_libs_to_find 0 "starpumpi-${STARPU_VERSION}")
set(STARPU_MPI_libs_to_find "${STARPU_libs_to_find}")
endif()
......@@ -625,7 +634,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND)
if(NOT STARPU_FIND_QUIETLY)
message(STATUS "Looking for starpu -- lib ${starpu_lib} not found")
endif()
if(starpu_lib STREQUAL "starpumpi-${STARPU_VERSION_STRING}" AND
if(starpu_lib STREQUAL "starpumpi-${STARPU_VERSION}" AND
NOT STARPU_FIND_REQUIRED_MPI)
# if MPI optional, not a problem: no NOTFOUND in list of MPI LIBRARIES
if(NOT STARPU_FIND_QUIETLY)
......