Improve package folder layout. (#8229)

* Improve package naming and build directory structure.

* Fix recastbuilder path.

* Remove co-simulation copy command + minor cleanup.
This commit is contained in:
MarcelPiNacy-CVC 2024-09-30 19:08:27 +02:00 committed by GitHub
parent e5f7e79d09
commit fb62780b58
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 123 additions and 68 deletions

View File

@ -56,9 +56,14 @@ set (
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
) )
set (
CARLA_BUILD_PATH
${CMAKE_BINARY_DIR}
)
set ( set (
CARLA_PACKAGE_PATH CARLA_PACKAGE_PATH
${CMAKE_BINARY_DIR}/Package ${CARLA_BUILD_PATH}/Package
) )
set ( set (

View File

@ -14,11 +14,6 @@ carla_option (
ON ON
) )
set (
CARLA_BUILD_PATH
${CARLA_WORKSPACE_PATH}/Build/
)
set ( set (
CARLA_UE_PATH CARLA_UE_PATH
${CARLA_WORKSPACE_PATH}/Unreal/CarlaUnreal ${CARLA_WORKSPACE_PATH}/Unreal/CarlaUnreal
@ -375,16 +370,38 @@ add_dependencies (
${UE_DEPENDENCIES_ORDER_ONLY} ${UE_DEPENDENCIES_ORDER_ONLY}
) )
function ( function (
add_carla_ue_package_target add_carla_ue_package_target
PACKAGE_CONFIGURATION PACKAGE_CONFIGURATION
UE_BUILD_CONFIGURATION) UE_BUILD_CONFIGURATION)
set ( set (
CARLA_TARGET_PACKAGE_PATH CARLA_PACKAGE_NAME
${CARLA_PACKAGE_PATH}/${UE_SYSTEM_NAME} Carla-${CARLA_VERSION}-${UE_SYSTEM_NAME}-${UE_BUILD_CONFIGURATION}
) )
set (
CARLA_CURRENT_PACKAGE_PATH
${CARLA_PACKAGE_PATH}/${CARLA_PACKAGE_NAME}
)
set (
CARLA_CURRENT_PACKAGE_ARCHIVE_PATH
${CARLA_PACKAGE_PATH}/${CARLA_PACKAGE_NAME}
)
set (
CARLA_PACKAGE_STAGING_PATH
${CARLA_PACKAGE_PATH}/StagedBuilds/${CARLA_PACKAGE_NAME}
)
set (
CARLA_PACKAGE_ARCHIVE_PATH
${CARLA_CURRENT_PACKAGE_PATH}
)
if (NOT "${PACKAGE_CONFIGURATION}" STREQUAL "") if (NOT "${PACKAGE_CONFIGURATION}" STREQUAL "")
set (TARGET_NAME_SUFFIX -${PACKAGE_CONFIGURATION}) set (TARGET_NAME_SUFFIX -${PACKAGE_CONFIGURATION})
string (TOLOWER "${TARGET_NAME_SUFFIX}" TARGET_NAME_SUFFIX) string (TOLOWER "${TARGET_NAME_SUFFIX}" TARGET_NAME_SUFFIX)
@ -422,7 +439,8 @@ function (
-Platform=${UE_SYSTEM_NAME} -Platform=${UE_SYSTEM_NAME}
-prereqs -prereqs
-build -build
-archivedirectory=${CARLA_PACKAGE_PATH} -stagingdirectory=${CARLA_PACKAGE_STAGING_PATH}
-archivedirectory=${CARLA_PACKAGE_ARCHIVE_PATH}
USES_TERMINAL USES_TERMINAL
VERBATIM VERBATIM
) )
@ -432,33 +450,35 @@ function (
POST_BUILD POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo "********** PACKAGE CREATING VERSION FILE UNREAL PACKAGE EXTRA FILES STARTED **********" COMMAND ${CMAKE_COMMAND} -E echo "********** PACKAGE CREATING VERSION FILE UNREAL PACKAGE EXTRA FILES STARTED **********"
COMMAND ${CMAKE_COMMAND} COMMAND ${CMAKE_COMMAND}
-DCARLA_SOURCE_DIR=${CARLA_SOURCE_DIR} -DCARLA_WORKSPACE_PATH=${CARLA_WORKSPACE_PATH}
-DCARLA_UNREAL_ENGINE_PATH=${CARLA_UNREAL_ENGINE_PATH} -DCARLA_UNREAL_ENGINE_PATH=${CARLA_UNREAL_ENGINE_PATH}
-DCARLA_PACKAGE_VERSION_FILE=${CARLA_TARGET_PACKAGE_PATH}/VERSION -DCARLA_PACKAGE_VERSION_FILE=${CARLA_PACKAGE_ARCHIVE_PATH}/VERSION
-P${CMAKE_CURRENT_SOURCE_DIR}/Package/CreateCarlaVersionFile.cmake -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 VERSION FILE UNREAL PACKAGE EXTRA FILES COMPLETED **********"
COMMAND ${CMAKE_COMMAND} -E echo "********** PACKAGE REMOVING UNREAL PACKAGE EXTRA FILES STARTED **********" COMMAND ${CMAKE_COMMAND} -E echo "********** PACKAGE REMOVING UNREAL PACKAGE EXTRA FILES STARTED **********"
COMMAND ${CMAKE_COMMAND} COMMAND ${CMAKE_COMMAND}
-DCARLA_TARGET_PACKAGE_PATH=${CARLA_TARGET_PACKAGE_PATH} -DCARLA_PACKAGE_ARCHIVE_PATH=${CARLA_PACKAGE_ARCHIVE_PATH}
-P${CMAKE_CURRENT_SOURCE_DIR}/Package/RemoveUnrealPackageExtraFiles.cmake -P${CMAKE_CURRENT_SOURCE_DIR}/Package/RemoveUnrealPackageExtraFiles.cmake
COMMAND ${CMAKE_COMMAND} -E echo "********** PACKAGE REMOVING UNREAL PACKAGE EXTRA FILES COMPLETED **********" COMMAND ${CMAKE_COMMAND} -E echo "********** PACKAGE REMOVING UNREAL PACKAGE EXTRA FILES COMPLETED **********"
COMMAND ${CMAKE_COMMAND} -E echo "********** PACKAGE COPYING CARLA ADDITIONAL FILES STARTED **********" COMMAND ${CMAKE_COMMAND} -E echo "********** PACKAGE COPYING CARLA ADDITIONAL FILES STARTED **********"
COMMAND ${CMAKE_COMMAND} COMMAND ${CMAKE_COMMAND}
-DCARLA_SOURCE_DIR=${CARLA_SOURCE_DIR} -DCARLA_BUILD_PATH=${CARLA_BUILD_PATH}
-DCARLA_TARGET_PACKAGE_PATH=${CARLA_TARGET_PACKAGE_PATH} -DCARLA_WORKSPACE_PATH=${CARLA_WORKSPACE_PATH}
-DCARLA_BINARY_DIR=${CARLA_BINARY_DIR} -DCARLA_PACKAGE_ARCHIVE_PATH=${CARLA_PACKAGE_ARCHIVE_PATH}
-P${CMAKE_CURRENT_SOURCE_DIR}/Package/CopyCarlaAdditionalFiles.cmake -P${CMAKE_CURRENT_SOURCE_DIR}/Package/CopyCarlaAdditionalFiles.cmake
COMMAND ${CMAKE_COMMAND} -E echo "********** PACKAGE COPYING CARLA ADDITIONAL FILES COMPLETED **********" COMMAND ${CMAKE_COMMAND} -E echo "********** PACKAGE COPYING CARLA ADDITIONAL FILES COMPLETED **********"
COMMAND ${CMAKE_COMMAND} -E echo "********** COMPRESSING PACKAGE STARTED **********" COMMAND ${CMAKE_COMMAND} -E echo "********** COMPRESSING PACKAGE STARTED **********"
COMMAND ${CMAKE_COMMAND} COMMAND ${CMAKE_COMMAND}
-DCARLA_PACKAGE_PATH=${CARLA_PACKAGE_PATH} -DCARLA_PACKAGE_PATH=${CARLA_PACKAGE_PATH}
-DCARLA_TARGET_PACKAGE_PATH=${CARLA_TARGET_PACKAGE_PATH} -DCARLA_PACKAGE_ARCHIVE_PATH=${CARLA_PACKAGE_ARCHIVE_PATH}
-DTARGET_NAME_SUFFIX=${TARGET_NAME_SUFFIX} -DCARLA_CURRENT_PACKAGE_PATH=${CARLA_CURRENT_PACKAGE_PATH}
-P${CMAKE_CURRENT_SOURCE_DIR}/Package/Compress.cmake -P${CMAKE_CURRENT_SOURCE_DIR}/Package/Compress.cmake
COMMAND ${CMAKE_COMMAND} -E echo "********** COMPRESSING PACKAGE COMPLETED **********" COMMAND ${CMAKE_COMMAND} -E echo "********** COMPRESSING PACKAGE COMPLETED **********"
USES_TERMINAL
VERBATIM
) )
add_dependencies ( add_dependencies (

View File

@ -31,10 +31,7 @@
#include "Misc/FileHelper.h" #include "Misc/FileHelper.h"
#include "Misc/Paths.h" #include "Misc/Paths.h"
#define TO_STRING_EXPAND(s) #s constexpr TCHAR DefaultRecastBuilderPath[] = TEXT(RECASTBUILDER_PATH);
#define TO_STRING(s) TO_STRING_EXPAND(s)
constexpr TCHAR DefaultRecastBuilderPath[] = TEXT(TO_STRING(RECASTBUILDER_PATH));
static FString BuildRecastBuilderFile() static FString BuildRecastBuilderFile()
{ {

View File

@ -1,12 +1,36 @@
set (CARLA_PACKAGE_FILE_NAME_WITHOUT_EXTENSION ${CARLA_PACKAGE_PATH}/CARLA${TARGET_NAME_SUFFIX}) file (
GLOB
CARLA_PACKAGE_FILES
${CARLA_PACKAGE_ARCHIVE_PATH}/*
)
if (WIN32) if (WIN32)
set(CARLA_PACKAGE_FILE_NAME_AND_ARGS cvf ${CARLA_PACKAGE_FILE_NAME_WITHOUT_EXTENSION}.zip --format=zip) set (
else() COMPRESS_PACKAGE_COMMAND
set(CARLA_PACKAGE_FILE_NAME_AND_ARGS cvfz ${CARLA_PACKAGE_FILE_NAME_WITHOUT_EXTENSION}.tar.gz) ${CMAKE_COMMAND}
endif() -E tar cvf
${CARLA_CURRENT_PACKAGE_PATH}.zip
--format=zip
${CARLA_PACKAGE_FILES}
)
else ()
set (
COMPRESS_PACKAGE_COMMAND
${CMAKE_COMMAND}
-E tar cvfz
${CARLA_CURRENT_PACKAGE_PATH}.tar.gz
${CARLA_PACKAGE_FILES}
)
endif ()
file(GLOB CARLA_PACKAGE_FILES ${CARLA_TARGET_PACKAGE_PATH}/*) message (
STATUS
"Running \"${COMPRESS_PACKAGE_COMMAND}\""
)
execute_process( execute_process (
COMMAND cmake -E tar ${CARLA_PACKAGE_FILE_NAME_AND_ARGS} ${CARLA_PACKAGE_FILES} COMMAND
WORKING_DIRECTORY ${CARLA_TARGET_PACKAGE_PATH}) ${COMPRESS_PACKAGE_COMMAND}
WORKING_DIRECTORY
${CARLA_PACKAGE_PATH}
)

View File

@ -1,41 +1,41 @@
file (COPY_FILE ${CARLA_SOURCE_DIR}/LICENSE ${CARLA_TARGET_PACKAGE_PATH}/LICENSE) file (COPY_FILE ${CARLA_WORKSPACE_PATH}/LICENSE ${CARLA_PACKAGE_ARCHIVE_PATH}/LICENSE)
file (COPY_FILE ${CARLA_SOURCE_DIR}/CHANGELOG.md ${CARLA_TARGET_PACKAGE_PATH}/CHANGELOG) file (COPY_FILE ${CARLA_WORKSPACE_PATH}/CHANGELOG.md ${CARLA_PACKAGE_ARCHIVE_PATH}/CHANGELOG)
file (COPY_FILE ${CARLA_SOURCE_DIR}/Docs/release_readme.md ${CARLA_TARGET_PACKAGE_PATH}/README) file (COPY_FILE ${CARLA_WORKSPACE_PATH}/Docs/release_readme.md ${CARLA_PACKAGE_ARCHIVE_PATH}/README)
if (WIN32) if (WIN32)
set (EXE_EXT .exe) set (EXE_EXT .exe)
else () else ()
set (EXE_EXT) set (EXE_EXT)
endif () endif ()
make_directory (${CARLA_TARGET_PACKAGE_PATH}/Tools) make_directory (${CARLA_PACKAGE_ARCHIVE_PATH}/Tools)
# @TODO Temporary hack: # @TODO Temporary hack:
file (COPY_FILE ${CARLA_BINARY_DIR}/_deps/recastnavigation-build/RecastBuilder/RecastBuilder${EXE_EXT} ${CARLA_TARGET_PACKAGE_PATH}/Tools/RecastBuilder${EXE_EXT}) file (COPY_FILE ${CARLA_BUILD_PATH}/_deps/recastnavigation-build/RecastBuilder/RecastBuilder${EXE_EXT} ${CARLA_PACKAGE_ARCHIVE_PATH}/Tools/RecastBuilder${EXE_EXT})
make_directory (${CARLA_TARGET_PACKAGE_PATH}/PythonAPI/carla/dist) make_directory (${CARLA_PACKAGE_ARCHIVE_PATH}/PythonAPI/carla/dist)
file (GLOB PYTHON_WHL_FILES ${CARLA_BINARY_DIR}/PythonAPI/dist/carla-*.whl) file (GLOB PYTHON_WHL_FILES ${CARLA_BUILD_PATH}/PythonAPI/dist/carla-*.whl)
file (COPY ${PYTHON_WHL_FILES} DESTINATION ${CARLA_TARGET_PACKAGE_PATH}/PythonAPI/carla/dist/) file (COPY ${PYTHON_WHL_FILES} DESTINATION ${CARLA_PACKAGE_ARCHIVE_PATH}/PythonAPI/carla/dist/)
file (COPY_FILE ${CARLA_SOURCE_DIR}/Docs/python_api.md ${CARLA_TARGET_PACKAGE_PATH}/PythonAPI/python_api.md) file (COPY_FILE ${CARLA_WORKSPACE_PATH}/Docs/python_api.md ${CARLA_PACKAGE_ARCHIVE_PATH}/PythonAPI/python_api.md)
file (COPY ${CARLA_SOURCE_DIR}/PythonAPI/carla/agents/ DESTINATION ${CARLA_TARGET_PACKAGE_PATH}/PythonAPI/carla/agents/) file (COPY ${CARLA_WORKSPACE_PATH}/PythonAPI/carla/agents/ DESTINATION ${CARLA_PACKAGE_ARCHIVE_PATH}/PythonAPI/carla/agents/)
file (COPY_FILE ${CARLA_SOURCE_DIR}/PythonAPI/carla/scene_layout.py ${CARLA_TARGET_PACKAGE_PATH}/PythonAPI/carla/scene_layout.py) file (COPY_FILE ${CARLA_WORKSPACE_PATH}/PythonAPI/carla/scene_layout.py ${CARLA_PACKAGE_ARCHIVE_PATH}/PythonAPI/carla/scene_layout.py)
file (COPY_FILE ${CARLA_SOURCE_DIR}/PythonAPI/carla/requirements.txt ${CARLA_TARGET_PACKAGE_PATH}/PythonAPI/carla/requirements.txt) file (COPY_FILE ${CARLA_WORKSPACE_PATH}/PythonAPI/carla/requirements.txt ${CARLA_PACKAGE_ARCHIVE_PATH}/PythonAPI/carla/requirements.txt)
make_directory (${CARLA_TARGET_PACKAGE_PATH}/PythonAPI/examples/) make_directory (${CARLA_PACKAGE_ARCHIVE_PATH}/PythonAPI/examples/)
file (GLOB PYTHON_EXAMPLE_FILES ${CARLA_SOURCE_DIR}/PythonAPI/examples/*.py) file (GLOB PYTHON_EXAMPLE_FILES ${CARLA_WORKSPACE_PATH}/PythonAPI/examples/*.py)
file (COPY ${PYTHON_EXAMPLE_FILES} DESTINATION ${CARLA_TARGET_PACKAGE_PATH}/PythonAPI/examples/) file (COPY ${PYTHON_EXAMPLE_FILES} DESTINATION ${CARLA_PACKAGE_ARCHIVE_PATH}/PythonAPI/examples/)
make_directory (${CARLA_TARGET_PACKAGE_PATH}/PythonAPI/examples/rss/) make_directory (${CARLA_PACKAGE_ARCHIVE_PATH}/PythonAPI/examples/rss/)
file (GLOB PYTHON_EXAMPLE_RSS_FILES ${CARLA_SOURCE_DIR}/PythonAPI/examples/rss/*.py) file (GLOB PYTHON_EXAMPLE_RSS_FILES ${CARLA_WORKSPACE_PATH}/PythonAPI/examples/rss/*.py)
file (COPY ${PYTHON_EXAMPLE_RSS_FILES} DESTINATION ${CARLA_TARGET_PACKAGE_PATH}/PythonAPI/examples/rss/) file (COPY ${PYTHON_EXAMPLE_RSS_FILES} DESTINATION ${CARLA_PACKAGE_ARCHIVE_PATH}/PythonAPI/examples/rss/)
file (COPY_FILE ${CARLA_SOURCE_DIR}/PythonAPI/examples/requirements.txt ${CARLA_TARGET_PACKAGE_PATH}/PythonAPI/examples/requirements.txt) file (COPY_FILE ${CARLA_WORKSPACE_PATH}/PythonAPI/examples/requirements.txt ${CARLA_PACKAGE_ARCHIVE_PATH}/PythonAPI/examples/requirements.txt)
make_directory (${CARLA_TARGET_PACKAGE_PATH}/PythonAPI/util/) make_directory (${CARLA_PACKAGE_ARCHIVE_PATH}/PythonAPI/util/)
file (GLOB PYTHON_UTIL_FILES ${CARLA_SOURCE_DIR}/PythonAPI/util/*.py) file (GLOB PYTHON_UTIL_FILES ${CARLA_WORKSPACE_PATH}/PythonAPI/util/*.py)
file (COPY ${PYTHON_UTIL_FILES} DESTINATION ${CARLA_TARGET_PACKAGE_PATH}/PythonAPI/util/) file (COPY ${PYTHON_UTIL_FILES} DESTINATION ${CARLA_PACKAGE_ARCHIVE_PATH}/PythonAPI/util/)
file (COPY_FILE ${CARLA_SOURCE_DIR}/PythonAPI/util/requirements.txt ${CARLA_TARGET_PACKAGE_PATH}/PythonAPI/util/requirements.txt) file (COPY_FILE ${CARLA_WORKSPACE_PATH}/PythonAPI/util/requirements.txt ${CARLA_PACKAGE_ARCHIVE_PATH}/PythonAPI/util/requirements.txt)
file (COPY ${CARLA_SOURCE_DIR}/PythonAPI/util/opendrive/ DESTINATION ${CARLA_TARGET_PACKAGE_PATH}/PythonAPI/util/opendrive/) file (COPY ${CARLA_WORKSPACE_PATH}/PythonAPI/util/opendrive/ DESTINATION ${CARLA_PACKAGE_ARCHIVE_PATH}/PythonAPI/util/opendrive/)
file (COPY ${CARLA_SOURCE_DIR}/Co-Simulation/ DESTINATION ${CARLA_TARGET_PACKAGE_PATH}/Co-Simulation/) # file (COPY ${CARLA_WORKSPACE_PATH}/Co-Simulation/ DESTINATION ${CARLA_PACKAGE_ARCHIVE_PATH}/Co-Simulation/)
make_directory (${CARLA_TARGET_PACKAGE_PATH}/HDMaps/) make_directory (${CARLA_PACKAGE_ARCHIVE_PATH}/HDMaps/)
file (GLOB PYTHON_HDMAP_FILES ${CARLA_SOURCE_DIR}/Unreal/CarlaUnreal/Content/Carla/HDMaps/*.pcd) file (GLOB PYTHON_HDMAP_FILES ${CARLA_WORKSPACE_PATH}/Unreal/CarlaUnreal/Content/Carla/HDMaps/*.pcd)
file (COPY ${PYTHON_HDMAP_FILES} DESTINATION ${CARLA_TARGET_PACKAGE_PATH}/HDMaps/) file (COPY ${PYTHON_HDMAP_FILES} DESTINATION ${CARLA_PACKAGE_ARCHIVE_PATH}/HDMaps/)
file (COPY_FILE ${CARLA_SOURCE_DIR}/Unreal/CarlaUnreal/Content/Carla/HDMaps/Readme.md ${CARLA_TARGET_PACKAGE_PATH}/HDMaps/README) file (COPY_FILE ${CARLA_WORKSPACE_PATH}/Unreal/CarlaUnreal/Content/Carla/HDMaps/Readme.md ${CARLA_PACKAGE_ARCHIVE_PATH}/HDMaps/README)

View File

@ -1,21 +1,30 @@
execute_process( execute_process(
COMMAND git log -1 --format=%H COMMAND
WORKING_DIRECTORY ${CARLA_SOURCE_DIR} git log -1 --format=%H
OUTPUT_VARIABLE CARLA_GIT_HASH WORKING_DIRECTORY
${CARLA_WORKSPACE_PATH}
OUTPUT_VARIABLE
CARLA_GIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
) )
execute_process( execute_process(
COMMAND git log -1 --format=%H COMMAND
WORKING_DIRECTORY ${CARLA_SOURCE_DIR}/Unreal/CarlaUnreal/Content/Carla git log -1 --format=%H
OUTPUT_VARIABLE CONTENT_GIT_HASH WORKING_DIRECTORY
${CARLA_WORKSPACE_PATH}/Unreal/CarlaUnreal/Content/Carla
OUTPUT_VARIABLE
CONTENT_GIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
) )
execute_process( execute_process(
COMMAND git log -1 --format=%H COMMAND
WORKING_DIRECTORY ${CARLA_UNREAL_ENGINE_PATH} git log -1 --format=%H
OUTPUT_VARIABLE UNREAL_ENGINE_GIT_HASH WORKING_DIRECTORY
${CARLA_UNREAL_ENGINE_PATH}
OUTPUT_VARIABLE
UNREAL_ENGINE_GIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
) )