Thought about a Qt port
Thiago Macieira
thiago at macieira.org
Sat Mar 30 15:11:55 PDT 2013
On sábado, 30 de março de 2013 23.25.35, Alberto Mardegan wrote:
> Here's how I'd do it:
> https://github.com/mardy/subsurface/commit/407e8e831f6b75d4d27a54224b1429f72
> dcab586
>
> We require the developer to have the Qt bin/ directory in the path, and
> then we ask qmake about the Qt version; depending on that, we pick
> different pkg-config modules (it may be that more things will have to
> end up in that if/else switch, in the future).
Great. You'll need to query QtCore for "reduce_relocations":
ifneq ($(shell $(PKGCONFIG) --variable qt_config $(QTCORE) | grep
reduce_relocations), )
CXXFLAGS += -fPIE
endif
(In a Linux section -- this doesn't apply to Mac and Windows)
Also, we should probably prepare to use QtNetwork too, so you'll have at least
two Qt modules.
> >> Adding basic C++ and Qt support to the Makefile isn't difficult. Adding
> >> support for Qt resource files is also trivial, if that feature is ever
> >> needed. Support for moc and uic can be done, but without a good
> >> dependency scanner, subsurface will have to obey some strict rules about
> >> where the #includes can be placed for the generated files. Or manually
> >> adjust the Makefile to declare the dependencies.
>
> Thiago, I would simply go for declaring the dependencies in the
> Makefile. Something like:
>
> OBJS = main.o ... qt-class.o qt-class.moc.o
>
> and then have a rule
>
> %.moc.cpp: %.h
> @echo ' MOC' $<
> @$(MOC) $< -o $@
You need to add the -D and -I flags here too. You can use gmake's filter
function:
MOCFLAGS = $(filter -I%, $(CXXFLAGS)) $(filter -D%, $(CXXFLAGS))
> (I didn't try this, but it should work)
Yup, it should work for moc, but not for uic. You'll need something like:
%.ui.h: %.ui
@echo ' UIC' $<
@$(UIC) $< -o $@
And then the manual dependencies elsewhere:
foo.o: foo.ui.h
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Software Architect - Intel Open Source Technology Center
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20130330/11449fe2/attachment.sig>
More information about the subsurface
mailing list