automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

QT Plugins, target build order AND BUILT_SOURCES


From: Andre Heine
Subject: QT Plugins, target build order AND BUILT_SOURCES
Date: Thu, 29 Oct 2009 15:02:33 +0100
User-agent: KMail/1.9.5

Hello all,

I've a litte problem to build subproject correctly...

In my Makefile.am are one "bin_programs" and one "lib_LTLIBRARIES".

The plugin is a shared linked library, so that it can loaded into QT's 
designer. The program should test all plugin widgets, features etc...

"bin_programs" has some UI files more, that UI's needed the plugin (.so)

All other source and header files are shared, so all files are in one  
directory...

And that is the problem, the "uic" needs the plugin to load at runtime. The
"uic" will load the plugin via dlopen, so I must build the lib first.

In my Makefile.am I call the "uic" with an extra switch (-L) to add the 
libpath to my shared object:

$(UIC) -L $(top_builddir)/dvplugins/.libs

The "uic" will load the lib and generate some include defines into the qt 
class files. But when uic  can't load the plugin my header is broken;()

Our source are bad organized, because there some file with ".hpp" and some
with ".h". So I must add some extra suffix rules...

When I call "make libCustomPlugin.la && make qplugin" all things works 
correctly. 

"make all" can't build the project...

I had gamble a little with "BUILT_SOURCES", but I can't resolve 
the "cycles"...


Any hints?


Best regards

Andre


System: SuSE 10.2
                autoconf-2.60-21
                automake-1.9.6-35

------------------------ Makefile.am -----------------
AUTOMAKE_OPTIONS = foreign 1.4 gnu

INCLUDES = -I$(top_srcdir)/. -I$(top_srcdir)/src -I$(QTDIR)/include \
        -I$(QTDIR)/mkspecs/linux-g++ -I$(top_srcdir)/../libdvutil/include \
        -I$(top_srcdir)/../libsettings/include/ -I.

MOC      = $(QTDIR)/bin/moc
UIC      = $(QTDIR)/bin/uic

# global DV
ISAMFLAGS = -DREALLY_DB_ONLY -DITOOLS -DDB_ONLY -DLATIN1KONV 
                     -DDVPLUGINS -DDAVIDX

bin_PROGRAMS    = qplugin
lib_LTLIBRARIES = libCustomPlugin.la

DVHEADER  =
DVSOURCE  =
DVXSOURCE =
DVXHEADER =

# only qplugin, it got the dynamic widgets from the plugin
FORMS_TEST      = Test.ui dialogimplform.ui

# all
FORMS           = dialogbase.ui
FORMS_HPP   = consdatum_dlg.ui adt_wizard.ui


MOC_HEADERS     = DialogImpl.h \
                  messagebox.hpp \
                  lineedit.hpp \
                  consdatum_dlg_impl.hpp \
                  datum_le.hpp

SHARED_SRC      = messagebox.cpp DialogImpl.cpp \
                          lineedit.cpp \
                          isam2x_str.cpp \
                          x2isam_str.cpp \
                          setwindow.cpp \
                          custom_event.cpp \
                          consdatum_dlg_impl.cpp \
                          datum_le.cpp

SHARED_INC      = isam2x_str.hpp \
                          x2isam_str.hpp \
                          setwindow.hpp \
                          custom_event.hpp


qplugindir = $(prefix)/include
qplugin_SOURCES         = $(SHARED_SRC)\
                          qplugin.cpp

qplugin_HEADERS         = $(SHARED_INC) $(MOC_HEADERS)


MOCdir = $(prefix)/include
FORMHEADERS     = $(FORMS:.ui=.h) $(FORMS_HPP:.ui=.hpp)
MOC_CC                = $(FORMS:.ui=.moc.cpp) $(MOC_HEADERS:.h=.moc.cpp) \
                    $(MOC_HEADERS:.hpp=.moc.cpp) $(FORMS_HPP:.ui=.moc.cpp)

MOC_CC_QP = $(FORMS_TEST:.ui=.moc.cpp)
UIC_CC_QP   = $(FORMS_TEST:.ui=.uic.cpp)

UIC_CC         = $(FORMS:.ui=.uic.cpp)
UIC_CXX        = $(FORMS_HPP:.ui=.uic.cxx)

nodist_qplugin_SOURCES  = $(UIC_CC) $(MOC_CC) $(UIC_CXX) $(MOC_CC_QP) 
$(UIC_CC_QP)


qplugin_LDFLAGS         = $(all_libraries) 
$(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -lqt-mt \
                         -lqui -lXext -lX11 -lm -lpthread \
                         -ldvutil $(top_builddir)/src/libISAMCore.la \
                         $(BOOST_ROOT)/lib/libboost_regex.a \
                         -export-dynamic
# $(DVSTATICS_ROOT)/lib/libsettings.a

qplugin_LDADD           =
qplugin_CPPFLAGS        = $(ISAMFLAGS)
qplugin_CFLAGS          
= -pipe -Wall  -Wno-write-strings -Wno-parentheses -Werror -O2 \
        -D_REENTRANT  -DQT_THREAD_SUPPORT -DQT_SHARED

qplugin_CXXFLAGS        
= -pipe -Wall  -Wno-write-strings -Wno-parentheses -Werror -O2 \
        -D_REENTRANT  -DQT_THREAD_SUPPORT -DQT_SHARED



# This line ensures that generated moc_*.cpp and resources.cpp files are
# deleted when we make clean.
# CLEANFILES = $(filter moc_%.cpp, $(qplugin_SOURCES))

# This is to ensure the myapp.h file is distributed in your myapp-0.1.tar.gz
# I also have a resources.qrc I need to include. The png is used in myapp.


libCustomPlugin_ladir                   = $(exec_prefix)/include
#libCustomPlugin_la_MOCdir       = $(exec_prefix)/include
libCustomPlugin_la_SOURCES      = $(SHARED_SRC) CustomPlugin.cpp
#dialogbase.moc.cpp dialogbase.uic.cpp
#libCustomPlugin_la_MOC_HEADERS  = DialogImpl.h
libCustomPlugin_la_HEADERS      = $(SHARED_INC) $(MOC_HEADERS) CustomPlugin.h
# dialogbase.h

nodist_libCustomPlugin_la_SOURCES       = $(UIC_CC) $(MOC_CC) $(UIC_CXX)

libCustomPlugin_la_CFLAGS   
= -pipe -Wall -Wno-pointer-sign -Wno-parentheses -Werror -O2 \
        -D_REENTRANT  -DQT_THREAD_SUPPORT -DQT_SHARED
libCustomPlugin_la_CXXFLAGS 
= -pipe -Wall -Wno-write-strings -Wno-parentheses -Werror -O2 \
        -D_REENTRANT  -DQT_THREAD_SUPPORT -DQT_SHARED

#-Wl,-soname,libcustomplugin.so.0 -Wl,-rpath,/home/ahe/david/plugins/widgets

libCustomPlugin_la_CPPFLAGS = $(ISAMFLAGS)
libCustomPlugin_la_LDFLAGS      = $(all_libraries) 
$(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -lqt-mt -lqui -lXext -lX11 -lm 
-lpthread 
\
        -ldvutil $(top_builddir)/src/libISAMCore.la 
$(BOOST_ROOT)/lib/libboost_regex.a \
        -lsettings \
        -module -release 1.0 -version-info 1:1:0 -shared
# -export-dynamic -rdynamic
# -Wl,-rpath,'$$ORIGIN'

libCustomPlugin_la_LIBADD       = -lfbn

# QT specialslibCustomPlugin_la_HEADERSlibCustomPlugin_la_HEADERS
noinst_HEADERS  = $(MOC_HEADERS) $(qplugin_HEADERS) 
$(libCustomPlugin_la_HEADERS)
BUILT_SOURCES   = $(FORMHEADERS) $(UIC_CC) $(MOC_CC) $(UIC_CXX) \
                  $(FORMS_TEST:.ui=.h) $(MOC_CC_QP) $(UIC_CC_QP)
EXTRA_DIST              = $(nodist_qplugin_SOURCES:moc_%.cpp=%.h) $(FORMS) 
$(FORMS_HPP) \
                  $(nodist_libCustomPlugin_la_SOURCES:moc_%.cpp=%.h)
CLEANFILES              = $(BUILT_SOURCES)


#echo "@($@) *($*) <($<) %($%)"
#       echo "cpp@($@) *($*) <($<) %($%) NO("$(nodist_qplugin_SOURCES)")"
.ui.h: $(FORMS)
        $(UIC) -L $(top_builddir)/dvplugins/.libs -o $@ $<

.ui.hpp: $(FORMS_HPP)
        $(UIC) -o $@ $<

.h.moc.cpp:
        $(MOC) -o $@ $<

.hpp.moc.cpp:
        $(MOC) -o $@ $<

# $(FORMS:.ui=.h) $(FORMS_HPP:.ui=.hpp)

.ui.uic.cpp: $(FORMS)
        $(UIC) -o $@ -impl $*.h $(<:.h=.ui)

.ui.uic.cxx: $(FORMS_HPP)
        $(UIC) -o $@ -impl $*.hpp $(<:.hpp=.ui)

SUFFIXES = .h .ui .moc.cpp .uic.cpp .hpp .uic.cxx





-- 
Barometer, n.:
        An ingenious instrument which indicates what kind of weather we
are having.
                -- Ambrose Bierce, "The Devil's Dictionary"




reply via email to

[Prev in Thread] Current Thread [Next in Thread]