Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Don't build smpi in a separate library anymore.
[simgrid.git] / buildtools / Cmake / Distrib.cmake
index 60d66d8..b84a0f0 100644 (file)
@@ -1,97 +1,88 @@
 #########################################
 ### Fill in the "make install" target ###
 #########################################
-         
+
 # doc
-if(NOT EXISTS ${CMAKE_HOME_DIRECTORY}/doc/html/)
-       file(MAKE_DIRECTORY ${CMAKE_HOME_DIRECTORY}/doc/html/)
-endif(NOT EXISTS ${CMAKE_HOME_DIRECTORY}/doc/html/)
+file(MAKE_DIRECTORY ${CMAKE_HOME_DIRECTORY}/doc/html/)
 install(DIRECTORY "${CMAKE_HOME_DIRECTORY}/doc/html/"
-  DESTINATION "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/doc/simgrid/html/"
-  PATTERN ".svn" EXCLUDE 
-  PATTERN ".git" EXCLUDE 
-  PATTERN "*.o" EXCLUDE
-  PATTERN "*~" EXCLUDE
-)
+  DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/doc/simgrid/html/)
+install(DIRECTORY "${CMAKE_HOME_DIRECTORY}/doc/HelloWorld/"
+  DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/doc/simgrid/HelloWorld/)
 
 #### Generate the manpages
 if(NOT WIN32)
-if( NOT MANPAGE_DIR)
-       set( MANPAGE_DIR ${CMAKE_BINARY_DIR}/manpages )
-endif( NOT MANPAGE_DIR)
-
-add_custom_target(manpages ALL
-        COMMAND ${CMAKE_COMMAND} -E make_directory ${MANPAGE_DIR}
-       COMMAND pod2man ${CMAKE_HOME_DIRECTORY}/tools/simgrid_update_xml.pl > ${MANPAGE_DIR}/simgrid_update_xml.1
-       COMMENT "Generating manpages"
-)
-install(FILES ${MANPAGE_DIR}/simgrid_update_xml.1
-        DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/share/man/man1)
+  if( NOT MANPAGE_DIR)
+    set( MANPAGE_DIR ${CMAKE_BINARY_DIR}/manpages )
+  endif()
+
+  add_custom_target(manpages ALL
+    COMMAND ${CMAKE_COMMAND} -E make_directory ${MANPAGE_DIR}
+    COMMAND pod2man ${CMAKE_HOME_DIRECTORY}/tools/simgrid_update_xml.pl > ${MANPAGE_DIR}/simgrid_update_xml.1
+    COMMENT "Generating manpages"
+    )
+  install(FILES ${MANPAGE_DIR}/simgrid_update_xml.1 ${CMAKE_HOME_DIRECTORY}/tools/tesh/tesh.1
+    DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/share/man/man1)
 
-endif(NOT WIN32)
+endif()
 
 # binaries
 install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/smpicc
-                 ${CMAKE_BINARY_DIR}/bin/smpif2c
-                 ${CMAKE_BINARY_DIR}/bin/smpiff
-                 ${CMAKE_BINARY_DIR}/bin/smpirun
-               DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/)
+  ${CMAKE_BINARY_DIR}/bin/smpif2c
+  ${CMAKE_BINARY_DIR}/bin/smpiff
+  ${CMAKE_BINARY_DIR}/bin/smpif90
+  ${CMAKE_BINARY_DIR}/bin/smpirun
+  DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/)
 
 install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/tesh
-DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/)
+  DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/)
 
 install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/graphicator
-DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/)
-       
+  DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/)
+
 install(PROGRAMS ${CMAKE_HOME_DIRECTORY}/tools/MSG_visualization/colorize.pl
-        DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/
-               RENAME simgrid-colorizer)
-               
+  DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/
+  RENAME simgrid-colorizer)
+
 add_custom_target(simgrid-colorizer ALL
-COMMENT "Install ${CMAKE_BINARY_DIR}/bin/colorize"
-COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_HOME_DIRECTORY}/tools/MSG_visualization/colorize.pl ${CMAKE_BINARY_DIR}/bin/colorize
-)
-                               
+  COMMENT "Install ${CMAKE_BINARY_DIR}/bin/colorize"
+  COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_HOME_DIRECTORY}/tools/MSG_visualization/colorize.pl ${CMAKE_BINARY_DIR}/bin/colorize
+  )
+
 install(PROGRAMS ${CMAKE_HOME_DIRECTORY}/tools/simgrid_update_xml.pl
-               DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/
-               RENAME simgrid_update_xml)
-               
+  DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/
+  RENAME simgrid_update_xml)
+
 add_custom_target(simgrid_update_xml ALL
-COMMENT "Install ${CMAKE_BINARY_DIR}/bin/simgrid_update_xml"
-COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_HOME_DIRECTORY}/tools/simgrid_update_xml.pl ${CMAKE_BINARY_DIR}/bin/simgrid_update_xml
-)
-               
-install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/gras_stub_generator
-               DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/)
+  COMMENT "Install ${CMAKE_BINARY_DIR}/bin/simgrid_update_xml"
+  COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_HOME_DIRECTORY}/tools/simgrid_update_xml.pl ${CMAKE_BINARY_DIR}/bin/simgrid_update_xml
+  )
 
 # libraries
-install(TARGETS simgrid gras 
-        DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/)
-       
-if(enable_smpi)        
-  install(TARGETS smpi
-          DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/)
-endif(enable_smpi)
+install(TARGETS simgrid 
+  DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/)
 
 if(enable_lib_static AND NOT WIN32)
-       install(TARGETS simgrid_static 
-               DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/)
-       if(enable_smpi) 
-               install(TARGETS smpi_static
-                       DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/)
-       endif(enable_smpi)
-endif(enable_lib_static AND NOT WIN32)
+  install(TARGETS simgrid_static
+    DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/)
+endif()
+
+if(enable_java)
+  install(TARGETS SG_java
+      DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/)
+  install(FILES ${SIMGRID_JAR}
+      DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/java/)
+endif()
 
 # include files
 set(HEADERS
-    ${headers_to_install}
-    ${generated_headers_to_install}
-    )
+  ${headers_to_install}
+  ${generated_headers_to_install}
+  )
 foreach(file ${HEADERS})
   get_filename_component(location ${file} PATH)
   string(REPLACE "${CMAKE_CURRENT_BINARY_DIR}/" "" location "${location}")
   install(FILES ${file}
-          DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${location})
+    DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${location})
 endforeach(file ${HEADERS})
 
 # example files
@@ -99,74 +90,71 @@ foreach(file ${examples_to_install})
   string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/examples/" "" file ${file})
   get_filename_component(location ${file} PATH)
   install(FILES "examples/${file}"
-          DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/doc/simgrid/examples/${location})
+    DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/doc/simgrid/examples/${location})
 endforeach(file ${examples_to_install})
 
 # bindings cruft
 
 if(HAVE_LUA)
-       file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/lib/lua/5.1")
-       add_custom_target(simgrid_lua ALL
-               DEPENDS simgrid 
-                               ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
-               )
-       add_custom_command(
-               OUTPUT ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
-               COMMAND ${CMAKE_COMMAND} -E create_symlink ../../libsimgrid.${LIB_EXE} ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
-       )
-       install(FILES ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
-               DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/lua/5.1
-               )
-endif(HAVE_LUA)
+  file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/lib/lua/5.1")
+  add_custom_target(simgrid_lua ALL
+    DEPENDS simgrid
+    ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
+    )
+  add_custom_command(
+    OUTPUT ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
+    COMMAND ${CMAKE_COMMAND} -E create_symlink ../../libsimgrid.${LIB_EXE} ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
+    )
+  install(FILES ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
+    DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/lua/5.1
+    )
+endif()
 
 ###########################################
 ### Fill in the "make uninstall" target ###
 ###########################################
 
 add_custom_target(uninstall
-COMMAND ${CMAKE_COMMAND} -E    remove_directory ${CMAKE_INSTALL_PREFIX}/doc/simgrid
-COMMAND ${CMAKE_COMMAND} -E    echo "uninstall doc ok"
-COMMAND ${CMAKE_COMMAND} -E    remove -f ${CMAKE_INSTALL_PREFIX}/lib/libgras*
-COMMAND ${CMAKE_COMMAND} -E    remove -f ${CMAKE_INSTALL_PREFIX}/lib/libsimgrid*
-COMMAND ${CMAKE_COMMAND} -E    remove -f ${CMAKE_INSTALL_PREFIX}/lib/libsmpi*
-COMMAND ${CMAKE_COMMAND} -E    echo "uninstall lib ok"
-COMMAND ${CMAKE_COMMAND} -E    remove -f ${CMAKE_INSTALL_PREFIX}/bin/smpicc
-COMMAND ${CMAKE_COMMAND} -E    remove -f ${CMAKE_INSTALL_PREFIX}/bin/smpif2c
-COMMAND ${CMAKE_COMMAND} -E    remove -f ${CMAKE_INSTALL_PREFIX}/bin/smpiff
-COMMAND ${CMAKE_COMMAND} -E    remove -f ${CMAKE_INSTALL_PREFIX}/bin/smpirun
-COMMAND ${CMAKE_COMMAND} -E    remove -f ${CMAKE_INSTALL_PREFIX}/bin/tesh
-COMMAND ${CMAKE_COMMAND} -E    remove -f ${CMAKE_INSTALL_PREFIX}/bin/simgrid-colorizer
-COMMAND ${CMAKE_COMMAND} -E    remove -f ${CMAKE_INSTALL_PREFIX}/bin/simgrid_update_xml
-COMMAND ${CMAKE_COMMAND} -E    remove -f ${CMAKE_INSTALL_PREFIX}/bin/gras_stub_generator
-COMMAND ${CMAKE_COMMAND} -E    remove -f ${CMAKE_INSTALL_PREFIX}/bin/graphicator
-COMMAND ${CMAKE_COMMAND} -E    echo "uninstall bin ok"
-COMMAND ${CMAKE_COMMAND} -E    remove_directory ${CMAKE_INSTALL_PREFIX}/include/amok
-COMMAND ${CMAKE_COMMAND} -E    remove_directory ${CMAKE_INSTALL_PREFIX}/include/gras
-COMMAND ${CMAKE_COMMAND} -E    remove_directory ${CMAKE_INSTALL_PREFIX}/include/instr
-COMMAND ${CMAKE_COMMAND} -E    remove_directory ${CMAKE_INSTALL_PREFIX}/include/msg 
-COMMAND ${CMAKE_COMMAND} -E    remove_directory ${CMAKE_INSTALL_PREFIX}/include/simdag
-COMMAND ${CMAKE_COMMAND} -E    remove_directory ${CMAKE_INSTALL_PREFIX}/include/smpi
-COMMAND ${CMAKE_COMMAND} -E    remove_directory ${CMAKE_INSTALL_PREFIX}/include/simix
-COMMAND ${CMAKE_COMMAND} -E    remove_directory ${CMAKE_INSTALL_PREFIX}/include/surf
-COMMAND ${CMAKE_COMMAND} -E    remove_directory ${CMAKE_INSTALL_PREFIX}/include/xbt
-COMMAND ${CMAKE_COMMAND} -E    remove_directory ${CMAKE_INSTALL_PREFIX}/include/mc
-COMMAND ${CMAKE_COMMAND} -E    remove_directory ${CMAKE_INSTALL_PREFIX}/include/simgrid
-COMMAND ${CMAKE_COMMAND} -E    remove -f ${CMAKE_INSTALL_PREFIX}/include/simgrid_config.h
-COMMAND ${CMAKE_COMMAND} -E    remove -f ${CMAKE_INSTALL_PREFIX}/include/gras.h 
-COMMAND ${CMAKE_COMMAND} -E    remove -f ${CMAKE_INSTALL_PREFIX}/include/xbt.h
-COMMAND ${CMAKE_COMMAND} -E    echo "uninstall include ok"
-COMMAND ${CMAKE_COMMAND} -E    remove -f ${CMAKE_INSTALL_PREFIX}/share/man/man1/simgrid_update_xml.1
-COMMAND ${CMAKE_COMMAND} -E    echo "uninstall man ok"
-WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}"
-)
+  COMMAND ${CMAKE_COMMAND} -E  remove_directory ${CMAKE_INSTALL_PREFIX}/doc/simgrid
+  COMMAND ${CMAKE_COMMAND} -E  echo "uninstall doc ok"
+  COMMAND ${CMAKE_COMMAND} -E  remove -f ${CMAKE_INSTALL_PREFIX}/lib/libsimgrid*
+  COMMAND ${CMAKE_COMMAND} -E   remove -f ${CMAKE_INSTALL_PREFIX}/lib/lua/5.1/simgrid*
+  COMMAND ${CMAKE_COMMAND} -E  echo "uninstall lib ok"
+  COMMAND ${CMAKE_COMMAND} -E  remove -f ${CMAKE_INSTALL_PREFIX}/bin/smpicc
+  COMMAND ${CMAKE_COMMAND} -E  remove -f ${CMAKE_INSTALL_PREFIX}/bin/smpif2c
+  COMMAND ${CMAKE_COMMAND} -E  remove -f ${CMAKE_INSTALL_PREFIX}/bin/smpiff
+  COMMAND ${CMAKE_COMMAND} -E  remove -f ${CMAKE_INSTALL_PREFIX}/bin/smpif90
+  COMMAND ${CMAKE_COMMAND} -E  remove -f ${CMAKE_INSTALL_PREFIX}/bin/smpirun
+  COMMAND ${CMAKE_COMMAND} -E  remove -f ${CMAKE_INSTALL_PREFIX}/bin/tesh
+  COMMAND ${CMAKE_COMMAND} -E  remove -f ${CMAKE_INSTALL_PREFIX}/bin/simgrid-colorizer
+  COMMAND ${CMAKE_COMMAND} -E  remove -f ${CMAKE_INSTALL_PREFIX}/bin/simgrid_update_xml
+  COMMAND ${CMAKE_COMMAND} -E  remove -f ${CMAKE_INSTALL_PREFIX}/bin/graphicator
+  COMMAND ${CMAKE_COMMAND} -E  echo "uninstall bin ok"
+  COMMAND ${CMAKE_COMMAND} -E  remove_directory ${CMAKE_INSTALL_PREFIX}/include/instr
+  COMMAND ${CMAKE_COMMAND} -E  remove_directory ${CMAKE_INSTALL_PREFIX}/include/msg
+  COMMAND ${CMAKE_COMMAND} -E  remove_directory ${CMAKE_INSTALL_PREFIX}/include/simdag
+  COMMAND ${CMAKE_COMMAND} -E  remove_directory ${CMAKE_INSTALL_PREFIX}/include/smpi
+  COMMAND ${CMAKE_COMMAND} -E  remove_directory ${CMAKE_INSTALL_PREFIX}/include/simix
+  COMMAND ${CMAKE_COMMAND} -E  remove_directory ${CMAKE_INSTALL_PREFIX}/include/surf
+  COMMAND ${CMAKE_COMMAND} -E  remove_directory ${CMAKE_INSTALL_PREFIX}/include/xbt
+  COMMAND ${CMAKE_COMMAND} -E  remove_directory ${CMAKE_INSTALL_PREFIX}/include/mc
+  COMMAND ${CMAKE_COMMAND} -E  remove_directory ${CMAKE_INSTALL_PREFIX}/include/simgrid
+  COMMAND ${CMAKE_COMMAND} -E  remove -f ${CMAKE_INSTALL_PREFIX}/include/simgrid_config.h
+  COMMAND ${CMAKE_COMMAND} -E  remove -f ${CMAKE_INSTALL_PREFIX}/include/xbt.h
+  COMMAND ${CMAKE_COMMAND} -E  echo "uninstall include ok"
+  COMMAND ${CMAKE_COMMAND} -E  remove -f ${CMAKE_INSTALL_PREFIX}/share/man/man1/simgrid_update_xml.1
+    COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/share/man/man1/tesh.1
+  COMMAND ${CMAKE_COMMAND} -E  echo "uninstall man ok"
+  WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}"
+  )
 
 if(HAVE_LUA)
-       add_custom_command(TARGET uninstall
-       COMMAND ${CMAKE_COMMAND} -E echo "uninstall binding lua ok"
-       COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/lib/lua/5.1/simgrid.${LIB_EXE}
-       WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}/"
-       )
-endif(HAVE_LUA)
+  add_custom_command(TARGET uninstall
+    COMMAND ${CMAKE_COMMAND} -E echo "uninstall binding lua ok"
+    COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/lib/lua/5.1/simgrid.${LIB_EXE}
+    WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}/"
+    )
+endif()
 
 ################################################################
 ## Build a sain "make dist" target to build a source package ###
@@ -175,47 +163,47 @@ endif(HAVE_LUA)
 ################################################################
 
 # This is the complete list of what will be added to the source archive
-set(source_to_pack  
+set(source_to_pack
   ${headers_to_install}
   ${source_of_generated_headers}
-  ${XBT_RL_SRC}
-  ${EXTRA_DIST}
-  ${SMPI_SRC}
-  ${GRAS_RL_SRC}
-  ${XBT_SRC}
+  ${BINDINGS_SRC}
   ${GTNETS_SRC}
-  ${NS3_SRC}
-  ${SURF_SRC}
-  ${SIMIX_SRC}
-  ${TRACING_SRC}
-  ${MSG_SRC}
-  ${SIMDAG_SRC}
-  ${GRAS_COMMON_SRC}
-  ${GRAS_SG_SRC}
-  ${AMOK_SRC}
+  ${JEDULE_SRC}
+  ${JMSG_C_SRC}
+  ${JMSG_JAVA_SRC}
   ${LUA_SRC}
   ${MC_SRC}
-  ${JEDULE_SRC}
+  ${MSG_SRC}
+  ${NS3_SRC}
   ${RNGSTREAM_SRC}
-  ${BINDINGS_FILES}
+  ${SIMDAG_SRC}
+  ${SIMGRID_SRC}
+  ${SIMIX_SRC}
+  ${SURF_SRC}
+  ${TRACING_SRC}
+  ${XBT_RL_SRC}
+  ${XBT_SRC}
+  ${EXTRA_DIST}
   ${CMAKE_SOURCE_FILES}
   ${EXAMPLES_CMAKEFILES_TXT}
   ${TESHSUITE_CMAKEFILES_TXT}
-  ${TOOLS_CMAKEFILES_TXT}
   ${TESTSUITE_CMAKEFILES_TXT}
-  ${DOC_SOURCES}
+  ${TOOLS_CMAKEFILES_TXT}
   ${DOC_FIGS}
+  ${DOC_IMG}
+  ${DOC_SOURCES}
+  ${DOC_TOOLS}
+  ${PLATFORMS_EXAMPLES}
   ${README_files}
-  ${xml_files}
-  ${tesh_files}
-  ${txt_files}
   ${bin_files}
   ${examples_src}
+  ${tesh_files}
   ${teshsuite_src}
-  ${tools_src}
   ${testsuite_src}
-  ${PLATFORMS_EXAMPLES}
-)
+  ${tools_src}
+  ${txt_files}
+  ${xml_files}
+  )
 
 ##########################################
 ### Fill in the "make dist-dir" target ###
@@ -228,7 +216,7 @@ add_custom_target(dist-dir
   COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_NAME}-${release_version}
   COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_NAME}-${release_version}/doc/html/
   COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_HOME_DIRECTORY}/doc/html/ ${PROJECT_NAME}-${release_version}/doc/html/
-)
+  )
 add_dependencies(dist-dir simgrid_documentation)
 add_dependencies(dist-dir maintainer_files)
 
@@ -237,7 +225,7 @@ foreach(file ${source_to_pack})
   #message(${file})
   # This damn prefix is still set somewhere (seems to be in subdirs)
   string(REPLACE "${CMAKE_HOME_DIRECTORY}/" "" file "${file}")
-  
+
   # Create the directory on need
   get_filename_component(file_location ${file} PATH)
   string(REGEX MATCH ";${file_location};" OPERATION "${dirs_in_tarball}")
@@ -246,21 +234,21 @@ foreach(file ${source_to_pack})
     add_custom_command(
       TARGET dist-dir
       COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_NAME}-${release_version}/${file_location}/
-    )
-  endif(NOT OPERATION)
-  
+      )
+  endif()
+
   # Actually copy the file
   add_custom_command(
     TARGET dist-dir
     COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_HOME_DIRECTORY}/${file} ${PROJECT_NAME}-${release_version}/${file_location}/
-  )
-  
-  add_custom_command(
-    TARGET dist-dir
-    COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/Scripts/Makefile.default ${PROJECT_NAME}-${release_version}/Makefile
-  )
+    )
 endforeach(file ${source_to_pack})
 
+add_custom_command(
+  TARGET dist-dir
+  COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/Scripts/Makefile.default ${PROJECT_NAME}-${release_version}/Makefile
+  )
+
 ######################################
 ### Fill in the "make dist" target ###
 ######################################
@@ -268,16 +256,17 @@ endforeach(file ${source_to_pack})
 add_custom_target(dist
   COMMENT "Removing the distribution directory"
   DEPENDS ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-${release_version}.tar.gz
+  COMMAND ${CMAKE_COMMAND} -E echo ${PROJECT_NAME}-${release_version} > ${CMAKE_BINARY_DIR}/VERSION
   COMMAND ${CMAKE_COMMAND} -E remove_directory ${PROJECT_NAME}-${release_version}/
-)
+  )
 
 add_custom_command(
-       OUTPUT ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-${release_version}.tar.gz    
-       COMMENT "Compressing the archive from the distribution directory"
-       COMMAND ${CMAKE_COMMAND} -E tar cf ${PROJECT_NAME}-${release_version}.tar ${PROJECT_NAME}-${release_version}/
-       COMMAND gzip -9v ${PROJECT_NAME}-${release_version}.tar
-       COMMAND ${CMAKE_COMMAND} -E remove_directory ${PROJECT_NAME}-${release_version}/
-)
+  OUTPUT ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-${release_version}.tar.gz
+  COMMENT "Compressing the archive from the distribution directory"
+  COMMAND ${CMAKE_COMMAND} -E tar cf ${PROJECT_NAME}-${release_version}.tar ${PROJECT_NAME}-${release_version}/
+  COMMAND gzip -9v ${PROJECT_NAME}-${release_version}.tar
+  COMMAND ${CMAKE_COMMAND} -E remove_directory ${PROJECT_NAME}-${release_version}/
+  )
 add_dependencies(dist dist-dir)
 
 if(NOT enable_maintainer_mode)
@@ -285,120 +274,98 @@ if(NOT enable_maintainer_mode)
     COMMAND ${CMAKE_COMMAND} -E echo "WARNING: ----------------------------------------------------"
     COMMAND ${CMAKE_COMMAND} -E echo "WARNING: Distrib is generated without option maintainer mode "
     COMMAND ${CMAKE_COMMAND} -E echo "WARNING: ----------------------------------------------------"
-  )
-   add_dependencies(dist echo-dist)
-endif(NOT enable_maintainer_mode)
+    )
+  add_dependencies(dist echo-dist)
+endif()
 
 ###########################################
 ### Fill in the "make distcheck" target ###
 ###########################################
 
+set(CMAKE_BINARY_TEST_DIR ${CMAKE_BINARY_DIR})
+
 # Allow to test the "make dist"
 add_custom_target(distcheck
+  COMMAND ${CMAKE_COMMAND} -E echo "XXX compare archive with git repository"
+  COMMAND ${CMAKE_HOME_DIRECTORY}/tools/check_dist_archive -batch ${CMAKE_BINARY_TEST_DIR}/${PROJECT_NAME}-${release_version}.tar.gz
+
   COMMAND ${CMAKE_COMMAND} -E echo "XXX remove old copy"
-  COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-${release_version} 
+  COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_TEST_DIR}/${PROJECT_NAME}-${release_version}
+
   COMMAND ${CMAKE_COMMAND} -E echo "XXX Untar distrib"
-  COMMAND ${CMAKE_COMMAND} -E tar  xf ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-${release_version}.tar.gz ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-${release_version}
+  COMMAND ${CMAKE_COMMAND} -E tar xf ${CMAKE_BINARY_TEST_DIR}/${PROJECT_NAME}-${release_version}.tar.gz ${CMAKE_BINARY_TEST_DIR}/${PROJECT_NAME}-${release_version}
+
   COMMAND ${CMAKE_COMMAND} -E echo "XXX create build and install subtrees"
-  COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-${release_version}/_build
-  COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-${release_version}/_inst
-  # This stupid cmake creates a directory in source, killing the purpose of the chmod
-  # (tricking around)
-  #COMMAND ${CMAKE_COMMAND} -E echo "XXX change the modes of directories"
-  #COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_NAME}-${release_version}/CMakeFiles 
-  #COMMAND chmod -R a-w ${PROJECT_NAME}-${release_version}/ # FIXME: we should pass without commenting that line
-  #COMMAND chmod -R a+w ${PROJECT_NAME}-${release_version}/_build
-  #COMMAND chmod -R a+w ${PROJECT_NAME}-${release_version}/_inst
-  #COMMAND chmod -R a+w ${PROJECT_NAME}-${release_version}/CMakeFiles
-  
+  COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_TEST_DIR}/${PROJECT_NAME}-${release_version}/_build
+  COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_TEST_DIR}/${PROJECT_NAME}-${release_version}/_inst
+
   COMMAND ${CMAKE_COMMAND} -E echo "XXX Configure"
-  COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-${release_version}/_build 
-          ${CMAKE_COMMAND} 
-          -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/${PROJECT_NAME}-${release_version}/_inst 
-          -Denable_lua=ON
-          -Denable_model-checking=ON
-          ..
+  COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_TEST_DIR}/${PROJECT_NAME}-${release_version}/_build
+  ${CMAKE_COMMAND}
+  -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_TEST_DIR}/${PROJECT_NAME}-${release_version}/_inst
+  ..
   COMMAND ${CMAKE_COMMAND} -E echo "XXX Build"
-  COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-${release_version}/_build ${CMAKE_MAKE_PROGRAM} VERBOSE=1
+  COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_TEST_DIR}/${PROJECT_NAME}-${release_version}/_build ${CMAKE_MAKE_PROGRAM}
+
   COMMAND ${CMAKE_COMMAND} -E echo "XXX Test"
-  COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-${release_version}/_build ctest
+  COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_TEST_DIR}/${PROJECT_NAME}-${release_version}/_build ctest
+
   COMMAND ${CMAKE_COMMAND} -E echo "XXX Install"
-  COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-${release_version}/_build ${CMAKE_MAKE_PROGRAM} install
+  COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_TEST_DIR}/${PROJECT_NAME}-${release_version}/_build ${CMAKE_MAKE_PROGRAM} install
+  COMMAND ${CMAKE_COMMAND} -E create_symlink
+  ${CMAKE_BINARY_TEST_DIR}/${PROJECT_NAME}-${release_version}/_inst/lib/libsimgrid.so
+  ${CMAKE_BINARY_TEST_DIR}/${PROJECT_NAME}-${release_version}/_inst/lib/libsimgridtest.so
+
+  COMMAND ${CMAKE_COMMAND} -E echo "XXX Build documentation"
+  COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_TEST_DIR}/${PROJECT_NAME}-${release_version}/_build ${CMAKE_MAKE_PROGRAM} simgrid_documentation
+
+  COMMAND ${CMAKE_COMMAND} -E echo "XXX Install with documentation"
+  COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_TEST_DIR}/${PROJECT_NAME}-${release_version}/_build ${CMAKE_MAKE_PROGRAM} install
+
   COMMAND ${CMAKE_COMMAND} -E echo "XXX Remove temp directories"
-  COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-${release_version}
-)
-#add_dependencies(distcheck dist)
+  COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_TEST_DIR}/${PROJECT_NAME}-${release_version}
+  )
+add_dependencies(distcheck dist)
 
 #######################################
 ### Fill in the "make check" target ###
 #######################################
 
 if(enable_memcheck)
-       add_custom_target(check
-       COMMAND ctest -D ExperimentalMemCheck
-       )
-else(enable_memcheck)
-       add_custom_target(check
-       COMMAND make test
-       )
-endif(enable_memcheck)
+  add_custom_target(check
+    COMMAND ctest -D ExperimentalMemCheck
+    )
+else()
+  add_custom_target(check
+    COMMAND make test
+    )
+endif()
 
 #######################################
 ### Fill in the "make xxx-clean" target ###
 #######################################
 
 add_custom_target(maintainer-clean
-COMMAND ${CMAKE_COMMAND} -E remove -f src/config_unit.c
-COMMAND ${CMAKE_COMMAND} -E remove -f src/cunit_unit.c
-COMMAND ${CMAKE_COMMAND} -E remove -f src/dict_unit.c
-COMMAND ${CMAKE_COMMAND} -E remove -f src/dynar_unit.c
-COMMAND ${CMAKE_COMMAND} -E remove -f src/ex_unit.c
-COMMAND ${CMAKE_COMMAND} -E remove -f src/set_unit.c
-COMMAND ${CMAKE_COMMAND} -E remove -f src/simgrid_units_main.c
-COMMAND ${CMAKE_COMMAND} -E remove -f src/swag_unit.c
-COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_sha_unit.c
-COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_str_unit.c
-COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_strbuff_unit.c
-COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_synchro_unit.c
-WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}"
-)
+  COMMAND ${CMAKE_COMMAND} -E remove -f src/config_unit.c
+  COMMAND ${CMAKE_COMMAND} -E remove -f src/cunit_unit.c
+  COMMAND ${CMAKE_COMMAND} -E remove -f src/dict_unit.c
+  COMMAND ${CMAKE_COMMAND} -E remove -f src/dynar_unit.c
+  COMMAND ${CMAKE_COMMAND} -E remove -f src/ex_unit.c
+  COMMAND ${CMAKE_COMMAND} -E remove -f src/set_unit.c
+  COMMAND ${CMAKE_COMMAND} -E remove -f src/simgrid_units_main.c
+  COMMAND ${CMAKE_COMMAND} -E remove -f src/swag_unit.c
+  COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_sha_unit.c
+  COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_str_unit.c
+  COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_strbuff_unit.c
+  COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_synchro_unit.c
+  WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}"
+  )
 
 add_custom_target(supernovae-clean
-COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_gras.c
-COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_sg.c
-COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_smpi.c
-WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}"
-)
-
-#############################################
-### Fill in the "make sync-gforge" target ###
-#############################################
-
-add_custom_target(sync-gforge-doc
-COMMAND chmod g+rw -R doc/
-COMMAND chmod a+rX -R doc/
-COMMAND ssh scm.gforge.inria.fr mkdir /home/groups/simgrid/htdocs/simgrid/${release_version}/ || true 
-COMMAND rsync --verbose --cvs-exclude --compress --delete --delete-excluded --rsh=ssh --ignore-times --recursive --links --perms --times --omit-dir-times 
-doc/html/ scm.gforge.inria.fr:/home/groups/simgrid/htdocs/simgrid/${release_version}/doc/ || true
-COMMAND scp doc/html/simgrid_modules2.png doc/html/simgrid_modules.png doc/webcruft/simgrid_logo_2011.png  doc/webcruft/simgrid_logo_small.png scm.gforge.inria.fr:/home/groups/simgrid/htdocs/simgrid/${release_version}/
-WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}"
-)
-add_dependencies(sync-gforge-doc simgrid_documentation)
-
-add_custom_target(sync-gforge-dtd
-COMMAND scp src/surf/simgrid.dtd scm.gforge.inria.fr:/home/groups/simgrid/htdocs/simgrid/${release_version}/simgrid.dtd
-COMMAND scp src/surf/simgrid.dtd scm.gforge.inria.fr:/home/groups/simgrid/htdocs/simgrid.dtd
-WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}"
-)
-
-#PIPOL
-add_custom_target(sync-pipol
-COMMAND scp -r Experimental_bindings.sh Experimental.sh  MemCheck.sh pre-simgrid.sh navarro@pipol.inria.fr:~/
-COMMAND scp -r rc.* navarro@pipol.inria.fr:~/.pipol/
-COMMAND scp -r Nightly* navarro@pipol.inria.fr:~/.pipol/nightly
-COMMAND ssh navarro@pipol.inria.fr "chmod a=rwx ~/* ~/.pipol/rc.* ~/.pipol/nightly/*"
-WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}/buildtools/pipol/"
-)
+  COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_sg.c
+  COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_smpi.c
+  WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}"
+  )
+
 
 include(CPack)