Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Reorganize cmake directory.
[simgrid.git] / buildtools / Cmake / Supernovae.cmake
1 ### Make supernovae files and libs
2
3 set(simgrid_fragile_sources 
4 ${PROJECT_DIRECTORY}/src/gras/DataDesc/ddt_parse.yy.c
5 ${PROJECT_DIRECTORY}/src/surf/surfxml_parse.c
6 ${PROJECT_DIRECTORY}/src/xbt/graphxml_parse.c
7 ${PROJECT_DIRECTORY}/src/simdag/sd_daxloader.c
8 )
9 set(gras_fragile_sources
10 ${PROJECT_DIRECTORY}/src/gras/DataDesc/ddt_parse.yy.c
11 ${PROJECT_DIRECTORY}/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 "${PROJECT_DIRECTORY}/src/xbt/log.c")
33                         set(file "xbt/log.c")
34                 endif(file MATCHES "${PROJECT_DIRECTORY}/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 "${PROJECT_DIRECTORY}/src/xbt/log.c")
49                         set(file "xbt/log.c")
50                 endif(file MATCHES "${PROJECT_DIRECTORY}/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}" OUTPUT_VARIABLE "SUPER_OK")
58 exec_program("${PROJECT_DIRECTORY}/src/mk_supernovae.sh ${PROJECT_DIRECTORY}/src/supernovae_gras.c ${temp_src_gras}"    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}"    OUTPUT_VARIABLE "SUPER_OK")
61 endif(enable_smpi)
62
63 add_library(simgrid     SHARED  ${PROJECT_DIRECTORY}/src/supernovae_sg.c ${simgrid_fragile_sources})
64 add_library(simgrid_static STATIC ${PROJECT_DIRECTORY}/src/supernovae_sg.c ${simgrid_fragile_sources})
65 add_library(gras        SHARED  ${PROJECT_DIRECTORY}/src/supernovae_gras.c ${gras_fragile_sources})
66 if(enable_smpi)
67         add_library(smpi        SHARED  ${PROJECT_DIRECTORY}/src/supernovae_smpi.c)
68 endif(enable_smpi)
69