mirror of
https://github.com/mumble-voip/mumble.git
synced 2025-10-26 11:19:16 +00:00
GCC 4.1, used in our CentOS 5 buildenv doesn't know the c++03 alias. Use c++98 instead. This is completely safe, since there is no semantic difference between -std=c++98 and -std=c++03. GCC treats all of "-std=c++98", "-std=c++03" and "-ansi" as being equal. From the GCC docs: "The original ISO C++ standard was published as the ISO standard (ISO/IEC 14882:1998) and amended by a Technical Corrigenda published in 2003 (ISO/IEC 14882:2003). These standards are referred to as C++98 and C++03, respectively. GCC implements the majority of C++98 (export is a notable exception) and most of the changes in C++03. To select this standard in GCC, use one of the options -ansi, -std=c++98, or -std=c++03 [...]" (Via https://gcc.gnu.org/onlinedocs/gcc/Standards.html)
402 lines
13 KiB
Plaintext
402 lines
13 KiB
Plaintext
# Copyright 2005-2016 The Mumble Developers. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license
|
|
# that can be found in the LICENSE file at the root of the
|
|
# Mumble source tree or at <https://www.mumble.info/LICENSE>.
|
|
|
|
include(qt.pri)
|
|
include(uname.pri)
|
|
|
|
CONFIG *= warn_on
|
|
|
|
# Enable zlib compression for assets
|
|
# embedded via rcc. This is done to
|
|
# keep the size of rcc's output
|
|
# source files under control.
|
|
QMAKE_RESOURCE_FLAGS += -compress 9
|
|
|
|
# The architecture we're building for.
|
|
# On Windows, Mumble supports overriding the
|
|
# architecture of the compiler via the
|
|
# force-x86_64-toolchain and force-x86-toolchain
|
|
# CONFIG options. Because we have these, qmake's
|
|
# QMAKE_TARGET.arch doesn't suffice any longer, and
|
|
# we define MUMBLE_ARCH to be used in its place.
|
|
MUMBLE_ARCH = $$QMAKE_TARGET.arch
|
|
|
|
win32 {
|
|
# Define the CONFIG options 'force-x86-toolchain' and
|
|
# 'force-x86_64-toolchain'. These can be used to force
|
|
# the target of a .pro file to be built for a specific
|
|
# architecture, regardless of the actual architecture
|
|
# used by the current build environment.
|
|
FULL_MKSPEC_PATH = $$QMAKESPEC
|
|
CURRENT_MKSPEC = $$basename(QMAKESPEC)
|
|
|
|
CONFIG(force-x86-toolchain) {
|
|
MUMBLE_ARCH = x86
|
|
include(toolchain/$${CURRENT_MKSPEC}/x86-xp.toolchain)
|
|
}
|
|
|
|
CONFIG(force-x86_64-toolchain) {
|
|
MUMBLE_ARCH = x86_64
|
|
include(toolchain/$${CURRENT_MKSPEC}/x64.toolchain)
|
|
}
|
|
|
|
# Import dependency paths for windows
|
|
include(winpaths_default.pri)
|
|
|
|
INCLUDEPATH *= "$$BOOST_PATH/include"
|
|
QMAKE_LIBDIR *= "$$OPENSSL_PATH/lib" "$$LIBSNDFILE_PATH/lib" "$$BOOST_PATH/lib"
|
|
INCLUDEPATH *= "$$OPENSSL_PATH/include" "$$LIBSNDFILE_PATH/include"
|
|
|
|
# Sanity check that LIB and INCLUDE are properly set up.
|
|
INCLUDE_VAR=$$(INCLUDE)
|
|
LIB_VAR=$$(LIB)
|
|
isEmpty(LIB_VAR) {
|
|
error("The LIB environment variable is not set. Are you not in a build environment?")
|
|
}
|
|
isEmpty(INCLUDE_VAR) {
|
|
error("The INCLUDE environment variable is not set. Are you not in a build environment?")
|
|
}
|
|
|
|
CONFIG(analyze) {
|
|
QMAKE_CFLAGS_DEBUG *= /analyze
|
|
QMAKE_CXXFLAGS_DEBUG *= /analyze
|
|
QMAKE_CFLAGS_RELEASE *= /analyze
|
|
QMAKE_CXXFLAGS_RELEASE *= /analyze
|
|
}
|
|
|
|
# Always enable warnings-as-errors
|
|
# if we're inside a Mumble build environment.
|
|
# Can be disabled with CONFIG+=no-warnings-as-errors.
|
|
MUMBLE_PREFIX=$$(MUMBLE_PREFIX)
|
|
!isEmpty(MUMBLE_PREFIX):!CONFIG(no-warnings-as-errors) {
|
|
CONFIG += warnings-as-errors
|
|
}
|
|
|
|
CONFIG(warnings-as-errors) {
|
|
QMAKE_CFLAGS *= -WX
|
|
QMAKE_CXXFLAGS *= -WX
|
|
QMAKE_LFLAGS *= -WX
|
|
}
|
|
|
|
# Increase the verbosity of the linker.
|
|
# For now, only increases the verbosity
|
|
# of searching for libraries.
|
|
# This is useful when diagnosing libraries
|
|
# that use a wrong runtime library DLL.
|
|
CONFIG(verbose-linker) {
|
|
QMAKE_LFLAGS *= /VERBOSE:LIB
|
|
}
|
|
|
|
# Increase PCH heap to 150MB: https://msdn.microsoft.com/en-us/library/bdscwf1c.aspx
|
|
QMAKE_CFLAGS *= -Zm200
|
|
QMAKE_CXXFLAGS *= -Zm200
|
|
|
|
QMAKE_CFLAGS_RELEASE *= -Ox /fp:fast
|
|
QMAKE_CXXFLAGS_RELEASE *= -Ox /fp:fast
|
|
|
|
equals(MUMBLE_ARCH, x86) {
|
|
QMAKE_LFLAGS_RELEASE -= /SafeSEH
|
|
}
|
|
|
|
# MSVS 2012 and 2013's cl.exe will generate SSE2 code by default,
|
|
# unless an explict arch is set.
|
|
# For our non-64 x86 builds, our binaries should not contain any
|
|
# SSE2 code, so override the default by using -arch:SSE.
|
|
equals(MUMBLE_ARCH, x86) {
|
|
QMAKE_CFLAGS_RELEASE *= -arch:SSE
|
|
QMAKE_CXXFLAGS_RELEASE *= -arch:SSE
|
|
}
|
|
|
|
# Qt 5.4 uses -Zc:strictStrings by default on MSVS 2013.
|
|
# TextToSpeech_win.cpp uses sapi.h, which isn't compatible
|
|
# with the strictStrings option due to bad conversions
|
|
# in some of its functions's default parameters.
|
|
QMAKE_CFLAGS_RELEASE -= -Zc:strictStrings
|
|
QMAKE_CXXFLAGS_RELEASE -= -Zc:strictStrings
|
|
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO -= -Zc:strictStrings
|
|
QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO -= -Zc:strictStrings
|
|
# The mkspec update for MSVC2015 puts the flag directly in
|
|
# CFLAGS and CXXFLAGS, so try there, too.
|
|
QMAKE_CFLAGS -= -Zc:strictStrings
|
|
QMAKE_CXXFLAGS -= -Zc:strictStrings
|
|
|
|
# Explicitly set the subsystem versions to
|
|
# 5.01 (XP) for x86 and 6.00 (Vista) for x64.
|
|
#
|
|
# Qt expands the @QMAKE_SUBSYSTEM_SUFFIX@ via
|
|
# qt_config.prf, which doesn't seem to trigger
|
|
# for us. So we'll just try our luck.
|
|
QMAKE_LFLAGS_CONSOLE -= /SUBSYSTEM:CONSOLE
|
|
QMAKE_LFLAGS_CONSOLE -= /SUBSYSTEM:CONSOLE@QMAKE_SUBSYSTEM_SUFFIX@
|
|
QMAKE_LFLAGS_WINDOWS -= /SUBSYSTEM:WINDOWS
|
|
QMAKE_LFLAGS_WINDOWS -= /SUBSYSTEM:WINDOWS@QMAKE_SUBSYSTEM_SUFFIX@
|
|
!isEmpty(QMAKE_LFLAGS_WINDOWS) {
|
|
error("QMAKE_LFLAGS_WINDOWS is not empty. Please adjust the pri file.")
|
|
}
|
|
!isEmpty(QMAKE_LFLAGS_CONSOLE) {
|
|
error("QMAKE_LFLAGS_CONSOLE is not empty. Please adjust the pri file.")
|
|
}
|
|
equals(MUMBLE_ARCH, x86) {
|
|
QMAKE_LFLAGS_CONSOLE += /SUBSYSTEM:CONSOLE,5.01
|
|
QMAKE_LFLAGS_WINDOWS += /SUBSYSTEM:WINDOWS,5.01
|
|
}
|
|
equals(MUMBLE_ARCH, x86_64) {
|
|
QMAKE_LFLAGS_CONSOLE += /SUBSYSTEM:CONSOLE,6.00
|
|
QMAKE_LFLAGS_WINDOWS += /SUBSYSTEM:WINDOWS,6.00
|
|
}
|
|
|
|
DEFINES *= RESTRICT=
|
|
CONFIG(sse2) {
|
|
QMAKE_CFLAGS_RELEASE -= -arch:SSE
|
|
QMAKE_CFLAGS_DEBUG -= -arch:SSE
|
|
QMAKE_CFLAGS += -arch:SSE2
|
|
}
|
|
|
|
CONFIG(symbols) {
|
|
# Configure build to be able to properly debug release builds
|
|
# (https://msdn.microsoft.com/en-us/library/fsk896zz.aspx).
|
|
# This includes explicitely disabling /Oy to help debugging
|
|
# (https://msdn.microsoft.com/en-us/library/2kxx5t2c.aspx).
|
|
# Also set /Zo to enhance optimized debugging
|
|
# (https://msdn.microsoft.com/en-us/library/dn785163.aspx?f=255&MSPPError=-2147217396).
|
|
QMAKE_CFLAGS_RELEASE -= -Oy
|
|
QMAKE_CXXFLAGS_RELEASE -= -Oy
|
|
|
|
QMAKE_CFLAGS_RELEASE *= -GR -Zi -Zo -Oy-
|
|
QMAKE_CXXFLAGS_RELEASE *= -GR -Zi -Zo -Oy-
|
|
|
|
QMAKE_LFLAGS *= /DEBUG /OPT:REF /OPT:ICF /INCREMENTAL:NO
|
|
}
|
|
|
|
CONFIG(vld) {
|
|
CONFIG(debug, debug|release) {
|
|
DEFINES *= USE_VLD
|
|
INCLUDEPATH *= "$$VLD_PATH/include"
|
|
QMAKE_LIBDIR *= "$$VLD_PATH/lib"
|
|
}
|
|
}
|
|
}
|
|
|
|
unix {
|
|
DEFINES *= RESTRICT=__restrict__
|
|
QMAKE_CFLAGS *= -fvisibility=hidden
|
|
QMAKE_CXXFLAGS *= -fvisibility=hidden
|
|
QMAKE_OBJECTIVE_CFLAGS *= -fvisibility=hidden
|
|
QMAKE_OBJECTIVE_CXXFLAGS *= -fvisibility=hidden
|
|
|
|
QMAKE_CFLAGS *= -Wall -Wextra
|
|
QMAKE_CXXFLAGS *= -Wall -Wextra
|
|
QMAKE_OBJECTIVE_CFLAGS *= -Wall -Wextra
|
|
QMAKE_OBJECTIVE_CXXFLAGS *= -Wall -Wextra
|
|
|
|
# Always enable warnings-as-errors
|
|
# if we're inside a Mumble build environment.
|
|
# Can be disabled with CONFIG+=no-warnings-as-errors.
|
|
MUMBLE_PREFIX=$$(MUMBLE_PREFIX)
|
|
!isEmpty(MUMBLE_PREFIX):!CONFIG(no-warnings-as-errors) {
|
|
CONFIG += warnings-as-errors
|
|
}
|
|
|
|
CONFIG(warnings-as-errors) {
|
|
QMAKE_CFLAGS *= -Werror
|
|
QMAKE_CXXFLAGS *= -Werror
|
|
QMAKE_OBJECTIVE_CFLAGS *= -Werror
|
|
QMAKE_OBJECTIVE_CXXFLAGS *= -Werror
|
|
}
|
|
|
|
CONFIG(opt-gcc) {
|
|
QMAKE_CC = /opt/gcc/bin/gcc
|
|
QMAKE_CXX = /opt/gcc/bin/g++
|
|
QMAKE_LINK = /opt/gcc/bin/g++
|
|
}
|
|
|
|
CONFIG(optgen) {
|
|
QMAKE_CFLAGS *= -O3 -march=native -ffast-math -ftree-vectorize -fprofile-generate
|
|
QMAKE_CXXFLAGS *= -O3 -march=native -ffast-math -ftree-vectorize -fprofile-generate
|
|
QMAKE_OBJECTIVE_CFLAGS *= -O3 -march=native -ffast-math -ftree-vectorize -fprofile-generate
|
|
QMAKE_OBJECTIVE_CXXFLAGS *= -O3 -march=native -ffast-math -ftree-vectorize -fprofile-generate
|
|
QMAKE_LFLAGS *= -fprofile-generate
|
|
}
|
|
|
|
CONFIG(optimize) {
|
|
QMAKE_CFLAGS *= -O3 -march=native -ffast-math -ftree-vectorize -fprofile-use
|
|
QMAKE_CXXFLAGS *= -O3 -march=native -ffast-math -ftree-vectorize -fprofile-use
|
|
QMAKE_OBJECTIVE_CFLAGS *= -O3 -march=native -ffast-math -ftree-vectorize -fprofile-use
|
|
QMAKE_OBJECTIVE_CXXFLAGS *= -O3 -march=native -ffast-math -ftree-vectorize -fprofile-use
|
|
}
|
|
|
|
CONFIG(c++11) {
|
|
# Qt 5 will pass the expected compiler flags
|
|
# needed for C++11 mode when CONFIG includes c++11.
|
|
# But Qt 4 won't, so we add it manually.
|
|
lessThan(QT_MAJOR_VERSION, 5) {
|
|
QMAKE_CXXFLAGS *= -std=c++11
|
|
}
|
|
|
|
# Debian seems to put C++11 variants of shared libraries
|
|
# in /usr/lib/$triple/c++11.
|
|
#
|
|
# At least, that is the case for ZeroC Ice.
|
|
#
|
|
# The expectation is that this is a general convention,
|
|
# so add it to our library search path in C++11 mode.
|
|
MULTIARCH_TRIPLE = $$system($${QMAKE_CXX} -print-multiarch)
|
|
!isEmpty(MULTIARCH_TRIPLE) {
|
|
QMAKE_LIBDIR *= /usr/lib/$${MULTIARCH_TRIPLE}/c++11
|
|
}
|
|
} else {
|
|
# If C++11 support hasn't been explicitly enabled,
|
|
# force C++98/C++03 mode. If we don't do this, newer
|
|
# compilers (such as G++ 6) will default to C++11
|
|
# without us being aware.
|
|
#
|
|
# The flag passed below might seem archaic. And it is.
|
|
# But GCC treats -std=c++98, -std=c++03 and -ansi to
|
|
# mean the same thing. (See the GCC man page in Debian,
|
|
# or https://gcc.gnu.org/onlinedocs/gcc/Standards.html)
|
|
# We use the -std=c++98 variant to be compatible with
|
|
# older compilers such as CentOS 5's default compiler,
|
|
# GCC 4.1.
|
|
QMAKE_CXXFLAGS *= -std=c++98
|
|
}
|
|
}
|
|
|
|
contains(UNAME, FreeBSD) {
|
|
QMAKE_CFLAGS *= -isystem /usr/local/include
|
|
QMAKE_CXXFLAGS *= -isystem /usr/local/include
|
|
QMAKE_LIBDIR *= /usr/lib
|
|
QMAKE_LIBDIR *= /usr/local/lib
|
|
}
|
|
|
|
unix:!macx {
|
|
# If we're building in a Mumble build environment,
|
|
# add its include and lib dirs to the build configuration.
|
|
MUMBLE_PREFIX=$$(MUMBLE_PREFIX)
|
|
!isEmpty(MUMBLE_PREFIX) {
|
|
SYSTEM_INCLUDES = $$(MUMBLE_PREFIX)/include $$[QT_INSTALL_HEADERS]
|
|
QMAKE_LIBDIR *= $$(MUMBLE_PREFIX)/lib
|
|
|
|
for(inc, $$list($$SYSTEM_INCLUDES)) {
|
|
QMAKE_CFLAGS += -isystem $$inc
|
|
QMAKE_CXXFLAGS += -isystem $$inc
|
|
}
|
|
}
|
|
|
|
CONFIG(debug, debug|release) {
|
|
QMAKE_CFLAGS *= -fstack-protector -fPIE
|
|
QMAKE_CXXFLAGS *= -fstack-protector -fPIE
|
|
QMAKE_LFLAGS *= -pie
|
|
QMAKE_LFLAGS *= -Wl,--no-add-needed
|
|
}
|
|
|
|
# Ensure _FORTIFY_SOURCE is not used in debug builds.
|
|
#
|
|
# First, ensure _FORTIFY_SOURCE is undefined.
|
|
# Then -- and, only for release builds -- set
|
|
# _FORTIFY_SOURCE=2.
|
|
#
|
|
# We can't use _FORTIFY_SOURCE in debug builds (which are
|
|
# built with -O0) because _FORTIFY_SOURCE=1 requires -O1
|
|
# and _FORTIFY_SOURCE=2 requires -O2.
|
|
# Modern GLIBCs warn about this since
|
|
# https://sourceware.org/bugzilla/show_bug.cgi?id=13979.
|
|
# In Mumble builds with warnings-as-errors, this will
|
|
# cause build failures.
|
|
#
|
|
# We use the += operator because we care about the
|
|
# ordering of unsetting versus setting the preprocessor
|
|
# define. If they're in the wrong order, this will not
|
|
# work as intended.
|
|
QMAKE_CFLAGS += -U_FORTIFY_SOURCE
|
|
QMAKE_CXXFLAGS += -U_FORTIFY_SOURCE
|
|
CONFIG(release, debug|release) {
|
|
QMAKE_CFLAGS += -D_FORTIFY_SOURCE=2
|
|
QMAKE_CXXFLAGS += -D_FORTIFY_SOURCE=2
|
|
}
|
|
|
|
QMAKE_LFLAGS *= -Wl,-z,relro -Wl,-z,now
|
|
|
|
CONFIG(symbols) {
|
|
QMAKE_CFLAGS *= -g
|
|
QMAKE_CXXFLAGS *= -g
|
|
}
|
|
}
|
|
|
|
macx {
|
|
SYSTEM_INCLUDES = $$(MUMBLE_PREFIX)/include $$[QT_INSTALL_HEADERS]
|
|
QMAKE_LIBDIR *= $$(MUMBLE_PREFIX)/lib
|
|
|
|
for(inc, $$list($$SYSTEM_INCLUDES)) {
|
|
QMAKE_CFLAGS += -isystem $$inc
|
|
QMAKE_CXXFLAGS += -isystem $$inc
|
|
QMAKE_OBJECTIVE_CFLAGS += -isystem $$inc
|
|
QMAKE_OBJECTIVE_CXXFLAGS += -isystem $$inc
|
|
}
|
|
|
|
!CONFIG(universal) {
|
|
CONFIG += no-pch
|
|
|
|
# Qt 5.1 and greater want short-form OS X SDKs.
|
|
isEqual(QT_MAJOR_VERSION, 5) {
|
|
QMAKE_MAC_SDK = macosx
|
|
} else {
|
|
QMAKE_MAC_SDK = $$system(xcrun --sdk macosx --show-sdk-path 2>/dev/null)
|
|
isEmpty(QMAKE_MAC_SDK) {
|
|
QMAKE_MAC_SDK = $$system(xcode-select --print-path)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
|
|
!exists($$QMAKE_MAC_SDK) {
|
|
message("Unable to find usable OS X SDK")
|
|
error("Aborting build")
|
|
}
|
|
}
|
|
}
|
|
|
|
QMAKE_CC = $$system(xcrun -find clang)
|
|
QMAKE_CXX = $$system(xcrun -find clang++)
|
|
QMAKE_LINK = $$system(xcrun -find clang++)
|
|
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
|
|
QMAKE_CFLAGS += -mmacosx-version-min=10.7
|
|
QMAKE_CXXFLAGS += -mmacosx-version-min=10.7
|
|
QMAKE_OBJECTIVE_CFLAGS += -mmacosx-version-min=10.7
|
|
QMAKE_OBJECTIVE_CXXFLAGS += -mmacosx-version-min=10.7
|
|
} else {
|
|
XCODE_PATH=$$system(xcode-select -print-path)
|
|
CONFIG += x86 ppc no-cocoa
|
|
QMAKE_MAC_SDK = $${XCODE_PATH}/SDKs/MacOSX10.5.sdk
|
|
QMAKE_CC = $${XCODE_PATH}/usr/bin/gcc-4.2
|
|
QMAKE_CXX = $${XCODE_PATH}/usr/bin/g++-4.2
|
|
QMAKE_LINK = $${XCODE_PATH}/usr/bin/g++-4.2
|
|
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4
|
|
QMAKE_CFLAGS += -mmacosx-version-min=10.4 -Xarch_i386 -mmmx -Xarch_i386 -msse -Xarch_i386 -msse2
|
|
QMAKE_CXXFLAGS += -mmacosx-version-min=10.4 -Xarch_i386 -mmmx -Xarch_i386 -msse -Xarch_i386 -msse2
|
|
QMAKE_OBJECTIVE_CFLAGS += -mmacosx-version-min=10.4 -Xarch_i386 -mmmx -Xarch_i386 -msse -Xarch_i386 -msse2
|
|
QMAKE_OBJECTIVE_CXXFLAGS += -mmacosx-version-min=10.4 -Xarch_i386 -mmmx -Xarch_i386 -msse -Xarch_i386 -msse2
|
|
DEFINES += USE_MAC_UNIVERSAL
|
|
}
|
|
|
|
QMAKE_LFLAGS += -Wl,-dead_strip -framework Cocoa -framework Carbon
|
|
|
|
CONFIG(symbols) {
|
|
QMAKE_CFLAGS *= -gfull -gdwarf-2
|
|
QMAKE_CXXFLAGS *= -gfull -gdwarf-2
|
|
QMAKE_OBJECTIVE_CFLAGS *= -gfull -gdwarf-2
|
|
QMAKE_OBJECTIVE_CXXFLAGS *= -gfull -gdwarf-2
|
|
}
|
|
}
|
|
|
|
CONFIG(clang-analyzer) {
|
|
QMAKE_CC = $$(CC)
|
|
QMAKE_CXX = $$(CXX)
|
|
}
|
|
|
|
CONFIG(no-pch) {
|
|
CONFIG -= precompile_header
|
|
} else {
|
|
CONFIG *= precompile_header
|
|
}
|
|
|
|
CONFIG(debug, debug|release) {
|
|
DEFINES *= SNAPSHOT_BUILD
|
|
}
|