aedi: make platform header without subdirectories
This commit is contained in:
parent
beb10abbbb
commit
010af3e93d
|
@ -218,26 +218,23 @@ Cflags: -I${{includedir}} {cflags}
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def make_platform_header(state: BuildState, header: str):
|
def make_platform_header(state: BuildState, header: str):
|
||||||
include_path = state.install_path + os.sep + 'include' + os.sep
|
include_path = state.install_path + os.sep + 'include' + os.sep
|
||||||
include_platform_path = include_path
|
|
||||||
|
|
||||||
header_parts = header.rsplit(os.sep, 1)
|
header_parts = header.rsplit(os.sep, 1)
|
||||||
|
|
||||||
if len(header_parts) == 1:
|
if len(header_parts) == 1:
|
||||||
header_parts.insert(0, '')
|
header_parts.insert(0, '')
|
||||||
|
|
||||||
include_platform_path += header_parts[0] + os.sep + state.architecture()
|
common_header = include_path + header
|
||||||
os.makedirs(include_platform_path, exist_ok=True)
|
platform_header = f'{include_path}{header_parts[0]}/_aedi_{state.architecture()}_{header_parts[1]}'
|
||||||
|
shutil.move(common_header, platform_header)
|
||||||
|
|
||||||
root_header = include_path + header
|
with open(common_header, 'w') as f:
|
||||||
shutil.move(root_header, include_platform_path)
|
|
||||||
|
|
||||||
with open(root_header, 'w') as f:
|
|
||||||
f.write(f'''
|
f.write(f'''
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#if defined(__x86_64__)
|
#if defined(__x86_64__)
|
||||||
# include "x86_64/{header_parts[1]}"
|
# include "_aedi_x86_64_{header_parts[1]}"
|
||||||
#elif defined(__aarch64__)
|
#elif defined(__aarch64__)
|
||||||
# include "arm64/{header_parts[1]}"
|
# include "_aedi_arm64_{header_parts[1]}"
|
||||||
#else
|
#else
|
||||||
# error Unknown architecture
|
# error Unknown architecture
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue