Generate carla package version file (#7470)

* First implementation

* Small fixes
This commit is contained in:
Xavier Solé Nogués 2024-04-19 11:21:21 +02:00 committed by GitHub
parent 9e67a0193a
commit b85edc6b95
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 36 additions and 0 deletions

View File

@ -368,6 +368,14 @@ function(add_carla_ue_package_target TARGET_NAME_SUFFIX UE_BUILD_CONFIGURATION)
add_custom_command(
TARGET carla-unreal-package${TARGET_NAME_SUFFIX}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo "********** PACKAGE CREATING VERSION FILE UNREAL PACKAGE EXTRA FILES STARTED **********"
COMMAND ${CMAKE_COMMAND}
-DCARLA_SOURCE_DIR=${CARLA_SOURCE_DIR}
-DCARLA_UNREAL_ENGINE_PATH=${CARLA_UNREAL_ENGINE_PATH}
-DCARLA_PACKAGE_VERSION_FILE=${CARLA_TARGET_PACKAGE_PATH}/VERSION
-P${CMAKE_CURRENT_SOURCE_DIR}/Package/CreateCarlaVersionFile.cmake
COMMAND ${CMAKE_COMMAND} -E echo "********** PACKAGE VERSION FILE UNREAL PACKAGE EXTRA FILES COMPLETED **********"
COMMAND ${CMAKE_COMMAND} -E echo "********** PACKAGE REMOVING UNREAL PACKAGE EXTRA FILES STARTED **********"
COMMAND ${CMAKE_COMMAND}
-DCARLA_TARGET_PACKAGE_PATH=${CARLA_TARGET_PACKAGE_PATH}

View File

@ -0,0 +1,28 @@
execute_process(
COMMAND git log -1 --format=%H
WORKING_DIRECTORY ${CARLA_SOURCE_DIR}
OUTPUT_VARIABLE CARLA_GIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND git log -1 --format=%H
WORKING_DIRECTORY ${CARLA_SOURCE_DIR}/Unreal/CarlaUnreal/Content/Carla
OUTPUT_VARIABLE CONTENT_GIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND git log -1 --format=%H
WORKING_DIRECTORY ${CARLA_UNREAL_ENGINE_PATH}
OUTPUT_VARIABLE UNREAL_ENGINE_GIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
file (
WRITE
${CARLA_PACKAGE_VERSION_FILE}
"Carla git hash: ${CARLA_GIT_HASH}\n"
"Content git hash: ${CONTENT_GIT_HASH}\n"
"UnrealEngine git hash: ${UNREAL_ENGINE_GIT_HASH}\n"
)