2020-02-06 01:46:50 +08:00
|
|
|
#! /bin/bash
|
2019-12-04 01:27:11 +08:00
|
|
|
|
2020-02-06 01:46:50 +08:00
|
|
|
source $(dirname "$0")/Environment.sh
|
2019-12-04 01:27:11 +08:00
|
|
|
|
2020-02-06 01:46:50 +08:00
|
|
|
FBX2OBJ_DIST=${CARLA_DOCKER_UTILS_FOLDER}/dist
|
|
|
|
FBX2OBJ_FOLDER=${CARLA_DOCKER_UTILS_FOLDER}/fbx
|
|
|
|
FBX2OBJ_BUILD_FOLDER=${FBX2OBJ_FOLDER}/build
|
|
|
|
FBX2OBJ_DEP_FOLDER=${FBX2OBJ_FOLDER}/dependencies
|
2019-12-04 01:27:11 +08:00
|
|
|
|
2020-02-06 20:15:02 +08:00
|
|
|
if [ -f "${FBX2OBJ_DIST}/FBX2OBJ" ]; then
|
2020-02-06 01:46:50 +08:00
|
|
|
log "FBX SDK already installed."
|
|
|
|
exit
|
|
|
|
fi
|
2019-12-04 01:27:11 +08:00
|
|
|
|
2020-02-06 01:46:50 +08:00
|
|
|
LIB_NAME=fbx202001_fbxsdk_linux
|
|
|
|
FBXSDK_URL=https://www.autodesk.com/content/dam/autodesk/www/adn/fbx/2020-0-1/${LIB_NAME}.tar.gz
|
|
|
|
|
2020-03-06 18:43:32 +08:00
|
|
|
if [ ! -d "${FBX2OBJ_DEP_FOLDER}" ]; then
|
|
|
|
log "Downloading FBX SDK..."
|
2022-07-30 12:58:49 +08:00
|
|
|
wget -c "${FBXSDK_URL}" -P "${CARLA_DOCKER_UTILS_FOLDER}" --user-agent="Mozilla"
|
2020-02-06 01:46:50 +08:00
|
|
|
|
2020-03-06 18:43:32 +08:00
|
|
|
echo "Unpacking..."
|
|
|
|
mkdir -p "${FBX2OBJ_DEP_FOLDER}"
|
|
|
|
tar -xvzf "${CARLA_DOCKER_UTILS_FOLDER}/${LIB_NAME}.tar.gz" -C "${CARLA_DOCKER_UTILS_FOLDER}" "${LIB_NAME}"
|
|
|
|
rm "${CARLA_DOCKER_UTILS_FOLDER}/${LIB_NAME}.tar.gz"
|
2020-02-06 01:46:50 +08:00
|
|
|
|
2020-03-06 18:43:32 +08:00
|
|
|
echo "Installing FBX SDK..."
|
|
|
|
echo -e "y\nyes\nn\n" | "${CARLA_DOCKER_UTILS_FOLDER}/${LIB_NAME}" "${FBX2OBJ_DEP_FOLDER}"
|
|
|
|
echo
|
|
|
|
rm "${CARLA_DOCKER_UTILS_FOLDER}/${LIB_NAME}"
|
|
|
|
fi
|
2019-12-04 01:27:11 +08:00
|
|
|
|
2020-03-06 18:43:32 +08:00
|
|
|
log "Compiling FBX2OBJ..."
|
2020-02-06 20:15:02 +08:00
|
|
|
mkdir -p "${FBX2OBJ_DIST}"
|
2020-03-05 23:57:44 +08:00
|
|
|
mkdir -p "${FBX2OBJ_BUILD_FOLDER}"
|
2020-02-06 01:46:50 +08:00
|
|
|
|
2020-03-05 23:57:44 +08:00
|
|
|
pushd "${FBX2OBJ_BUILD_FOLDER}" >/dev/null
|
2020-02-06 01:46:50 +08:00
|
|
|
|
2020-03-05 23:57:44 +08:00
|
|
|
cmake -G "Ninja" \
|
|
|
|
-DCMAKE_CXX_FLAGS="-fPIC -std=c++14" \
|
|
|
|
..
|
|
|
|
|
2020-04-03 02:53:00 +08:00
|
|
|
# copy the shared object 'libfbxsdk.so' to 'dist' folder
|
2020-04-09 21:08:36 +08:00
|
|
|
if [ ! -f "${FBX2OBJ_DIST}/libfbxsdk.so" ]; then
|
|
|
|
cp "${FBX2OBJ_DEP_FOLDER}/lib/gcc/x64/release/libfbxsdk.so" "${FBX2OBJ_DIST}"
|
|
|
|
fi
|
2020-04-03 02:53:00 +08:00
|
|
|
|
2020-03-06 18:43:32 +08:00
|
|
|
set +e
|
|
|
|
|
2020-03-05 23:57:44 +08:00
|
|
|
ninja
|
|
|
|
|
2020-03-06 18:43:32 +08:00
|
|
|
if [ $? -eq 1 ]; then
|
|
|
|
fatal_error "Make sure \"libxml2-dev\" is installed using:\n\n sudo apt-get install libxml2-dev\n"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-03-05 23:57:44 +08:00
|
|
|
ninja install
|
|
|
|
|
2020-03-06 18:43:32 +08:00
|
|
|
set -e
|
|
|
|
|
2020-03-05 23:57:44 +08:00
|
|
|
popd >/dev/null
|
2020-02-06 01:46:50 +08:00
|
|
|
|
|
|
|
log "Success!"
|