Skip to content

Commit

Permalink
build(traffic_light_fine_detector): disable downloading artifacts by …
Browse files Browse the repository at this point in the history
…default

Signed-off-by: Esteve Fernandez <esteve.fernandez@tier4.jp>
  • Loading branch information
esteve committed Jul 7, 2023
1 parent 3b0671a commit 50dc52a
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions perception/traffic_light_fine_detector/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ autoware_package()
add_compile_options(-Wno-deprecated-declarations)

option(CUDA_VERBOSE "Verbose output of CUDA modules" OFF)
option(DOWNLOAD_ARTIFACTS "Enable artifacts download" OFF)

find_package(OpenCV REQUIRED)

Expand Down Expand Up @@ -92,16 +93,28 @@ function(download FILE_NAME FILE_HASH)
else()
message(STATUS "diff ${FILE_NAME}")
message(STATUS "File hash changes. Downloading now ...")
if(DOWNLOAD_ARTIFACTS)
file(DOWNLOAD ${DATA_DIR}/${FILE_NAME} ${FILE_PATH} STATUS DOWNLOAD_STATUS TIMEOUT 300)
list(GET DOWNLOAD_STATUS 0 STATUS_CODE)
list(GET DOWNLOAD_STATUS 1 ERROR_MESSAGE)
else()
message(WARNING "Skipped download for ${FILE_NAME} (enable by setting DOWNLOAD_ARTIFACTS)")
file(MAKE_DIRECTORY "${DATA_PATH}")
return()
endif()
endif()
else()
message(STATUS "not found ${FILE_NAME}")
if(DOWNLOAD_ARTIFACTS)
message(STATUS "File doesn't exists. Downloading now ...")
file(DOWNLOAD ${DATA_DIR}/${FILE_NAME} ${FILE_PATH} STATUS DOWNLOAD_STATUS TIMEOUT 300)
list(GET DOWNLOAD_STATUS 0 STATUS_CODE)
list(GET DOWNLOAD_STATUS 1 ERROR_MESSAGE)
else()
message(WARNING "Skipped download for ${FILE_NAME} (enable by setting DOWNLOAD_ARTIFACTS)")
file(MAKE_DIRECTORY "${DATA_PATH}")
return()
endif()
else()
message(STATUS "not found ${FILE_NAME}")
message(STATUS "File doesn't exists. Downloading now ...")
file(DOWNLOAD ${DATA_DIR}/${FILE_NAME} ${FILE_PATH} STATUS DOWNLOAD_STATUS TIMEOUT 300)
list(GET DOWNLOAD_STATUS 0 STATUS_CODE)
list(GET DOWNLOAD_STATUS 1 ERROR_MESSAGE)
endif()
if(${STATUS_CODE} EQUAL 0)
message(STATUS "Download completed successfully!")
Expand Down

0 comments on commit 50dc52a

Please sign in to comment.