Python_linux_x86_64.cmake 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. # Setup the Python global variables and download and associate python to the correct package
  9. # Python package info
  10. ly_set(LY_PYTHON_VERSION 3.10.13)
  11. ly_set(LY_PYTHON_VERSION_MAJOR_MINOR 3.10)
  12. ly_set(LY_PYTHON_PACKAGE_NAME python-3.10.13-rev2-linux)
  13. ly_set(LY_PYTHON_PACKAGE_HASH a7832f9170a3ac93fbe678e9b3d99a977daa03bb667d25885967e8b4977b86f8)
  14. # Python package relative paths
  15. ly_set(LY_PYTHON_BIN_PATH "python/bin")
  16. ly_set(LY_PYTHON_LIB_PATH "python/lib")
  17. ly_set(LY_PYTHON_EXECUTABLE "python")
  18. ly_set(LY_PYTHON_SHARED_LIB "libpython3.10.so.1.0")
  19. # Python venv relative paths
  20. ly_set(LY_PYTHON_VENV_BIN_PATH "bin")
  21. ly_set(LY_PYTHON_VENV_LIB_PATH "lib")
  22. ly_set(LY_PYTHON_VENV_SITE_PACKAGES "${LY_PYTHON_VENV_LIB_PATH}/python3.10/site-packages")
  23. ly_set(LY_PYTHON_VENV_PYTHON "${LY_PYTHON_VENV_BIN_PATH}/python")
  24. function(ly_post_python_venv_install venv_path)
  25. # We need to create a symlink to the shared library in the venv
  26. execute_process(COMMAND ln -s -f "${PYTHON_PACKAGES_ROOT_PATH}/${LY_PYTHON_PACKAGE_NAME}/${LY_PYTHON_LIB_PATH}/${LY_PYTHON_SHARED_LIB}" ${LY_PYTHON_SHARED_LIB}
  27. WORKING_DIRECTORY "${PYTHON_VENV_PATH}/${LY_PYTHON_VENV_LIB_PATH}"
  28. RESULT_VARIABLE command_result)
  29. if (NOT ${command_result} EQUAL 0)
  30. message(WARNING "Unable to create a venv shared library link.")
  31. endif()
  32. endfunction()