Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Cosmetics.
[simgrid.git] / buildtools / Cmake / Supernovae.cmake
1 ### Make supernovae files and libs
2
3 set(simgrid_fragile_sources 
4 src/gras/DataDesc/ddt_parse.yy.c
5 src/surf/surfxml_parse.c
6 src/xbt/graphxml_parse.c
7 src/simdag/sd_daxloader.c
8 )
9 set(gras_fragile_sources
10 src/gras/DataDesc/ddt_parse.yy.c
11 src/xbt/graphxml_parse.c
12 )
13 set(temp_src_smpi "")
14 set(temp_src_simgrid "")
15 set(temp_src_gras "")
16
17 if(enable_smpi)
18         foreach(file ${SMPI_SRC})
19                 set(temp_src_smpi "${temp_src_smpi} ${file}")
20         endforeach(file ${SMPI_SRC})
21 endif(enable_smpi)
22
23 foreach(file ${simgrid_sources})
24         set(en_plus yes)
25         foreach(file_delete ${simgrid_fragile_sources})
26                 if(file_delete MATCHES "${file}")
27                         set(en_plus no)
28                         #message("${file}")
29                 endif(file_delete MATCHES "${file}")
30         endforeach (file_delete ${simgrid_fragile_sources})
31         if(en_plus)
32                 if(file MATCHES "src/xbt/log.c")
33                         set(file "xbt/log.c")
34                 endif(file MATCHES "src/xbt/log.c")
35                 set(temp_src_simgrid "${temp_src_simgrid} ${file}")
36         endif(en_plus)
37 endforeach(file ${simgrid_sources})
38
39 foreach(file ${gras_sources})
40         set(en_plus yes)
41         foreach(file_delete ${gras_fragile_sources})
42                 if(file_delete MATCHES "${file}")
43                         set(en_plus no)
44                         #message("${file}")
45                 endif(file_delete MATCHES "${file}")
46         endforeach (file_delete ${gras_fragile_sources})
47         if(en_plus)
48                 if(file MATCHES "src/xbt/log.c")
49                         set(file "xbt/log.c")
50                 endif(file MATCHES "src/xbt/log.c")
51                 set(temp_src_gras "${temp_src_gras} ${file}")
52         endif(en_plus)
53 endforeach(file ${gras_sources})
54
55 exec_program("${CMAKE_COMMAND} -E remove -f ${PROJECT_DIRECTORY}/src/supernovae_sg.c ${PROJECT_DIRECTORY}/src/supernovae_gras.c ${PROJECT_DIRECTORY}/src/supernovae_smpi.c" OUTPUT_VARIABLE "SUPER_OK")
56 exec_program("chmod a=rwx ${PROJECT_DIRECTORY}/src/mk_supernovae.sh" OUTPUT_VARIABLE "SUPER_OK")
57 exec_program("${PROJECT_DIRECTORY}/src/mk_supernovae.sh ${PROJECT_DIRECTORY}/src/supernovae_sg.c   ${temp_src_simgrid}" "${PROJECT_DIRECTORY}" OUTPUT_VARIABLE "SUPER_OK")
58 exec_program("${PROJECT_DIRECTORY}/src/mk_supernovae.sh ${PROJECT_DIRECTORY}/src/supernovae_gras.c ${temp_src_gras}" "${PROJECT_DIRECTORY}"     OUTPUT_VARIABLE "SUPER_OK")
59 if(enable_smpi)
60         exec_program("${PROJECT_DIRECTORY}/src/mk_supernovae.sh ${PROJECT_DIRECTORY}/src/supernovae_smpi.c ${temp_src_smpi}" "${PROJECT_DIRECTORY}"     OUTPUT_VARIABLE "SUPER_OK")
61 endif(enable_smpi)
62
63 add_library(simgrid     SHARED  ${PROJECT_DIRECTORY}/src/supernovae_sg.c ${simgrid_fragile_sources})
64         if(enable_lib_static)
65                 add_library(simgrid_static STATIC ${PROJECT_DIRECTORY}/src/supernovae_sg.c ${simgrid_fragile_sources})  
66         endif(enable_lib_static)
67 add_library(gras        SHARED  ${PROJECT_DIRECTORY}/src/supernovae_gras.c ${gras_fragile_sources})
68 if(enable_smpi)
69         add_library(smpi        SHARED  ${PROJECT_DIRECTORY}/src/supernovae_smpi.c)
70                         if(enable_lib_static)
71                         add_library(smpi_static STATIC ${PROJECT_DIRECTORY}/src/supernovae_smpi.c)      
72                 endif(enable_lib_static)
73 endif(enable_smpi)