Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Look for simgrid into $SIMGRID_ROOT. If lib simgrid or gras.h is not found print...
[simgrid.git] / CMakeLists.txt
index 8b23be0..be2d4bf 100644 (file)
@@ -1,11 +1,67 @@
-cmake_minimum_required(VERSION 2.6)
-project(simgrid-java C)
+cmake_minimum_required(VERSION 2.8)
+project(SimGrid-Java C)
+set(UPDATE_TYPE svn)
 set(CMAKE_C_FLAGS "" CACHE TYPE INTERNAL FORCE)
 set(CMAKE_EXE_LINKER_FLAGS "" CACHE TYPE INTERNAL FORCE)
 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_HOME_DIRECTORY}/lib")
+set(soversion 1)
 
+set(SIMGRID_JAVA_VERSION_MAJOR "1")
+set(SIMGRID_JAVA_VERSION_MINOR "0")
+set(SIMGRID_JAVA_VERSION_PATCH "0")
+set(DIST_NAME ${PROJECT_NAME}-${SIMGRID_JAVA_VERSION_MAJOR}.${SIMGRID_JAVA_VERSION_MINOR})
+
+########
+## GCC #
+########
+exec_program("${CMAKE_C_COMPILER} --version" OUTPUT_VARIABLE "COMPILER_C_VERSION")
+string(REGEX MATCH "[0-9].[0-9].[0-9]" COMPILER_C_VERSION "${COMPILER_C_VERSION}")
+string(REGEX MATCH "^[0-9].[0-9]" COMPILER_C_VERSION_MAJOR_MINOR "${COMPILER_C_VERSION}")
+string(REPLACE "${COMPILER_C_VERSION_MAJOR_MINOR}." "" COMPILER_C_VERSION_PATCH "${COMPILER_C_VERSION}")
+
+########
+## GIT #
+########
+if(EXISTS ${CMAKE_HOME_DIRECTORY}/.git/)
+exec_program("git remote | head -n 1" OUTPUT_VARIABLE remote RETURN_VALUE ret)
+exec_program("git config --get remote.${remote}.url" OUTPUT_VARIABLE url RETURN_VALUE ret)
+
+if(url)
+       exec_program("git --git-dir=${CMAKE_HOME_DIRECTORY}/.git log --oneline -1" OUTPUT_VARIABLE "GIT_VERSION")
+       message(STATUS "Git version: ${GIT_VERSION}")
+       exec_program("git --git-dir=${CMAKE_HOME_DIRECTORY}/.git log -n 1 --format=%ai ." OUTPUT_VARIABLE "GIT_DATE")
+       message(STATUS "Git date: ${GIT_DATE}")
+       string(REGEX REPLACE " .*" "" GIT_VERSION "${GIT_VERSION}")
+       STRING(REPLACE " +0000" "" GIT_DATE ${GIT_DATE})
+       STRING(REPLACE " " "~" GIT_DATE ${GIT_DATE})
+       STRING(REPLACE ":" "-" GIT_DATE ${GIT_DATE})
+endif(url)
+endif(EXISTS ${CMAKE_HOME_DIRECTORY}/.git/)
+
+#########
+# CDASH #
+#########
+SET(DROP_METHOD "http")
+SET(DROP_SITE "cdash.inria.fr/CDash")
+SET(DROP_LOCATION "/submit.php?project=simgrid")
+SET(DROP_SITE_CDASH TRUE)
+SET(TRIGGER_SITE "http://cdash.inria.fr/CDash/cgi-bin/Submit-Random-TestingResults.cgi")
+SET(BUILDNAME "SimGrid-Java" CACHE TYPE INTERNAL FORCE)
+set(osname ${CMAKE_SYSTEM_NAME})
+set(cpu ${CMAKE_SYSTEM_PROCESSOR})
+set(DISTRIB2 ${CMAKE_SYSTEM_VERSION})
+SET(SITE "${osname}_${DISTRIB2}_${cpu}")
+SET(CTEST_SITE "${osname}_${DISTRIB2}_${cpu}")
+SET(CTEST_PROJECT_NAME "${PROJECT_NAME}")
+SET(CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE "3000000")
+SET(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE "3000000")
+set(PIPOL_IMAGE $ENV{PIPOL_IMAGE})
+if(NOT ${PIPOL_IMAGE} MATCHES "\n")
+set(SITE ${PIPOL_IMAGE})
+endif(NOT ${PIPOL_IMAGE} MATCHES "\n")
+message(STATUS "SITE        : ${SITE}")
+message(STATUS "BUILDNAME   : ${BUILDNAME}")
 
-set(soversion 1)
 ###############################
 # Test the build dependencies #
 ###############################
@@ -51,92 +107,135 @@ set(JMSG_JAVA_SRC
        org/simgrid/msg/TransferFailureException.java   
 )
 
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing -Wno-format-nonliteral -Werror ")
+set(JAVA_EXAMPLES
+       examples/mutualExclusion/centralized/MutexCentral.java
+       examples/mutualExclusion/centralized/GrantTask.java
+       examples/mutualExclusion/centralized/Coordinator.java
+       examples/mutualExclusion/centralized/ReleaseTask.java
+       examples/mutualExclusion/centralized/Node.java
+       examples/mutualExclusion/centralized/RequestTask.java
+       examples/basic/FinalizeTask.java
+       examples/basic/Forwarder.java
+       examples/basic/Master.java
+       examples/basic/BasicTest.java
+       examples/basic/Slave.java
+       examples/commTime/FinalizeTask.java
+       examples/commTime/Master.java
+       examples/commTime/Slave.java
+       examples/commTime/CommTimeTest.java
+       examples/pingPong/PingPongTask.java
+       examples/pingPong/Sender.java
+       examples/pingPong/Receiver.java
+       examples/pingPong/PingPongTest.java
+       examples/master_slave_bypass/Master.java
+       examples/master_slave_bypass/MsBypass.java
+       examples/master_slave_bypass/Slave.java
+       examples/master_slave_bypass/FinalizeTask.java
+       examples/master_slave_kill/Master.java
+       examples/master_slave_kill/MsKill.java
+       examples/master_slave_kill/Slave.java
+       examples/master_slave_kill/FinalizeTask.java
+)
+
+set(CMAKE_SRC
+${CMAKE_HOME_DIRECTORY}/ChangeLog
+${CMAKE_HOME_DIRECTORY}/CMakeLists.txt
+${CMAKE_HOME_DIRECTORY}/FindJavaSG.cmake
+${CMAKE_HOME_DIRECTORY}/FindSimGrid.cmake
+)
+
+set(XML_FILES
+    examples/commTime/commTimeDeployment.xml
+    examples/mutualExclusion/ring3.xml
+    examples/mutualExclusion/centralized/mutex_centralized_deployment.xml
+    examples/platform.xml
+    examples/pingPong/pingPongDeployment.xml
+    examples/basic/basicDeployment.xml
+    examples/basic/deploy.xml
+    examples/master_slave_bypass/platform.xml
+    examples/master_slave_kill/platform.xml
+)
+
+set(source_to_pack
+${CMAKE_SRC}
+${JMSG_C_SRC}
+${JMSG_JAVA_SRC}
+${JAVA_EXAMPLES}
+${XML_FILES}
+)
+
+string(REPLACE "org/" "${CMAKE_HOME_DIRECTORY}/org/" JAVA_FILES "${JMSG_JAVA_SRC}") 
+string(REPLACE "org/" "${CMAKE_HOME_DIRECTORY}/classes/org/" JMSG_JAVA_SRC_CLASS "${JMSG_JAVA_SRC}")
+string(REPLACE ".java" ".class" JMSG_JAVA_SRC_CLASS "${JMSG_JAVA_SRC_CLASS}")
+string(REPLACE "examples/" "${CMAKE_HOME_DIRECTORY}/examples/" JAVA_EXAMPLES_CLASS "${JAVA_EXAMPLES}") 
+string(REPLACE ".java" ".class" JAVA_EXAMPLES_CLASS "${JAVA_EXAMPLES_CLASS}")
 
+#########
+# FLAGS #
+#########
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing -Wno-format-nonliteral -Werror ")
 set(INCLUDE_PATH "-I${CMAKE_HOME_DIRECTORY}/src -I$ENV{SIMGRID_ROOT}/include -I$ENV{SIMGRID_ROOT}/src -I$ENV{SIMGRID_ROOT}/src/include")
 set(LIB_PATH "-L$ENV{SIMGRID_ROOT}/lib")
-
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${INCLUDE_PATH} ${LIB_PATH}")
 
+if(COMPILER_C_VERSION_MAJOR_MINOR MATCHES "4.6")
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=unused-but-set-variable ")
+endif(COMPILER_C_VERSION_MAJOR_MINOR MATCHES "4.6")
+
+
+###########
+# TARGETS #
+###########
+# SG_java
 add_library(SG_java SHARED ${JMSG_C_SRC})
 target_link_libraries(SG_java -lsimgrid)
 set_target_properties(SG_java PROPERTIES VERSION ${soversion})
-
-set(JAVA_FILES ${JMSG_JAVA_SRC})
-set(JAVA_CLASSES ${JAVA_FILES})
-
-string(REPLACE "org/" "${CMAKE_HOME_DIRECTORY}/org/"
-               JAVA_FILES "${JAVA_FILES}")
-
-string(REPLACE "org/simgrid/msg" "${CMAKE_BINARY_DIR}/classes/simgrid/msg"
-               JAVA_CLASSES "${JAVA_CLASSES}")
-string(REPLACE ".java" ".class;" 
-               JAVA_CLASSES "${JAVA_CLASSES}")        
-
-add_custom_command(
-  OUTPUT  ${CMAKE_HOME_DIRECTORY}/classes/
-  COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_HOME_DIRECTORY}/classes/"
-  )
   
-# compile all .java files with javac to .class
-ADD_CUSTOM_COMMAND(
-  OUTPUT ${JAVA_CLASSES}
-  DEPENDS ${JMSG_JAVA_SRC} ${CMAKE_HOME_DIRECTORY}/classes/
-  COMMAND ${JAVA_COMPILE} -d ${CMAKE_HOME_DIRECTORY}/classes/
-                          -cp ${CMAKE_HOME_DIRECTORY}/classes/
-                         ${JAVA_FILES}
-  COMMENT "Compiling java sources of core library..."
-)
-
-ADD_CUSTOM_COMMAND(
-  OUTPUT ${CMAKE_HOME_DIRECTORY}/simgrid.jar
-  DEPENDS ${JAVA_CLASSES}
-  WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/classes  
+# java_classes
+add_custom_command(
+       OUTPUT  ${JMSG_JAVA_SRC_CLASS}
+       DEPENDS ${JMSG_JAVA_SRC}
+       COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_HOME_DIRECTORY}/classes/"
+       COMMAND ${JAVA_COMPILE} -d ${CMAKE_HOME_DIRECTORY}/classes/
+                                       -cp ${CMAKE_HOME_DIRECTORY}/classes/ ${JAVA_FILES}
+       COMMENT "Compiling java sources of core library..."                                     
+)
+add_custom_target(java_classes ALL
+  DEPENDS ${JMSG_JAVA_SRC_CLASS}               
+)
+
+# simgrid_jar
+add_custom_target(simgrid_jar ALL
   COMMAND ${JAVA_ARCHIVE} -cvf ${CMAKE_HOME_DIRECTORY}/simgrid.jar .
   COMMENT "Building simgrid.jar..."
+  WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/classes 
 )
 
-ADD_CUSTOM_COMMAND(
-       OUTPUT  ${CMAKE_HOME_DIRECTORY}/examples/basic/BasicTest.class
-                       ${CMAKE_HOME_DIRECTORY}/examples/basic/FinalizeTask.class
-                       ${CMAKE_HOME_DIRECTORY}/examples/basic/Forwarder.class
-                       ${CMAKE_HOME_DIRECTORY}/examples/basic/Slave.class
-                       ${CMAKE_HOME_DIRECTORY}/examples/basic/Master.class
-                       ${CMAKE_HOME_DIRECTORY}/examples/pingPong/PingPongTest.class
-                       ${CMAKE_HOME_DIRECTORY}/examples/pingPong/Sender.class
-                       ${CMAKE_HOME_DIRECTORY}/examples/pingPong/PingPongTask.class
-                       ${CMAKE_HOME_DIRECTORY}/examples/pingPong/Receiver.class
-                       ${CMAKE_HOME_DIRECTORY}/examples/pingPong/FinalizeTask.class
-                       ${CMAKE_HOME_DIRECTORY}/examples/pingPong/CommTimeTest.class
-                       ${CMAKE_HOME_DIRECTORY}/examples/pingPong/Slave.class
-                       ${CMAKE_HOME_DIRECTORY}/examples/pingPong/Master.class
-                       ${CMAKE_HOME_DIRECTORY}/lib/libsimgrid.so
-                       
-       DEPENDS SG_java
-            ${CMAKE_HOME_DIRECTORY}/simgrid.jar
-                       
-       COMMENT "Build examples for java"       
-       
+# simgrid_java_examples
+add_custom_command(
+       COMMENT "Build examples for java"
+       OUTPUT  ${JAVA_EXAMPLES_CLASS}
+       DEPENDS ${JAVA_EXAMPLES}
        COMMAND ${JAVA_COMPILE} -d ${CMAKE_HOME_DIRECTORY}/examples -cp ${CMAKE_HOME_DIRECTORY}/simgrid.jar ${CMAKE_HOME_DIRECTORY}/examples/basic/*.java  
        COMMAND ${JAVA_COMPILE} -d ${CMAKE_HOME_DIRECTORY}/examples -cp ${CMAKE_HOME_DIRECTORY}/simgrid.jar ${CMAKE_HOME_DIRECTORY}/examples/pingPong/*.java
-       COMMAND ${JAVA_COMPILE} -d ${CMAKE_HOME_DIRECTORY}/examples -cp ${CMAKE_HOME_DIRECTORY}/simgrid.jar ${CMAKE_HOME_DIRECTORY}/examples/pingPong/*.java
-)
-
-ADD_CUSTOM_TARGET(simgrid_java_examples ALL
-                  DEPENDS      ${CMAKE_HOME_DIRECTORY}/examples/basic/BasicTest.class
-                                                       ${CMAKE_HOME_DIRECTORY}/examples/basic/FinalizeTask.class
-                                                       ${CMAKE_HOME_DIRECTORY}/examples/basic/Forwarder.class
-                                                       ${CMAKE_HOME_DIRECTORY}/examples/basic/Slave.class
-                                                       ${CMAKE_HOME_DIRECTORY}/examples/basic/Master.class
-                                                       ${CMAKE_HOME_DIRECTORY}/examples/pingPong/PingPongTest.class
-                                                       ${CMAKE_HOME_DIRECTORY}/examples/pingPong/Sender.class
-                                                       ${CMAKE_HOME_DIRECTORY}/examples/pingPong/PingPongTask.class
-                                                       ${CMAKE_HOME_DIRECTORY}/examples/pingPong/Receiver.class
-                                                       ${CMAKE_HOME_DIRECTORY}/examples/pingPong/FinalizeTask.class
-                                                       ${CMAKE_HOME_DIRECTORY}/examples/pingPong/CommTimeTest.class
-                                                       ${CMAKE_HOME_DIRECTORY}/examples/pingPong/Slave.class
-                                                       ${CMAKE_HOME_DIRECTORY}/examples/pingPong/Master.class
-                                       
+       COMMAND ${JAVA_COMPILE} -d ${CMAKE_HOME_DIRECTORY}/examples -cp ${CMAKE_HOME_DIRECTORY}/simgrid.jar ${CMAKE_HOME_DIRECTORY}/examples/commTime/*.java
+       COMMAND ${JAVA_COMPILE} -d ${CMAKE_HOME_DIRECTORY}/examples -cp ${CMAKE_HOME_DIRECTORY}/simgrid.jar ${CMAKE_HOME_DIRECTORY}/examples/mutualExclusion/centralized/*.java                                 
+       COMMAND ${JAVA_COMPILE} -d ${CMAKE_HOME_DIRECTORY}/examples -cp ${CMAKE_HOME_DIRECTORY}/simgrid.jar ${CMAKE_HOME_DIRECTORY}/examples/master_slave_bypass/*.java
+       COMMAND ${JAVA_COMPILE} -d ${CMAKE_HOME_DIRECTORY}/examples -cp ${CMAKE_HOME_DIRECTORY}/simgrid.jar ${CMAKE_HOME_DIRECTORY}/examples/master_slave_kill/*.java
+)
+
+add_custom_target(simgrid_java_examples ALL
+       DEPENDS ${JAVA_EXAMPLES_CLASS}
+)
+
+########################
+# Declare dependencies #
+########################
+add_dependencies(simgrid_jar java_classes)
+add_dependencies(simgrid_java_examples simgrid_jar SG_java)
+
+SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
+${CMAKE_HOME_DIRECTORY}/simgrid.jar
 )
 
 #####################
@@ -145,5 +244,111 @@ ADD_CUSTOM_TARGET(simgrid_java_examples ALL
 INCLUDE(CTest)
 ENABLE_TESTING()
 
-ADD_TEST(java-basic    ${CMAKE_HOME_DIRECTORY}/test_java.sh ${CMAKE_HOME_DIRECTORY}/examples basic/BasicTest ${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/examples/basic/)
-ADD_TEST(java-pingpong         ${CMAKE_HOME_DIRECTORY}/test_java.sh ${CMAKE_HOME_DIRECTORY}/examples pingPong/PingPongTest ${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/examples/pingPong/)
\ No newline at end of file
+ADD_TEST(basic
+java -cp .:${CMAKE_HOME_DIRECTORY}/examples:${CMAKE_HOME_DIRECTORY}/simgrid.jar basic/BasicTest ${CMAKE_HOME_DIRECTORY}/examples/platform.xml ${CMAKE_HOME_DIRECTORY}/examples/basic/basicDeployment.xml
+)
+ADD_TEST(pingPong
+java -cp .:${CMAKE_HOME_DIRECTORY}/examples:${CMAKE_HOME_DIRECTORY}/simgrid.jar pingPong/PingPongTest ${CMAKE_HOME_DIRECTORY}/examples/platform.xml ${CMAKE_HOME_DIRECTORY}/examples/pingPong/pingPongDeployment.xml
+)
+ADD_TEST(CommTime
+java -cp .:${CMAKE_HOME_DIRECTORY}/examples:${CMAKE_HOME_DIRECTORY}/simgrid.jar commTime/CommTimeTest ${CMAKE_HOME_DIRECTORY}/examples/platform.xml ${CMAKE_HOME_DIRECTORY}/examples/commTime/commTimeDeployment.xml
+)
+ADD_TEST(mutualExclusion
+java -cp .:${CMAKE_HOME_DIRECTORY}/examples:${CMAKE_HOME_DIRECTORY}/simgrid.jar mutualExclusion/centralized/MutexCentral ${CMAKE_HOME_DIRECTORY}/examples/mutualExclusion/ring3.xml ${CMAKE_HOME_DIRECTORY}/examples/mutualExclusion/centralized/mutex_centralized_deployment.xml
+)
+ADD_TEST(bypass
+java -cp .:${CMAKE_HOME_DIRECTORY}/examples:${CMAKE_HOME_DIRECTORY}/simgrid.jar master_slave_bypass/MsBypass ${CMAKE_HOME_DIRECTORY}/examples/master_slave_bypass/platform.xml
+)
+ADD_TEST(kill
+java -cp .:${CMAKE_HOME_DIRECTORY}/examples:${CMAKE_HOME_DIRECTORY}/simgrid.jar master_slave_kill/MsKill ${CMAKE_HOME_DIRECTORY}/examples/master_slave_kill/platform.xml
+)
+
+##########################################
+# Set the  DYLD_LIBRARY_PATH for mac     #
+##########################################
+if(APPLE)
+    if($ENV{DYLD_LIBRARY_PATH} STREQUAL "")
+        set_tests_properties(basic pingPong CommTime mutualExclusion bypass kill
+        PROPERTIES ENVIRONMENT "DYLD_LIBRARY_PATH=${CMAKE_HOME_DIRECTORY}/lib:$ENV{SIMGRID_ROOT}/lib")
+    else($ENV{DYLD_LIBRARY_PATH} STREQUAL "")
+        set_tests_properties(basic pingPong CommTime mutualExclusion bypass kill
+        PROPERTIES ENVIRONMENT "DYLD_LIBRARY_PATH=$ENV{DYLD_LIBRARY_PATH}:${CMAKE_HOME_DIRECTORY}/lib:$ENV{SIMGRID_ROOT}/lib")
+    endif($ENV{DYLD_LIBRARY_PATH} STREQUAL "")
+endif(APPLE)
+
+##########################################
+# Set the  LD_LIBRARY_PATH for our tests #
+##########################################
+if($ENV{LD_LIBRARY_PATH} STREQUAL "")
+    set_tests_properties(basic pingPong CommTime mutualExclusion bypass kill
+    PROPERTIES ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_HOME_DIRECTORY}/lib:$ENV{SIMGRID_ROOT}/lib")
+else($ENV{LD_LIBRARY_PATH} STREQUAL "")
+    set_tests_properties(basic pingPong CommTime mutualExclusion bypass kill
+    PROPERTIES ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_HOME_DIRECTORY}/lib:$ENV{SIMGRID_ROOT}/lib")
+endif($ENV{LD_LIBRARY_PATH} STREQUAL "")
+
+###########
+# Install #
+###########
+install(TARGETS SG_java
+       DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/java/)
+install(FILES ${CMAKE_HOME_DIRECTORY}/simgrid.jar
+       DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/java/)
+
+
+#########
+# Dist  #
+#########
+
+add_custom_target(dist-dir
+  COMMENT "Generating the distribution directory"
+  COMMAND test -e ${DIST_NAME}/ && chmod -R a+w ${DIST_NAME}/ || true
+  COMMAND ${CMAKE_COMMAND} -E remove_directory ${DIST_NAME}/
+  COMMAND ${CMAKE_COMMAND} -E make_directory ${DIST_NAME}
+)
+
+set(dirs_in_tarball "")
+foreach(file ${source_to_pack})
+
+  # 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}")
+  if(NOT OPERATION)
+       set(dirs_in_tarball "${dirs_in_tarball};${file_location};")
+       add_custom_command(
+         TARGET dist-dir
+         COMMAND ${CMAKE_COMMAND} -E make_directory ${DIST_NAME}/${file_location}/
+       )       
+   endif(NOT OPERATION)
+   
+   # Actually copy the file
+   add_custom_command(
+     TARGET dist-dir
+     COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_HOME_DIRECTORY}/${file} ${DIST_NAME}/${file_location}/
+   )
+endforeach(file ${source_to_pack})
+
+add_custom_target(dist
+  DEPENDS ${CMAKE_BINARY_DIR}/${DIST_NAME}.tar.gz
+  COMMENT "Generated ${DIST_NAME}"
+)
+add_custom_command(
+       OUTPUT ${CMAKE_BINARY_DIR}/${DIST_NAME}.tar.gz  
+       COMMENT "Compressing the archive from the distribution directory"
+       COMMAND ${CMAKE_COMMAND} -E tar cf ${DIST_NAME}.tar ${DIST_NAME}/
+       COMMAND gzip -9v ${DIST_NAME}.tar
+       COMMAND ${CMAKE_COMMAND} -E remove_directory ${DIST_NAME}/
+)
+add_dependencies(dist dist-dir)
+
+########
+# NOTE #
+########
+file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Testing/Notes/)
+file(WRITE ${CMAKE_BINARY_DIR}/Testing/Notes/Build  "GIT version : ${GIT_VERSION}\n")
+file(APPEND ${CMAKE_BINARY_DIR}/Testing/Notes/Build "Release     : ${DIST_NAME}\n")
+file(APPEND ${CMAKE_BINARY_DIR}/Testing/Notes/Build "Pipol user  : $ENV{PIPOL_USER}\n")
+file(APPEND ${CMAKE_BINARY_DIR}/Testing/Notes/Build "Pipol image : $ENV{PIPOL_IMAGE}\n")
\ No newline at end of file