Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
typo, bummer
[simgrid.git] / tools / cmake / Distrib.cmake
index d13a04d..a4ca296 100644 (file)
@@ -142,9 +142,6 @@ set(source_to_pack
   ${JEDULE_SRC}
   ${JMSG_C_SRC}
   ${JMSG_JAVA_SRC}
-  ${JSURF_SWIG_SRC}
-  ${JSURF_SWIG_SRC_EXTRA}
-  ${JSURF_C_SRC}
   ${LUA_SRC}
   ${MC_SRC_BASE}
   ${MC_SRC}
@@ -223,6 +220,37 @@ add_custom_command(
   TARGET dist-dir
   COMMAND ${CMAKE_COMMAND} -E echo "${GIT_VERSION}" > ${PROJECT_NAME}-${release_version}/.gitversion)
 
+##########################################################
+### Link all sources to the bindir if srcdir != bindir ###
+##########################################################
+add_custom_target(hardlinks
+   COMMENT "Making the source files available from the bindir"
+)
+if (NOT ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
+  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_bindir}")
+    if(NOT OPERATION)
+      set(dirs_in_tarball "${dirs_in_bindir};${file_location};")
+      add_custom_command(
+        TARGET hardlinks
+        COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/${file_location}/)
+    endif()
+
+    # Actually copy the file
+    add_custom_command(
+      TARGET hardlinks
+      COMMAND if test -f ${CMAKE_HOME_DIRECTORY}/${file} \; then rm -f ${CMAKE_BINARY_DIR}/${file}\; ln ${CMAKE_HOME_DIRECTORY}/${file} ${CMAKE_BINARY_DIR}/${file_location}\; fi
+    )
+  endforeach(file ${source_to_pack})
+endif()
+
+
 ######################################
 ### Fill in the "make dist" target ###
 ######################################
@@ -316,9 +344,7 @@ add_custom_target(maintainer-clean
   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_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}")