@@ -58,7 +58,8 @@ def create_cmake_script(
5858 cmake_commands ,
5959 include_dirs = [],
6060 cmake_prefix = None ,
61- is_debug_mode = True ):
61+ is_debug_mode = True ,
62+ ext_build_dirs = []):
6263 """Constructs CMake script to be passed to cc_external_rule_impl.
6364
6465 Args:
@@ -81,12 +82,13 @@ def create_cmake_script(
8182 include_dirs: Optional additional include directories. Defaults to [].
8283 cmake_prefix: Optional prefix before the cmake command (without the trailing space).
8384 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.
8486
8587 Returns:
8688 list: Lines of bash which make up the build script
8789 """
8890
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 )
9092
9193 toolchain_dict = _fill_crossfile_from_toolchain (workspace_name , tools , flags )
9294 params = None
@@ -171,9 +173,12 @@ def _wipe_empty_values(cache, keys_with_empty_values_in_user_cache):
171173 cache .pop (key )
172174
173175# 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 ):
175177 user_prefix = user_cache .get ("CMAKE_PREFIX_PATH" )
176178 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+
177182 if user_prefix != None :
178183 # remove it, it is gonna be merged specifically
179184 user_cache .pop ("CMAKE_PREFIX_PATH" )
0 commit comments