File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 1414try : from fwgslib import get_flags_by_type , get_flags_by_compiler
1515except : from waflib .extras .fwgslib import get_flags_by_type , get_flags_by_compiler
1616from waflib .Configure import conf
17- from waflib import Logs
17+ from waflib import Logs , Utils
1818
1919'''
2020Flags can be overriden and new types can be added
@@ -257,6 +257,20 @@ def get_optimization_flags(conf):
257257 # this port don't have stack printing support
258258 cflags .remove ('-fasynchronous-unwind-tables' )
259259
260+ if conf .env .DEST_CPU == 'riscv' and conf .env .DEST_OS == 'linux' and conf .options .BUILD_TYPE in ['release' , 'fast' ]:
261+ # try to guess better flags, as march=native is not supported in my toolchain yet
262+ # shoddy work, remove later
263+ s = None
264+ for line in Utils .readf ('/proc/cpuinfo' ).splitlines ():
265+ if line .startswith ('uarch' ):
266+ s = line [line .find (':' ) + 2 :]
267+ break
268+ march = None
269+ if s == 'thead,c910' :
270+ march = '-march=rv64gc_xtheadvector'
271+
272+ conf .msg ('Guessed best -march' , march )
273+
260274 if conf .env .COMPILER_CC in ['gcc' , 'clang' ] and conf .options .LIMITED_DEBUGINFO :
261275 # probably not a good idea to do this, but it should save space on Android builds especially
262276 # that are never going to be run under debugger, but we still want that readable fileline
You can’t perform that action at this time.
0 commit comments