@@ -58,7 +58,8 @@ def create_cmake_script(
58
58
cmake_commands ,
59
59
include_dirs = [],
60
60
cmake_prefix = None ,
61
- is_debug_mode = True ):
61
+ is_debug_mode = True ,
62
+ ext_build_dirs = []):
62
63
"""Constructs CMake script to be passed to cc_external_rule_impl.
63
64
64
65
Args:
@@ -81,12 +82,13 @@ def create_cmake_script(
81
82
include_dirs: Optional additional include directories. Defaults to [].
82
83
cmake_prefix: Optional prefix before the cmake command (without the trailing space).
83
84
is_debug_mode: If the compilation mode is `debug`. Defaults to True.
85
+ ext_build_dirs: A list of gen_dirs for each foreign_cc dep.
84
86
85
87
Returns:
86
88
list: Lines of bash which make up the build script
87
89
"""
88
90
89
- merged_prefix_path = _merge_prefix_path (user_cache , include_dirs )
91
+ merged_prefix_path = _merge_prefix_path (user_cache , include_dirs , ext_build_dirs )
90
92
91
93
toolchain_dict = _fill_crossfile_from_toolchain (workspace_name , tools , flags )
92
94
params = None
@@ -171,9 +173,12 @@ def _wipe_empty_values(cache, keys_with_empty_values_in_user_cache):
171
173
cache .pop (key )
172
174
173
175
# From CMake documentation: ;-list of directories specifying installation prefixes to be searched...
174
- def _merge_prefix_path (user_cache , include_dirs ):
176
+ def _merge_prefix_path (user_cache , include_dirs , ext_build_dirs ):
175
177
user_prefix = user_cache .get ("CMAKE_PREFIX_PATH" )
176
178
values = ["$$EXT_BUILD_DEPS$$" ] + include_dirs
179
+ for ext_dir in ext_build_dirs :
180
+ values .append ("$$EXT_BUILD_DEPS$$/{}" .format (ext_dir .basename ))
181
+
177
182
if user_prefix != None :
178
183
# remove it, it is gonna be merged specifically
179
184
user_cache .pop ("CMAKE_PREFIX_PATH" )
0 commit comments