Skip to content

Commit

Permalink
qmake: Separated platform-specific parts into config_*.pri
Browse files Browse the repository at this point in the history
To clarify config.pri, the platform-specific configuration was moved
to their own .pri files.

Also, clearing up Mac config with three distinct options: native SDK
with qmake default settings (not for distribution), 10.6+ 64-bit Intel, and
10.4+ 32-bit Intel/PPC.
  • Loading branch information
skyjake committed Mar 19, 2012
1 parent 23a2e2c commit 1a871a2
Show file tree
Hide file tree
Showing 6 changed files with 209 additions and 170 deletions.
172 changes: 7 additions & 165 deletions doomsday/config.pri
Expand Up @@ -5,28 +5,23 @@
# Do not modify this file. Custom CONFIG options can be specified on the
# qmake command line or in config_user.pri.
#
# NOTE: The PREFIX option should always be specified on the qmake command
# line, as it is checked before config_user.pri is read.
#
# User-definable variables:
# PREFIX Install prefix for Unix (specify on qmake command line)
# PREFIX Install prefix for Unix
# SCRIPT_PYTHON Path of the Python interpreter binary to be used in
# generated scripts (python on path used for building)
#
# CONFIG options for Doomsday:
# - deng_32bitonly Only do a 32-bit build (no 64-bit)
# - deng_aptstable Include the stable apt repository .list
# - deng_aptunstable Include the unstable apt repository .list
# - deng_fmod Build the FMOD Ex sound driver
# - deng_nativesdk (Mac OS X) Use the current OS's SDK
# - deng_nativesdk (Mac) Use current OS's SDK for non-distrib use
# - deng_nofixedasm Disable assembler fixed-point math
# - deng_nosdlmixer Disable SDL_mixer; use dummy driver as default
# - deng_nosnowberry (Unix) Exclude Snowberry from installation
# - deng_openal Build the OpenAL sound driver
# - deng_nopackres Do not package the Doomsday resources
# - deng_rangecheck Parameter range checking/value assertions
# - deng_snowberry Include Snowberry in installation
# - deng_snowleopard (Mac OS X) Use 10.6 SDK
# - deng_writertypecheck Enable type checking in Writer/Reader
#
# Read-only options (set automatically):
Expand Down Expand Up @@ -103,115 +98,17 @@ contains(QMAKE_HOST.arch, x86_64) {
DEFINES += HOST_IS_64BIT
}

win32 {
win32-g++* {
error("Sorry, gcc is not supported in the Windows build.")
}

DEFINES += WIN32 _CRT_SECURE_NO_WARNINGS _USE_MATH_DEFINES

# Library location.
DENG_EXPORT_LIB = $$OUT_PWD/../engine/doomsday.lib

# Install locations:
DENG_BASE_DIR = $$DENG_WIN_PRODUCTS_DIR

DENG_LIB_DIR = $$DENG_BASE_DIR/bin
DENG_DATA_DIR = $$DENG_BASE_DIR/data
DENG_DOCS_DIR = $$DENG_BASE_DIR/doc

# Tell rc where to get the API headers.
QMAKE_RC = $$QMAKE_RC /I \"$$DENG_API_DIR\"

# Also build the OpenAL plugin.
CONFIG += deng_openal
}
unix {
# Unix/Mac build options.
DEFINES += UNIX

# Ease up on the warnings. (The old C code is a bit messy.)
QMAKE_CFLAGS_WARN_ON -= -Wall
QMAKE_CFLAGS_WARN_ON -= -W
QMAKE_CFLAGS_WARN_ON += -Werror-implicit-function-declaration
}
unix:!macx {
# Generic Unix build options.
CONFIG += deng_nofixedasm
!deng_nosnowberry: CONFIG += deng_snowberry

exists(/etc/apt) {
# Choose the apt repository to include in the distribution.
isStableRelease(): CONFIG += deng_aptstable
else: CONFIG += deng_aptunstable
}

# Link against standard math library.
LIBS += -lm

# Install prefix.
isEmpty(PREFIX) {
freebsd-*: PREFIX = /usr/local
else: PREFIX = /usr
}

# Binary location.
DENG_BIN_DIR = $$PREFIX/bin

# Library location.
DENG_LIB_DIR = $$PREFIX/lib

contains(QMAKE_HOST.arch, x86_64) {
exists($$PREFIX/lib64) {
DENG_LIB_DIR = $$PREFIX/lib64
}
exists($$PREFIX/lib/x86_64-linux-gnu) {
DENG_LIB_DIR = $$PREFIX/lib/x86_64-linux-gnu
}
}

DENG_BASE_DIR = $$PREFIX/share/doomsday
DENG_DATA_DIR = $$DENG_BASE_DIR/data

echo(Binary directory: $$DENG_BIN_DIR)
echo(Library directory: $$DENG_LIB_DIR)
echo(Doomsday base directory: $$DENG_BASE_DIR)
}
macx {
# Mac OS X build options.
CONFIG += deng_nativesdk deng_nofixedasm

DEFINES += MACOSX

# Print include directories and other info.
#QMAKE_CFLAGS += -Wp,-v

QMAKE_LFLAGS += -flat_namespace -undefined suppress
}
isStableRelease(): DEFINES += DENG_STABLE

# Options defined by the user (may not exist).
exists(config_user.pri) {
include(config_user.pri)
}

# System Tools ---------------------------------------------------------------
exists(config_user.pri): include(config_user.pri)

unix:!macx {
# Python to be used in generated scripts.
isEmpty(SCRIPT_PYTHON) {
exists(/usr/bin/python): SCRIPT_PYTHON = /usr/bin/python
exists(/usr/local/bin/python): SCRIPT_PYTHON = /usr/local/bin/python
}
isEmpty(SCRIPT_PYTHON) {
# Check the system path.
SCRIPT_PYTHON = $$system(which python)
}
}
win32: include(config_win32.pri)
else:macx: include(config_macx.pri)
else: include(config_unix.pri)

# Apply deng_* Configuration -------------------------------------------------

isStableRelease(): DEFINES += DENG_STABLE

deng_nofixedasm {
DEFINES += DENG_NO_FIXED_ASM
}
Expand All @@ -221,58 +118,3 @@ deng_nofixedasm {
deng_nosdlmixer {
DEFINES += DENG_DISABLE_SDLMIXER
}
macx {
# Select OS version.
deng_nativesdk {
echo("Using SDK for your Mac OS version.")
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6
}
else:deng_snowleopard {
echo("Using Mac OS 10.6 SDK.")
QMAKE_MAC_SDK = /Developer/SDKs/MacOSX10.6.sdk
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6
CONFIG += x86 x86_64

deng_32bitonly {
CONFIG -= x86_64
QMAKE_CFLAGS_X86_64 = ""
QMAKE_OBJECTIVE_CFLAGS_X86_64 = ""
QMAKE_LFLAGS_X86_64 = ""
}
}
else {
echo("Using Mac OS 10.4 SDK.")
echo("Architectures: 32-bit Intel + 32-bit PowerPC.")
QMAKE_MAC_SDK = /Developer/SDKs/MacOSX10.4u.sdk
QMAKE_CFLAGS += -mmacosx-version-min=10.4
DEFINES += MACOS_10_4
CONFIG += x86 ppc
}

# What's our arch?
!ppc {
x86_64:x86 {
echo("Architectures: 32-bit Intel + 64-bit Intel.")
}
else:x86_64 {
echo("Architectures: 64-bit Intel.")
}
else {
echo("Architectures: 32-bit Intel.")
}
}

!deng_nativesdk {
# Not using Qt, and anyway these would not point to the chosen SDK.
QMAKE_INCDIR_QT = ""
QMAKE_LIBDIR_QT = ""
}

defineTest(useFramework) {
LIBS += -framework $$1
INCLUDEPATH += $$QMAKE_MAC_SDK/System/Library/Frameworks/$${1}.framework/Headers
export(LIBS)
export(INCLUDEPATH)
return(true)
}
}
96 changes: 96 additions & 0 deletions doomsday/config_macx.pri
@@ -0,0 +1,96 @@
# The Doomsday Engine Project
# Copyright (c) 2011-2012 Jaakko Keränen <jaakko.keranen@iki.fi>
# Copyright (c) 2011-2012 Daniel Swanson <danij@dengine.net>

include(config_unix_any.pri)

DEFINES += MACOSX

CONFIG += deng_nofixedasm

# The native SDK option assumes the build is not for distribution.
!deng_nativesdk {
contains(QT_VERSION, ^4\\.[0-6]\\..*) {
# 4.6 or earlier, assume Tiger with 32-bit Universal Intel/PowerPC binaries.
CONFIG += deng_macx4u_32bit
}
else {
# 4.7 or newer, assume Snow Leopard with 64-bit only Intel.
CONFIG += deng_macx6_64bit
}
}

QMAKE_LFLAGS += -flat_namespace -undefined suppress

# Apply deng_* Configuration -------------------------------------------------

# Three options:
# - deng_nativesdk
# - deng_macx4u_32bit
# - deng_macx6_64bit

deng_nativesdk {
echo(Using native SDK.)
}
else:deng_macx6_64bit {
echo(Using 64-bit only 10.6+ SDK.)
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6
QMAKE_MAC_SDK = /Developer/SDKs/MacOSX10.6.sdk
INCLUDEPATH = $$QMAKE_MAC_SDK/usr/X11/include $$INCLUDEPATH
QMAKE_INCDIR_QT = $${QMAKE_MAC_SDK}$$QMAKE_INCDIR_QT
}
else:deng_macx4u_32bit {
error("32-bit 10.4+ SDK still wip.")
}
else {
error(Unspecified SDK configuration.)
}

#deng_nativesdk {
# echo("Using SDK for your Mac OS version.")
# QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6
#}
#else:deng_snowleopard {
# echo("Using Mac OS 10.6 SDK.")
# QMAKE_MAC_SDK = /Developer/SDKs/MacOSX10.6.sdk
# QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6
# CONFIG += x86 x86_64
#
# deng_32bitonly {
# CONFIG -= x86_64
# QMAKE_CFLAGS_X86_64 = ""
# QMAKE_OBJECTIVE_CFLAGS_X86_64 = ""
# QMAKE_LFLAGS_X86_64 = ""
# }
#}
#else {
# echo("Using Mac OS 10.4 SDK.")
# echo("Architectures: 32-bit Intel + 32-bit PowerPC.")
# QMAKE_MAC_SDK = /Developer/SDKs/MacOSX10.4u.sdk
# QMAKE_CFLAGS += -mmacosx-version-min=10.4
# DEFINES += MACOS_10_4
# CONFIG += x86 ppc
#}

#!deng_nativesdk {
# # Not using Qt, and anyway these would not point to the chosen SDK.
# QMAKE_INCDIR_QT = ""
# QMAKE_LIBDIR_QT = ""
#}

# What's our arch?
archs = "Architectures:"
ppc: archs += ppc32
x86: archs += intel32
x86_64: archs += intel64
echo($$archs)

# Macros ---------------------------------------------------------------------

defineTest(useFramework) {
LIBS += -framework $$1
INCLUDEPATH += $$QMAKE_MAC_SDK/System/Library/Frameworks/$${1}.framework/Headers
export(LIBS)
export(INCLUDEPATH)
return(true)
}
48 changes: 48 additions & 0 deletions doomsday/config_unix.pri
@@ -0,0 +1,48 @@
# The Doomsday Engine Project
# Copyright (c) 2011-2012 Jaakko Keränen <jaakko.keranen@iki.fi>
# Copyright (c) 2011-2012 Daniel Swanson <danij@dengine.net>
#
# Unix configuration (non-Mac).

include(config_unix_any.pri)

CONFIG += deng_nofixedasm

!deng_nosnowberry: CONFIG += deng_snowberry

exists(/etc/apt) {
# Choose the apt repository to include in the distribution.
isStableRelease(): CONFIG += deng_aptstable
else: CONFIG += deng_aptunstable
}

# Link against standard math library.
LIBS += -lm

# Install prefix.
isEmpty(PREFIX) {
freebsd-*: PREFIX = /usr/local
else: PREFIX = /usr
}

# Binary location.
DENG_BIN_DIR = $$PREFIX/bin

# Library location.
DENG_LIB_DIR = $$PREFIX/lib

contains(QMAKE_HOST.arch, x86_64) {
exists($$PREFIX/lib64) {
DENG_LIB_DIR = $$PREFIX/lib64
}
exists($$PREFIX/lib/x86_64-linux-gnu) {
DENG_LIB_DIR = $$PREFIX/lib/x86_64-linux-gnu
}
}

DENG_BASE_DIR = $$PREFIX/share/doomsday
DENG_DATA_DIR = $$DENG_BASE_DIR/data

echo(Binary directory: $$DENG_BIN_DIR)
echo(Library directory: $$DENG_LIB_DIR)
echo(Doomsday base directory: $$DENG_BASE_DIR)
27 changes: 27 additions & 0 deletions doomsday/config_unix_any.pri
@@ -0,0 +1,27 @@
# The Doomsday Engine Project
# Copyright (c) 2011-2012 Jaakko Keränen <jaakko.keranen@iki.fi>
# Copyright (c) 2011-2012 Daniel Swanson <danij@dengine.net>

# Common Unix build options for all Unix-compatible platforms (assumes gcc).

DEFINES += UNIX

# Ease up on the warnings. (The old C code is a bit messy.)
QMAKE_CFLAGS_WARN_ON -= -Wall
QMAKE_CFLAGS_WARN_ON -= -W
QMAKE_CFLAGS_WARN_ON += -Werror-implicit-function-declaration

# Print include directories and other info.
#QMAKE_CFLAGS += -Wp,-v

# Unix System Tools ----------------------------------------------------------

# Python to be used in generated scripts.
isEmpty(SCRIPT_PYTHON) {
exists(/usr/bin/python): SCRIPT_PYTHON = /usr/bin/python
exists(/usr/local/bin/python): SCRIPT_PYTHON = /usr/local/bin/python
}
isEmpty(SCRIPT_PYTHON) {
# Check the system path.
SCRIPT_PYTHON = $$system(which python)
}

0 comments on commit 1a871a2

Please sign in to comment.