release_cmake.cmake 2.3 KB

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