@@ -93,10 +93,16 @@ def run(
93
93
help = "Set the compilation mode to debugging" ,
94
94
)
95
95
driver .add_argument (
96
- "--compiler-root" , type = str , help = "Path to compiler home directory"
96
+ "--compiler-root" ,
97
+ type = str ,
98
+ help = "Path to compiler home directory" ,
99
+ default = None ,
97
100
)
98
101
driver .add_argument (
99
- "--cmake-executable" , type = str , help = "Path to cmake executable"
102
+ "--cmake-executable" ,
103
+ type = str ,
104
+ help = "Path to cmake executable" ,
105
+ default = None ,
100
106
)
101
107
driver .add_argument (
102
108
"--no-level-zero" ,
@@ -112,26 +118,47 @@ def run(
112
118
)
113
119
args = parser .parse_args ()
114
120
115
- if args .oneapi :
121
+ args_to_validate = [
122
+ "c_compiler" ,
123
+ "cxx_compiler" ,
124
+ "compiler_root" ,
125
+ ]
126
+
127
+ if args .oneapi or (
128
+ args .c_compiler is None
129
+ and args .cxx_compiler is None
130
+ and args .compiler_root is None
131
+ ):
116
132
args .c_compiler = "icx"
117
133
args .cxx_compiler = "icpx" if "linux" in sys .platform else "icx"
118
134
args .compiler_root = None
119
135
else :
136
+ cr = args .compiler_root
137
+ if isinstance (cr , str ) and os .path .exists (cr ):
138
+ if args .c_compiler is None :
139
+ args .c_compiler = "icx"
140
+ if args .cxx_compiler is None :
141
+ args .cxx_compiler = "icpx" if "linux" in sys .platform else "icx"
142
+ else :
143
+ raise RuntimeError (
144
+ "Option 'compiler-root' must be provided when "
145
+ "using non-default DPC++ layout."
146
+ )
120
147
args_to_validate = [
121
148
"c_compiler" ,
122
149
"cxx_compiler" ,
123
- "compiler_root" ,
124
150
]
125
151
for p in args_to_validate :
126
- arg = getattr (args , p , None )
127
- if not isinstance (arg , str ):
128
- opt_name = p .replace ("_" , "-" )
129
- raise RuntimeError (
130
- f"Option { opt_name } must be provided is "
131
- "using non-default DPC++ layout"
132
- )
152
+ arg = getattr (args , p )
153
+ assert isinstance (arg , str )
133
154
if not os .path .exists (arg ):
134
- raise RuntimeError (f"Path { arg } must exist" )
155
+ arg2 = os .path .join (cr , arg )
156
+ if os .path .exists (arg2 ):
157
+ arg = arg2
158
+ setattr (args , p , arg )
159
+ if not os .path .exists (arg ):
160
+ opt_name = p .replace ("_" , "-" )
161
+ raise RuntimeError (f"Option { opt_name } value { arg } must exist." )
135
162
136
163
run (
137
164
use_oneapi = args .oneapi ,
0 commit comments