Changeset 1675 in kBuild
- Timestamp:
- Jul 11, 2008 2:03:20 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kBuild/units/qt4.kmk
r1671 r1675 28 28 29 29 # Add our target properties. 30 PROPS_SINGLE += MOCTOOL UICTOOL RCCTOOL31 PROPS_ACCUMULATE_R += MOCDEFS MOCFLAGS UICFLAGS RCCFLAGS 30 PROPS_SINGLE += QTTOOL MOCTOOL UICTOOL RCCTOOL LRCTOOL QT_TRANSLATIONS_INST QT_TRANSLATIONS_TEMPLATE 31 PROPS_ACCUMULATE_R += MOCDEFS MOCFLAGS UICFLAGS RCCFLAGS LRCFLAGS QT_TRANSLATIONS QT_MOCSRCS QT_MOCHDRS 32 32 33 33 … … 63 63 TOOL_QT4_UIC ?= $(PATH_TOOL_QT4_BIN)/uic$(HOST_SUFF_EXE) 64 64 TOOL_QT4_RCC ?= $(PATH_TOOL_QT4_BIN)/rcc$(HOST_SUFF_EXE) 65 TOOL_QT4_LRC ?= $(PATH_TOOL_QT4_BIN)/lrelease$(HOST_SUFF_EXE) 65 66 TOOL_QT4_LUPDATE ?= $(PATH_TOOL_QT4_BIN)/lupdate$(HOST_SUFF_EXE) 66 TOOL_QT4_LRELEASE ?= $(PATH_TOOL_QT4_BIN)/lrelease$(HOST_SUFF_EXE)67 67 else 68 68 # Pathless, relies on the environment. … … 70 70 TOOL_QT4_UIC ?= uic$(HOST_SUFF_EXE) 71 71 TOOL_QT4_RCC ?= rcc$(HOST_SUFF_EXE) 72 TOOL_QT4_LRC ?= lrelease$(HOST_SUFF_EXE) 72 73 TOOL_QT4_LUPDATE ?= lupdate$(HOST_SUFF_EXE) 73 TOOL_QT4_LRELEASE ?= lrelease$(HOST_SUFF_EXE)74 74 endif 75 75 … … 190 190 endef 191 191 192 ## Compile a Qt translation file (.ts). 193 # @param $(target) Normalized main target name. 194 # @param $(source) Source filename (relative). 195 # @param $(out) Object file name. This shall be (re)created by the compilation. 196 # @param $(dep) Dependcy file. This may be (re)created by the compilation. 197 # @param $(flags) Flags. 198 # @param $(defs) Definitions. 199 # @param $(incs) Includes. 200 # @param $(outbase) Output basename (full). Use this for list files and such. 201 # 202 TOOL_QT4_LRC_TS_DEPEND = 203 TOOL_QT4_LRC_TS_DEPORD = 204 TOOL_QT4_LRC_TS_OUTPUT = 205 TOOL_QT4_LRC_TS_OUTPUT_MAYBE = 206 define TOOL_QT4_LRC_TS_CMDS 207 $(QUIET)$(TOOL_QT4_LRC)\ 208 $(flags)\ 209 $(source)\ 210 -qm $(out) 211 endef 212 192 213 193 214 … … 199 220 200 221 201 ## 202 # Source handler for .ts sources (translations). 203 # 204 # @remarks $(evalvalctx me). 205 define def_unit_qt4_src_handler_ts 206 $(warning def_unit_qt4_src_handler_ts: $(source)) 207 ## @todo not quite sure about this bugger, perhaps the translations doesn't really belong here... 208 endef 222 ## wrapper for the lrelease (LRC) command dependencies. 223 ifndef NO_COMPILE_CMDS_DEPS 224 _UNIT_QT_LRC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT_LRC_CMDS_PREV_),$$(commands $(out)),FORCE) 225 else 226 _UNIT_QT_LRC_CMDS_DEP = 227 endif 228 229 ## 230 # def_unit_qt4_target_pre_handle_translation helper that is expanded before evaluation. 231 # 232 # This is necessary to resolve reference to local variables before doing 233 # assignments and setting up commands. They would otherwise be resolved 234 # later in a different context and the result would be completely wrong. 235 # 236 define def_unit_qt4_target_pre_handle_translation_dx 237 238 $(out) + $(more_output) +| $(maybe_output): \ 239 $(deps) \ 240 $(value _UNIT_QT_LRC_CMDS_DEP) \ 241 | \ 242 $(orderdeps) 243 %$$(call MSG_TOOL,lrelease,$(target),$(source),$$@) 244 $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep) 245 246 $(cmds) 247 248 ifndef NO_COMPILE_CMDS_DEPS 249 %$$(QUIET2)$$(APPEND) '$(dep)' 250 %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT_LRC_CMDS_PREV_' 251 %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)' 252 %$$(QUIET2)$$(APPEND) '$(dep)' 'endef' 253 endif 254 255 $(target)_OUT_FILES += $(out) $(more_output) $(maybe_output) 256 $(target)-inst-nls_SOURCES += $(out) 257 258 endef # def_unit_qt4_target_pre_handle_translation_dx 259 260 ## 261 # Handle a source file listed in QT_TRANSLATIONS. 262 # 263 # The files listed in QT_TRANSLATIONS are translation files (.ts) which needs 264 # to be translated into .qm files that are loadble by Qt. 265 # 266 # @remarks Invoked via $(evalvalctx ). 267 define def_unit_qt4_target_pre_handle_translation 268 local type := LRC 269 270 # fetch the properties. 271 local tool := $(kb-src-tool dummy_var) 272 local qtnlsdir := $(PATH_$(target))/qtnls 273 local outbase := $(qtnlsdir)/$(notdir $(basename $(source))) 274 local out := $(outbase).qm 275 local dep := $(out).dep 276 local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left) 277 local deps := $(kb-src-prop DEPS,dummy_var,left-to-right) 278 local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right) 279 280 # default path + source dep. 281 ifneq ($(defpath),) 282 local deps := $(abspathex $(deps) $(source),$($(target)_PATH)) 283 local incs := $(abspathex $(incs),$($(target)_PATH)) 284 else 285 local deps += $(source) 286 endif 287 288 # call the tool 289 ifndef TOOL_$(tool)_LRC_TS_CMDS 290 $(error kBuild: qt lrelease tool not found: TOOL_$(tool)_LRC_TS_CMDS) 291 endif 292 local cmds := $(TOOL_$(tool)_LRC_TS_CMDS) 293 local more_output := $(TOOL_$(tool)_LRC_TS_OUTPUT) 294 local maybe_output := $(TOOL_$(tool)_LRC_TS_OUTPUT_MAYBE) 295 local deps += $(TOOL_$(tool)_LRC_TS_DEPEND) 296 local orderdeps += $(TOOL_$(tool)_LRC_TS_DEPORD) 297 298 # generate the link rule and update some source and target variables. 299 ifndef NO_COMPILE_CMDS_DEPS 300 $(eval includedep $(dep)) 301 endif 302 $(eval $(def_unit_qt4_target_pre_handle_translation_dx)) 303 304 endef # def_unit_qt4_target_pre_handle_translation 305 209 306 210 307 … … 294 391 295 392 393 296 394 ## wrapper for the UIC command dependencies. 297 395 ifndef NO_COMPILE_CMDS_DEPS … … 302 400 303 401 ## 304 # def_unit_qt4_ target_pre_handle_uic_ui helper that is expanded before evaluation.402 # def_unit_qt4_src_handler_ui helper that is expanded before evaluation. 305 403 # 306 404 # This is necessary to resolve reference to local variables before doing … … 378 476 379 477 478 380 479 ## wrapper for the MOC command dependencies. 381 480 ifndef NO_COMPILE_CMDS_DEPS … … 419 518 420 519 ## 421 # Handle a source file listed in QT_MOCSRCS. 422 # 423 # The files listed in QT_MOCSRCS uses the Q_OBJECT macro and will include 424 # a .moc file that we're expected to generate here. 520 # Handle a source file listed in QT_MOCHDRSS. 521 # 522 # The files listed in QT_MOCHDRS uses the Q_OBJECT macro and we will 523 # generate a .cpp file for each of them and add it to the generated 524 # sources so that it's compiled and linked. (There is an alternative 525 # way to do this where the .cpp file is included, this isn't currently 526 # supported by this unit.) 425 527 # 426 528 # @remarks Invoked via $(evalvalctx ). … … 569 671 define def_unit_qt4_target_pre 570 672 673 # Make QTTOOL the default for the specific Qt tools instead of TOOL. 674 ifneq ($($(target)_QTTOOL),) 675 ifeq ($($(target)_MOCTOOL),) 676 $($(target)_MOCTOOL := $($(target)_QTTOOL) 677 endif 678 ifeq ($($(target)_UICTOOL),) 679 $($(target)_UICTOOL := $($(target)_QTTOOL) 680 endif 681 ifeq ($($(target)_RCCTOOL),) 682 $($(target)_RCCTOOL := $($(target)_QTTOOL) 683 endif 684 ifeq ($($(target)_LRCTOOL),) 685 $($(target)_LRCTOOL := $($(target)_QTTOOL) 686 endif 687 endif 688 571 689 # Autodetect source files with Q_OBJECT references if QT_MOCSRCS is undefined. (slow) 572 690 # Tip: Use target_QT_MOCSRCS = $(NO_SUCH_VARIABLE) to avoid this. … … 587 705 .UI:def_unit_qt4_src_handler_ui \ 588 706 .qrc:def_unit_qt4_src_handler_qrc \ 589 .qrc:def_unit_qt4_src_handler_qrc \ 590 .ts:def_unit_qt4_src_handler_ts \ 591 .TS:def_unit_qt4_src_handler_ts 707 .qrc:def_unit_qt4_src_handler_qrc 592 708 593 709 # Calc the MOC and UI output directories and add them to BLDDIRS and INCS. … … 595 711 local qtuicdir := $(PATH_$(target))/qtuic 596 712 local qtrccdir := $(PATH_$(target))/qtrcc 597 $(eval $(target)_BLDDIRS += $(qtmocdir) $(qtuicdir) $(qtrccdir)) 598 $(eval $(target)_INCS += $(qtmocdir) $(qtuicdir) $(qtrccdir)) 713 local qtnlsdir := $(PATH_$(target))/qtnls 714 $(eval $(target)_BLDDIRS += $(qtmocdir) $(qtuicdir) $(qtrccdir) $(qtnlsdir)) 715 $(eval $(target)_INCS += $(qtmocdir) $(qtuicdir)) 599 716 600 717 # Deal with QT_MOCSRCS. … … 618 735 , $(evalvalctx def_unit_qt4_target_pre_handle_moc_hdr)) 619 736 737 # Deal with QT_TRANSLATIONS. 738 # ASSUMES (_ALL_)INSTALLS is processed after the targets using this unit. 739 local translations := \ 740 $($(target)_QT_TRANSLATIONS.$(_bld_trg)) \ 741 $($(target)_QT_TRANSLATIONS.$(_bld_trg_arch)) \ 742 $($(target)_QT_TRANSLATIONS.$(_bld_trg).$(_bld_trg_arch)) \ 743 $($(target)_QT_TRANSLATIONS.$(_bld_trg_cpu)) \ 744 $($(target)_QT_TRANSLATIONS.$(_bld_type)) \ 745 $($(target)_QT_TRANSLATIONS) 746 ifneq ($(strip $(translations)),) 747 local expr := _ALL_INSTALLS += $(target)-inst-nls 748 $(eval $(expr)) 749 ifdef $(target)_QT_TRANSLATIONS_TEMPLATE 750 $(target)-inst-nls_TEMPLATE := $($(target)_QT_TRANSLATIONS_TEMPLATE) 751 endif 752 ifdef $(target)_QT_TRANSLATIONS_INST 753 $(target)-inst-nls_INST := $($(target)_QT_TRANSLATIONS_INST) 754 endif 755 $(target)-inst-nls_SOURCES := 756 $(foreach source, $(translations)\ 757 , $(evalvalctx def_unit_qt4_target_pre_handle_translation)) 758 endif 759 620 760 endef # def_unit_qt4_target_pre 621 761
Note:
See TracChangeset
for help on using the changeset viewer.