Skip to content

Commit

Permalink
Adjust ExtractResources script to be POSIX-compliant again
Browse files Browse the repository at this point in the history
Also set CMAKE to copy the extraction scripts over with the executable flag set on Linux.

Co-authored-by: Dwyriel <[email protected]>
  • Loading branch information
2 people authored and Muehe committed Sep 20, 2023
1 parent d6b6992 commit ced9ec1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
16 changes: 10 additions & 6 deletions contrib/extractor_scripts/ExtractResources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,10 @@ then
echo "How many CPU threads should be used for extracting mmaps? (leave empty to use all available threads)"
read line
echo
if [[ ! -z $line ]]; then
if [[ $line =~ ^[1-9+]$ ]]; then
# check string is there
if [ ! -z $line ]; then
# and a number greater 0
if [ "$(expr "$line" : "^[1-9][0-9]*$")" -gt 0 ]; then
NUM_THREAD=$line
else
echo "Only numbers are allowed!"
Expand Down Expand Up @@ -252,8 +254,9 @@ if [ "$USE_VMAPS" = "1" ]
then
echo "$(date): Start extraction of vmaps..." | tee -a $LOG_FILE
$PREFIX/vmap_extractor $VMAP_RES $VMAP_OPT_RES | tee -a $DETAIL_LOG_FILE
exit_code="${PIPESTATUS[0]}"
if [[ "$exit_code" -ne "0" ]]; then
# $? has the exit code of the last closed pipeline, vmap_extractor in this case
exit_code="$?"
if [ "$exit_code" -ne "0" ]; then
echo "$(date): Extraction of vmaps failed with errors. Aborting extraction. See the log file for more details."
exit "$exit_code"
fi
Expand All @@ -264,8 +267,9 @@ then
fi
echo "$(date): Start assembling of vmaps..." | tee -a $LOG_FILE
$PREFIX/vmap_assembler ${OUTPUT_PATH:-.}/Buildings ${OUTPUT_PATH:-.}/vmaps | tee -a $DETAIL_LOG_FILE
exit_code="${PIPESTATUS[0]}"
if [[ "$exit_code" -ne "0" ]]; then
# $? has the exit code of the last closed pipeline, vmap_assembler in this case
exit_code="$?"
if [ "$exit_code" -ne "0" ]; then
echo "$(date): Assembling of vmaps failed with errors. Aborting extraction. See the log file for more details."
exit "$exit_code"
fi
Expand Down
2 changes: 1 addition & 1 deletion contrib/mmap/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,6 @@ if (BUILD_EXTRACTORS)
endif()

install(TARGETS ${EXECUTABLE_NAME} DESTINATION ${BIN_DIR}/tools)
install(FILES "${CMAKE_SOURCE_DIR}/contrib/extractor_scripts/MoveMapGen.sh" DESTINATION ${BIN_DIR}/tools)
install(PROGRAMS "${CMAKE_SOURCE_DIR}/contrib/extractor_scripts/MoveMapGen.sh" DESTINATION ${BIN_DIR}/tools)
install(FILES "${CMAKE_SOURCE_DIR}/contrib/extractor_scripts/offmesh.txt" DESTINATION ${BIN_DIR}/tools)
endif()
2 changes: 1 addition & 1 deletion contrib/vmap_extractor/vmapextract/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ if(MSVC)
COMMAND ${CMAKE_COMMAND} -E copy_if_different \"${CMAKE_SOURCE_DIR}/contrib/extractor_scripts/ExtractResources.sh\" \"$<TARGET_FILE_DIR:${EXECUTABLE_NAME}>\")
endif()

install(FILES "${CMAKE_SOURCE_DIR}/contrib/extractor_scripts/ExtractResources.sh" DESTINATION ${BIN_DIR}/tools)
install(PROGRAMS "${CMAKE_SOURCE_DIR}/contrib/extractor_scripts/ExtractResources.sh" DESTINATION ${BIN_DIR}/tools)
install(TARGETS ${EXECUTABLE_NAME} DESTINATION ${BIN_DIR}/tools)

0 comments on commit ced9ec1

Please sign in to comment.