Merge branch 'bugfix/build_system_test_fixes_windows' into 'master'

Various fixes for build tests on Windows

See merge request idf/esp-idf!3944
This commit is contained in:
Ivan Grokhotkov
2018-12-14 20:19:51 +08:00
4 changed files with 29 additions and 10 deletions

View File

@@ -18,7 +18,12 @@ endfunction()
# Needed to for include_next includes to work from within mbedtls # Needed to for include_next includes to work from within mbedtls
include_directories("${COMPONENT_PATH}/port/include") include_directories("${COMPONENT_PATH}/port/include")
if(MSYS) # Needed in order to workaround issue with improper conversion to native path
# when building on MSYS2. This ensures that when building on MSYS, Unix style
# paths are used.
set(msystem $ENV{MSYSTEM})
if(MSYS OR msystem)
set(CMAKE_HOST_UNIX 1) set(CMAKE_HOST_UNIX 1)
endif() endif()

View File

@@ -7,17 +7,26 @@ LDGEN_FRAGMENT_FILES = $(COMPONENT_LDFRAGMENTS)
# the components # the components
define ldgen_process_template define ldgen_process_template
$(BUILD_DIR_BASE)/ldgen.section_infos: $(LDGEN_SECTIONS_INFO_FILES) $(IDF_PATH)/make/ldgen.mk $(BUILD_DIR_BASE)/ldgen.section_infos: $(LDGEN_SECTIONS_INFO_FILES) $(IDF_PATH)/make/ldgen.mk
printf "$(foreach section_info,$(LDGEN_SECTIONS_INFO_FILES),$(section_info)\n)" > $(BUILD_DIR_BASE)/ldgen.section_infos
sed -E -i.bak 's|^[[:blank:]]*||g' $(BUILD_DIR_BASE)/ldgen.section_infos
rm $(BUILD_DIR_BASE)/ldgen.section_infos.bak
ifeq ($(OS), Windows_NT) ifeq ($(OS), Windows_NT)
mv $(BUILD_DIR_BASE)/ldgen.section_infos $(BUILD_DIR_BASE)/ldgen.section_infos.temp printf "$(foreach info,$(LDGEN_SECTIONS_INFO_FILES),$(subst \,/,$(shell cygpath -w $(info)))\n)" > $(BUILD_DIR_BASE)/ldgen.section_infos
cygpath -w -f $(BUILD_DIR_BASE)/ldgen.section_infos.temp > $(BUILD_DIR_BASE)/ldgen.section_infos else
rm -f $(BUILD_DIR_BASE)/ldgen.section_infos.temp printf "$(foreach info,$(LDGEN_SECTIONS_INFO_FILES),$(info)\n)" > $(BUILD_DIR_BASE)/ldgen.section_infos
endif endif
$(2): $(1) $(LDGEN_FRAGMENT_FILES) $(SDKCONFIG) $(BUILD_DIR_BASE)/ldgen.section_infos $(2): $(1) $(LDGEN_FRAGMENT_FILES) $(SDKCONFIG) $(BUILD_DIR_BASE)/ldgen.section_infos
@echo 'Generating $(notdir $(2))' @echo 'Generating $(notdir $(2))'
ifeq ($(OS), Windows_NT)
$(PYTHON) $(IDF_PATH)/tools/ldgen/ldgen.py \
--input $(1) \
--config $(SDKCONFIG) \
--fragments $(LDGEN_FRAGMENT_FILES) \
--output $(2) \
--sections $(BUILD_DIR_BASE)/ldgen.section_infos \
--kconfig $(IDF_PATH)/Kconfig \
--env "COMPONENT_KCONFIGS=$(foreach k, $(COMPONENT_KCONFIGS), $(shell cygpath -w $(k)))" \
--env "COMPONENT_KCONFIGS_PROJBUILD=$(foreach k, $(COMPONENT_KCONFIGS_PROJBUILD), $(shell cygpath -w $(k)))" \
--env "IDF_CMAKE=n"
else
$(PYTHON) $(IDF_PATH)/tools/ldgen/ldgen.py \ $(PYTHON) $(IDF_PATH)/tools/ldgen/ldgen.py \
--input $(1) \ --input $(1) \
--config $(SDKCONFIG) \ --config $(SDKCONFIG) \
@@ -28,6 +37,7 @@ $(2): $(1) $(LDGEN_FRAGMENT_FILES) $(SDKCONFIG) $(BUILD_DIR_BASE)/ldgen.section_
--env "COMPONENT_KCONFIGS=$(COMPONENT_KCONFIGS)" \ --env "COMPONENT_KCONFIGS=$(COMPONENT_KCONFIGS)" \
--env "COMPONENT_KCONFIGS_PROJBUILD=$(COMPONENT_KCONFIGS_PROJBUILD)" \ --env "COMPONENT_KCONFIGS_PROJBUILD=$(COMPONENT_KCONFIGS_PROJBUILD)" \
--env "IDF_CMAKE=n" --env "IDF_CMAKE=n"
endif
endef endef
define ldgen_create_commands define ldgen_create_commands

View File

@@ -230,9 +230,9 @@ function run_tests()
print_status "Can build with IDF_PATH unset and inferred by build system" print_status "Can build with IDF_PATH unset and inferred by build system"
clean_build_dir clean_build_dir
sed -i.bak "s%\$ENV{IDF_PATH}%${IDF_PATH}%" CMakeLists.txt # expand to a hardcoded path sed -i.bak "s%\$ENV{IDF_PATH}%\${ci_idf_path}%" CMakeLists.txt # expand to a hardcoded path
(unset IDF_PATH && cd build && (ci_idf_path=${IDF_PATH} && unset IDF_PATH && cd build &&
cmake -G Ninja .. && ninja) || failure "Ninja build failed" cmake -G Ninja -D ci_idf_path=${ci_idf_path} .. && ninja) || failure "Ninja build failed"
mv CMakeLists.txt.bak CMakeLists.txt mv CMakeLists.txt.bak CMakeLists.txt
assert_built ${APP_BINS} ${BOOTLOADER_BINS} ${PARTITION_BIN} assert_built ${APP_BINS} ${BOOTLOADER_BINS} ${PARTITION_BIN}

View File

@@ -118,6 +118,10 @@ def convert_project(project_path):
# Convert components as needed # Convert components as needed
for p in component_paths: for p in component_paths:
if "MSYSTEM" in os.environ:
cmd = ["cygpath", "-w", p]
p = subprocess.check_output(cmd).strip()
convert_component(project_path, p) convert_component(project_path, p)
project_name = project_vars["PROJECT_NAME"] project_name = project_vars["PROJECT_NAME"]