Add support for lib_dirs to gn_to_cmake.py.
The vulcan code uses lib_dirs to point to the libs in the SDK. Change-Id: I4a1a4235b8534f3f937640b10f9758b0c70434c9 Reviewed-on: https://skia-review.googlesource.com/4003 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
This commit is contained in:
parent
2ce47630fe
commit
187a771f59
@ -579,6 +579,10 @@ def WriteTarget(out, target, project):
|
|||||||
# Non-OBJECT library dependencies.
|
# Non-OBJECT library dependencies.
|
||||||
external_libraries = target.properties.get('libs', [])
|
external_libraries = target.properties.get('libs', [])
|
||||||
if target.cmake_type.is_linkable and (external_libraries or libraries):
|
if target.cmake_type.is_linkable and (external_libraries or libraries):
|
||||||
|
library_dirs = target.properties.get('lib_dirs', [])
|
||||||
|
if library_dirs:
|
||||||
|
SetVariableList(out, '${target}__library_directories', library_dirs)
|
||||||
|
|
||||||
system_libraries = []
|
system_libraries = []
|
||||||
for external_library in external_libraries:
|
for external_library in external_libraries:
|
||||||
if '/' in external_library:
|
if '/' in external_library:
|
||||||
@ -586,12 +590,19 @@ def WriteTarget(out, target, project):
|
|||||||
else:
|
else:
|
||||||
if external_library.endswith('.framework'):
|
if external_library.endswith('.framework'):
|
||||||
external_library = external_library[:-len('.framework')]
|
external_library = external_library[:-len('.framework')]
|
||||||
system_library = external_library + '__library'
|
system_library = 'library__' + external_library
|
||||||
|
if library_dirs:
|
||||||
|
system_library = system_library + '__for_${target}'
|
||||||
out.write('find_library("')
|
out.write('find_library("')
|
||||||
out.write(CMakeStringEscape(system_library))
|
out.write(CMakeStringEscape(system_library))
|
||||||
out.write('" "')
|
out.write('" "')
|
||||||
out.write(CMakeStringEscape(external_library))
|
out.write(CMakeStringEscape(external_library))
|
||||||
out.write('")\n')
|
out.write('"')
|
||||||
|
if library_dirs:
|
||||||
|
out.write(' PATHS "')
|
||||||
|
WriteVariable(out, '${target}__library_directories')
|
||||||
|
out.write('"')
|
||||||
|
out.write(')\n')
|
||||||
system_libraries.append(system_library)
|
system_libraries.append(system_library)
|
||||||
out.write('target_link_libraries("${target}"')
|
out.write('target_link_libraries("${target}"')
|
||||||
for library in libraries:
|
for library in libraries:
|
||||||
|
Loading…
Reference in New Issue
Block a user