release_cmake.cmake 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. set(CVSROOT ":pserver:[email protected]:/cvsroot/CMake")
  2. get_filename_component(SCRIPT_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH)
  3. if(NOT DEFINED RUN_SHELL)
  4. set(RUN_SHELL "/bin/sh")
  5. endif(NOT DEFINED RUN_SHELL)
  6. if(NOT DEFINED INSTALLER_SUFFIX)
  7. set(INSTALLER_SUFFIX "*.sh")
  8. endif(NOT DEFINED INSTALLER_SUFFIX)
  9. if(NOT DEFINED PROCESSORS)
  10. set(PROCESSORS 1)
  11. endif(NOT DEFINED PROCESSORS)
  12. if(NOT DEFINED CMAKE_VERSION)
  13. message(FATAL_ERROR "CMAKE_VERSION not defined")
  14. endif(NOT DEFINED CMAKE_VERSION)
  15. if(NOT DEFINED CVS_COMMAND)
  16. set(CVS_COMMAND cvs)
  17. endif(NOT DEFINED CVS_COMMAND)
  18. if("${CMAKE_VERSION}" STREQUAL "CVS")
  19. set( CMAKE_CHECKOUT "${CVS_COMMAND} -q -z3 -d ${CVSROOT} export -D now ")
  20. set( CMAKE_VERSION "CurrentCVS")
  21. else("${CMAKE_VERSION}" STREQUAL "CVS")
  22. set( CMAKE_CHECKOUT "${CVS_COMMAND} -q -z3 -d ${CVSROOT} export -r ${CMAKE_VERSION} ")
  23. endif("${CMAKE_VERSION}" STREQUAL "CVS")
  24. if(NOT HOST)
  25. message(FATAL_ERROR "HOST must be specified with -DHOST=host")
  26. endif(NOT HOST)
  27. if(NOT DEFINED MAKE)
  28. message(FATAL_ERROR "MAKE must be specified with -DMAKE=\"make -j2\"")
  29. endif(NOT DEFINED MAKE)
  30. message("Creating CMake release ${CMAKE_VERSION} on ${HOST} with parallel = ${PROCESSORS}")
  31. # define a macro to run a remote command
  32. macro(remote_command comment command)
  33. message("${comment}")
  34. if(${ARGC} GREATER 2)
  35. message("ssh ${HOST} ${EXTRA_HOP} ${command}")
  36. execute_process(COMMAND ssh ${HOST} ${EXTRA_HOP} ${command} RESULT_VARIABLE result INPUT_FILE ${ARGV2})
  37. else(${ARGC} GREATER 2)
  38. message("ssh ${HOST} ${EXTRA_HOP} ${command}")
  39. execute_process(COMMAND ssh ${HOST} ${EXTRA_HOP} ${command} RESULT_VARIABLE result)
  40. endif(${ARGC} GREATER 2)
  41. if(${result} GREATER 0)
  42. message(FATAL_ERROR "Error running command: ${command}, return value = ${result}")
  43. endif(${result} GREATER 0)
  44. endmacro(remote_command)
  45. set(CMAKE_BACKWARDS_COMPATIBILITY 2.4)
  46. configure_file(${SCRIPT_PATH}/release_cmake.sh.in
  47. release_cmake-${HOST}.sh @ONLY)
  48. file(READ release_cmake-${HOST}.sh RELEASE_CMAKE_CONTENTS)
  49. remote_command("Copy release_cmake-${HOST}.sh to sever"
  50. "tr -d '\\\\015' > release_cmake-${HOST}.sh" release_cmake-${HOST}.sh)
  51. remote_command("Run release script" "${RUN_SHELL} release_cmake-${HOST}.sh")
  52. message("copy the .gz file back from the machine")
  53. execute_process(COMMAND scp ${HOST}:CMakeReleaseDirectory/${CMAKE_VERSION}-build/*.gz .
  54. RESULT_VARIABLE result)
  55. message("copy the ${INSTALLER_SUFFIX} file back from the machine")
  56. execute_process(COMMAND scp ${HOST}:CMakeReleaseDirectory/${CMAKE_VERSION}-build/${INSTALLER_SUFFIX} .
  57. RESULT_VARIABLE result)