Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add MSG_task_set_data_size function binding
[simgrid.git] / FindSimGrid.cmake
1 #IF YOU HAVE INSTALL SIMGRID IN A SPECIAL DIRECTORY
2 #YOU CAN SPECIFY SIMGRID_ROOT OR GRAS_ROOT
3
4 find_library(SIMGRID_LIB
5     NAME simgrid
6     HINTS
7         $ENV{SIMGRID_ROOT}
8     PATH_SUFFIXES lib
9 )
10
11 find_path(SIMGRID_INCLUDES msg/msg.h
12     HINTS
13         $ENV{SIMGRID_ROOT}
14     PATH_SUFFIXES include
15 )
16
17 find_program(TESH_BIN_PATH
18         NAMES tesh
19         HINTS
20         $ENV{SIMGRID_ROOT}
21         PATH_SUFFIXES bin
22 )
23
24 message(STATUS "Looking for lib SimGrid")
25 if(SIMGRID_LIB)
26   message(STATUS "Looking for lib SimGrid - found")  
27   get_filename_component(simgrid_version ${SIMGRID_LIB} REALPATH)
28   string(REPLACE "${SIMGRID_LIB}." "" simgrid_version "${simgrid_version}")       
29   string(REGEX MATCH "^[0-9]" SIMGRID_MAJOR_VERSION "${simgrid_version}")
30   string(REGEX MATCH "^[0-9].[0-9]" SIMGRID_MINOR_VERSION "${simgrid_version}")
31   string(REGEX MATCH "^[0-9].[0-9].[0-9]" SIMGRID_PATCH_VERSION "${simgrid_version}")
32   string(REGEX REPLACE "^${SIMGRID_MINOR_VERSION}." "" SIMGRID_PATCH_VERSION "${SIMGRID_PATCH_VERSION}") 
33   string(REGEX REPLACE "^${SIMGRID_MAJOR_VERSION}." "" SIMGRID_MINOR_VERSION "${SIMGRID_MINOR_VERSION}")
34 else(SIMGRID_LIB)
35   message(STATUS "Looking for lib SimGrid - not found")
36 endif(SIMGRID_LIB)
37
38 string(REGEX REPLACE "libsimgrid.*" "" SIMGRID_LIB_PATH "${SIMGRID_LIB}")
39
40 message(STATUS "Simgrid         : ${SIMGRID_LIB}")
41 message(STATUS "Simgrid_path    : ${SIMGRID_LIB_PATH}")
42 message(STATUS "Simgrid version : ${SIMGRID_MAJOR_VERSION}.${SIMGRID_MINOR_VERSION}")
43
44 message(STATUS "Looking for msg.h")
45 if(SIMGRID_INCLUDES)
46   message(STATUS "Looking for msg.h - found")
47 else(SIMGRID_INCLUDES)
48   message(STATUS "Looking for msg.h - not found")
49 endif(SIMGRID_INCLUDES)
50
51 if(SIMGRID_LIB AND SIMGRID_INCLUDES)
52 else(SIMGRID_LIB AND SIMGRID_INCLUDES)
53     message(FATAL_ERROR "Unable to find both the library and the include files. Setting the environment variable SIMGRID_ROOT may help.")
54 endif(SIMGRID_LIB AND SIMGRID_INCLUDES)
55
56 if(TESH_BIN_PATH)
57 message(STATUS "Found Tesh: ${TESH_BIN_PATH}")
58 endif(TESH_BIN_PATH)