Tweak *.Build.cs files to read .def files. (#7243)

* Tweak *.Build.cs files to read .def files instead of being configured by CMake.

* Add missing EOF.

* Minor fix.

* Fix PixelReader compile error and use copy instead of symlink for Includes & Libraries.def.

* Fix CarlaTools linker error.
This commit is contained in:
Marcel Pi 2024-03-14 20:03:32 +01:00 committed by GitHub
parent 44d0c1bc3c
commit bb806ad0e3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 101 additions and 64 deletions

View File

@ -101,11 +101,11 @@ carla_string_option (
carla_string_option (
GCC_COMPILER
"gcc compiler used by some CARLA extensions."
"/usr/bin/gcc-7"
/usr/bin/gcc-7
)
carla_string_option (
GXX_COMPILER
"g++ compiler used by some CARLA extensions."
"/usr/bin/g++-7"
/usr/bin/g++-7
)

View File

@ -18,6 +18,16 @@ set (
${CARLA_UE_PATH}/Plugins
)
set (
CARLA_UE_CARLA_PATH
${CARLA_UE_PLUGINS_PATH}/Carla
)
set (
CARLA_UE_CARLA_TOOLS_PATH
${CARLA_UE_PLUGINS_PATH}/CarlaTools
)
set (
CARLA_UE_PROJECT_PATH
${CARLA_UE_PATH}/CarlaUnreal.uproject
@ -35,7 +45,6 @@ if (WIN32)
-CMakefile
-game
-engine
-progress
)
else ()
set (
@ -45,7 +54,6 @@ else ()
-CMakefile
-game
-engine
-progress
)
endif ()
@ -82,8 +90,48 @@ set (
Eigen3::Eigen
zlibstatic
png_static
rpc
)
set (
CARLA_UNREAL_INCLUDE_PATHS_FILE_PATH
${CMAKE_CURRENT_BINARY_DIR}/Includes.inc
)
set (
CARLA_UNREAL_INCLUDE_PATHS
${sqlite3_SOURCE_DIR}
)
foreach (UE_DEP ${UE_DEPENDENCIES})
list (
APPEND
CARLA_UNREAL_INCLUDE_PATHS
"$<TARGET_PROPERTY:${UE_DEP},INTERFACE_INCLUDE_DIRECTORIES>"
)
endforeach ()
set (
CARLA_UNREAL_LIBRARIES_PATHS_FILE_PATH
${CMAKE_CURRENT_BINARY_DIR}/Libraries.inc
)
set (
CARLA_UNREAL_LIBRARIES
$<TARGET_FILE:libsqlite3>
)
foreach (UE_DEP ${UE_DEPENDENCIES})
get_target_property (UE_DEP_TYPE ${UE_DEP} TYPE)
if (NOT ("${UE_DEP_TYPE}" STREQUAL "INTERFACE_LIBRARY"))
list (
APPEND
CARLA_UNREAL_LIBRARIES
"$<TARGET_FILE:${UE_DEP}>"
)
endif ()
endforeach ()
add_dependencies (
carla-unreal-generate-project-files
${UE_DEPENDENCIES}
@ -93,10 +141,13 @@ add_dependencies (
if (CMAKE_TOOLCHAIN_FILE)
cmake_path (
ABSOLUTE_PATH CMAKE_TOOLCHAIN_FILE
BASE_DIRECTORY ${CARLA_WORKSPACE_PATH}
ABSOLUTE_PATH
CMAKE_TOOLCHAIN_FILE
BASE_DIRECTORY
${CARLA_WORKSPACE_PATH}
NORMALIZE
OUTPUT_VARIABLE TOOLCHAIN_FILE
OUTPUT_VARIABLE
TOOLCHAIN_FILE
)
set (
TOOLCHAIN_FILE_OPTION
@ -110,17 +161,23 @@ endif ()
add_custom_command (
OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/carla-unreal-configure.stamp
${CARLA_UNREAL_INCLUDE_PATHS_FILE_PATH}
${CARLA_UNREAL_LIBRARIES_PATHS_FILE_PATH}
COMMENT
"Configuring Carla Unreal..."
COMMAND ${CMAKE_COMMAND} -E rm -f ${CARLA_UNREAL_INCLUDE_PATHS_FILE_PATH}
COMMAND ${CMAKE_COMMAND} -E echo "${CARLA_UNREAL_INCLUDE_PATHS}" >> ${CARLA_UNREAL_INCLUDE_PATHS_FILE_PATH}
COMMAND ${CMAKE_COMMAND} -E copy ${CARLA_UNREAL_INCLUDE_PATHS_FILE_PATH} ${CARLA_UE_CARLA_PATH}/Includes.def
COMMAND ${CMAKE_COMMAND} -E copy ${CARLA_UNREAL_INCLUDE_PATHS_FILE_PATH} ${CARLA_UE_CARLA_TOOLS_PATH}/Includes.def
COMMAND ${CMAKE_COMMAND} -E rm -f ${CARLA_UNREAL_LIBRARIES_PATHS_FILE_PATH}
COMMAND ${CMAKE_COMMAND} -E echo "${CARLA_UNREAL_LIBRARIES}" >> ${CARLA_UNREAL_LIBRARIES_PATHS_FILE_PATH}
COMMAND ${CMAKE_COMMAND} -E copy ${CARLA_UNREAL_LIBRARIES_PATHS_FILE_PATH} ${CARLA_UE_CARLA_PATH}/Libraries.def
COMMAND ${CMAKE_COMMAND} -E copy ${CARLA_UNREAL_LIBRARIES_PATHS_FILE_PATH} ${CARLA_UE_CARLA_TOOLS_PATH}/Libraries.def
COMMAND
${CMAKE_COMMAND}
-S ${CARLA_UE_PATH}
-B ${CMAKE_CURRENT_BINARY_DIR}
${TOOLCHAIN_FILE_OPTION}
COMMAND
${CMAKE_COMMAND}
-E touch carla-unreal-configure.stamp
USES_TERMINAL
VERBATIM
)
@ -128,7 +185,8 @@ add_custom_command (
add_custom_target (
carla-unreal-configure
DEPENDS
carla-unreal-configure.stamp
${CARLA_UNREAL_INCLUDE_PATHS_FILE_PATH}
${CARLA_UNREAL_LIBRARIES_PATHS_FILE_PATH}
)
add_dependencies (
@ -217,11 +275,19 @@ add_custom_target (
add_custom_target (
launch
COMMENT
"Launching Carla Unreal..."
COMMAND
${UNREAL_EDITOR_PATH}
${CARLA_UE_PROJECT_PATH}
-${CARLA_UNREAL_RHI}
${LAUNCH_ARGS}
USES_TERMINAL
VERBATIM
)
add_dependencies (
launch
launch-only
${LAUNCH_DEPENDENCIES}
)
@ -231,13 +297,3 @@ file (
MAKE_DIRECTORY
${CARLA_UE_PATH}/Content/Carla/ExportedMaps
)
carla_two_step_configure_file (
${CARLA_UE_PLUGINS_PATH}/Carla/Source/Carla/Carla.Build.cs
${CARLA_UE_PLUGINS_PATH}/Carla/Source/Carla/Carla.Build.cs.in
)
carla_two_step_configure_file (
${CARLA_UE_PLUGINS_PATH}/CarlaTools/Source/CarlaTools/CarlaTools.Build.cs
${CARLA_UE_PLUGINS_PATH}/CarlaTools/Source/CarlaTools/CarlaTools.Build.cs.in
)

View File

@ -22,5 +22,7 @@ Config/CarSimConfig.ini
.idea
.vscode
.ignore
*.sln
CMakeLists.txt
Makefile

View File

@ -0,0 +1,2 @@
Includes.def
Libraries.def

View File

@ -1 +0,0 @@
Carla.Build.cs

View File

@ -5,6 +5,7 @@ using System.IO;
using UnrealBuildTool;
using System.Diagnostics;
using EpicGames.Core;
using System.IO;
public class Carla :
ModuleRules
@ -110,27 +111,14 @@ public class Carla :
PublicDependencyModuleNames.Add("UnrealEd");
PublicIncludePaths.Add(ModuleDirectory);
AddIncludeDirectories("$<TARGET_PROPERTY:Boost::asio,INTERFACE_INCLUDE_DIRECTORIES>");
AddIncludeDirectories("$<TARGET_PROPERTY:Boost::python,INTERFACE_INCLUDE_DIRECTORIES>");
AddIncludeDirectories("$<TARGET_PROPERTY:Boost::numpy,INTERFACE_INCLUDE_DIRECTORIES>");
AddIncludeDirectories("$<TARGET_PROPERTY:Boost::geometry,INTERFACE_INCLUDE_DIRECTORIES>");
AddIncludeDirectories("$<TARGET_PROPERTY:Boost::gil,INTERFACE_INCLUDE_DIRECTORIES>");
AddIncludeDirectories("$<TARGET_PROPERTY:Eigen3::Eigen,INTERFACE_INCLUDE_DIRECTORIES>");
PublicAdditionalLibraries.Add("$<TARGET_FILE:carla-server>");
AddIncludeDirectories("$<TARGET_PROPERTY:carla-server,INTERFACE_INCLUDE_DIRECTORIES>");
PublicAdditionalLibraries.Add("$<TARGET_FILE:zlibstatic>");
AddIncludeDirectories("$<TARGET_PROPERTY:zlibstatic,INTERFACE_INCLUDE_DIRECTORIES>");
foreach (var Path in File.ReadAllText(Path.Combine(PluginDirectory, "Includes.def")).Split(';'))
if (Path.Length != 0)
PublicIncludePaths.Add(Path);
PublicAdditionalLibraries.Add("$<TARGET_FILE:png_static>");
AddIncludeDirectories("$<TARGET_PROPERTY:png_static,INTERFACE_INCLUDE_DIRECTORIES>");
PublicAdditionalLibraries.Add("$<TARGET_FILE:rpc>");
AddIncludeDirectories("$<TARGET_PROPERTY:rpc,INTERFACE_INCLUDE_DIRECTORIES>");
PublicAdditionalLibraries.Add("$<TARGET_FILE:libsqlite3>");
PublicIncludePaths.Add("@sqlite3_SOURCE_DIR@");
foreach (var Path in File.ReadAllText(Path.Combine(PluginDirectory, "Libraries.def")).Split(';'))
if (Path.Length != 0)
PublicAdditionalLibraries.Add(Path);
if (EnableOSM2ODR)
{

View File

@ -83,7 +83,7 @@ public:
///
/// @pre To be called from render-thread.
static void WritePixelsToBuffer(
const UTextureRenderTarget2D &RenderTarget,
UTextureRenderTarget2D &RenderTarget,
uint32 Offset,
FRHICommandListImmediate &InRHICmdList,
FPixelReader::Payload FuncForSending);

View File

@ -0,0 +1,2 @@
Includes.def
Libraries.def

View File

@ -1 +0,0 @@
CarlaTools.Build.cs

View File

@ -3,6 +3,7 @@
using System;
using UnrealBuildTool;
using EpicGames.Core;
using System.IO;
public class CarlaTools :
ModuleRules
@ -48,6 +49,7 @@ public class CarlaTools :
PublicDependencyModuleNames.AddRange(new string[]
{
"Core",
"LevelEditor",
"ProceduralMeshComponent",
"MeshDescription",
"RawMesh",
@ -118,27 +120,14 @@ public class CarlaTools :
}
PublicIncludePaths.Add(ModuleDirectory);
AddIncludeDirectories("$<TARGET_PROPERTY:Boost::asio,INTERFACE_INCLUDE_DIRECTORIES>");
AddIncludeDirectories("$<TARGET_PROPERTY:Boost::python,INTERFACE_INCLUDE_DIRECTORIES>");
AddIncludeDirectories("$<TARGET_PROPERTY:Boost::numpy,INTERFACE_INCLUDE_DIRECTORIES>");
AddIncludeDirectories("$<TARGET_PROPERTY:Boost::geometry,INTERFACE_INCLUDE_DIRECTORIES>");
AddIncludeDirectories("$<TARGET_PROPERTY:Boost::gil,INTERFACE_INCLUDE_DIRECTORIES>");
AddIncludeDirectories("$<TARGET_PROPERTY:Eigen3::Eigen,INTERFACE_INCLUDE_DIRECTORIES>");
PublicAdditionalLibraries.Add("$<TARGET_FILE:carla-server>");
AddIncludeDirectories("$<TARGET_PROPERTY:carla-server,INTERFACE_INCLUDE_DIRECTORIES>");
PublicAdditionalLibraries.Add("$<TARGET_FILE:zlibstatic>");
AddIncludeDirectories("$<TARGET_PROPERTY:zlibstatic,INTERFACE_INCLUDE_DIRECTORIES>");
foreach (var Path in File.ReadAllText(Path.Combine(PluginDirectory, "Includes.def")).Split(';'))
if (Path.Length != 0)
PublicIncludePaths.Add(Path);
PublicAdditionalLibraries.Add("$<TARGET_FILE:png_static>");
AddIncludeDirectories("$<TARGET_PROPERTY:png_static,INTERFACE_INCLUDE_DIRECTORIES>");
PublicAdditionalLibraries.Add("$<TARGET_FILE:rpc>");
AddIncludeDirectories("$<TARGET_PROPERTY:rpc,INTERFACE_INCLUDE_DIRECTORIES>");
PublicAdditionalLibraries.Add("$<TARGET_FILE:libsqlite3>");
PublicIncludePaths.Add("@sqlite3_SOURCE_DIR@");
foreach (var Path in File.ReadAllText(Path.Combine(PluginDirectory, "Libraries.def")).Split(';'))
if (Path.Length != 0)
PublicAdditionalLibraries.Add(Path);
PublicDefinitions.AddRange(new string[]
{