PackagingConfig.cmake 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #
  2. # Copyright (c) Contributors to the Open 3D Engine Project.
  3. # For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. #
  5. # SPDX-License-Identifier: Apache-2.0 OR MIT
  6. #
  7. #
  8. set(_target_name ${CMAKE_HOST_SYSTEM_NAME})
  9. if(${_target_name} STREQUAL Darwin)
  10. set(_target_name Mac)
  11. endif()
  12. if(CPACK_AUTO_GEN_TAG)
  13. set(_python_script python.sh)
  14. if(${_target_name} STREQUAL Windows)
  15. set(_python_script python.cmd)
  16. endif()
  17. file(REAL_PATH "${CPACK_SOURCE_DIR}/.." _root_path)
  18. file(TO_NATIVE_PATH "${_root_path}/python/${_python_script}" _python_cmd)
  19. file(TO_NATIVE_PATH "${_root_path}/scripts/build/tools/generate_build_tag.py" _gen_tag_script)
  20. execute_process(
  21. COMMAND ${_python_cmd} -s -u ${_gen_tag_script}
  22. RESULT_VARIABLE _gen_tag_result
  23. OUTPUT_VARIABLE _gen_tag_output
  24. ERROR_VARIABLE _gen_tag_errors
  25. OUTPUT_STRIP_TRAILING_WHITESPACE
  26. ERROR_STRIP_TRAILING_WHITESPACE
  27. )
  28. if (NOT ${_gen_tag_result} EQUAL 0)
  29. message(FATAL_ERROR "Failed to generate build tag! Errors: ${_gen_tag_errors}")
  30. endif()
  31. set(_url_tag ${_gen_tag_output})
  32. else()
  33. set(_url_tag ${CPACK_PACKAGE_VERSION})
  34. endif()
  35. set(_full_tag ${_url_tag}/${_target_name})
  36. if(CPACK_DOWNLOAD_SITE)
  37. set(CPACK_DOWNLOAD_SITE ${CPACK_DOWNLOAD_SITE}/${_full_tag})
  38. endif()
  39. if(CPACK_UPLOAD_URL)
  40. set(CPACK_UPLOAD_URL ${CPACK_UPLOAD_URL}/${_full_tag})
  41. endif()