|
|
|
@ -93,8 +93,6 @@ target_type_map = { |
|
|
|
|
'INTERFACE_LIBRARY': 'header_only' |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
target_type_requires_trace = ['INTERFACE_LIBRARY'] |
|
|
|
|
|
|
|
|
|
skip_targets = ['UTILITY'] |
|
|
|
|
|
|
|
|
|
blacklist_compiler_flags = [ |
|
|
|
@ -152,6 +150,8 @@ class ConverterTarget: |
|
|
|
|
self.install_dir = '' |
|
|
|
|
self.link_libraries = target.link_libraries |
|
|
|
|
self.link_flags = target.link_flags + target.link_lang_flags |
|
|
|
|
self.depends_raw = [] |
|
|
|
|
self.depends = [] |
|
|
|
|
|
|
|
|
|
if target.install_paths: |
|
|
|
|
self.install_dir = target.install_paths[0] |
|
|
|
@ -227,16 +227,18 @@ class ConverterTarget: |
|
|
|
|
self.pie = True |
|
|
|
|
|
|
|
|
|
# Use the CMake trace, if required |
|
|
|
|
if self.type.upper() in target_type_requires_trace: |
|
|
|
|
if self.cmake_name in trace.targets: |
|
|
|
|
props = trace.targets[self.cmake_name].properties |
|
|
|
|
tgt = trace.targets.get(self.cmake_name) |
|
|
|
|
if tgt: |
|
|
|
|
self.depends_raw = trace.targets[self.cmake_name].depends |
|
|
|
|
if self.type.upper() == 'INTERFACE_LIBRARY': |
|
|
|
|
props = tgt.properties |
|
|
|
|
|
|
|
|
|
self.includes += props.get('INTERFACE_INCLUDE_DIRECTORIES', []) |
|
|
|
|
self.public_compile_opts += props.get('INTERFACE_COMPILE_DEFINITIONS', []) |
|
|
|
|
self.public_compile_opts += props.get('INTERFACE_COMPILE_OPTIONS', []) |
|
|
|
|
self.link_flags += props.get('INTERFACE_LINK_OPTIONS', []) |
|
|
|
|
else: |
|
|
|
|
mlog.warning('CMake: Target', mlog.bold(self.cmake_name), 'not found in CMake trace. This can lead to build errors') |
|
|
|
|
elif self.type.upper() not in ['EXECUTABLE', 'OBJECT_LIBRARY']: |
|
|
|
|
mlog.warning('CMake: Target', mlog.bold(self.cmake_name), 'not found in CMake trace. This can lead to build errors') |
|
|
|
|
|
|
|
|
|
# Fix link libraries |
|
|
|
|
def try_resolve_link_with(path: str) -> Optional[str]: |
|
|
|
@ -337,6 +339,11 @@ class ConverterTarget: |
|
|
|
|
self.link_libraries = [x for x in self.link_libraries if x.lower() not in blacklist_link_libs] |
|
|
|
|
self.link_flags = [x for x in self.link_flags if check_flag(x)] |
|
|
|
|
|
|
|
|
|
for i in self.depends_raw: |
|
|
|
|
tgt = output_target_map.get(_target_key(i)) |
|
|
|
|
if tgt: |
|
|
|
|
self.depends.append(tgt) |
|
|
|
|
|
|
|
|
|
def process_object_libs(self, obj_target_list: List['ConverterTarget']): |
|
|
|
|
# Try to detect the object library(s) from the generated input sources |
|
|
|
|
temp = [x for x in self.generated if isinstance(x, str)] |
|
|
|
@ -841,6 +848,7 @@ class CMakeInterpreter: |
|
|
|
|
generated = [] |
|
|
|
|
generated_filenames = [] |
|
|
|
|
custom_targets = [] |
|
|
|
|
dependencies = [] |
|
|
|
|
for i in tgt.link_with: |
|
|
|
|
assert(isinstance(i, ConverterTarget)) |
|
|
|
|
if i.name not in processed: |
|
|
|
@ -851,6 +859,12 @@ class CMakeInterpreter: |
|
|
|
|
if i.name not in processed: |
|
|
|
|
process_target(i) |
|
|
|
|
objec_libs += [extract_tgt(i)] |
|
|
|
|
for i in tgt.depends: |
|
|
|
|
if not isinstance(i, ConverterCustomTarget): |
|
|
|
|
continue |
|
|
|
|
if i.name not in processed: |
|
|
|
|
process_custom_target(i) |
|
|
|
|
dependencies += [extract_tgt(i)] |
|
|
|
|
|
|
|
|
|
# Generate the source list and handle generated sources |
|
|
|
|
for i in tgt.sources + tgt.generated: |
|
|
|
@ -920,6 +934,9 @@ class CMakeInterpreter: |
|
|
|
|
'include_directories': id_node(inc_var), |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if dependencies: |
|
|
|
|
generated += dependencies |
|
|
|
|
|
|
|
|
|
# Generate the function nodes |
|
|
|
|
dir_node = assign(dir_var, function('include_directories', tgt.includes)) |
|
|
|
|
sys_node = assign(sys_var, function('include_directories', tgt.sys_includes, {'is_system': True})) |
|
|
|
@ -959,6 +976,10 @@ class CMakeInterpreter: |
|
|
|
|
if x.name not in processed: |
|
|
|
|
process_target(x) |
|
|
|
|
return extract_tgt(x) |
|
|
|
|
if isinstance(x, ConverterCustomTarget): |
|
|
|
|
if x.name not in processed: |
|
|
|
|
process_custom_target(x) |
|
|
|
|
return extract_tgt(x) |
|
|
|
|
elif isinstance(x, CustomTargetReference): |
|
|
|
|
if x.ctgt.name not in processed: |
|
|
|
|
process_custom_target(x.ctgt) |
|
|
|
|