diff --git a/Util/BuildTools/BuildUtilsDocker.sh b/Util/BuildTools/BuildUtilsDocker.sh index 26ff9e3a7..1dbc2e3c7 100755 --- a/Util/BuildTools/BuildUtilsDocker.sh +++ b/Util/BuildTools/BuildUtilsDocker.sh @@ -1,32 +1,42 @@ -echo "Building FBX2OBJ" -echo "----------------" +#! /bin/bash -FBXSDK_URL=https://www.autodesk.com/content/dam/autodesk/www/adn/fbx/2020-0-1/fbx202001_fbxsdk_linux.tar.gz +source $(dirname "$0")/Environment.sh -cd Util/DockerUtils -mkdir dist -cp . dist/ -r -cd dist -cd fbx +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 -echo "Download FBX SDK 2020" -wget -c ${FBXSDK_URL} -O fbx202001_fbxsdk_linux.tar.gz +if [ -f ${FBX2OBJ_DIST}/FBX2OBJ ]; then + log "FBX SDK already installed." + exit +fi -echo "Unpacking" -tar -xvzf fbx202001_fbxsdk_linux.tar.gz -rm fbx202001_fbxsdk_linux.tar.gz +log "Downloading and preparing FBX SDK..." -echo "Installing" -printf "y\nyes\nn\n" | ./fbx202001_fbxsdk_linux -rm fbx202001_fbxsdk_linux +LIB_NAME=fbx202001_fbxsdk_linux +FBXSDK_URL=https://www.autodesk.com/content/dam/autodesk/www/adn/fbx/2020-0-1/${LIB_NAME}.tar.gz + +echo "Downloading FBX SDK 2020" + +wget -c ${FBXSDK_URL} -P ${CARLA_DOCKER_UTILS_FOLDER} + +echo "Unpacking..." +echo ${FBX2OBJ_DEP_FOLDER} +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 + +echo "Installing..." +echo -e "y\nyes\nn\n" | ${CARLA_DOCKER_UTILS_FOLDER}/${LIB_NAME} ${FBX2OBJ_DEP_FOLDER} +echo +rm ${CARLA_DOCKER_UTILS_FOLDER}/${LIB_NAME} echo "Compiling FBX2OBJ..." -mkdir build -cd build -cmake .. -make +mkdir -p ${FBX2OBJ_DIST} -echo "Copy binary FBX2OBJ" -mv FBX2OBJ ../.. -cd ../.. -rm -Rf build +cmake -S ${FBX2OBJ_FOLDER} -B ${FBX2OBJ_BUILD_FOLDER} + +make -C ${FBX2OBJ_BUILD_FOLDER} install + +log "Success!" diff --git a/Util/BuildTools/Linux.mk b/Util/BuildTools/Linux.mk index ef2811856..314be688b 100644 --- a/Util/BuildTools/Linux.mk +++ b/Util/BuildTools/Linux.mk @@ -9,7 +9,7 @@ launch: LibCarla.server.release launch-only: @${CARLA_BUILD_TOOLS_FOLDER}/BuildCarlaUE4.sh --launch $(ARGS) -import: CarlaUE4Editor +import: CarlaUE4Editor PythonAPI build.utils @${CARLA_BUILD_TOOLS_FOLDER}/Import.py $(ARGS) package: CarlaUE4Editor PythonAPI build.utils diff --git a/Util/BuildTools/Vars.mk b/Util/BuildTools/Vars.mk index ab107a55d..ead230c9d 100644 --- a/Util/BuildTools/Vars.mk +++ b/Util/BuildTools/Vars.mk @@ -3,7 +3,9 @@ CARLA_ROOT_FOLDER=${CURDIR} CARLA_BUILD_FOLDER=${CURDIR}/Build CARLA_DIST_FOLDER=${CURDIR}/Dist -CARLA_BUILD_TOOLS_FOLDER=${CURDIR}/Util/BuildTools +CARLA_UTIL_FOLDER=${CURDIR}/Util +CARLA_DOCKER_UTILS_FOLDER=${CARLA_UTIL_FOLDER}/DockerUtils +CARLA_BUILD_TOOLS_FOLDER=${CARLA_UTIL_FOLDER}/BuildTools CARLA_TEST_RESULTS_FOLDER=${CARLA_BUILD_FOLDER}/test-results CARLAUE4_ROOT_FOLDER=${CURDIR}/Unreal/CarlaUE4 diff --git a/Util/DockerUtils/.gitignore b/Util/DockerUtils/.gitignore index 1521c8b76..e80d074fb 100644 --- a/Util/DockerUtils/.gitignore +++ b/Util/DockerUtils/.gitignore @@ -1 +1,3 @@ dist +fbx/build +fbx/dependencies diff --git a/Util/DockerUtils/fbx/CMakeLists.txt b/Util/DockerUtils/fbx/CMakeLists.txt index 4665015c2..8a74cfa36 100644 --- a/Util/DockerUtils/fbx/CMakeLists.txt +++ b/Util/DockerUtils/fbx/CMakeLists.txt @@ -12,15 +12,18 @@ set(CMAKE_GENERATOR_PLATFORM x64) # include folders include_directories(src) -include_directories(include) +include_directories(dependencies/include) # library folders -link_directories(lib/gcc/x64/release) +link_directories(dependencies/lib/gcc/x64/release) # sources file(GLOB SOURCES "src/*.cpp") add_executable(FBX2OBJ ${SOURCES}) +# install location +install(TARGETS FBX2OBJ DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/../dist") + # libraries to link target_link_libraries(FBX2OBJ libfbxsdk.so) target_link_libraries(FBX2OBJ dl)