-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Expand file tree
/
Copy pathget_python_package_hash.cmake
More file actions
55 lines (45 loc) · 2 KB
/
get_python_package_hash.cmake
File metadata and controls
55 lines (45 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#
# Copyright (c) Contributors to the Open 3D Engine Project.
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
# This script will get the current python package hash. To use this script, invoke it using CMake
# script mode (-P option) with the cwd being the engine root folder (the one with cmake as a subfolder)
# on the command line, define LY_3RDPARTY_PATH to a valid directory
# and PAL_PLATFORM_NAME to the platform you'd like to get or update python for.
# defines must come before the script call.
# example:
# cmake -DPAL_PLATFORM_NAME:string=Windows -DLY_ROOT_FOLDER:string=%CMD_DIR% -P get_python_package_hash.cmake
cmake_minimum_required(VERSION 3.24)
if(${CMAKE_ARGC} LESS 4)
message(FATAL_ERROR "Missing required engine root argument.")
endif()
if(${CMAKE_ARGC} LESS 5)
message(FATAL_ERROR "Missing required platform name argument.")
endif()
#! ly_set: override the ly_set macro that the Python_<platform>.cmake file will use to set
# the environments.
#
macro(ly_set name)
set(${name} "${ARGN}")
if(LY_PARENT_SCOPE)
set(${name} "${ARGN}" PARENT_SCOPE)
endif()
endmacro()
#! ly_associate_package: Stub out since this script is only reading the package hash
#
macro("ly_associate_package")
endmacro()
# The first required argument is the platform name
set(ENGINE_ROOT ${CMAKE_ARGV3})
set(PAL_PLATFORM_NAME ${CMAKE_ARGV4})
# The optional second argument is the architecture
if(${CMAKE_ARGC} GREATER 5)
set(PLATFORM_ARCH "_${CMAKE_ARGV5}")
endif()
string(TOLOWER ${PAL_PLATFORM_NAME} PAL_PLATFORM_NAME_LOWERCASE)
include(${ENGINE_ROOT}/cmake/3rdParty/Platform/${PAL_PLATFORM_NAME}/Python_${PAL_PLATFORM_NAME_LOWERCASE}${PLATFORM_ARCH}.cmake)
# Note: using 'message(STATUS ..' will print to STDOUT, but will always include a double hyphen '--'. Instead we will
# use the cmake echo command directly to do this
execute_process(COMMAND ${CMAKE_COMMAND} -E echo ${LY_PYTHON_PACKAGE_HASH})