Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Allow binary to be stripped with install/strip.
[simgrid.git] / tools / cmake / Distrib.cmake
index a4ca296..c3d372a 100644 (file)
@@ -3,9 +3,9 @@
 #########################################
 
 # doc
-file(MAKE_DIRECTORY ${CMAKE_HOME_DIRECTORY}/doc/html/)
-install(DIRECTORY "${CMAKE_HOME_DIRECTORY}/doc/html/"
-  DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/doc/simgrid/html/)
+file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/doc/html/)
+install(DIRECTORY "${CMAKE_BINARY_DIR}/doc/html/"
+  DESTINATION doc/simgrid/html/)
 
 # binaries
 if(enable_smpi)
@@ -13,28 +13,24 @@ if(enable_smpi)
     ${CMAKE_BINARY_DIR}/bin/smpicc
     ${CMAKE_BINARY_DIR}/bin/smpicxx
     ${CMAKE_BINARY_DIR}/bin/smpirun
-    ${CMAKE_BINARY_DIR}/bin/smpimain
-    DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/)
+    DESTINATION bin/)
   if(SMPI_FORTRAN)
     install(PROGRAMS
       ${CMAKE_BINARY_DIR}/bin/smpif90
       ${CMAKE_BINARY_DIR}/bin/smpiff
-      DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/)
+      DESTINATION bin/)
+    install(PROGRAMS
+      ${CMAKE_BINARY_DIR}/include/smpi/mpi.mod
+      DESTINATION include/smpi/)
   endif()
 endif()
 
-if(enable_model-checking)
-  install(
-    PROGRAMS ${CMAKE_BINARY_DIR}/bin/simgrid-mc
-    DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/)
-endif()
-
-install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/tesh  DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/)
+install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/tesh  DESTINATION bin/)
 
-install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/graphicator  DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/)
+install(TARGETS graphicator DESTINATION bin/)
 
 install(PROGRAMS ${CMAKE_HOME_DIRECTORY}/tools/MSG_visualization/colorize.pl
-  DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/
+  DESTINATION bin/
   RENAME simgrid-colorizer)
 
 add_custom_target(simgrid-colorizer ALL
@@ -42,38 +38,50 @@ add_custom_target(simgrid-colorizer ALL
   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/
+  DESTINATION 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_HOME_DIRECTORY}/tools/simgrid_convert_TI_traces.py
+  DESTINATION bin/
+  RENAME simgrid_convert_TI_traces)
+
+add_custom_target(simgrid_convert_TI_traces ALL
+    COMMENT "Install ${CMAKE_BINARY_DIR}/bin/simgrid_convert_TI_traces"
+    COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_HOME_DIRECTORY}/tools/simgrid_convert_TI_traces.py ${CMAKE_BINARY_DIR}/bin/simgrid_convert_TI_traces)
+
 # libraries
-install(TARGETS simgrid DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/)
+install(TARGETS simgrid DESTINATION lib/)
 
 if(enable_java)
   set(SIMGRID_JAR_TO_INSTALL "${SIMGRID_JAR}")
-  install(TARGETS simgrid-java   DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/)
+  install(TARGETS simgrid-java   DESTINATION lib/)
   install(FILES ${SIMGRID_JAR_TO_INSTALL}
-      DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/java/
+      DESTINATION java/
       RENAME simgrid.jar)
 endif()
 
+# pkg-config files
+configure_file("${CMAKE_HOME_DIRECTORY}/tools/pkg-config/simgrid.pc.in"
+  "${PROJECT_BINARY_DIR}/simgrid.pc" @ONLY)
+install(FILES "${PROJECT_BINARY_DIR}/simgrid.pc" DESTINATION lib/pkgconfig/)
+
 # include files
-set(HEADERS  ${headers_to_install}  ${generated_headers_to_install})
-foreach(file ${HEADERS})
+foreach(file ${headers_to_install}  ${generated_headers_to_install})
   get_filename_component(location ${file} PATH)
   string(REPLACE "${CMAKE_CURRENT_BINARY_DIR}/" "" location "${location}")
-  install(FILES ${file} DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${location})
-endforeach(file ${HEADERS})
+  install(FILES ${file} DESTINATION ${location})
+endforeach()
 
 # example files
 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 doc/simgrid/examples/${location})
 endforeach(file ${examples_to_install})
 
 ###########################################
@@ -94,6 +102,7 @@ add_custom_target(uninstall
   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/simgrid_convert_TI_traces
   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
@@ -106,7 +115,7 @@ add_custom_target(uninstall
   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.h
-  COMMAND ${CMAKE_COMMAND} -E  remove -f ${CMAKE_INSTALL_PREFIX}/include/simgrid_config.h
+  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
@@ -116,8 +125,8 @@ add_custom_target(uninstall
   COMMAND ${CMAKE_COMMAND} -E   remove -f ${CMAKE_INSTALL_PREFIX}/share/man/man1/smpirun.1
   COMMAND ${CMAKE_COMMAND} -E   remove -f ${CMAKE_INSTALL_PREFIX}/share/man/man1/smpiff.1
   COMMAND ${CMAKE_COMMAND} -E   remove -f ${CMAKE_INSTALL_PREFIX}/share/man/man1/smpif90.1
-  
-    
+
+
   COMMAND ${CMAKE_COMMAND} -E  echo "uninstall man ok"
   WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}")
 
@@ -188,7 +197,7 @@ add_custom_target(dist-dir
   COMMAND ${CMAKE_COMMAND} -E remove ${PROJECT_NAME}-${release_version}.tar.gz
   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/
+  COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/doc/html/ ${PROJECT_NAME}-${release_version}/doc/html/
   COMMAND rm -f `grep -rl " Reference" ${PROJECT_NAME}-${release_version}/doc/html/` # Doxygen, go away
   COMMAND rm -f `grep -rl "Member List" ${PROJECT_NAME}-${release_version}/doc/html/` # Doxygen, you're getting annoying
   )
@@ -301,21 +310,18 @@ add_custom_target(distcheck
   COMMAND ${CMAKE_COMMAND} -E echo "XXX Configure"
   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 -Denable_lto=OFF ..
-         
+       
   COMMAND ${CMAKE_COMMAND} -E echo "XXX Build"
   COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_TEST_DIR}/${PROJECT_NAME}-${release_version}/_build ${CMAKE_MAKE_PROGRAM} -j 4
-  
-  COMMAND ${CMAKE_COMMAND} -E echo "XXX Test"
-  COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_TEST_DIR}/${PROJECT_NAME}-${release_version}/_build ctest --output-on-failure -j 4
 
   COMMAND ${CMAKE_COMMAND} -E echo "XXX 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 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 Build tests"
+  COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_TEST_DIR}/${PROJECT_NAME}-${release_version}/_build ${CMAKE_MAKE_PROGRAM} -j 4 tests
+
+  COMMAND ${CMAKE_COMMAND} -E echo "XXX Run tests"
+  COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_TEST_DIR}/${PROJECT_NAME}-${release_version}/_build ctest --output-on-failure -j 4
 
   COMMAND ${CMAKE_COMMAND} -E echo "XXX Remove temp directories"
   COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_TEST_DIR}/${PROJECT_NAME}-${release_version}
@@ -331,21 +337,14 @@ if(enable_memcheck)
 else()
   add_custom_target(check COMMAND make test)
 endif()
+add_dependencies(check tests)
 
 #######################################
 ### 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/xbt_str_unit.c
-  COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_synchro_unit.c
+  COMMAND ${CMAKE_COMMAND} -E remove -f src/mpif.f90
   WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}")
 
 include(CPack)