copy_platform_cmakes.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. import glob
  9. import os
  10. import pathlib
  11. import platform
  12. import shutil
  13. import sys
  14. # There are some additional cmake files we need to copy per-platform to the install directory
  15. platform_system = platform.system().lower()
  16. platform_to_pal = {
  17. "windows": "Windows",
  18. "linux": "Linux",
  19. "darwin": "Mac"
  20. }
  21. if platform_system not in platform_to_pal:
  22. print(f"Unknown platform: {platform_system}")
  23. sys.exit(1)
  24. platform_folder = pathlib.Path("Platform") / platform_to_pal[platform_system]
  25. package_root = os.environ['PACKAGE_ROOT']
  26. platform_install_folder = pathlib.Path(package_root) / platform_folder
  27. # Make sure the install folder for the platform exists
  28. platform_install_folder.mkdir(parents=True, exist_ok=True)
  29. files = glob.iglob(os.path.join(platform_folder, "*.cmake"))
  30. for file in files:
  31. print(f"Copying {file} => {platform_install_folder}")
  32. shutil.copy2(file, platform_install_folder)
  33. # Install additional copyright notices to the package/qt root
  34. package_qt_root = os.path.join(package_root, "qt")
  35. additional_copyright_notices = ["QT-NOTICE.TXT",
  36. "LICENSE",
  37. os.path.join("temp","src", "qtfeedback", "LGPL_EXCEPTION.txt")]
  38. for file in additional_copyright_notices:
  39. if not os.path.isfile(file):
  40. print(f"Error: Cannot locate copyright notice file: {file}")
  41. sys.exit(1)
  42. print(f"Copying {file} => {package_qt_root}")
  43. shutil.copy2(file, package_qt_root)