Commit f31e3814 authored by Max Kellermann's avatar Max Kellermann Committed by Max Kellermann

python/build/cmake.py: some ccache support

parent 02316221
......@@ -2,6 +2,15 @@ import subprocess
from build.project import Project
def __cmake_compiler_args(language, compiler):
s = compiler.split(' ', 1)
result = []
if len(s) == 2:
result.append(f'-DCMAKE_{language}_COMPILER_LAUNCHER={s[0]}')
compiler = s[1]
result.append(f'-DCMAKE_{language}_COMPILER={compiler}')
return result
def configure(toolchain, src, build, args=()):
cross_args = []
......@@ -15,10 +24,10 @@ def configure(toolchain, src, build, args=()):
'-DCMAKE_INSTALL_PREFIX=' + toolchain.install_prefix,
'-DCMAKE_BUILD_TYPE=release',
'-DCMAKE_C_COMPILER=' + toolchain.cc,
'-DCMAKE_CXX_COMPILER=' + toolchain.cxx,
] + \
__cmake_compiler_args('C', toolchain.cc) + \
__cmake_compiler_args('CXX', toolchain.cxx) + \
[
'-DCMAKE_C_FLAGS=' + toolchain.cflags + ' ' + toolchain.cppflags,
'-DCMAKE_CXX_FLAGS=' + toolchain.cxxflags + ' ' + toolchain.cppflags,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment