qt5: fix parallel build issues related to generated files

Store all files generated by moc and rcc in the application's build
directory to prevent the use of unfinished generated files for other
applications built at the same time.

Issue #3115
This commit is contained in:
Christian Prochaska 2019-01-16 18:14:29 +01:00 committed by Norman Feske
parent e0af049124
commit a155d0e531
2 changed files with 20 additions and 19 deletions

View File

@ -35,20 +35,7 @@ QT_DEFINES += -D__GENODE__
CC_OPT += $(QT_DEFINES)
SOURCES_FILTERED = $(filter-out $(SOURCES_FILTER_OUT), $(SOURCES))
HEADERS_FILTERED = $(filter-out $(HEADERS_FILTER_OUT), $(HEADERS))
# add sources defined in qmake project files
SRC_CC += $(SOURCES_FILTERED)
# handle moc-headers, resources and ui descriptions
$(addsuffix .o,$(basename $(SRC_CC))): $(addprefix ui_,$(FORMS:.ui=.h))
SRC_CC_QT_GENERATED = $(join $(dir $(HEADERS_FILTERED)),$(addprefix moc_,$(notdir $(HEADERS_FILTERED:.h=.cpp)))) \
$(join $(dir $(RESOURCES)),$(addprefix qrc_,$(notdir $(RESOURCES:.qrc=.cpp))))
.SECONDARY: $(SRC_CC_QT_GENERATED)
SRC_CC += $(SRC_CC_QT_GENERATED)
#
# Locations of moc, rcc, and uic binaries
@ -104,10 +91,4 @@ ifneq ($(filter arm,$(SPECS)),)
QT_DEFINES += -DQT_ARCH_ARMV6
endif
# remove generated files in clean rules
clean cleanall: clean_rule
clean_rule:
$(VERBOSE)$(RM) -f $(SRC_CC_QT_GENERATED)
$(VERBOSE)$(RM) -f $(SOURCES_FILTERED:.cpp=.moc)
$(VERBOSE)$(RM) -f $(addprefix ui_,$(FORMS:.ui=.h))
endif

View File

@ -1,5 +1,25 @@
INC_DIR += $(PRG_DIR)
SOURCES_FILTERED = $(filter-out $(SOURCES_FILTER_OUT), $(SOURCES))
HEADERS_FILTERED = $(filter-out $(HEADERS_FILTER_OUT), $(HEADERS))
# add sources defined in qmake project files
SRC_CC += $(SOURCES_FILTERED)
# add generated sources
SRC_CC_QT_GENERATED = $(addprefix moc_,$(notdir $(HEADERS_FILTERED:.h=.cpp))) \
$(addprefix qrc_,$(notdir $(RESOURCES:.qrc=.cpp)))
SRC_CC += $(SRC_CC_QT_GENERATED)
# handle relative paths in the 'HEADERS' variable
vpath %.h $(abspath $(addprefix $(PRG_DIR)/,$(sort $(dir $(HEADERS_FILTERED)))))
# handle relative paths in the 'RESOURCES' variable
vpath %.qrc $(abspath $(addprefix $(PRG_DIR)/,$(sort $(dir $(RESOURCES)))))
$(addsuffix .o,$(basename $(SRC_CC))): $(addprefix ui_,$(FORMS:.ui=.h))
LIBS += libc base
# QtCore