[odb-users] How generate *-odb. files first
Diego Fernando
lordvampyre at gmail.com
Thu Feb 19 19:05:06 EST 2015
Hi Boris...
Sorry for not having answered before....
This is my .pro
#-------------------------------------------------
#
# Project created by QtCreator 2015-01-27T14:55:16
#
#-------------------------------------------------
QT -= gui
TARGET = DRM
TEMPLATE = lib
DEFINES += DRM_LIBRARY
CONFIG += dll c++14
CONFIG += debug_and_release
DESTDIR += "lib"
LIBS += -L"lib"
CONFIG(debug, debug|release) {
} else {
} # CONFIG(debug, debug|release)
SOURCES += \
src/validator/validatorrct.cpp \
src/validator/validatorsiac.cpp \
src/validator/validatorsial.cpp \
src/validator/validatorsiam.cpp \
src/validator/validatorsiap.cpp \
src/validator/validatorsiba.cpp \
src/validator/validatorsice.cpp \
src/validator/validatorsidf.cpp \
src/validator/validatorsies.cpp \
src/validator/validatorsigo.cpp \
src/validator/validatorsima.cpp \
src/validator/validatorsimg.cpp \
src/validator/validatorsims.cpp \
src/validator/validatorsimt.cpp \
src/validator/validatorsipa.cpp \
src/validator/validatorsipb.cpp \
src/validator/validatorsipe.cpp \
src/validator/validatorsipi.cpp \
src/validator/validatorsipr.cpp \
src/validator/validatorsirj.cpp \
src/validator/validatorsirn.cpp \
src/entity/branch.cpp \
src/entity/city.cpp \
src/entity/country.cpp \
src/entity/paymentform.cpp \
src/entity/employee.cpp \
src/entity/account.cpp \
src/entity/carrier.cpp \
src/entity/supplier.cpp \
src/entity/customer.cpp \
src/entity/cfop.cpp \
src/entity/product.cpp \
src/entity/group.cpp \
src/entity/brand.cpp \
src/entity/chartsaccount.cpp \
src/entity/service.cpp \
src/dao/citydao.cpp
HEADERS +=\
include/drm_global.h \
include/validator/validatorsiac.h \
include/validator/validatorsial.h \
include/validator/validatorsiam.h \
include/validator/validatorsiap.h \
include/validator/validatorsiba.h \
include/validator/validatorsice.h \
include/validator/validatorsidf.h \
include/validator/validatorsies.h \
include/validator/validatorsigo.h \
include/validator/validatorsima.h \
include/validator/validatorsimg.h \
include/validator/validatorsims.h \
include/validator/validatorsimt.h \
include/validator/validatorsipa.h \
include/validator/validatorsipb.h \
include/validator/validatorsipe.h \
include/validator/validatorsipi.h \
include/validator/validatorsipr.h \
include/validator/validatorsirj.h \
include/validator/validatorsirn.h \
include/validator/validatorrct.h \
include/entity/branch.h \
include/entity/city.h \
include/entity/country.h \
include/entity/paymentform.h \
include/entity/employee.h \
include/entity/account.h \
include/entity/carrier.h \
include/entity/cfop.h \
include/entity/customer.h \
include/entity/product.h \
include/entity/supplier.h \
include/entity/group.h \
include/entity/brand.h \
include/entity/chartsaccount.h \
include/entity/service.h \
include/dao/databasehelper.h \
include/dao/icitydao.h \
include/dao/citydao.h
unix {
target.path = /usr/lib
INSTALLS += target
}
# List of header files that should be compiled with the ODB compiler.
#
ODB_FILES +=\
include/entity/city.h \
include/entity/account.h \
include/entity/branch.h \
include/entity/brand.h \
include/entity/carrier.h \
include/entity/cfop.h \
include/entity/chartsaccount.h \
include/entity/country.h \
include/entity/customer.h \
include/entity/employee.h \
include/entity/group.h \
include/entity/paymentform.h \
include/entity/product.h \
include/entity/service.h \
include/entity/supplier.h
# ODB compiler flags.
#
ODB_FLAGS = --database pgsql --profile qt --generate-schema
--generate-query --generate-session --std c++14 --hxx-suffix .h
--schema-format embedded --include-prefix ./include/entity/
--include-regex $$re_escape(%./include/entity/(.+)-odb.h%\1-odb.h%)
--include-regex
$$re_escape(%./include/entity/(.+)-odb.ixx%\1-odb.ixx%)
--include-regex $$re_escape(%../entity/(.+)-odb.h%\1-odb.h%)
# Select the database we are going to use.
#
#DEFINES += DATABASE_PGSQL
# Suppress unknown pragmas GCC warnings.
#
QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CXXFLAGS_WARN_ON -Wno-unknown-pragmas
# Link to the ODB runtime libraries.
#
LIBS += -L"/usr/local/lib"
LIBS += -lodb-pgsql
LIBS += -lodb-qt
LIBS += -lodb
# ODB compilation rules. Normally you don't need to change anything here.
#
# Add the Qt headers directory to the ODB include directory list.
#
ODB_FLAGS += -I$$[QT_INSTALL_HEADERS]
# Newer versions of QtCreator do builds in a separate directory. As a
# result, we need to append the source directory to ODB files.
#
for(dir, ODB_FILES) {
ODB_PWD_FILES += $$PWD/$${dir}
}
odb.name = odb ${QMAKE_FILE_IN}
odb.input = ODB_PWD_FILES
odb.output = ${QMAKE_FILE_BASE}-odb.cxx
odb.commands = odb $$ODB_FLAGS ${QMAKE_FILE_IN}
odb.depends = $$ODB_PWD_FILES
odb.variable_out = SOURCES
odb.clean = ${QMAKE_FILE_BASE}-odb.cxx ${QMAKE_FILE_BASE}-odb.hxx
${QMAKE_FILE_BASE}-odb.ixx ${QMAKE_FILE_BASE}.sql
${QMAKE_FILE_BASE}-odb.h
QMAKE_EXTRA_COMPILERS += odb
odbh.name = odb ${QMAKE_FILE_IN}
odbh.input = ODB_PWD_FILES
odbh.output = ${QMAKE_FILE_BASE}-odb.hxx
odbh.commands = @true
odbh.CONFIG = no_link
odbh.depends = ${QMAKE_FILE_BASE}-odb.cxx
QMAKE_EXTRA_COMPILERS += odbh
It doesn't generate -odb.** first
Thank you
2015-02-10 15:11 GMT-02:00 Boris Kolpackov <boris at codesynthesis.com>:
> Hi Diego,
>
> Diego Fernando <lordvampyre at gmail.com> writes:
>
> > How generate *-odb.* files first in qmake. To compile the project I need
> > comment the code in the dao classes that need the -odb files?
>
> The setup described on the Wiki is supposed to achieve exactly that.
> That is, if the headers have changed, then the -odb files are
> regenerated first before anything else gets compiled. Note though
> that they are not regenerated by qmake but rather by the Makefile
> that it generates.
>
> http://wiki.codesynthesis.com/Using_ODB_with_Qt_Creator_on_Linux
>
> Boris
>
More information about the odb-users
mailing list