Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Definitively remove old variable PROJECT_DIRECTORY for CMAKE_HOME_DIRECTORY.
[simgrid.git] / buildtools / Cmake / Supernovae.cmake
1 ### Make supernovae files and libs
2
3 #############################################################################
4 ### Add here every files that should not be supernovaed (generated files) ###
5 #############################################################################
6 set(simgrid_fragile_sources 
7         src/gras/DataDesc/ddt_parse.yy.c
8         src/surf/surfxml_parse.c
9         src/xbt/graphxml_parse.c
10         src/simdag/sd_daxloader.c
11 )
12 set(gras_fragile_sources
13         src/gras/DataDesc/ddt_parse.yy.c
14         src/xbt/graphxml_parse.c
15 )
16
17 #####################################################
18 ### END OF CONFIGURATION, NO NEED TO READ FURTHER ###
19 #####################################################
20
21 ### Rebuild the supernovae source files
22 if (PERL_EXECUTABLE AND enable_supernovae) # I need supernovae and can use it
23
24         # supernovae files are generated. I promise
25         set_source_files_properties(${CMAKE_HOME_DIRECTORY}/src/supernovae_sg.c
26                                       PROPERTIES GENERATED true)
27         set_source_files_properties(${CMAKE_HOME_DIRECTORY}/src/supernovae_gras.c
28                                       PROPERTIES GENERATED true)
29         set_source_files_properties(${CMAKE_HOME_DIRECTORY}/src/supernovae_smpi.c
30                                       PROPERTIES GENERATED true)
31
32         ADD_CUSTOM_COMMAND(
33                 OUTPUT   ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_sg.c
34                 DEPENDS  ${CMAKE_HOME_DIRECTORY}/src/mk_supernovae.pl ${simgrid_sources}
35                 COMMAND  perl ${CMAKE_HOME_DIRECTORY}/src/mk_supernovae.pl --out=${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_sg.c '--fragile=${simgrid_fragile_sources}' '${simgrid_sources}'
36                 WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}
37                 COMMENT "Generating supernovae_sg.c"
38         )
39
40         ADD_CUSTOM_COMMAND(
41                 OUTPUT   ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_gras.c
42                 DEPENDS  ${CMAKE_HOME_DIRECTORY}/src/mk_supernovae.pl ${gras_sources}
43                 COMMAND  perl ${CMAKE_HOME_DIRECTORY}/src/mk_supernovae.pl --out=${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_gras.c '--fragile=${gras_fragile_sources}'    '${gras_sources}'
44                 WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}
45                 COMMENT "Generating supernovae_gras.c"
46         )
47
48         ADD_CUSTOM_COMMAND(
49                 OUTPUT   ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_smpi.c
50                 DEPENDS  ${CMAKE_HOME_DIRECTORY}/src/mk_supernovae.pl ${SMPI_SRC}
51                 COMMAND  perl ${CMAKE_HOME_DIRECTORY}/src/mk_supernovae.pl --out=${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_smpi.c  '${SMPI_SRC}'
52                 WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}
53                 COMMENT "Generating supernovae_smpi.c"
54         )
55
56         ### Change the content of the libraries so that it contains only supernovae+fragiles
57         set(simgrid_sources 
58                 ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_sg.c
59                 ${simgrid_fragile_sources})
60
61         set(gras_sources
62                 ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_gras.c 
63                 ${gras_fragile_sources})                
64
65         set(SMPI_SRC 
66                 ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_smpi.c)
67 else(PERL_EXECUTABLE AND enable_supernovae) # I need supernovae and can use it
68         if (enable_supernovae)
69                 message(You need Perl to activate supernovae)
70                 set(enable_supernovae 0)
71         endif(enable_supernovae)
72 endif(PERL_EXECUTABLE AND enable_supernovae) # I need supernovae and can use it