Skip to content

Commit 31541ae

Browse files
committed
scons 严格模式
1 parent 4a23d32 commit 31541ae

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

tools/ci/bsp_buildings.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,11 @@ def build_bsp_cmake(bsp, scons_args=''):
104104
rm -rf packages
105105
106106
"""
107-
if scons_args != '':
107+
ext_flags = ''
108+
if scons_args == "--strict":
109+
print("scons using strict mode, build it with `-Werror` flag")
110+
ext_flags += '-DCMAKE_COMPILE_WARNING_AS_ERROR'
111+
elif scons_args != '':
108112
print("this project would be built regularly because `scons_args` is not empty")
109113
return build_bsp(bsp, scons_args)
110114
success = True
@@ -122,7 +126,7 @@ def build_bsp_cmake(bsp, scons_args=''):
122126
run_cmd('scons --target=cmake')
123127
os.mkdir(f'{rtt_root}/bsp/{bsp}/cmake-build')
124128
os.chdir(f'{rtt_root}/bsp/{bsp}/cmake-build')
125-
run_cmd('cmake .. -G Ninja')
129+
run_cmd(f'cmake {ext_flags} .. -G Ninja')
126130
_, res = run_cmd(f'ninja -j{nproc}')
127131

128132
if res != 0:
@@ -222,16 +226,6 @@ def build_bsp_attachconfig(bsp, attach_file):
222226
rtt_root = os.getcwd()
223227
srtt_bsp = os.getenv('SRTT_BSP').split(',')
224228
build_tool = os.getenv('RTT_BUILD_TOOL')
225-
226-
os.system("which cmake")
227-
os.system("cmake --version")
228-
os.system("cmake --help")
229-
os.system("which ninja")
230-
os.system("ninja --version")
231-
232-
subprocess.run(['cmake', '--version'])
233-
subprocess.run(['cmake', '--help'])
234-
subprocess.run(['ninja', '--version'])
235229

236230
for bsp in srtt_bsp:
237231
count += 1

0 commit comments

Comments
 (0)