Skip to content

Commit

Permalink
check for wget and tar on arena-sdk installation
Browse files Browse the repository at this point in the history
  • Loading branch information
atar13 committed Oct 22, 2023
1 parent 2989744 commit f607de5
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 9 deletions.
21 changes: 15 additions & 6 deletions deps/arena-sdk/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
if(UNIX AND NOT APPLE)
set(ARENA_SDK_DIR "${CMAKE_BINARY_DIR}/_deps/arena-sdk")
set(INSTALL_SCRIPT "${PROJECT_SOURCE_DIR}/deps/arena-sdk/install-arena.sh")

# run install script with output directory as argument
execute_process(
COMMAND "${PROJECT_SOURCE_DIR}/deps/arena-sdk/install-arena.sh" ${ARENA_SDK_DIR}
COMMAND sh ${INSTALL_SCRIPT} ${ARENA_SDK_DIR}
RESULT_VARIABLE ret
)
if(ret EQUAL "0")
# Add a preprocessor macro that will enable us to compile
# functionality that depends on the Arena SDK.
target_compile_definitions(${PROJECT_NAME} PRIVATE
ARENA_SDK_INSTALLED
)
else()
message(FATAL_ERROR "Unable to install Arena-SDK. ${INSTALL_SCRIPT} script exited with code ${ret}.")
endif()

target_include_directories(${PROJECT_NAME} PRIVATE
"${ARENA_SDK_DIR}/extracted/include/Arena"
"${ARENA_SDK_DIR}/extracted/GenICam/library/CPP/include"
Expand All @@ -14,9 +28,4 @@ if(UNIX AND NOT APPLE)
target_link_libraries(${PROJECT_NAME} PRIVATE
${ARENA_LIBS}
)
# Add a preprocessor macro that will enable us to compile
# functionality that depends on the Arena SDK.
target_compile_definitions(${PROJECT_NAME} PRIVATE
ARENA_SDK_INSTALLED
)
endif()
23 changes: 20 additions & 3 deletions deps/arena-sdk/install-arena.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,34 @@ else
FILE_ID="1pQtheOK-f2N4C2CDi43HTqttGuxHKptg"
ARENA_SDK_DIR="ArenaSDK_Linux_x64"
ARENA_CONF="Arena_SDK_Linux_x64.conf"
else
echo "ERROR: Unable to install Arena-SDK. Unkown architecture $ARCH. Architecture must be aarch64 or x86_64."
exit 1
fi;

if [ ! -f "$PKGS_DIR/$FILE_NAME" ]; then \
if [ ! -d "$PKGS_DIR/$ARENA_SDK_DIR" ]; then \
# Check that wget is installed
if ! command -v wget > /dev/null; then \
echo "ERROR: Unable to install Arena-SDK. wget is not installed. Install wget for your system and retry."
exit 1
fi;

# Check that tar is installed
if ! command -v tar > /dev/null; then \
echo "ERROR: Unable to install Arena-SDK. tar is not installed. Install tar for your system and retry."
exit 1
fi;

# This command is kinda crazy to bypass Google drive's virus scanning warning for large files https://medium.com/@acpanjan/download-google-drive-files-using-wget-3c2c025a8b99
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate "https://docs.google.com/uc?export=download&id=$FILE_ID" -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=$FILE_ID" -O "$PKGS_DIR/$FILE_NAME" && rm -rf /tmp/cookies.txt
tar xf "$PKGS_DIR/$FILE_NAME" --directory="$PKGS_DIR"
else \
echo "WARNING: Arena SDK is already installed. Will not download again."; \
echo "WARNING: Arena SDK is already installed at $PKGS_DIR/$ARENA_SDK_DIR. Will not download again."; \
fi;

# Symlink arch specific arena install to architecture agnostic directory.
# Build system can point to this folder without knowing which architecture to use.
ln -sf "$ARENA_SDK_DIR" "$PKGS_DIR/extracted"
SYMLINKED_DIR="$PKGS_DIR/extracted"
echo "Symlinking $ARENA_SDK_DIR to $SYMLINKED_DIR"
ln -sf "$PKGS_DIR/$ARENA_SDK_DIR" "$SYMLINKED_DIR"
fi;

0 comments on commit f607de5

Please sign in to comment.