init: use emit CMAKE_TOOLCHAIN_FILE rather than compile names

This commit is contained in:
Danny Robson 2024-05-16 10:47:35 +10:00
parent 1cf517309b
commit 5fe431b8da

25
init.py
View File

@ -48,16 +48,16 @@ def merge_option(a: Option, b: Option) -> Option:
###############################################################################
OPTIONS['gcc'] = Option(
vars={
'CMAKE_CXX_COMPILER': 'g++',
'CMAKE_C_COMPILER': 'gcc'
#'CMAKE_CXX_COMPILER': 'g++',
#'CMAKE_C_COMPILER': 'gcc'
},
compiler='gcc',
)
OPTIONS['clang'] = Option(
vars={
'CMAKE_CXX_COMPILER': f'clang++',
'CMAKE_C_COMPILER': f'clang',
#'CMAKE_CXX_COMPILER': f'clang++',
#'CMAKE_C_COMPILER': f'clang',
#'CMAKE_CXX_FLAGS': '-fuse-ld=lld',
},
compiler='clang',
@ -143,10 +143,10 @@ OPTIONS['ninja'] = Option(
# -----------------------------------------------------------------------------
OPTIONS['mingw'] = Option(
vars={
'CMAKE_TOOLCHAIN_FILE': os.path.join(
os.path.dirname(__file__),
'cmake', 'toolchain', 'mingw'
)
# 'CMAKE_TOOLCHAIN_FILE': os.path.join(
# os.path.dirname(__file__),
# 'cmake', 'toolchain', 'mingw'
# )
},
compiler='gcc',
platform='mingw',
@ -156,10 +156,10 @@ OPTIONS['mingw'] = Option(
# -----------------------------------------------------------------------------
OPTIONS['pi3'] = Option(
vars={
'CMAKE_TOOLCHAIN_FILE': os.path.join(
os.path.dirname(__file__),
'cmake', 'toolchain', 'armv7a-gcc'
)
# 'CMAKE_TOOLCHAIN_FILE': os.path.join(
# os.path.dirname(__file__),
# 'cmake', 'toolchain', 'armv7a-gcc'
# )
},
arch="armv7",
compiler='gcc',
@ -227,6 +227,7 @@ if __name__ == '__main__':
accum = merge_option(accum, OPTIONS[i])
accumulated = [f'"-D{key}={val}"' for key, val in accum.vars.items()] + accum.args
accumulated.append('-DCMAKE_TOOLCHAIN_FILE=./conan_toolchain.cmake')
conan_build_profile = '-'.join([
'x86_64',