Use install dir instead of project root for build stamp file. Otherwise only one version will be built.

This commit is contained in:
Patrick 2023-08-06 14:07:30 +02:00
parent d1c48fbd8a
commit d5bfa0ee80

View File

@ -11,7 +11,7 @@ def cook(env: Environment, project_root: str, generate_args: 'list[str]' = [], b
config = env['BUILD_TYPE']
build_dir = os.path.join(project_root, f'build_{config}')
install_dir = os.path.join(project_root, f'install_{config}')
is_built = os.path.exists(os.path.join(project_root, _BUILT_STAMPFILE))
is_built = os.path.exists(os.path.join(install_dir, _BUILT_STAMPFILE))
if not is_built or env['UPDATE_REPOSITORIES']:
print(f'Building {project_root}, config {config}')
os.makedirs(build_dir, exist_ok=True)
@ -24,7 +24,7 @@ def cook(env: Environment, project_root: str, generate_args: 'list[str]' = [], b
subprocess.run(('cmake', '-G', 'Ninja', '-B', build_dir, f'-DCMAKE_BUILD_TYPE={build_type}', f'-DCMAKE_INSTALL_PREFIX={install_dir}', *generate_args, project_root), stdout=sys.stdout, stderr=sys.stderr, check=True)
subprocess.run(('cmake', '--build', *build_args, build_dir), stdout=sys.stdout, stderr=sys.stderr, check=True)
subprocess.run(('cmake', '--install', *install_args, build_dir), stdout=sys.stdout, stderr=sys.stderr, check=True)
pathlib.Path(project_root, _BUILT_STAMPFILE).touch()
pathlib.Path(install_dir, _BUILT_STAMPFILE).touch()
return {
'LIBPATH': [os.path.join(install_dir, 'lib')],