Remove robot clones

Robot clones were shared library duplicates with a different name that
the game would rely on to perform different actions based on the car
category.

Not only this was a hacky solution, but it also involved around 50
extra libraries loaded into the game, which means higher resource
consumption and slower startup time, as well as making driver management
more difficult to the much higher of directories involved in
data/drivers/.

Now, only 1 shared library per robot is defined.


Former-commit-id: 4c5141000bc9b46363a16c0928e90b14f40a430a
Former-commit-id: 773f3d6987da3f6ef8e78e0f0276e2d4bf2b07f2
This commit is contained in:
Xavier Del Campo Romero 2024-11-04 01:42:42 +01:00
parent ee1deeaf00
commit 38e0ab0584
5 changed files with 5 additions and 82 deletions

View file

@ -79,7 +79,6 @@ ENDMACRO(GENERATE_ROBOT_DEF_FILE ROBOTNAME DEF_FILE)
# See GENERATE_ROBOT_DEF_FILE macro.
# If not specified, defaults to "LEGACY_MIN" ; not used if MODULE used
# SOURCES : List of files to use as build sources if any ; not needed if MODULE used
# CLONENAMES : The names of the clones to generate
# VERSION : The VERSION of the libraries to produce (robot and its clones) (def: $VERSION).
# SOVERSION : The SOVERSION of the libraries to produce (in the ldconfig meaning) (def: 0.0.0).
# WARNING: Not taken into account for the moment : might not work with GCC 4.5 or +.
@ -87,8 +86,7 @@ ENDMACRO(GENERATE_ROBOT_DEF_FILE ROBOTNAME DEF_FILE)
# Example:
# ROBOT_MODULE(NAME simplix VERSION 3.0.5 SOVERSION 0.0.0
# INTERFACE LEGACY WELCOME simplix_trb1 simplix_ls1 simplix_36GP
# SOURCES simplix.cpp ...
# CLONENAMES simplix_trb1 simplix_ls1 simplix_36GP)
# SOURCES simplix.cpp ...)
MACRO(ROBOT_MODULE)
SET(RBM_SYNTAX "NAME,1,1,RBM_HAS_NAME,RBM_NAME")
@ -96,7 +94,6 @@ MACRO(ROBOT_MODULE)
SET(RBM_SYNTAX ${RBM_SYNTAX} "SOVERSION,0,1,RBM_HAS_SOVERSION,RBM_SOVERSION")
SET(RBM_SYNTAX ${RBM_SYNTAX} "INTERFACE,0,-1,RBM_HAS_INTERFACE,RBM_INTERFACE")
SET(RBM_SYNTAX ${RBM_SYNTAX} "SOURCES,0,-1,RBM_HAS_SOURCES,RBM_SOURCES")
SET(RBM_SYNTAX ${RBM_SYNTAX} "CLONENAMES,0,-1,RBM_HAS_CLONENAMES,RBM_CLONENAMES")
SPLIT_ARGN(${RBM_SYNTAX} ARGUMENTS ${ARGN})
@ -169,46 +166,6 @@ MACRO(ROBOT_MODULE)
# Install target robot module shared library
SD_INSTALL_FILES(LIB drivers/${RBM_NAME} TARGETS ${RBM_NAME})
# Install clone robot modules shared libraries (use ldconfig version naming scheme under Linux)
IF(RBM_HAS_CLONENAMES AND RBM_CLONENAMES)
GET_TARGET_PROPERTY(MODLOC ${RBM_NAME} RUNTIME_OUTPUT_DIRECTORY)
IF(NOT RUNTIME_OUTPUT_DIRECTORY)
GET_TARGET_PROPERTY(MODLOC ${RBM_NAME} LIBRARY_OUTPUT_DIRECTORY)
ENDIF()
SET(MODLOC "${MODLOC}/${RBM_NAME}${CMAKE_SHARED_MODULE_SUFFIX}")
FOREACH(CLONENAME ${RBM_CLONENAMES})
SET(CLONE_MODDIR "${CMAKE_BINARY_DIR}/${SD_LIBDIR}/drivers/${CLONENAME}")
SET(CLONE_MODLOC "${CLONE_MODDIR}/${CLONENAME}${CMAKE_SHARED_MODULE_SUFFIX}")
SET_PROPERTY(GLOBAL APPEND PROPERTY SD_ROBOT_LIST "${CLONENAME}")
IF(FALSE) #IF(UNIX)
# Might not work with GCC 4.5 or + (see above)
ADD_CUSTOM_COMMAND(TARGET ${RBM_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo "Cloning ${RBM_NAME}${CMAKE_SHARED_MODULE_SUFFIX} into ${CLONE_MODLOC}.${RBM_VERSION}"
COMMAND ${CMAKE_COMMAND} -E make_directory "${CLONE_MODDIR}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${MODLOC} ${CLONE_MODLOC}.${RBM_VERSION})
ADD_CUSTOM_COMMAND(TARGET ${RBM_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CLONE_MODLOC}.${RBM_VERSION} ${CLONE_MODLOC}.${RBM_SOVERSION}
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CLONE_MODLOC}.${RBM_SOVERSION} ${CLONE_MODLOC})
SD_INSTALL_FILES(LIB drivers/${CLONENAME}
FILES ${CLONE_MODLOC} ${CLONE_MODLOC}.${RBM_SOVERSION} ${CLONE_MODLOC}.${RBM_VERSION} )
ELSE()
ADD_CUSTOM_COMMAND(TARGET ${RBM_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo "Creating directory ${CLONE_MODDIR}"
COMMAND ${CMAKE_COMMAND} -E make_directory "${CLONE_MODDIR}"
COMMAND ${CMAKE_COMMAND} -E echo "Cloning ${RBM_NAME}${CMAKE_SHARED_MODULE_SUFFIX}=${MODLOC} into ${CLONE_MODLOC}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${MODLOC} ${CLONE_MODLOC})
SD_INSTALL_FILES(LIB drivers/${CLONENAME}
FILES ${CLONE_MODLOC})
ENDIF()
ENDFOREACH(CLONENAME ${RBM_CLONENAMES})
ENDIF()
ENDMACRO(ROBOT_MODULE)
# Robot data installation

View file

@ -35,19 +35,10 @@ SET(ROBOT_SOURCES
src/Vec3d.h
)
# Official-only dandroid instances.
SET(ROBOT_CLONES dandroid_36GP dandroid_67GP dandroid_ls1 dandroid_ls2 dandroid_mpa1
dandroid_mpa11 dandroid_mpa12 dandroid_rs dandroid_sc dandroid_srw dandroid_trb1)
IF(NOT OPTION_OFFICIAL_ONLY)
SET(ROBOT_CLONES ${ROBOT_CLONES} dandroid_stock dandroid_lp1)
ENDIF(NOT OPTION_OFFICIAL_ONLY)
# The ubiquitous robot module and its clones.
ROBOT_MODULE(NAME ${ROBOT_NAME} VERSION 2.0.0 SOVERSION 1.0.0
INTERFACE ${ROBOT_INTERFACE}
SOURCES ${ROBOT_SOURCES}
CLONENAMES ${ROBOT_CLONES})
SOURCES ${ROBOT_SOURCES})
# For data associated to the ubiquitous robot module and its clones,
# see data/drivers/dandroid*/CMakeLists.txt

View file

@ -71,19 +71,10 @@ SET(ROBOT_SOURCES
src/WheelModel.cpp
src/WheelModel.h)
# Official-only shadow instances.
SET(ROBOT_CLONES shadow_36GP shadow_67GP shadow_sc shadow_trb1 shadow_ls1 shadow_ls2
shadow_mp1 shadow_mpa1 shadow_mpa11 shadow_mpa12)
IF(NOT OPTION_OFFICIAL_ONLY)
SET(ROBOT_CLONES ${ROBOT_CLONES} shadow_mp5 shadow_ref shadow_srw shadow_lp1)
ENDIF(NOT OPTION_OFFICIAL_ONLY)
# The ubiquitous robot module and its clones.
ROBOT_MODULE(NAME ${ROBOT_NAME} VERSION 3.3.0 SOVERSION 1.0.0
INTERFACE ${ROBOT_INTERFACE}
SOURCES ${ROBOT_SOURCES}
CLONENAMES ${ROBOT_CLONES})
SOURCES ${ROBOT_SOURCES})
# For data associated to the ubiquitous robot module and its clones,
# see data/drivers/shadow*/CMakeLists.txt

View file

@ -72,18 +72,10 @@ SET(ROBOT_SOURCES
src/unitvec3d.h
)
# Official-only simplix instances.
SET(ROBOT_CLONES simplix_36GP simplix_67GP simplix_sc simplix_srw simplix_trb1 simplix_ls1 simplix_ls2 simplix_mp5)
IF(NOT OPTION_OFFICIAL_ONLY)
SET(ROBOT_CLONES ${ROBOT_CLONES} simplix_ref simplix_stock simplix_lp1)
ENDIF(NOT OPTION_OFFICIAL_ONLY)
# The ubiquitous robot module and its clones.
ROBOT_MODULE(NAME ${ROBOT_NAME} VERSION 3.3.0 SOVERSION 1.0.0
INTERFACE ${ROBOT_INTERFACE}
SOURCES ${ROBOT_SOURCES}
CLONENAMES ${ROBOT_CLONES})
SOURCES ${ROBOT_SOURCES})
# For data associated to the ubiquitous robot module and its clones,

View file

@ -59,17 +59,9 @@ SET(ROBOT_SOURCES
src/Vec3.h
src/Vec3d.h)
# Official-only USR instances.
SET(ROBOT_CLONES usr_36GP usr_67GP usr_ls1 usr_ls2 usr_mpa1 usr_mpa11 usr_mpa12 usr_rs usr_sc usr_trb1)
IF(NOT OPTION_OFFICIAL_ONLY)
SET(ROBOT_CLONES ${ROBOT_CLONES} usr_mp10 usr_srw usr_lp1)
ENDIF(NOT OPTION_OFFICIAL_ONLY)
ROBOT_MODULE(NAME ${ROBOT_NAME} VERSION 3.0.0 SOVERSION 1.0.0
INTERFACE ${ROBOT_INTERFACE}
SOURCES ${ROBOT_SOURCES}
CLONENAMES ${ROBOT_CLONES})
SOURCES ${ROBOT_SOURCES})
# For data associated to the ubiquirous USR robot module and its clones,
# see data/drivers/usr*/CMakeLists.txt