Comments in qmake scripts. Broken installation on macx.

--HG--
branch : develop
This commit is contained in:
dismine 2014-10-27 16:29:31 +02:00
parent f1a38431fa
commit ebfe0b4fc3
11 changed files with 887 additions and 614 deletions

View File

@ -40,9 +40,70 @@ defineTest(copyToDestdir) {
export(QMAKE_POST_LINK)
}
# We use precompiled headers for more fast compilation source code.
defineReplace(set_PCH){
macx:clang*{
# Precompiled headers don't work with clang on macx.
} else {
CONFIG += precompile_header # Turn on creation precompiled headers (PCH).
export(CONFIG) # export value to global variable.
GCC_CXXFLAGS += \
-O0 \
PRECOMPILED_HEADER = stable.h # Header file with all all static headers: libraries, static local headers.
export(PRECOMPILED_HEADER) # export value to global variable
win32-msvc* {
PRECOMPILED_SOURCE = stable.cpp # MSVC need also cpp file.
export(PRECOMPILED_SOURCE) # export value to global variable.
}
}
return(true)
}
defineReplace(enable_ccache){
# ccache support only Unix systems.
unix {
# This need for turn on ccache.
*-g++{
QMAKE_CC = ccache gcc
export(QMAKE_CC) # export value to global variable.
QMAKE_CXX = ccache g++
export(QMAKE_CXX) # export value to global variable.
}
clang*{
QMAKE_CC = ccache clang
export(QMAKE_CC) # export value to global variable.
QMAKE_CXX = ccache clang++
export(QMAKE_CXX) # export value to global variable.
}
}
return(true)
}
# Default prefix. Use for creation install path.
DEFAULT_PREFIX = /usr
# In debug mode on Unix system we use all usefull for us compilers keys for checking errors.
# Also trying make all possible for speed up build time.
unix {
# Key -isystem disable checking errors in system headers. Mark ignore warnings Qt headers.
ISYSTEM += \
-isystem "$$[QT_INSTALL_HEADERS]" \
-isystem "$$[QT_INSTALL_HEADERS]/QtWidgets" \
-isystem "$$[QT_INSTALL_HEADERS]/QtXml" \
-isystem "$$[QT_INSTALL_HEADERS]/QtGui" \
-isystem "$$[QT_INSTALL_HEADERS]/QtXmlPatterns" \
-isystem "$$[QT_INSTALL_HEADERS]/QtCore"
# Usefull GCC warnings keys.
GCC_DEBUG_CXXFLAGS += \
-O0 \ # Turn off oprimization.
$$ISYSTEM \ # Ignore warnings Qt headers.
# Last gdb doesn't show debug symbols with Qt Creator (issue with Python 3 and debug scripts that use Python 2.7).
# Solution to use older version gdb, that's why we use old standard of debug information.
-gdwarf-3 \
-Wall \
-Wextra \
-pedantic \
@ -80,11 +141,15 @@ GCC_CXXFLAGS += \
-Wstrict-overflow=5 \
-Wundef \
-Wno-unused \
-gdwarf-3 \
-ftrapv
CLANG_CXXFLAGS += \
-O0 \
# Usefull Clang warnings keys.
CLANG_DEBUG_CXXFLAGS += \
-O0 \ # Turn off oprimization.
$$ISYSTEM \ # Ignore warnings Qt headers.
# Last gdb doesn't show debug symbols with Qt Creator (issue with Python 3 and debug scripts that use Python 2.7).
# Solution to use older version gdb, that's why we use old standard of debug information.
-gdwarf-3 \
-fparse-all-comments \
-Wabi \
-Wabstract-final-class \
@ -452,3 +517,18 @@ CLANG_CXXFLAGS += \
-Wzero-length-array \
-Qunused-arguments \
-fcolor-diagnostics
} else {
# Don't use additional GCC and Clang keys on Windows system.
# Can't find way mark ignore Qt header on Windows.
GCC_DEBUG_CXXFLAGS += \
-O0 \
-Wall \
-Wextra \
-pedantic \
CLANG_DEBUG_CXXFLAGS += \
-O0 \
-Wall \
-Wextra \
-pedantic \
}

View File

@ -1,6 +1,6 @@
include(Valentina.pri)
#version check qt
#Check if Qt version >= 5.0.2
!minQtVersion(5, 0, 2) {
message("Cannot build Valentina with Qt version $${QT_VERSION}.")
error("Use at least Qt 5.0.2.")

BIN
dist/Valentina.icns vendored Normal file

Binary file not shown.

View File

@ -4,36 +4,43 @@
#
#-------------------------------------------------
# Use out-of-source builds (shadow builds)
# Compilation main binary file
# File with common stuff for whole project
include(../../Valentina.pri)
# Here we don't see "network" library, but, i think, "printsupport" depend on this library, so we still need this
# library in installer.
QT += core gui widgets xml svg printsupport xmlpatterns
# We want create executable file
TEMPLATE = app
# Name of binary file
TARGET = valentina
# Use out-of-source builds (shadow builds)
CONFIG -= debug_and_release debug_and_release_target
# We use C++11 standard
CONFIG += c++11
#DEFINES += ...
# directory for executable file
# Directory for executable file
DESTDIR = bin
# files created moc
# Directory for files created moc
MOC_DIR = moc
# objecs files
# Directory for objecs files
OBJECTS_DIR = obj
# files created rcc
# Directory for files created rcc
RCC_DIR = rcc
# files created uic
# Directory for files created uic
UI_DIR = uic
# Suport subdirectories. Just better project code tree.
include(container/container.pri)
include(dialogs/dialogs.pri)
include(exception/exception.pri)
@ -45,8 +52,10 @@ include(undocommands/undocommands.pri)
include(visualization/visualization.pri)
include(core/core.pri)
# This include path help promoute VMainGraphicsView on main window. Without it compiler can't find path to custom view
INCLUDEPATH += "$${PWD}/widgets"
# Some source files
SOURCES += \
main.cpp \
mainwindow.cpp \
@ -55,6 +64,7 @@ SOURCES += \
version.cpp \
options.cpp
# Some header files
HEADERS += \
mainwindow.h \
options.h \
@ -62,21 +72,30 @@ HEADERS += \
stable.h \
version.h
# Main forms
FORMS += \
mainwindow.ui \
tablewindow.ui
# Resource files. This files will be included in binary.
RESOURCES += \
share/resources/icon.qrc \
share/resources/cursor.qrc \
share/resources/theme.qrc \
share/resources/schema.qrc \
share/resources/measurements.qrc
share/resources/icon.qrc \ # All other icons except cursors and Windows theme.
share/resources/cursor.qrc \ # Tools cursor icons.
share/resources/theme.qrc \ # Windows theme icons.
share/resources/schema.qrc \ # Schemas for validation xml files.
share/resources/measurements.qrc # For measurements files that we save as resource.
# Compilation will fail without this files after we added them to this section.
OTHER_FILES += \
share/resources/valentina.rc \
share/resources/icon/64x64/icon64x64.ico
share/resources/valentina.rc \ # For Windows system.
share/resources/icon/64x64/icon64x64.ico # Valentina's logo.
# Add here path to new translation file with name "valentina_*_*.ts" if you want to add new language.
# Same paths in variable INSTALL_TRANSLATIONS.
# File valentina.ts we use in transifex.com. It is empty translation file only with english inside. transifex.com use
# this file like base for new language. Don't add path to valentina.ts to INSTALL_TRANSLATIONS variable.
# When adding a translation here, also add it in the macx part.
TRANSLATIONS += share/translations/valentina.ts \
share/translations/valentina_ru_RU.ts \
share/translations/valentina_uk_UA.ts \
@ -87,59 +106,35 @@ TRANSLATIONS += share/translations/valentina.ts \
share/translations/valentina_it_IT.ts \
share/translations/valentina_nl_NL.ts
unix {
*-g++{
QMAKE_CC = ccache gcc
QMAKE_CXX = ccache g++
}
clang*{
QMAKE_CC = ccache clang
QMAKE_CXX = ccache clang++
}
}
# Set using ccache. Function enable_ccache() defined in Valentina.pri.
$$enable_ccache()
unix:!macx:!clang*{
CONFIG += precompile_header
# Precompiled headers (PCH)
PRECOMPILED_HEADER = stable.h
win32-msvc* {
PRECOMPILED_SOURCE = stable.cpp
}
}
# Set precompiled headers. Function set_PCH() defined in Valentina.pri.
$$set_PCH()
CONFIG(debug, debug|release){
# Debug
# Debug mode
unix {
#Turn on compilers warnings.
*-g++{
QMAKE_CXXFLAGS += \
-isystem "$$[QT_INSTALL_HEADERS]" \
-isystem "$$[QT_INSTALL_HEADERS]/QtWidgets" \
-isystem "$$[QT_INSTALL_HEADERS]/QtXml" \
-isystem "$$[QT_INSTALL_HEADERS]/QtGui" \
-isystem "$$[QT_INSTALL_HEADERS]/QtXmlPatterns" \
-isystem "$$[QT_INSTALL_HEADERS]/QtCore" \
# Key -isystem disable checking errors in system headers.
-isystem "$${OUT_PWD}/$${UI_DIR}" \
-isystem "$${OUT_PWD}/$${MOC_DIR}" \
-isystem "$${OUT_PWD}/$${RCC_DIR}" \
$$GCC_CXXFLAGS
$$GCC_DEBUG_CXXFLAGS # See Valentina.pri for more details.
}
#Turn on Clang warnings
clang*{
QMAKE_CXXFLAGS += \
-isystem "$$[QT_INSTALL_HEADERS]" \
-isystem "$$[QT_INSTALL_HEADERS]/QtWidgets" \
-isystem "$$[QT_INSTALL_HEADERS]/QtXml" \
-isystem "$$[QT_INSTALL_HEADERS]/QtGui" \
-isystem "$$[QT_INSTALL_HEADERS]/QtCore" \
-isystem "$$[QT_INSTALL_HEADERS]/QtXmlPatterns" \
# Key -isystem disable checking errors in system headers.
-isystem "$${OUT_PWD}/$${UI_DIR}" \
-isystem "$${OUT_PWD}/$${MOC_DIR}" \
-isystem "$${OUT_PWD}/$${RCC_DIR}" \
$$CLANG_CXXFLAGS
$$CLANG_DEBUG_CXXFLAGS # See Valentina.pri for more details.
}
} else {
*-g++{#Don't use additional GCC keys on Windows system.
QMAKE_CXXFLAGS += -O0 -Wall -Wextra -pedantic
*-g++{
QMAKE_CXXFLAGS += $$GCC_DEBUG_CXXFLAGS # See Valentina.pri for more details.
}
}
@ -147,19 +142,22 @@ CONFIG(debug, debug|release){
#precompiled headers file.
DEFINES += "LOC_REV=0"
}else{
# Release
# Release mode
DEFINES += QT_NO_DEBUG_OUTPUT
unix:!macx:QMAKE_CXXFLAGS_RELEASE += -g
# Turn on debug symbols in release mode on Unix systems.
# On Mac OS X temporarily disabled. Need find way how to strip binary file.
unix:!macx:QMAKE_CXXFLAGS_RELEASE += -g -gdwarf-3
#local revision number for using in version
HG_REV=$$system(hg parents --template '{rev}')
isEmpty(HG_REV){
HG_REV = 0
HG_REV = 0 # if we can't find local revision left 0.
}
DEFINES += "LOC_REV=$${HG_REV}"
DEFINES += "LOC_REV=$${HG_REV}" # Make available local revision number in sources.
}
# Some extra information about Qt. Can be usefull.
message(Qt version: $$[QT_VERSION])
message(Qt is installed in $$[QT_INSTALL_PREFIX])
message(Qt resources can be found in the following locations:)
@ -173,9 +171,20 @@ message(Translation files: $$[QT_INSTALL_TRANSLATIONS])
message(Settings: $$[QT_INSTALL_SETTINGS])
message(Examples: $$[QT_INSTALL_EXAMPLES])
# Path to recource file.
win32:RC_FILE = share/resources/valentina.rc
INSTALL_TRANSLATIONS += \
# Set "make install" command for Unix-like systems.
unix{
isEmpty(PREFIX){
PREFIX = $$DEFAULT_PREFIX
}
# Prefix for binary file.
unix:!macx{
# Add to this variable all translation files that you want install with program.
# For generation *.qm file first you need create *.ts. See section TRANSLATIONS.
INSTALL_TRANSLATIONS += \
share/translations/valentina_ru_RU.qm \
share/translations/valentina_uk_UA.qm \
share/translations/valentina_de_DE.qm \
@ -185,37 +194,129 @@ INSTALL_TRANSLATIONS += \
share/translations/valentina_it_IT.qm \
share/translations/valentina_nl_NL.qm
INSTALL_STANDARD_MEASHUREMENTS += share/resources/tables/standard/GOST_man_ru.vst
# Keep path to all files with standard measurements we support right now
INSTALL_STANDARD_MEASHUREMENTS += share/resources/tables/standard/GOST_man_ru.vst
unix {
#VARIABLES
isEmpty(PREFIX) {
PREFIX = /usr
}
DATADIR =$$PREFIX/share
DEFINES += DATADIR=\\\"$$DATADIR\\\" PKGDATADIR=\\\"$$PKGDATADIR\\\"
#MAKE INSTALL
unix:!macx{
target.path = $$PREFIX/bin
}else{
target.path = $$PREFIX/
}
desktop.path = $$DATADIR/applications/
desktop.files += ../../dist/$${TARGET}.desktop
pixmaps.path = $$DATADIR/pixmaps/
pixmaps.files += ../../dist/$${TARGET}.png
translations.path = $$DATADIR/$${TARGET}/translations/
translations.files = $$INSTALL_TRANSLATIONS
standard.path = $$DATADIR/$${TARGET}/tables/standard/
standard.files = $$INSTALL_STANDARD_MEASHUREMENTS
INSTALLS += \
DATADIR =$$PREFIX/share
DEFINES += DATADIR=\\\"$$DATADIR\\\" PKGDATADIR=\\\"$$PKGDATADIR\\\"
# Path to bin file after installation
target.path = $$PREFIX/bin
# .desctop file
desktop.path = $$DATADIR/applications/
desktop.files += ../../dist/$${TARGET}.desktop
# logo
pixmaps.path = $$DATADIR/pixmaps/
pixmaps.files += ../../dist/$${TARGET}.png
# Path to translation files after installation
translations.path = $$DATADIR/$${TARGET}/translations/
translations.files = $$INSTALL_TRANSLATIONS
# Path to standard measurement after installation
standard.path = $$DATADIR/$${TARGET}/tables/standard/
standard.files = $$INSTALL_STANDARD_MEASHUREMENTS
INSTALLS += \
target \
desktop \
pixmaps \
translations \
standard
}
}else{
# Some macx stuff
QMAKE_MAC_SDK = "/Developer/SDKs/MacOSX10.6.sdk"
QMAKE_MACOSX_DEPLOYMENT_TARGET = "10.5"
# Path to resources in app bundle
RESOURCES_DIR = "Contents/Resources"
# On macx we will use app bundle. Bundle doesn't need bin directory inside.
# See issue #166: Creating OSX Homebrew (Mac OS X package manager) formula.
target.path = $$PREFIX/
# Copy in bundle translation files.
exists(share/translations/valentina_ru_RU.qm){
TRANSLATION_ru_RU.files += \
share/translations/valentina_ru_RU.qm \
share/translations/Localizable.strings
TRANSLATION_ru_RU.path = "$$RESOURCES_DIR/translations/ru_RU.lproj"
QMAKE_BUNDLE_DATA += TRANSLATION_ru_RU
}
exists(share/translations/valentina_uk_UA.qm){
TRANSLATION_uk_UA.files += \
share/translations/valentina_uk_UA.qm \
share/translations/Localizable.strings
TRANSLATION_uk_UA.path = "$$RESOURCES_DIR/translations/uk_UA.lproj"
QMAKE_BUNDLE_DATA += TRANSLATION_uk_UA
}
exists(share/translations/valentina_de_DE.qm){
TRANSLATION_de_DE.files += \
share/translations/valentina_de_DE.qm \
share/translations/Localizable.strings
TRANSLATION_de_DE.path = "$$RESOURCES_DIR/translations/de_DE.lproj"
QMAKE_BUNDLE_DATA += TRANSLATION_de_DE
}
exists(share/translations/valentina_cs_CZ.qm){
TRANSLATION_cs_CZ.files += \
share/translations/valentina_cs_CZ.qm \
share/translations/Localizable.strings
TRANSLATION_cs_CZ.path = "$$RESOURCES_DIR/translations/cs_CZ.lproj"
QMAKE_BUNDLE_DATA += TRANSLATION_cs_CZ
}
exists(share/translations/valentina_he_IL.qm){
TRANSLATION_he_IL.files += \
share/translations/valentina_he_IL.qm \
share/translations/Localizable.strings
TRANSLATION_he_IL.path = "$$RESOURCES_DIR/translations/he_IL.lproj"
QMAKE_BUNDLE_DATA += TRANSLATION_he_IL
}
exists(share/translations/valentina_fr_FR.qm){
TRANSLATION_fr_FR.files += \
share/translations/valentina_fr_FR.qm \
share/translations/Localizable.strings
TRANSLATION_fr_FR.path = "$$RESOURCES_DIR/translations/fr_FR.lproj"
QMAKE_BUNDLE_DATA += TRANSLATION_fr_FR
}
exists(share/translations/valentina_it_IT.qm){
TRANSLATION_it_IT.files += \
share/translations/valentina_it_IT.qm \
share/translations/Localizable.strings
TRANSLATION_it_IT.path = "$$RESOURCES_DIR/translations/it_IT.lproj"
QMAKE_BUNDLE_DATA += TRANSLATION_it_IT
}
exists(share/translations/valentina_nl_NL.qm){
TRANSLATION_nl_NL.files += \
share/translations/valentina_nl_NL.qm \
share/translations/Localizable.strings
TRANSLATION_nl_NL.path = "$$RESOURCES_DIR/translations/nl_NL.lproj"
QMAKE_BUNDLE_DATA += TRANSLATION_nl_NL
}
# logo on macx.
icon.files = "Valentina.icns"
icon.path = $$RESOURCES_DIR
# Copy to bundle standard measurements files
standard.path = $$RESOURCES_DIR/tables/standard/
standard.files = $$INSTALL_STANDARD_MEASHUREMENTS
QMAKE_BUNDLE_DATA += \
standard \
icons \
}
# Run generation *.qm file for available *.ts files each time you run qmake.
!isEmpty(TRANSLATIONS): {
for(_translation_name, TRANSLATIONS) {
_translation_name_qm = $$section(_translation_name,".", 0, 0).qm
@ -230,6 +331,7 @@ for(DIR, INSTALL_TRANSLATIONS) {
tr_path += $${PWD}/$$DIR
}
# Make possible run program even you do not install it. Seek files in local directory.
copyToDestdir($$tr_path, $$shell_path($${OUT_PWD}/$$DESTDIR/translations))
for(DIR, INSTALL_STANDARD_MEASHUREMENTS) {
@ -240,6 +342,7 @@ for(DIR, INSTALL_STANDARD_MEASHUREMENTS) {
copyToDestdir($$st_path, $$shell_path($${OUT_PWD}/$$DESTDIR/tables/standard))
# QMuParser library
win32:CONFIG(release, debug|release): LIBS += -L$${OUT_PWD}/../libs/qmuparser/$${DESTDIR} -lqmuparser2
else:win32:CONFIG(debug, debug|release): LIBS += -L$${OUT_PWD}/../libs/qmuparser/$${DESTDIR} -lqmuparser2
else:unix: LIBS += -L$${OUT_PWD}/../libs/qmuparser/$${DESTDIR} -lqmuparser
@ -247,6 +350,7 @@ else:unix: LIBS += -L$${OUT_PWD}/../libs/qmuparser/$${DESTDIR} -lqmuparser
INCLUDEPATH += $${PWD}/../libs/qmuparser
DEPENDPATH += $${PWD}/../libs/qmuparser
# VPropertyExplorer library
win32:CONFIG(release, debug|release): LIBS += -L$${OUT_PWD}/../libs/vpropertyexplorer/$${DESTDIR} -lvpropertyexplorer
else:win32:CONFIG(debug, debug|release): LIBS += -L$${OUT_PWD}/../libs/vpropertyexplorer/$${DESTDIR} -lvpropertyexplorer
else:unix: LIBS += -L$${OUT_PWD}/../libs/vpropertyexplorer/$${DESTDIR} -lvpropertyexplorer
@ -254,9 +358,10 @@ else:unix: LIBS += -L$${OUT_PWD}/../libs/vpropertyexplorer/$${DESTDIR} -lvproper
INCLUDEPATH += $${PWD}/../libs/vpropertyexplorer
DEPENDPATH += $${PWD}/../libs/vpropertyexplorer
# Strip after you link all libaries.
CONFIG(release, debug|release){
unix:!macx{
# On Linux
# Strip debug symbols.
QMAKE_POST_LINK += objcopy --only-keep-debug $(TARGET) $(TARGET).debug &&
QMAKE_POST_LINK += strip --strip-debug --strip-unneeded $(TARGET) &&
QMAKE_POST_LINK += objcopy --add-gnu-debuglink $(TARGET).debug $(TARGET)

View File

@ -0,0 +1 @@
/* Intentionally empty */

View File

@ -4,12 +4,22 @@
#
#-------------------------------------------------
# File with common stuff for whole project
include(../../../Valentina.pri)
# We don't need gui library.
QT -= gui
# Name of library
TARGET = qmuparser
# We want create library
TEMPLATE = lib
# Use out-of-source builds (shadow builds)
CONFIG -= debug_and_release debug_and_release_target
# We use C++11 standard
CONFIG += c++11
DEFINES += QMUPARSER_LIBRARY
@ -49,73 +59,56 @@ HEADERS += \
VERSION = 2.2.4
unix {
isEmpty(PREFIX) {
PREFIX = /usr/lib
# Set "make install" command for Unix-like systems.
unix{
isEmpty(PREFIX){
PREFIX = $$DEFAULT_PREFIX/lib
}
}
unix:!macx{
target.path = $$PREFIX/lib
INSTALLS += target
*-g++{
QMAKE_CC = ccache gcc
QMAKE_CXX = ccache g++
}
clang*{
QMAKE_CC = ccache clang
QMAKE_CXX = ccache clang++
}
}
unix:!macx:!clang*{
CONFIG += precompile_header
# Precompiled headers (PCH)
PRECOMPILED_HEADER = stable.h
win32-msvc* {
PRECOMPILED_SOURCE = stable.cpp
}
}
# Set using ccache. Function enable_ccache() defined in Valentina.pri.
$$enable_ccache()
include(../../../Valentina.pri)
# Set precompiled headers. Function set_PCH() defined in Valentina.pri.
$$set_PCH()
CONFIG(debug, debug|release){
# Debug
# Debug mode
unix {
#Turn on compilers warnings.
*-g++{
QMAKE_CXXFLAGS += \
-isystem "$$[QT_INSTALL_HEADERS]" \
-isystem "$$[QT_INSTALL_HEADERS]/QtWidgets" \
-isystem "$$[QT_INSTALL_HEADERS]/QtXml" \
-isystem "$$[QT_INSTALL_HEADERS]/QtGui" \
-isystem "$$[QT_INSTALL_HEADERS]/QtXmlPatterns" \
-isystem "$$[QT_INSTALL_HEADERS]/QtCore" \
# Key -isystem disable checking errors in system headers.
-isystem "$${OUT_PWD}/$${MOC_DIR}" \
$$GCC_CXXFLAGS
$$GCC_DEBUG_CXXFLAGS # See Valentina.pri for more details.
}
#Turn on Clang warnings
clang*{
QMAKE_CXXFLAGS += \
-isystem "/usr/include/qt5" \
-isystem "/usr/include/qt5/QtWidgets" \
-isystem "/usr/include/qt5/QtXml" \
-isystem "/usr/include/qt5/QtGui" \
-isystem "/usr/include/qt5/QtCore" \
-isystem "/usr/include/qt5/QtXmlPatterns" \
# Key -isystem disable checking errors in system headers.
-isystem "$${OUT_PWD}/$${MOC_DIR}" \
$$CLANG_CXXFLAGS
$$CLANG_DEBUG_CXXFLAGS # See Valentina.pri for more details.
}
} else {
*-g++{#Don't use additional GCC keys on Windows system.
QMAKE_CXXFLAGS += -O0 -Wall -Wextra -pedantic
*-g++{
QMAKE_CXXFLAGS += $$GCC_DEBUG_CXXFLAGS # See Valentina.pri for more details.
}
}
}else{
# Release
# Release mode
DEFINES += QT_NO_DEBUG_OUTPUT
unix:!macx:QMAKE_CXXFLAGS_RELEASE += -g
unix:!macx{
# On Linux
# Turn on debug symbols in release mode on Unix systems.
# On Mac OS X temporarily disabled. TODO: find way how to strip binary file.
QMAKE_CXXFLAGS_RELEASE += -g -gdwarf-3
# Strip debug symbols.
QMAKE_POST_LINK += objcopy --only-keep-debug $(DESTDIR)/$(TARGET) $(DESTDIR)/$(TARGET).debug &&
QMAKE_POST_LINK += strip --strip-debug --strip-unneeded $(DESTDIR)/$(TARGET) &&
QMAKE_POST_LINK += objcopy --add-gnu-debuglink $(DESTDIR)/$(TARGET).debug $(DESTDIR)/$(TARGET)

View File

@ -4,13 +4,22 @@
#
#-------------------------------------------------
# File with common stuff for whole project
include(../../../Valentina.pri)
# Library use widgets
QT += widgets
# We don't need gui library.
QT -= gui
# Name of library
TARGET = vpropertyexplorer
# We want create library
TEMPLATE = lib
# We use C++11 standard
CONFIG += c++11
DEFINES += VPROPERTYEXPLORER_LIBRARY
@ -92,72 +101,54 @@ HEADERS +=\
vproperties.h \
stable.h
unix {
isEmpty(PREFIX) {
PREFIX = /usr/lib
# Set "make install" command for Unix-like systems.
unix{
isEmpty(PREFIX){
PREFIX = $$DEFAULT_PREFIX/lib
}
}
unix:!macx{
target.path = $$PREFIX/lib
INSTALLS += target
*-g++{
QMAKE_CC = ccache gcc
QMAKE_CXX = ccache g++
}
clang*{
QMAKE_CC = ccache clang
QMAKE_CXX = ccache clang++
}
}
unix:!macx:!clang*{
CONFIG += precompile_header
# Precompiled headers (PCH)
PRECOMPILED_HEADER = stable.h
win32-msvc* {
PRECOMPILED_SOURCE = stable.cpp
}
}
# Set using ccache. Function enable_ccache() defined in Valentina.pri.
$$enable_ccache()
include(../../../Valentina.pri)
# Set precompiled headers. Function set_PCH() defined in Valentina.pri.
$$set_PCH()
CONFIG(debug, debug|release){
# Debug
# Debug mode
unix {
#Turn on compilers warnings.
*-g++{
QMAKE_CXXFLAGS += \
-isystem "$$[QT_INSTALL_HEADERS]" \
-isystem "$$[QT_INSTALL_HEADERS]/QtWidgets" \
-isystem "$$[QT_INSTALL_HEADERS]/QtXml" \
-isystem "$$[QT_INSTALL_HEADERS]/QtGui" \
-isystem "$$[QT_INSTALL_HEADERS]/QtXmlPatterns" \
-isystem "$$[QT_INSTALL_HEADERS]/QtCore" \
# Key -isystem disable checking errors in system headers.
-isystem "$${OUT_PWD}/$${MOC_DIR}" \
$$GCC_CXXFLAGS
$$GCC_DEBUG_CXXFLAGS # See Valentina.pri for more details.
}
#Turn on Clang warnings
clang*{
QMAKE_CXXFLAGS += \
-isystem "$$[QT_INSTALL_HEADERS]" \
-isystem "$$[QT_INSTALL_HEADERS]/QtWidgets" \
-isystem "$$[QT_INSTALL_HEADERS]/QtXml" \
-isystem "$$[QT_INSTALL_HEADERS]/QtGui" \
-isystem "$$[QT_INSTALL_HEADERS]/QtCore" \
-isystem "$$[QT_INSTALL_HEADERS]/QtXmlPatterns" \
# Key -isystem disable checking errors in system headers.
-isystem "$${OUT_PWD}/$${MOC_DIR}" \
$$CLANG_CXXFLAGS
$$CLANG_DEBUG_CXXFLAGS # See Valentina.pri for more details.
}
} else {
*-g++{#Don't use additional GCC keys on Windows system.
QMAKE_CXXFLAGS += -O0 -Wall -Wextra -pedantic
*-g++{
QMAKE_CXXFLAGS += $$CLANG_DEBUG_CXXFLAGS # See Valentina.pri for more details.
}
}
}else{
# Release
# Release mode
DEFINES += QT_NO_DEBUG_OUTPUT
unix:!macx:QMAKE_CXXFLAGS_RELEASE += -g
unix:!macx{
# Turn on debug symbols in release mode on Unix systems.
# On Mac OS X temporarily disabled. TODO: find way how to strip binary file.
QMAKE_CXXFLAGS_RELEASE += -g -gdwarf-3
# On Linux
QMAKE_POST_LINK += objcopy --only-keep-debug $(DESTDIR)/$(TARGET) $(DESTDIR)/$(TARGET).debug &&
QMAKE_POST_LINK += strip --strip-debug --strip-unneeded $(DESTDIR)/$(TARGET) &&

View File

@ -1,6 +1,7 @@
TEMPLATE = subdirs
CONFIG += ordered
# Order is important
SUBDIRS = \
libs \
app \

View File

@ -4,14 +4,27 @@
#
#-------------------------------------------------
# Build QMuParser tests.
# File with common stuff for whole project
include(../../../Valentina.pri)
# We use many core functions.
QT += core
# Consol application doesn't need gui.
QT -= gui
# Name of binary file.
TARGET = ParserTest
# Console application, we use C++11 standard.
CONFIG += console c++11
# Use out-of-source builds (shadow builds)
CONFIG -= app_bundle debug_and_release debug_and_release_target
# We want create executable file
TEMPLATE = app
# directory for executable file
@ -20,48 +33,59 @@ DESTDIR = bin
# objecs files
OBJECTS_DIR = obj
SOURCES += main.cpp
HEADERS += \
stable.h
unix {
QMAKE_CXX = ccache g++
}
SOURCES += \
main.cpp \
stable.cpp
# Set using ccache. Function enable_ccache() defined in Valentina.pri.
$$enable_ccache()
# Set precompiled headers. Function set_PCH() defined in Valentina.pri.
$$set_PCH()
CONFIG(debug, debug|release){
# Debug
# Debug mode
unix {
#Turn on compilers warnings.
*-g++{
QMAKE_CXXFLAGS += -isystem "/usr/include/qt5" -isystem "/usr/include/qt5/QtCore" \
-O0 -Wall -Wextra -pedantic -Weffc++ -Woverloaded-virtual -Wctor-dtor-privacy \
-Wnon-virtual-dtor -Wold-style-cast -Wconversion -Winit-self -Wstack-protector \
-Wunreachable-code -Wcast-align -Wcast-qual -Wdisabled-optimization -Wfloat-equal \
-Wformat=2 -Wimport \
-Winvalid-pch -Wunsafe-loop-optimizations -Wlong-long -Wmissing-format-attribute \
-Wmissing-include-dirs -Wpacked -Wredundant-decls -Winline \
-Wswitch-default -Wswitch-enum -Wuninitialized -Wvariadic-macros \
-Wlogical-op -Wnoexcept -Wmissing-noreturn -Wpointer-arith\
-Wstrict-null-sentinel -Wstrict-overflow=5 -Wundef -Wno-unused -gdwarf-3 \
-ftrapv
QMAKE_CXXFLAGS += \
$$GCC_DEBUG_CXXFLAGS # See Valentina.pri for more details.
}
clang*{
QMAKE_CXXFLAGS += \
$$CLANG_DEBUG_CXXFLAGS # See Valentina.pri for more details.
}
} else {
*-g++{#Don't use additional GCC keys on Windows system.
QMAKE_CXXFLAGS += -O0 -Wall -Wextra -pedantic
}
}
}else{
# Release
*-g++{
QMAKE_CXXFLAGS += -O2
QMAKE_CXXFLAGS += $$GCC_DEBUG_CXXFLAGS # See Valentina.pri for more details.
}
}
}else{
# Release mode
DEFINES += QT_NO_DEBUG_OUTPUT
# Turn on debug symbols in release mode on Unix systems.
# On Mac OS X temporarily disabled. Need find way how to strip binary file.
unix:!macx:QMAKE_CXXFLAGS_RELEASE += -g -gdwarf-3
}
# Remove generated files at cleaning
QMAKE_DISTCLEAN += $${DESTDIR}/* \
$${OBJECTS_DIR}/*
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../../libs/qmuparser/bin/ -lqmuparser2
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../../libs/qmuparser/bin/ -lqmuparser2
else:unix: LIBS += -L$$OUT_PWD/../../libs/qmuparser/bin/ -lqmuparser
INCLUDEPATH += $$PWD/../../libs/qmuparser
DEPENDPATH += $$PWD/../../libs/qmuparser
# Strip after you link all libaries.
CONFIG(release, debug|release){
unix:!macx{
# Strip debug symbols.
QMAKE_POST_LINK += objcopy --only-keep-debug $(TARGET) $(TARGET).debug &&
QMAKE_POST_LINK += strip --strip-debug --strip-unneeded $(TARGET) &&
QMAKE_POST_LINK += objcopy --add-gnu-debuglink $(TARGET).debug $(TARGET)
}
}

View File

@ -0,0 +1,30 @@
/************************************************************************
**
** @file stable.cpp
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date November 15, 2013
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
// Build the precompiled headers.
#include "stable.h"

View File

@ -0,0 +1,48 @@
/************************************************************************
**
** @file stable.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date November 15, 2013
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#ifndef STABLE_H
#define STABLE_H
/* I like to include this pragma too, so the build log indicates if pre-compiled headers were in use. */
#ifndef __clang__
#pragma message("Compiling precompiled headers for QmuParser tests.\n")
#endif
/* Add C includes here */
#if defined __cplusplus
/* Add C++ includes here */
#ifdef QT_CORE_LIB
#include <QtCore>
#endif
#endif
#endif // STABLE_H