Skip to content

Commit

Permalink
Fix #1907, Cmake modifiable table tool path parameter
Browse files Browse the repository at this point in the history
Cmake option to change the path of the ef2cfetbl executable file via the TABLETOOL_EXE environment variable. This also enables the user to specify other tools as table tool if needed.
  • Loading branch information
pavll committed Aug 31, 2021
1 parent 5e41330 commit 629fef7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
11 changes: 9 additions & 2 deletions cmake/arch_build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,13 @@ function(add_cfe_tables APP_NAME TBL_SRC_FILES)
set(TABLE_BINARY "${TABLE_DESTDIR}/${TBLWE}.tbl")
file(MAKE_DIRECTORY ${TABLE_DESTDIR})

# Get TBLTOOL executable location from environment variable if available
if (DEFINED $ENV{TABLETOOL_EXE})
set(TABLE_TOOL_EXECUTABLE $ENV{TABLETOOL_EXE})
else() # else to default
set(TABLE_TOOL_EXECUTABLE ${MISSION_BINARY_DIR}/tools/elf2cfetbl/elf2cfetbl)
endif()

# Check if an override exists at the mission level (recommended practice)
# This allows a mission to implement a customized table without modifying
# the original - this also makes for easier merging/updating if needed.
Expand Down Expand Up @@ -226,10 +233,10 @@ function(add_cfe_tables APP_NAME TBL_SRC_FILES)
OUTPUT ${TABLE_BINARY}
COMMAND ${CMAKE_COMMAND}
-DCMAKE_AR=${CMAKE_AR}
-DTBLTOOL=${MISSION_BINARY_DIR}/tools/elf2cfetbl/elf2cfetbl
-DTBLTOOL=${TABLE_TOOL_EXECUTABLE}
-DLIB=$<TARGET_FILE:${TABLE_LIBNAME}>
-P ${CFE_SOURCE_DIR}/cmake/generate_table.cmake
DEPENDS ${MISSION_BINARY_DIR}/tools/elf2cfetbl/elf2cfetbl ${TABLE_LIBNAME}
DEPENDS ${TABLE_TOOL_EXECUTABLE} ${TABLE_LIBNAME}
WORKING_DIRECTORY ${TABLE_DESTDIR}
)

Expand Down
4 changes: 2 additions & 2 deletions cmake/generate_table.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# Required passed in values:
# CMAKE_AR => path to "ar" utility for working with static lib files
# TBLTOOL => path to "elf2cfetbl" utility
# TBLTOOL => path to "elf2cfetbl" utility or equivalent utility
# LIB => name of library file to convert
#
# This assumes/requires that the static library has a single object in it.
Expand All @@ -37,7 +37,7 @@ if (NOT RESULT EQUAL 0)
message(FATAL_ERROR "Failure running ${CMAKE_AR} x ${LIB} ${OBJNAME}")
endif()

# Finally invoke the table tool (elf2cfetbl) on the object
# Finally invoke the table tool (elf2cfetbl or other tool executable) on the object
message("Executing Process: ${TBLTOOL} ${OBJNAME}")
execute_process(COMMAND ${TBLTOOL} "${OBJNAME}"
RESULT_VARIABLE RESULT
Expand Down
10 changes: 7 additions & 3 deletions cmake/mission_build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -386,9 +386,13 @@ function(prepare)
)
add_subdirectory(${MISSION_SOURCE_DIR}/tools tools)

# Add a dependency on the table generator tool as this is required for table builds
# The "elf2cfetbl" target should have been added by the "tools" above
add_dependencies(mission-prebuild elf2cfetbl)
# If no alternative table tool executable was set by environment variable,
# ...add default tool as dependency
if (NOT DEFINED $ENV{TABLETOOL_EXE})
# Add a dependency on the table generator tool as this is required for table builds
# The "elf2cfetbl" target should have been added by the "tools" above
add_dependencies(mission-prebuild elf2cfetbl)
endif()

# Build version information should be generated as part of the pre-build process
add_dependencies(mission-prebuild mission-version)
Expand Down

0 comments on commit 629fef7

Please sign in to comment.