Skip to content

Commit

Permalink
AWS GameLift Server SDK 5.1.1 Package (#228)
Browse files Browse the repository at this point in the history
Upgrading from GameLift Server C++ SDK 5.0.0 -> 5.1.1
Fixed the build.py to work with the latest SDK's folder layout.
  • Loading branch information
AMZN-Gene authored Dec 19, 2023
2 parents 0f59c46 + 2a8cd40 commit 51bc93b
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ ly_target_include_system_directories(TARGET ${TARGET_WITH_NAMESPACE} INTERFACE $
if (LY_MONOLITHIC_GAME)
target_link_libraries(${TARGET_WITH_NAMESPACE} INTERFACE ${AWSGAMELIFTSERVERSDK_LIBS})
else()
target_link_libraries(${TARGET_WITH_NAMESPACE} INTERFACE ${AWSGAMELIFTSERVERSDK_LIBS})
# Modules using aws-cpp-sdk-gamelift-server functionality will needs pThreads to link.
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)

target_link_libraries(${TARGET_WITH_NAMESPACE} INTERFACE Threads::Threads ${AWSGAMELIFTSERVERSDK_LIBS})
ly_add_dependencies(${TARGET_WITH_NAMESPACE} ${AWSGAMELIFTSERVERSDK_LIBS})
endif()

Expand Down
12 changes: 0 additions & 12 deletions package-system/AWSGameLiftServerSDK/aws_gamelift_5.0.0.patch

This file was deleted.

14 changes: 6 additions & 8 deletions package-system/AWSGameLiftServerSDK/build_config.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
{
"src_package_url": "https://gamelift-release.s3-us-west-2.amazonaws.com/GameLift-SDK-Release-5.0.0.zip",
"src_package_sha1": "25cfa89252a934925c14830ba75e91855bf02e5d",
"src_package_url": "https://gamelift-server-sdk-release.s3.us-west-2.amazonaws.com/cpp/GameLift-Cpp-ServerSDK-5.1.1.zip",
"src_package_sha1": "847dea8ec09b404e2aa6599a436b6c902c4dfe0e",
"package_name": "AWSGameLiftServerSDK",
"package_version": "5.0.0-rev3",
"package_version": "5.1.1-rev1",
"package_url": "https://aws.amazon.com/documentation/gamelift/",
"package_license": "Apache-2.0",
"package_license_file": "GameLift-SDK-Release-5.0.0/GameLift-SDK-Release-5.0.0/GameLift-Cpp-ServerSDK-5.0.0/LICENSE_AMAZON_GAMELIFT_SDK.TXT",
"package_license_file": "GameLift-Cpp-ServerSDK-5.1.1/LICENSE_AMAZON_GAMELIFT_SDK.TXT",
"cmake_find_target": "FindAWSGameLiftServerSDK.cmake",
"Platforms": {
"Linux": {
"Linux":{
"depends_on_packages": [
[ "OpenSSL-1.1.1t-rev1-linux", "63aea898b7afe8faccd0c7261e62d2f8b7b870f678a4520d5be81e5815542b39", "" ]
],
"patch_file":"aws_gamelift_5.0.0.patch",
"cmake_find_source": "FindAWSGameLiftServerSDK.cmake.Linux",
"custom_build_cmd": [
"./build-linux.sh",
"aws_gamelift_5_5_0",
"aws_gamelift_5_1_1",
"20.04",
"x86_64"
],
Expand All @@ -33,11 +32,10 @@
"depends_on_packages": [
[ "OpenSSL-1.1.1t-rev1-linux-aarch64", "f32721bec9c82d1bd7fb244d78d5dc4e2a47e7b808bb36027236ad377e241ea5", "" ]
],
"patch_file":"aws_gamelift_5.0.0.patch",
"cmake_find_source": "FindAWSGameLiftServerSDK.cmake.Linux",
"custom_build_cmd": [
"./build-linux.sh",
"aws_gamelift_5_5_0",
"aws_gamelift_5_1_1",
"20.04",
"aarch64"
],
Expand Down
27 changes: 6 additions & 21 deletions package-system/AWSGameLiftServerSDK/build_package_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
PACKAGE_LICENSE_FILE: str = "LICENSE_AMAZON_GAMELIFT_SDK.TXT"

GAMELIFT_SERVER_SDK_RELEASE_VERSION: str = O3DE_PACKAGE_NAME_PARTS[1]
GAMELIFT_SERVER_SDK_DOWNLOAD_URL: str = "https://gamelift-release.s3-us-west-2.amazonaws.com/GameLift-SDK-Release-5.0.0.zip"
GAMELIFT_SERVER_SDK_DOWNLOAD_URL: str = "https://gamelift-server-sdk-release.s3.us-west-2.amazonaws.com/cpp/GameLift-Cpp-ServerSDK-5.1.1.zip"

PACKAGE_BASE_PATH: pathlib.Path = pathlib.Path(os.path.dirname(__file__))
PACKAGE_ROOT_PATH: pathlib.Path = PACKAGE_BASE_PATH.parent
Expand Down Expand Up @@ -117,8 +117,7 @@ def prepare_working_directory() -> WorkingDirectoryInfo:
delete_folder(root_directory)

# source and build directory
source_directory: pathlib.Path = \
root_directory.joinpath(f"GameLift-SDK-Release-{GAMELIFT_SERVER_SDK_RELEASE_VERSION}/GameLift-Cpp-ServerSDK-{GAMELIFT_SERVER_SDK_RELEASE_VERSION}")
source_directory = root_directory
build_directory: pathlib.Path = root_directory.joinpath("build")
build_directory.mkdir(parents=True)

Expand All @@ -141,14 +140,8 @@ def download_gamelift_server_sdk(working_directory: WorkingDirectoryInfo) -> Non

# unzip sdk contents
with zipfile.ZipFile(gamelift_sdk_zip_file, "r") as f:
cpp_serversdk_folder = f"GameLift-SDK-Release-{GAMELIFT_SERVER_SDK_RELEASE_VERSION}/GameLift-Cpp-ServerSDK"
unzip_path = working_directory.root_path.resolve()
for file in f.namelist():
# Only unzip the GameLift-Cpp-ServerSDK folder, which is the only SDK we build
# because other folders inside the zip such as the __MACOSX metadata file structure
# and the Go SDK can exceed the max path on windows
if file.startswith(cpp_serversdk_folder):
f.extract(file, unzip_path)
f.extractall(unzip_path)

# get required custom environment for package build
def get_custom_build_env():
Expand All @@ -169,10 +162,7 @@ def configure_sdk_project(working_directory: WorkingDirectoryInfo,
source_folder: str = working_directory.source_path.resolve()
build_shared: str = "ON" if lib_type == "Shared" else "OFF"
if PACKAGE_PLATFORM == PACKAGE_PLATFORM_OPTIONS[0]:
# We need to explicitly build using the VS 2019 toolset. If we built using VS 2022
# then if we try to link against this library from VS 2019 there will be unresolved
# symbols for __std_init_once_link_alternate_names_and_abort and __std_find_trivial_1
generator: str = "-T v142"
generator: str = '-G "Visual Studio 17 2022" -A x64'
elif PACKAGE_PLATFORM in (PACKAGE_PLATFORM_OPTIONS[1], PACKAGE_PLATFORM_OPTIONS[2]):
generator: str = "-G \"Unix Makefiles\""
else:
Expand Down Expand Up @@ -202,12 +192,7 @@ def configure_sdk_project(working_directory: WorkingDirectoryInfo,
def build_sdk_project(source_folder: str,
build_folder: str,
build_type: str) -> None:
if PACKAGE_PLATFORM == PACKAGE_PLATFORM_OPTIONS[0]:
target: str = "--target ALL_BUILD"
elif PACKAGE_PLATFORM in (PACKAGE_PLATFORM_OPTIONS[1], PACKAGE_PLATFORM_OPTIONS[2]):
target: str = ""
else:
raise Exception(f"Error unsupported platform: {PACKAGE_PLATFORM}")
target = "--target aws-cpp-sdk-gamelift-server"

build_cmd: List[str] = ["cmake",
f"--build {build_folder}",
Expand Down Expand Up @@ -263,7 +248,7 @@ def build_gamelift_server_sdk(working_directory: WorkingDirectoryInfo,
lib_type: str) -> None:
build_folder: pathlib.Path = working_directory.build_path.joinpath(f"{build_type}_{lib_type}").resolve()

print(f"Generating GameLift Server SDK project with {build_type} {lib_type} configuration...")
print(f"Generating GameLift Server SDK project from source ({working_directory.source_path}) with {build_type} {lib_type} configuration...")
configure_sdk_project(working_directory, build_folder.resolve(), build_type, lib_type)

print(f"Building GameLift Server SDK project with {build_type} {lib_type} configuration...")
Expand Down
6 changes: 3 additions & 3 deletions package-system/AWSGameLiftServerSDK/docker_build_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fi
# Copy the source folder from the read-only $WORKSPACE/temp/src to $WORKSPACE/src
# since the build process will write/modify the source path
echo "Preparing source folder '$WORKSPACE/src'"
cp -r $WORKSPACE/temp/src/GameLift-SDK-Release-5.0.0/GameLift-SDK-Release-5.0.0/GameLift-Cpp-ServerSDK-5.0.0 $WORKSPACE/src || (echo "Error copying src from $WORKSPACE/temp" && exit 1)
cp -r $WORKSPACE/temp/src/GameLift-Cpp-ServerSDK-5.1.1/ $WORKSPACE/src || (echo "Error copying src from $WORKSPACE/temp" && exit 1)

SRC_PATH=$WORKSPACE/src

Expand Down Expand Up @@ -108,8 +108,8 @@ cp -r ${BUILD_PATH_ROOT}/Static/prefix/lib ${BUILD_FOLDER}/
cp -r ${BUILD_PATH_ROOT}/Shared/prefix/lib ${BUILD_FOLDER}/bin

# Copy the license and notice files
cp $WORKSPACE/temp/src/GameLift-SDK-Release-5.0.0/GameLift-SDK-Release-5.0.0/GameLift-Cpp-ServerSDK-5.0.0/LICENSE_AMAZON_GAMELIFT_SDK.TXT ${BUILD_FOLDER}/
cp $WORKSPACE/temp/src/GameLift-SDK-Release-5.0.0/GameLift-SDK-Release-5.0.0/GameLift-Cpp-ServerSDK-5.0.0/NOTICE_C++_AMAZON_GAMELIFT_SDK.TXT ${BUILD_FOLDER}/
cp $WORKSPACE/temp/src/GameLift-Cpp-ServerSDK-5.1.1/LICENSE_AMAZON_GAMELIFT_SDK.TXT ${BUILD_FOLDER}/
cp $WORKSPACE/temp/src/GameLift-Cpp-ServerSDK-5.1.1/NOTICE_C++_AMAZON_GAMELIFT_SDK.TXT ${BUILD_FOLDER}/

echo "Build Succeeded."

Expand Down
2 changes: 2 additions & 0 deletions package-system/AWSGameLiftServerSDK/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ PROJECT(test_AWSGameLift VERSION 1.0 LANGUAGES CXX)
find_package(OpenSSL)
find_package(AWSGameLiftServerSDK)


add_executable(test_AWSGameLift test_AWSGameLiftServer.cpp)


target_link_libraries(test_AWSGameLift PRIVATE 3rdParty::OpenSSL 3rdParty::AWSGameLiftServerSDK)
4 changes: 2 additions & 2 deletions package_build_list_host_linux-aarch64.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"build_from_source": {
"assimp-5.2.5-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/assimp --platform-name Linux-aarch64 --clean",
"astc-encoder-3.2-rev3-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/astc-encoder --platform-name Linux-aarch64 --clean",
"AWSGameLiftServerSDK-5.0.0-rev3-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/AWSGameLiftServerSDK --platform-name Linux-aarch64 --clean",
"AWSGameLiftServerSDK-5.1.1-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/AWSGameLiftServerSDK --platform-name Linux-aarch64 --clean",
"AwsIotDeviceSdkCpp-1.15.2-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/AwsIotDeviceSdkCpp --platform-name Linux-aarch64 --clean",
"AWSNativeSDK-1.11.144-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/AWSNativeSDK --platform-name Linux-aarch64 --clean",
"azslc-1.8.15-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/azslc --platform-name Linux-aarch64 --clean",
Expand Down Expand Up @@ -47,7 +47,7 @@
"build_from_folder": {
"assimp-5.2.5-rev1-linux-aarch64": "package-system/assimp/temp/assimp-linux-aarch64",
"astc-encoder-3.2-rev3-linux-aarch64": "package-system/astc-encoder/temp/astc-encoder-linux-aarch64",
"AWSGameLiftServerSDK-5.0.0-rev3-linux-aarch64": "package-system/AWSGameLiftServerSDK/temp/AWSGameLiftServerSDK-linux-aarch64",
"AWSGameLiftServerSDK-5.1.1-rev1-linux-aarch64": "package-system/AWSGameLiftServerSDK/temp/AWSGameLiftServerSDK-linux-aarch64",
"AwsIotDeviceSdkCpp-1.15.2-rev1-linux-aarch64": "package-system/AwsIotDeviceSdkCpp/temp/AwsIotDeviceSdkCpp-linux-aarch64",
"AWSNativeSDK-1.11.144-rev1-linux-aarch64": "package-system/AWSNativeSDK/temp/AWSNativeSDK-linux-aarch64",
"azslc-1.8.15-rev1-linux-aarch64": "package-system/azslc/temp/azslc-linux-aarch64",
Expand Down
8 changes: 4 additions & 4 deletions package_build_list_host_linux.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"comment4" : "Note: Build from source occurs before build_from_folder",
"build_from_source": {
"assimp-5.2.5-rev1-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/assimp --platform-name Linux --package-root ../../package-system --clean",
"AWSGameLiftServerSDK-5.0.0-rev3-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/AWSGameLiftServerSDK --platform-name Linux-aarch64 --clean",
"AWSGameLiftServerSDK-5.0.0-rev3-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/AWSGameLiftServerSDK --platform-name Linux --clean",
"AWSGameLiftServerSDK-5.1.1-rev1-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/AWSGameLiftServerSDK --platform-name Linux --clean",
"AWSGameLiftServerSDK-5.1.1-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/AWSGameLiftServerSDK --platform-name Linux-aarch64 --clean",
"AWSNativeSDK-1.11.144-rev1-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/AWSNativeSDK --platform-name Linux --clean",
"AWSNativeSDK-1.11.144-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/AWSNativeSDK --platform-name Linux-aarch64 --clean",
"cityhash-1.1-rev1-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/cityhash --platform-name Linux --clean",
Expand Down Expand Up @@ -52,8 +52,8 @@
},
"build_from_folder": {
"assimp-5.2.5-rev1-linux": "package-system/assimp-linux",
"AWSGameLiftServerSDK-5.0.0-rev3-linux": "package-system/AWSGameLiftServerSDK/temp/AWSGameLiftServerSDK-linux",
"AWSGameLiftServerSDK-5.0.0-rev3-linux-aarch64": "package-system/AWSGameLiftServerSDK/temp/AWSGameLiftServerSDK-linux-aarch64",
"AWSGameLiftServerSDK-5.1.1-rev1-linux": "package-system/AWSGameLiftServerSDK/temp/AWSGameLiftServerSDK-linux",
"AWSGameLiftServerSDK-5.1.1-rev1-linux-aarch64": "package-system/AWSGameLiftServerSDK/temp/AWSGameLiftServerSDK-linux-aarch64",
"AWSNativeSDK-1.11.144-rev1-linux": "package-system/AWSNativeSDK/temp/AWSNativeSDK-linux",
"AWSNativeSDK-1.11.144-rev1-linux-aarch64": "package-system/AWSNativeSDK/temp/AWSNativeSDK-linux-aarch64",
"cityhash-1.1-rev1-linux": "package-system/cityhash/temp/cityhash-linux",
Expand Down
4 changes: 2 additions & 2 deletions package_build_list_host_windows.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"assimp-5.2.5-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/assimp --platform-name Windows --package-root ../../package-system --clean",
"astc-encoder-3.2-rev2-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/astc-encoder --platform-name Windows --package-root ../../package-system --clean",
"azslc-1.8.15-rev2-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/azslc --platform-name Windows --package-root ../../package-system/azslc/temp --clean",
"AWSGameLiftServerSDK-5.0.0-rev2-windows": "package-system/AWSGameLiftServerSDK/build_package_image.py --platform-name windows",
"AWSGameLiftServerSDK-5.1.1-rev1-windows": "package-system/AWSGameLiftServerSDK/build_package_image.py --platform-name windows",
"AwsIotDeviceSdkCpp-1.15.2-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/AwsIotDeviceSdkCpp --build-path c:/Temp/awsiot --platform-name Windows --package-root ../../package-system --clean",
"AWSNativeSDK-1.9.50-rev2-android": "Scripts/extras/pull_and_build_from_git.py ../../package-system/AWSNativeSDK --platform-name Android --package-root ../../package-system --clean",
"AWSNativeSDK-1.11.144-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/AWSNativeSDK --platform-name Windows --package-root ../../package-system --clean",
Expand Down Expand Up @@ -69,7 +69,7 @@
"assimp-5.2.5-rev1-windows": "package-system/assimp-windows",
"astc-encoder-3.2-rev2-windows": "package-system/astc-encoder-windows",
"azslc-1.8.15-rev2-windows": "package-system/azslc/temp/azslc-windows",
"AWSGameLiftServerSDK-5.0.0-rev2-windows": "package-system/AWSGameLiftServerSDK-windows",
"AWSGameLiftServerSDK-5.1.1-rev1-windows": "package-system/AWSGameLiftServerSDK-windows",
"AwsIotDeviceSdkCpp-1.15.2-rev1-windows": "package-system/AwsIotDeviceSdkCpp-windows",
"AWSNativeSDK-1.9.50-rev2-android": "package-system/AWSNativeSDK-android",
"AWSNativeSDK-1.11.144-rev1-windows": "package-system/AWSNativeSDK-windows",
Expand Down

0 comments on commit 51bc93b

Please sign in to comment.