init: include the build command in the output
This commit is contained in:
parent
972c6a131b
commit
7233effbba
25
init.py
25
init.py
@ -3,7 +3,7 @@
|
||||
import sys
|
||||
import os
|
||||
import itertools
|
||||
|
||||
import multiprocessing
|
||||
|
||||
OPTIONS = {
|
||||
# compiler
|
||||
@ -11,7 +11,11 @@ OPTIONS = {
|
||||
'clang': {'vars': {'CMAKE_CXX_COMPILER': 'clang++', 'CMAKE_C_COMPILER': 'clang'}},
|
||||
|
||||
# profile
|
||||
'debug': {'vars': {'CMAKE_BUILD_TYPE': 'Debug', 'LTO': 'OFF'}, 'args': ['-G', '"Unix Makefiles"']},
|
||||
'debug': {
|
||||
'vars': {'CMAKE_BUILD_TYPE': 'Debug', 'LTO': 'OFF'},
|
||||
'args': ['-G', '"Unix Makefiles"'],
|
||||
'build': [ "make", f"-j{multiprocessing.cpu_count()}" ],
|
||||
},
|
||||
'release': {'vars': {'CMAKE_BUILD_TYPE': 'Release', 'LTO': 'ON'}},
|
||||
|
||||
# sanitizer
|
||||
@ -22,8 +26,15 @@ OPTIONS = {
|
||||
'tidy': { 'vars': { 'CMAKE_CXX_CLANG_TIDY': ';'.join(['clang-tidy', '--quiet', '-checks=bugprone-*,clang-analyzer-*,performance-*,portability-*,readability-,', '-warnings-as-errors=' ]) } },
|
||||
|
||||
# build tools
|
||||
'make': { 'args': [ '-G', '"Unix Makefiles"' ] },
|
||||
'ninja': { 'args': [ '-G', 'Ninja' ] },
|
||||
'make': {
|
||||
'args': [ '-G', '"Unix Makefiles"' ],
|
||||
'build': [ "make", f"-j{multiprocessing.cpu_count()}" ],
|
||||
},
|
||||
|
||||
'ninja': {
|
||||
'args': [ '-G', 'Ninja' ],
|
||||
'build': [ 'ninja' ]
|
||||
},
|
||||
|
||||
# platforms
|
||||
'mingw': { 'vars': { 'CMAKE_TOOLCHAIN_FILE': os.path.realpath(os.path.join(os.path.dirname(__file__), 'mingw.toolchain')) }, },
|
||||
@ -36,6 +47,8 @@ OPTIONS = {
|
||||
},
|
||||
|
||||
'args': ['-G', 'Ninja'],
|
||||
|
||||
'build': [ 'ninja' ],
|
||||
},
|
||||
}
|
||||
|
||||
@ -63,17 +76,21 @@ if __name__ == '__main__':
|
||||
components += sys.argv[1:]
|
||||
components += itertools.takewhile(lambda x: x in OPTIONS, split_all_path(os.getcwd()))
|
||||
|
||||
build = [ 'true' ]
|
||||
|
||||
for key in components:
|
||||
obj = OPTIONS[key]
|
||||
|
||||
vars = obj.get('vars', {})
|
||||
args = obj.get('args', [])
|
||||
build = obj.get('build', build)
|
||||
|
||||
accumulated += [f'"-D{key}={val}"' for key, val in vars.items()]
|
||||
accumulated += args
|
||||
cmds = [
|
||||
f"cp {os.path.join(self_dir, 'CACHEDIR.tag.in')} CACHEDIR.tag",
|
||||
f"cmake {source_dir} {' '.join(accumulated)}",
|
||||
' '.join(build)
|
||||
]
|
||||
|
||||
print(" && ".join(cmds))
|
||||
|
Loading…
Reference in New Issue
Block a user