|
47 | 47 | DefaultEnvironment,
|
48 | 48 | )
|
49 | 49 |
|
| 50 | +from platformio.builder.tools.piolib import ProjectAsLibBuilder |
50 | 51 | from platformio.fs import to_unix_path
|
51 | 52 | from platformio.proc import exec_command, where_is_program
|
52 | 53 | from platformio.util import get_systype
|
|
93 | 94 | CMAKE_API_REPLY_PATH = join(".cmake", "api", "v1", "reply")
|
94 | 95 |
|
95 | 96 |
|
| 97 | +def get_project_lib_includes(env): |
| 98 | + project = ProjectAsLibBuilder(env, "$PROJECT_DIR") |
| 99 | + project.search_deps_recursive() |
| 100 | + |
| 101 | + paths = [] |
| 102 | + for lb in env.GetLibBuilders(): |
| 103 | + if not lb.dependent: |
| 104 | + continue |
| 105 | + lb.env.PrependUnique(CPPPATH=lb.get_include_dirs()) |
| 106 | + paths.extend(lb.env["CPPPATH"]) |
| 107 | + |
| 108 | + DefaultEnvironment().Replace(__PIO_LIB_BUILDERS=None) |
| 109 | + |
| 110 | + return paths |
| 111 | + |
| 112 | + |
96 | 113 | def is_cmake_reconfigure_required(cmake_api_reply_dir):
|
97 | 114 | cmake_cache_file = join(BUILD_DIR, "CMakeCache.txt")
|
98 | 115 | cmake_txt_file = join(env.subst("$PROJECT_DIR"), "CMakeLists.txt")
|
@@ -875,13 +892,12 @@ def find_default_component(target_configs):
|
875 | 892 | env.Depends(project_ld_scipt, component_config["lib"])
|
876 | 893 |
|
877 | 894 | project_config = target_configs.get(project_target_name, {})
|
878 |
| -project_includes = get_app_includes(project_config) |
879 | 895 | default_config = target_configs.get(default_config_name, {})
|
880 | 896 | project_defines = get_app_defines(project_config)
|
881 | 897 | project_flags = get_app_flags(project_config, default_config)
|
882 | 898 | link_args = extract_link_args(elf_config)
|
883 |
| - |
884 | 899 | app_includes = get_app_includes(elf_config)
|
| 900 | +project_lib_includes = get_project_lib_includes(env) |
885 | 901 |
|
886 | 902 | #
|
887 | 903 | # Compile bootloader
|
@@ -951,8 +967,11 @@ def _skip_prj_source_files(node):
|
951 | 967 | # https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/build-system.html#rename-main
|
952 | 968 | project_env.AppendUnique(CPPPATH=app_includes["plain_includes"])
|
953 | 969 |
|
954 |
| -# Add default include dirs to global CPPPATH so they're visible to PIOBUILDFILES |
955 |
| -envsafe.Append(CPPPATH=["$PROJECT_INCLUDE_DIR", "$PROJECT_SRC_DIR"]) |
| 970 | + # Add include dirs from PlatformIO build system to project CPPPATH so |
| 971 | + # they're visible to PIOBUILDFILES |
| 972 | + project_env.Append( |
| 973 | + CPPPATH=["$PROJECT_INCLUDE_DIR", "$PROJECT_SRC_DIR"] + project_lib_includes |
| 974 | + ) |
956 | 975 |
|
957 | 976 | env.Append(
|
958 | 977 | PIOBUILDFILES=compile_source_files(
|
|
0 commit comments