diff --git a/Valentina.pri b/Valentina.pri index 4703667a2..854a22269 100644 --- a/Valentina.pri +++ b/Valentina.pri @@ -40,415 +40,495 @@ 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 \ - -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 \ - -Wmissing-include-dirs \ - -Wpacked \ - -Wredundant-decls \ - -Winline \ - -Winvalid-pch \ - -Wunsafe-loop-optimizations \ - -Wlong-long \ - -Wmissing-format-attribute \ - -Wswitch-default \ - -Wuninitialized \ - -Wvariadic-macros \ - -Wlogical-op \ - -Wnoexcept \ - -Wmissing-noreturn \ - -Wpointer-arith \ - -Wstrict-null-sentinel \ - -Wstrict-overflow=5 \ - -Wundef \ - -Wno-unused \ - -gdwarf-3 \ - -ftrapv + PRECOMPILED_HEADER = stable.h # Header file with all all static headers: libraries, static local headers. + export(PRECOMPILED_HEADER) # export value to global variable -CLANG_CXXFLAGS += \ - -O0 \ - -fparse-all-comments \ - -Wabi \ - -Wabstract-final-class \ - -Wabstract-vbase-init \ - -Waddress \ - -Waddress-of-array-temporary \ - -Waddress-of-temporary \ - -Waggregate-return \ - -Wall \ - -Wambiguous-macro \ - -Wambiguous-member-template \ - -Wanalyzer-incompatible-plugin \ - -Wanonymous-pack-parens \ - -Warc \ - -Warc-abi \ - -Warc-bridge-casts-disallowed-in-nonarc \ - -Warc-maybe-repeated-use-of-weak \ - -Warc-non-pod-memaccess \ - -Warc-performSelector-leaks \ - -Warc-repeated-use-of-weak \ - -Warc-retain-cycles \ - -Warc-unsafe-retained-assign \ - -Warray-bounds \ - -Warray-bounds-pointer-arithmetic \ - -Wasm \ - -Wasm-operand-widths \ - -Wassign-enum \ - -Watomic-properties \ - -Watomic-property-with-user-defined-accessor \ - -Wattributes \ - -Wauto-import \ - -Wauto-storage-class \ - -Wauto-var-id \ - -Wavailability \ - -Wbackslash-newline-escape \ - -Wbad-array-new-length \ - -Wbad-function-cast \ - -Wbind-to-temporary-copy \ - -Wbitfield-constant-conversion \ - -Wbitwise-op-parentheses \ - -Wbool-conversion \ - -Wbool-conversions \ - -Wbuiltin-macro-redefined \ - -Wbuiltin-requires-header \ - -Wc++-compat \ - -Wc++0x-compat \ - -Wc++0x-extensions \ - -Wc++0x-narrowing \ - -Wc++11-compat \ - -Wc++11-compat-pedantic \ - -Wc++11-compat-reserved-user-defined-literal \ - -Wc++11-extensions \ - -Wc++11-extra-semi \ - -Wc++11-long-long \ - -Wc++11-narrowing \ - -Wc11-extensions \ - -Wcast-align \ - -Wcast-of-sel-type \ - -Wcast-qual \ - -WCFString-literal \ - -Wchar-align \ - -Wchar-subscripts \ - -Wcomment \ - -Wcomments \ - -Wcompare-distinct-pointer-types \ - -Wcomplex-component-init \ - -Wconditional-type-mismatch \ - -Wconditional-uninitialized \ - -Wconfig-macros \ - -Wconstant-conversion \ - -Wconstant-logical-operand \ - -Wconstexpr-not-const \ - -Wconversion \ - -Wconversion-null \ - -Wno-covered-switch-default \ - -Wctor-dtor-privacy \ - -Wcustom-atomic-properties \ - -Wdangling-else \ - -Wdangling-field \ - -Wdangling-initializer-list \ - -Wdeclaration-after-statement \ - -Wdelegating-ctor-cycles \ - -Wdelete-incomplete \ - -Wdelete-non-virtual-dtor \ - -Wdeprecated \ - -Wdeprecated-declarations \ - -Wdeprecated-implementations \ - -Wdeprecated-objc-isa-usage \ - -Wdeprecated-objc-pointer-introspection \ - -Wdeprecated-objc-pointer-introspection-performSelector \ - -Wdeprecated-register \ - -Wdeprecated-writable-strings \ - -Wdirect-ivar-access \ - -Wdisabled-macro-expansion \ - -Wdisabled-optimization \ - -Wdiscard-qual \ - -Wdistributed-object-modifiers \ - -Wdiv-by-zero \ - -Wdivision-by-zero \ - -Wdocumentation \ - -Wdocumentation-deprecated-sync \ - -Wdocumentation-html \ - -Wdollar-in-identifier-extension \ - -Wduplicate-decl-specifier \ - -Wduplicate-enum \ - -Wduplicate-method-arg \ - -Wduplicate-method-match \ - -Wdynamic-class-memaccess \ - -Weffc++ \ - -Wembedded-directive \ - -Wempty-body \ - -Wempty-translation-unit \ - -Wendif-labels \ - -Wenum-compare \ - -Wenum-conversion \ - -Wexplicit-ownership-type \ - -Wextended-offsetof \ - -Wextern-initializer \ - -Wextra \ - -Wextra-semi \ - -Wextra-tokens \ - -Wflexible-array-extensions \ - -Wfloat-equal \ - -Wformat \ - -Wformat-extra-args \ - -Wformat-invalid-specifier \ - -Wformat-non-iso \ - -Wformat-nonliteral \ - -Wformat-security \ - -Wformat-y2k \ - -Wformat-zero-length \ - -Wformat=2 \ - -Wfour-char-constants \ - -Wgcc-compat \ - -Wgnu \ - -Wgnu-array-member-paren-init \ - -Wgnu-designator \ - -Wgnu-static-float-init \ - -Wheader-guard \ - -Wheader-hygiene \ - -Widiomatic-parentheses \ - -Wignored-attributes \ - -Wignored-qualifiers \ - -Wimplicit \ - -Wimplicit-atomic-properties \ - -Wimplicit-conversion-floating-point-to-bool \ - -Wimplicit-exception-spec-mismatch \ - -Wimplicit-fallthrough \ - -Wimplicit-fallthrough-per-function \ - -Wimplicit-function-declaration \ - -Wimplicit-int \ - -Wimplicit-retain-self \ - -Wimport \ - -Wimport-preprocessor-directive-pedantic \ - -Wincompatible-library-redeclaration \ - -Wincompatible-pointer-types \ - -Wincompatible-pointer-types-discards-qualifiers \ - -Wincomplete-implementation \ - -Wincomplete-module \ - -Wincomplete-umbrella \ - -Winherited-variadic-ctor \ - -Winit-self \ - -Winitializer-overrides \ - -Winline \ - -Wint-conversion \ - -Wint-conversions \ - -Wint-to-pointer-cast \ - -Wint-to-void-pointer-cast \ - -Winteger-overflow \ - -Winvalid-constexpr \ - -Winvalid-iboutlet \ - -Winvalid-noreturn \ - -Winvalid-offsetof \ - -Winvalid-pch \ - -Winvalid-pp-token \ - -Winvalid-source-encoding \ - -Winvalid-token-paste \ - -Wknr-promoted-parameter \ - -Wlanguage-extension-token \ - -Wlarge-by-value-copy \ - -Wliteral-conversion \ - -Wliteral-range \ - -Wlocal-type-template-args \ - -Wlogical-not-parentheses \ - -Wlogical-op-parentheses \ - -Wlong-long \ - -Wloop-analysis \ - -Wmain \ - -Wmain-return-type \ - -Wmalformed-warning-check \ - -Wmethod-signatures \ - -Wmicrosoft \ - -Wmicrosoft-exists \ - -Wmismatched-parameter-types \ - -Wmismatched-return-types \ - -Wmismatched-tags \ - -Wmissing-braces \ - -Wmissing-declarations \ - -Wmissing-field-initializers \ - -Wmissing-format-attribute \ - -Wmissing-include-dirs \ - -Wmissing-method-return-type \ - -Wmissing-noreturn \ - -Wmissing-prototypes \ - -Wmissing-selector-name \ - -Wmissing-sysroot \ - -Wmissing-variable-declarations \ - -Wmodule-conflict \ - -Wmost \ - -Wmultichar \ - -Wnarrowing \ - -Wnested-externs \ - -Wnewline-eof \ - -Wnon-gcc \ - -Wnon-literal-null-conversion \ - -Wnon-pod-varargs \ - -Wnon-virtual-dtor \ - -Wnonnull \ - -Wnonportable-cfstrings \ - -WNSObject-attribute \ - -Wnull-arithmetic \ - -Wnull-character \ - -Wnull-conversion \ - -Wnull-dereference \ - -Wodr \ - -Wold-style-cast \ - -Wold-style-definition \ - -Wout-of-line-declaration \ - -Wover-aligned \ - -Woverflow \ - -Woverlength-strings \ - -Woverloaded-shift-op-parentheses \ - -Woverloaded-virtual \ - -Woverriding-method-mismatch \ - -Wpacked \ - -Wparentheses \ - -Wparentheses-equality \ - -Wpedantic \ - -Wpointer-arith \ - -Wpointer-sign \ - -Wpointer-to-int-cast \ - -Wpointer-type-mismatch \ - -Wpredefined-identifier-outside-function \ - -Wprivate-extern \ - -Wprotocol \ - -Wprotocol-property-synthesis-ambiguity \ - -Wreadonly-iboutlet-property \ - -Wreceiver-expr \ - -Wreceiver-forward-class \ - -Wreceiver-is-weak \ - -Wredundant-decls \ - -Wreinterpret-base-class \ - -Wreorder \ - -Wrequires-super-attribute \ - -Wreserved-user-defined-literal \ - -Wreturn-stack-address \ - -Wreturn-type \ - -Wreturn-type-c-linkage \ - -Wsection \ - -Wselector \ - -Wselector-type-mismatch \ - -Wself-assign \ - -Wself-assign-field \ - -Wsemicolon-before-method-body \ - -Wsentinel \ - -Wsequence-point \ - -Wserialized-diagnostics \ - -Wshadow-ivar \ - -Wshift-count-negative \ - -Wshift-count-overflow \ - -Wshift-op-parentheses \ - -Wshift-overflow \ - -Wshift-sign-overflow \ - -Wshorten-64-to-32 \ - -Wsign-compare \ - -Wsign-conversion \ - -Wsign-promo \ - -Wsizeof-array-argument \ - -Wsizeof-array-decay \ - -Wsizeof-pointer-memaccess \ - -Wsometimes-uninitialized \ - -Wsource-uses-openmp \ - -Wstack-protector \ - -Wstatic-float-init \ - -Wstatic-in-inline \ - -Wstatic-local-in-inline \ - -Wstatic-self-init \ - -Wstrict-aliasing \ - -Wstrict-aliasing=0 \ - -Wstrict-aliasing=1 \ - -Wstrict-aliasing=2 \ - -Wstrict-overflow \ - -Wstrict-overflow=0 \ - -Wstrict-overflow=1 \ - -Wstrict-overflow=2 \ - -Wstrict-overflow=3 \ - -Wstrict-overflow=4 \ - -Wstrict-overflow=5 \ - -Wstrict-prototypes \ - -Wstrict-selector-match \ - -Wstring-compare \ - -Wstring-conversion \ - -Wstring-plus-int \ - -Wstrlcpy-strlcat-size \ - -Wstrncat-size \ - -Wsuper-class-method-mismatch \ - -Wswitch \ - -Wswitch-default \ - -Wsynth \ - -Wtautological-compare \ - -Wtautological-constant-out-of-range-compare \ - -Wtentative-definition-incomplete-type \ - -Wthread-safety \ - -Wthread-safety-analysis \ - -Wthread-safety-attributes \ - -Wthread-safety-beta \ - -Wthread-safety-precise \ - -Wtrigraphs \ - -Wtype-limits \ - -Wtype-safety \ - -Wtypedef-redefinition \ - -Wtypename-missing \ - -Wundeclared-selector \ - -Wundef \ - -Wundefined-inline \ - -Wundefined-internal \ - -Wundefined-reinterpret-cast \ - -Wunicode \ - -Wunicode-whitespace \ - -Wuninitialized \ - -Wunknown-warning-option \ - -Wunnamed-type-template-args \ - -Wunneeded-internal-declaration \ - -Wunneeded-member-function \ - -Wunsequenced \ - -Wunsupported-visibility \ - -Wunused \ - -Wunused-argument \ - -Wunused-command-line-argument \ - -Wunused-comparison \ - -Wunused-exception-parameter \ - -Wunused-function \ - -Wunused-label \ - -Wunused-member-function \ - -Wunused-parameter \ - -Wunused-private-field \ - -Wunused-result \ - -Wunused-sanitize-argument \ - -Wunused-value \ - -Wunused-variable \ - -Wunused-volatile-lvalue \ - -Wuser-defined-literals \ - -Wvarargs \ - -Wvariadic-macros \ - -Wvector-conversion \ - -Wvector-conversions \ - -Wvexing-parse \ - -Wvisibility \ - -Wvla \ - -Wvla-extension \ - -Wvolatile-register-var \ - -Wweak-template-vtables \ - -Wweak-vtables \ - -Wwrite-strings \ - -Wzero-length-array \ - -Qunused-arguments \ - -fcolor-diagnostics + 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 \ + -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 \ + -Wmissing-include-dirs \ + -Wpacked \ + -Wredundant-decls \ + -Winline \ + -Winvalid-pch \ + -Wunsafe-loop-optimizations \ + -Wlong-long \ + -Wmissing-format-attribute \ + -Wswitch-default \ + -Wuninitialized \ + -Wvariadic-macros \ + -Wlogical-op \ + -Wnoexcept \ + -Wmissing-noreturn \ + -Wpointer-arith \ + -Wstrict-null-sentinel \ + -Wstrict-overflow=5 \ + -Wundef \ + -Wno-unused \ + -ftrapv + +# 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 \ + -Wabstract-vbase-init \ + -Waddress \ + -Waddress-of-array-temporary \ + -Waddress-of-temporary \ + -Waggregate-return \ + -Wall \ + -Wambiguous-macro \ + -Wambiguous-member-template \ + -Wanalyzer-incompatible-plugin \ + -Wanonymous-pack-parens \ + -Warc \ + -Warc-abi \ + -Warc-bridge-casts-disallowed-in-nonarc \ + -Warc-maybe-repeated-use-of-weak \ + -Warc-non-pod-memaccess \ + -Warc-performSelector-leaks \ + -Warc-repeated-use-of-weak \ + -Warc-retain-cycles \ + -Warc-unsafe-retained-assign \ + -Warray-bounds \ + -Warray-bounds-pointer-arithmetic \ + -Wasm \ + -Wasm-operand-widths \ + -Wassign-enum \ + -Watomic-properties \ + -Watomic-property-with-user-defined-accessor \ + -Wattributes \ + -Wauto-import \ + -Wauto-storage-class \ + -Wauto-var-id \ + -Wavailability \ + -Wbackslash-newline-escape \ + -Wbad-array-new-length \ + -Wbad-function-cast \ + -Wbind-to-temporary-copy \ + -Wbitfield-constant-conversion \ + -Wbitwise-op-parentheses \ + -Wbool-conversion \ + -Wbool-conversions \ + -Wbuiltin-macro-redefined \ + -Wbuiltin-requires-header \ + -Wc++-compat \ + -Wc++0x-compat \ + -Wc++0x-extensions \ + -Wc++0x-narrowing \ + -Wc++11-compat \ + -Wc++11-compat-pedantic \ + -Wc++11-compat-reserved-user-defined-literal \ + -Wc++11-extensions \ + -Wc++11-extra-semi \ + -Wc++11-long-long \ + -Wc++11-narrowing \ + -Wc11-extensions \ + -Wcast-align \ + -Wcast-of-sel-type \ + -Wcast-qual \ + -WCFString-literal \ + -Wchar-align \ + -Wchar-subscripts \ + -Wcomment \ + -Wcomments \ + -Wcompare-distinct-pointer-types \ + -Wcomplex-component-init \ + -Wconditional-type-mismatch \ + -Wconditional-uninitialized \ + -Wconfig-macros \ + -Wconstant-conversion \ + -Wconstant-logical-operand \ + -Wconstexpr-not-const \ + -Wconversion \ + -Wconversion-null \ + -Wno-covered-switch-default \ + -Wctor-dtor-privacy \ + -Wcustom-atomic-properties \ + -Wdangling-else \ + -Wdangling-field \ + -Wdangling-initializer-list \ + -Wdeclaration-after-statement \ + -Wdelegating-ctor-cycles \ + -Wdelete-incomplete \ + -Wdelete-non-virtual-dtor \ + -Wdeprecated \ + -Wdeprecated-declarations \ + -Wdeprecated-implementations \ + -Wdeprecated-objc-isa-usage \ + -Wdeprecated-objc-pointer-introspection \ + -Wdeprecated-objc-pointer-introspection-performSelector \ + -Wdeprecated-register \ + -Wdeprecated-writable-strings \ + -Wdirect-ivar-access \ + -Wdisabled-macro-expansion \ + -Wdisabled-optimization \ + -Wdiscard-qual \ + -Wdistributed-object-modifiers \ + -Wdiv-by-zero \ + -Wdivision-by-zero \ + -Wdocumentation \ + -Wdocumentation-deprecated-sync \ + -Wdocumentation-html \ + -Wdollar-in-identifier-extension \ + -Wduplicate-decl-specifier \ + -Wduplicate-enum \ + -Wduplicate-method-arg \ + -Wduplicate-method-match \ + -Wdynamic-class-memaccess \ + -Weffc++ \ + -Wembedded-directive \ + -Wempty-body \ + -Wempty-translation-unit \ + -Wendif-labels \ + -Wenum-compare \ + -Wenum-conversion \ + -Wexplicit-ownership-type \ + -Wextended-offsetof \ + -Wextern-initializer \ + -Wextra \ + -Wextra-semi \ + -Wextra-tokens \ + -Wflexible-array-extensions \ + -Wfloat-equal \ + -Wformat \ + -Wformat-extra-args \ + -Wformat-invalid-specifier \ + -Wformat-non-iso \ + -Wformat-nonliteral \ + -Wformat-security \ + -Wformat-y2k \ + -Wformat-zero-length \ + -Wformat=2 \ + -Wfour-char-constants \ + -Wgcc-compat \ + -Wgnu \ + -Wgnu-array-member-paren-init \ + -Wgnu-designator \ + -Wgnu-static-float-init \ + -Wheader-guard \ + -Wheader-hygiene \ + -Widiomatic-parentheses \ + -Wignored-attributes \ + -Wignored-qualifiers \ + -Wimplicit \ + -Wimplicit-atomic-properties \ + -Wimplicit-conversion-floating-point-to-bool \ + -Wimplicit-exception-spec-mismatch \ + -Wimplicit-fallthrough \ + -Wimplicit-fallthrough-per-function \ + -Wimplicit-function-declaration \ + -Wimplicit-int \ + -Wimplicit-retain-self \ + -Wimport \ + -Wimport-preprocessor-directive-pedantic \ + -Wincompatible-library-redeclaration \ + -Wincompatible-pointer-types \ + -Wincompatible-pointer-types-discards-qualifiers \ + -Wincomplete-implementation \ + -Wincomplete-module \ + -Wincomplete-umbrella \ + -Winherited-variadic-ctor \ + -Winit-self \ + -Winitializer-overrides \ + -Winline \ + -Wint-conversion \ + -Wint-conversions \ + -Wint-to-pointer-cast \ + -Wint-to-void-pointer-cast \ + -Winteger-overflow \ + -Winvalid-constexpr \ + -Winvalid-iboutlet \ + -Winvalid-noreturn \ + -Winvalid-offsetof \ + -Winvalid-pch \ + -Winvalid-pp-token \ + -Winvalid-source-encoding \ + -Winvalid-token-paste \ + -Wknr-promoted-parameter \ + -Wlanguage-extension-token \ + -Wlarge-by-value-copy \ + -Wliteral-conversion \ + -Wliteral-range \ + -Wlocal-type-template-args \ + -Wlogical-not-parentheses \ + -Wlogical-op-parentheses \ + -Wlong-long \ + -Wloop-analysis \ + -Wmain \ + -Wmain-return-type \ + -Wmalformed-warning-check \ + -Wmethod-signatures \ + -Wmicrosoft \ + -Wmicrosoft-exists \ + -Wmismatched-parameter-types \ + -Wmismatched-return-types \ + -Wmismatched-tags \ + -Wmissing-braces \ + -Wmissing-declarations \ + -Wmissing-field-initializers \ + -Wmissing-format-attribute \ + -Wmissing-include-dirs \ + -Wmissing-method-return-type \ + -Wmissing-noreturn \ + -Wmissing-prototypes \ + -Wmissing-selector-name \ + -Wmissing-sysroot \ + -Wmissing-variable-declarations \ + -Wmodule-conflict \ + -Wmost \ + -Wmultichar \ + -Wnarrowing \ + -Wnested-externs \ + -Wnewline-eof \ + -Wnon-gcc \ + -Wnon-literal-null-conversion \ + -Wnon-pod-varargs \ + -Wnon-virtual-dtor \ + -Wnonnull \ + -Wnonportable-cfstrings \ + -WNSObject-attribute \ + -Wnull-arithmetic \ + -Wnull-character \ + -Wnull-conversion \ + -Wnull-dereference \ + -Wodr \ + -Wold-style-cast \ + -Wold-style-definition \ + -Wout-of-line-declaration \ + -Wover-aligned \ + -Woverflow \ + -Woverlength-strings \ + -Woverloaded-shift-op-parentheses \ + -Woverloaded-virtual \ + -Woverriding-method-mismatch \ + -Wpacked \ + -Wparentheses \ + -Wparentheses-equality \ + -Wpedantic \ + -Wpointer-arith \ + -Wpointer-sign \ + -Wpointer-to-int-cast \ + -Wpointer-type-mismatch \ + -Wpredefined-identifier-outside-function \ + -Wprivate-extern \ + -Wprotocol \ + -Wprotocol-property-synthesis-ambiguity \ + -Wreadonly-iboutlet-property \ + -Wreceiver-expr \ + -Wreceiver-forward-class \ + -Wreceiver-is-weak \ + -Wredundant-decls \ + -Wreinterpret-base-class \ + -Wreorder \ + -Wrequires-super-attribute \ + -Wreserved-user-defined-literal \ + -Wreturn-stack-address \ + -Wreturn-type \ + -Wreturn-type-c-linkage \ + -Wsection \ + -Wselector \ + -Wselector-type-mismatch \ + -Wself-assign \ + -Wself-assign-field \ + -Wsemicolon-before-method-body \ + -Wsentinel \ + -Wsequence-point \ + -Wserialized-diagnostics \ + -Wshadow-ivar \ + -Wshift-count-negative \ + -Wshift-count-overflow \ + -Wshift-op-parentheses \ + -Wshift-overflow \ + -Wshift-sign-overflow \ + -Wshorten-64-to-32 \ + -Wsign-compare \ + -Wsign-conversion \ + -Wsign-promo \ + -Wsizeof-array-argument \ + -Wsizeof-array-decay \ + -Wsizeof-pointer-memaccess \ + -Wsometimes-uninitialized \ + -Wsource-uses-openmp \ + -Wstack-protector \ + -Wstatic-float-init \ + -Wstatic-in-inline \ + -Wstatic-local-in-inline \ + -Wstatic-self-init \ + -Wstrict-aliasing \ + -Wstrict-aliasing=0 \ + -Wstrict-aliasing=1 \ + -Wstrict-aliasing=2 \ + -Wstrict-overflow \ + -Wstrict-overflow=0 \ + -Wstrict-overflow=1 \ + -Wstrict-overflow=2 \ + -Wstrict-overflow=3 \ + -Wstrict-overflow=4 \ + -Wstrict-overflow=5 \ + -Wstrict-prototypes \ + -Wstrict-selector-match \ + -Wstring-compare \ + -Wstring-conversion \ + -Wstring-plus-int \ + -Wstrlcpy-strlcat-size \ + -Wstrncat-size \ + -Wsuper-class-method-mismatch \ + -Wswitch \ + -Wswitch-default \ + -Wsynth \ + -Wtautological-compare \ + -Wtautological-constant-out-of-range-compare \ + -Wtentative-definition-incomplete-type \ + -Wthread-safety \ + -Wthread-safety-analysis \ + -Wthread-safety-attributes \ + -Wthread-safety-beta \ + -Wthread-safety-precise \ + -Wtrigraphs \ + -Wtype-limits \ + -Wtype-safety \ + -Wtypedef-redefinition \ + -Wtypename-missing \ + -Wundeclared-selector \ + -Wundef \ + -Wundefined-inline \ + -Wundefined-internal \ + -Wundefined-reinterpret-cast \ + -Wunicode \ + -Wunicode-whitespace \ + -Wuninitialized \ + -Wunknown-warning-option \ + -Wunnamed-type-template-args \ + -Wunneeded-internal-declaration \ + -Wunneeded-member-function \ + -Wunsequenced \ + -Wunsupported-visibility \ + -Wunused \ + -Wunused-argument \ + -Wunused-command-line-argument \ + -Wunused-comparison \ + -Wunused-exception-parameter \ + -Wunused-function \ + -Wunused-label \ + -Wunused-member-function \ + -Wunused-parameter \ + -Wunused-private-field \ + -Wunused-result \ + -Wunused-sanitize-argument \ + -Wunused-value \ + -Wunused-variable \ + -Wunused-volatile-lvalue \ + -Wuser-defined-literals \ + -Wvarargs \ + -Wvariadic-macros \ + -Wvector-conversion \ + -Wvector-conversions \ + -Wvexing-parse \ + -Wvisibility \ + -Wvla \ + -Wvla-extension \ + -Wvolatile-register-var \ + -Wweak-template-vtables \ + -Wweak-vtables \ + -Wwrite-strings \ + -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 \ +} diff --git a/Valentina.pro b/Valentina.pro index f0422e73b..68283c81b 100644 --- a/Valentina.pro +++ b/Valentina.pro @@ -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.") diff --git a/dist/Valentina.icns b/dist/Valentina.icns new file mode 100644 index 000000000..a803cf80b Binary files /dev/null and b/dist/Valentina.icns differ diff --git a/src/app/app.pro b/src/app/app.pro index c12c69f30..111fcbacf 100644 --- a/src/app/app.pro +++ b/src/app/app.pro @@ -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,49 +171,152 @@ 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 += \ - share/translations/valentina_ru_RU.qm \ - share/translations/valentina_uk_UA.qm \ - share/translations/valentina_de_DE.qm \ - share/translations/valentina_cs_CZ.qm \ - share/translations/valentina_he_IL.qm \ - share/translations/valentina_fr_FR.qm \ - share/translations/valentina_it_IT.qm \ - share/translations/valentina_nl_NL.qm - -INSTALL_STANDARD_MEASHUREMENTS += share/resources/tables/standard/GOST_man_ru.vst - -unix { -#VARIABLES -isEmpty(PREFIX) { - PREFIX = /usr +# Set "make install" command for Unix-like systems. +unix{ +isEmpty(PREFIX){ + PREFIX = $$DEFAULT_PREFIX } -DATADIR =$$PREFIX/share -DEFINES += DATADIR=\\\"$$DATADIR\\\" PKGDATADIR=\\\"$$PKGDATADIR\\\" -#MAKE INSTALL + +# Prefix for binary file. unix:!macx{ -target.path = $$PREFIX/bin + # 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 \ + share/translations/valentina_cs_CZ.qm \ + share/translations/valentina_he_IL.qm \ + share/translations/valentina_fr_FR.qm \ + share/translations/valentina_it_IT.qm \ + share/translations/valentina_nl_NL.qm + + # Keep path to all files with standard measurements we support right now + INSTALL_STANDARD_MEASHUREMENTS += share/resources/tables/standard/GOST_man_ru.vst + + 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{ -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 += \ - target \ - desktop \ - pixmaps \ - translations \ - standard + # 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) diff --git a/src/app/share/translations/Localizable.strings b/src/app/share/translations/Localizable.strings new file mode 100644 index 000000000..0aab0801f --- /dev/null +++ b/src/app/share/translations/Localizable.strings @@ -0,0 +1 @@ +/* Intentionally empty */ diff --git a/src/libs/qmuparser/qmuparser.pro b/src/libs/qmuparser/qmuparser.pro index 52ff3c209..0ec702b72 100644 --- a/src/libs/qmuparser/qmuparser.pro +++ b/src/libs/qmuparser/qmuparser.pro @@ -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) diff --git a/src/libs/vpropertyexplorer/vpropertyexplorer.pro b/src/libs/vpropertyexplorer/vpropertyexplorer.pro index 0d3ea0b66..a797ab03c 100644 --- a/src/libs/vpropertyexplorer/vpropertyexplorer.pro +++ b/src/libs/vpropertyexplorer/vpropertyexplorer.pro @@ -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 @@ -53,7 +62,7 @@ SOURCES += \ stable.cpp HEADERS +=\ - vpropertyexplorer_global.h \ + vpropertyexplorer_global.h \ vpropertyfactorymanager_p.h \ vpropertytreeview_p.h \ vpropertyset_p.h \ @@ -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) && diff --git a/src/src.pro b/src/src.pro index dbc4d1aaa..4ae343d2a 100644 --- a/src/src.pro +++ b/src/src.pro @@ -1,6 +1,7 @@ TEMPLATE = subdirs CONFIG += ordered +# Order is important SUBDIRS = \ libs \ app \ diff --git a/src/test/ParserTest/ParserTest.pro b/src/test/ParserTest/ParserTest.pro index 3be053f5d..7417bf98b 100644 --- a/src/test/ParserTest/ParserTest.pro +++ b/src/test/ParserTest/ParserTest.pro @@ -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 + *-g++{ + QMAKE_CXXFLAGS += $$GCC_DEBUG_CXXFLAGS # See Valentina.pri for more details. } } + }else{ - # Release - *-g++{ - QMAKE_CXXFLAGS += -O2 - } + # 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) + } +} diff --git a/src/test/ParserTest/stable.cpp b/src/test/ParserTest/stable.cpp new file mode 100644 index 000000000..243b23938 --- /dev/null +++ b/src/test/ParserTest/stable.cpp @@ -0,0 +1,30 @@ +/************************************************************************ + ** + ** @file stable.cpp + ** @author Roman Telezhynskyi + ** @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 + ** 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 . + ** + *************************************************************************/ + +// Build the precompiled headers. +#include "stable.h" diff --git a/src/test/ParserTest/stable.h b/src/test/ParserTest/stable.h new file mode 100644 index 000000000..4d9dd80f4 --- /dev/null +++ b/src/test/ParserTest/stable.h @@ -0,0 +1,48 @@ +/************************************************************************ + ** + ** @file stable.h + ** @author Roman Telezhynskyi + ** @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 + ** 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 . + ** + *************************************************************************/ + +#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 +#endif + +#endif + +#endif // STABLE_H