12
12
# See the License for the specific language governing permissions and
13
13
# limitations under the License.
14
14
15
+ set (DOWNLOAD_ARTIFACTS OFF CACHE BOOL "enable artifacts download" )
16
+
15
17
set (DATA_URL "https://s3.ap-northeast-2.wasabisys.com/pinto-model-zoo/136_road-segmentation-adas-0001/resources.tar.gz" )
16
18
set (DATA_PATH "${CMAKE_CURRENT_SOURCE_DIR} /data" )
17
19
set (FILE_HASH 146ed8af689a30b898dc5369870c40fb)
18
20
set (FILE_NAME "resources.tar.gz" )
19
21
20
- function (download )
22
+ function (download_and_extract )
21
23
message (STATUS "Checking and downloading ${FILE_NAME} " )
22
24
set (FILE_PATH ${DATA_PATH} /${FILE_NAME} )
23
25
set (STATUS_CODE 0)
@@ -38,25 +40,28 @@ function(download)
38
40
list (GET DOWNLOAD_STATUS 1 ERROR_MESSAGE)
39
41
endif ()
40
42
else ()
41
- message (STATUS "not found ${FILE_NAME} " )
42
- message (STATUS "File doesn't exists. Downloading now ..." )
43
- file (DOWNLOAD ${DATA_URL} ${FILE_PATH} STATUS DOWNLOAD_STATUS TIMEOUT 3600)
44
- list (GET DOWNLOAD_STATUS 0 STATUS_CODE)
45
- list (GET DOWNLOAD_STATUS 1 ERROR_MESSAGE)
43
+ if (DOWNLOAD_ARTIFACTS)
44
+ message (STATUS "not found ${FILE_NAME} " )
45
+ message (STATUS "File doesn't exists. Downloading now ..." )
46
+ file (DOWNLOAD ${DATA_URL} ${FILE_PATH} STATUS DOWNLOAD_STATUS TIMEOUT 3600)
47
+ list (GET DOWNLOAD_STATUS 0 STATUS_CODE)
48
+ list (GET DOWNLOAD_STATUS 1 ERROR_MESSAGE)
49
+ else ()
50
+ message (WARNING "Skipped download for ${FILE_NAME} (enable by setting DOWNLOAD_ARTIFACTS)" )
51
+ file (MAKE_DIRECTORY "${DATA_PATH} " )
52
+ return ()
53
+ endif ()
46
54
endif ()
47
55
48
56
if (${STATUS_CODE} EQUAL 0)
49
57
message (STATUS "Download completed successfully!" )
50
58
else ()
51
59
message (FATAL_ERROR "Error occurred during download: ${ERROR_MESSAGE} " )
52
60
endif ()
53
- endfunction ()
54
61
55
- function (extract)
56
62
execute_process (COMMAND
57
63
${CMAKE_COMMAND} -E
58
64
tar xzf "${DATA_PATH} /${FILE_NAME} " WORKING_DIRECTORY "${DATA_PATH} " )
59
65
endfunction ()
60
66
61
- download()
62
- extract()
67
+ download_and_extract()
0 commit comments