File tree Expand file tree Collapse file tree 2 files changed +43
-13
lines changed Expand file tree Collapse file tree 2 files changed +43
-13
lines changed Original file line number Diff line number Diff line change 26
26
27
27
function (get_level_zero_headers )
28
28
29
- # Clone the Level Zero git repo
30
- execute_process (
31
- COMMAND ${GIT_EXECUTABLE} clone https://github.com/oneapi-src/level-zero.git
32
- RESULT_VARIABLE result
33
- ERROR_VARIABLE error
34
- OUTPUT_STRIP_TRAILING_WHITESPACE
35
- ERROR_STRIP_TRAILING_WHITESPACE
36
- )
29
+ if (EXISTS level-zero )
30
+ # Update the checkout
31
+ execute_process (
32
+ COMMAND ${GIT_EXECUTABLE} fetch
33
+ RESULT_VARIABLE result
34
+ ERROR_VARIABLE error
35
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /level-zero
36
+ OUTPUT_STRIP_TRAILING_WHITESPACE
37
+ ERROR_STRIP_TRAILING_WHITESPACE
38
+ )
37
39
38
- if (NOT result EQUAL 0 )
39
- message (FATAL_ERROR
40
- "Could not clone the Level Zero sources."
40
+ if (NOT result EQUAL 0 )
41
+ message (FATAL_ERROR
42
+ "Could not update Level Zero sources."
43
+ )
44
+ endif ()
45
+ else ()
46
+ # Clone the Level Zero git repo
47
+ execute_process (
48
+ COMMAND ${GIT_EXECUTABLE} clone https://github.com/oneapi-src/level-zero.git
49
+ RESULT_VARIABLE result
50
+ ERROR_VARIABLE error
51
+ OUTPUT_STRIP_TRAILING_WHITESPACE
52
+ ERROR_STRIP_TRAILING_WHITESPACE
41
53
)
54
+
55
+ if (NOT result EQUAL 0 )
56
+ message (FATAL_ERROR
57
+ "Could not clone Level Zero sources from github.com/oneapi-src/level-zero."
58
+ )
59
+ endif ()
42
60
endif ()
43
61
44
62
# Use git describe to get latest tag name
Original file line number Diff line number Diff line change 45
45
dpctl_dir = os .getcwd ()
46
46
build_cmake_dir = os .path .join (dpctl_dir , "build_cmake" )
47
47
if os .path .exists (build_cmake_dir ):
48
- shutil .rmtree (build_cmake_dir )
49
- os .mkdir (build_cmake_dir )
48
+ for f in os .listdir (build_cmake_dir ):
49
+ f_path = os .path .join (build_cmake_dir , f )
50
+ if os .path .isdir (f_path ):
51
+ if (f == "level-zero" ) and os .path .isdir (
52
+ os .path .join (f_path , ".git" )
53
+ ):
54
+ # do not delete Git checkout of level zero headers
55
+ pass
56
+ else :
57
+ shutil .rmtree (f_path )
58
+ else :
59
+ os .remove (f_path )
60
+ else :
61
+ os .mkdir (build_cmake_dir )
50
62
os .chdir (build_cmake_dir )
51
63
52
64
INSTALL_PREFIX = os .path .join (dpctl_dir , "install" )
You can’t perform that action at this time.
0 commit comments