Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Unix|qmake: Sorting out compilation and linker issues on Ubuntu
The platform-specific sources in engine.pro are now set up a bit more
cleanly. Added a stub for the X11 version of the native DisplayMode.
  • Loading branch information
skyjake committed Mar 22, 2012
1 parent 7b2cabb commit 928d6c7
Show file tree
Hide file tree
Showing 5 changed files with 143 additions and 49 deletions.
4 changes: 3 additions & 1 deletion doomsday/dep_sdl.pri
Expand Up @@ -28,7 +28,9 @@ else:macx {
}
else {
# Generic Unix.
QMAKE_CFLAGS += $$system(pkg-config sdl --cflags)
sdlflags = $$system(pkg-config sdl --cflags)
QMAKE_CFLAGS += $$sdlflags
QMAKE_CXXFLAGS += $$sdlflags
LIBS += $$system(pkg-config sdl --libs)
}

Expand Down
93 changes: 47 additions & 46 deletions doomsday/engine/engine.pro
Expand Up @@ -338,16 +338,53 @@ DENG_HEADERS = \
portable/include/window.h \
portable/include/zipfile.h

# Platform-specific configuration.
unix:!win32 {
DENG_PLATFORM_HEADERS += \
INCLUDEPATH += \
$$DENG_INCLUDE_DIR \
$$DENG_API_DIR

HEADERS += \
$$DENG_API_HEADERS \
$$DENG_HEADERS

# Platform-specific sources.
win32 {
# Windows.
HEADERS += \
$$DENG_WIN_INCLUDE_DIR/dd_winit.h \
$$DENG_WIN_INCLUDE_DIR/directinput.h \
$$DENG_WIN_INCLUDE_DIR/mouse_win32.h \
$$DENG_WIN_INCLUDE_DIR/resource.h

INCLUDEPATH += $$DENG_WIN_INCLUDE_DIR

SOURCES += \
win32/src/dd_winit.c \
win32/src/displaymode_win32.cpp \
win32/src/directinput.c \
win32/src/sys_console.c \
win32/src/sys_findfile.c \
win32/src/joystick.c \
win32/src/mouse_win32.c
}
else:unix {
# Common Unix (including Mac OS X).
HEADERS += \
$$DENG_UNIX_INCLUDE_DIR/dd_uinit.h \
$$DENG_UNIX_INCLUDE_DIR/sys_path.h

INCLUDEPATH += $$DENG_UNIX_INCLUDE_DIR

SOURCES += \
unix/src/dd_uinit.c \
unix/src/joystick.c \
unix/src/sys_console.c \
unix/src/sys_findfile.c \
unix/src/sys_path.c
}

macx {
DENG_PLATFORM_HEADERS += \
# Mac OS X only.
HEADERS += \
$$DENG_MAC_INCLUDE_DIR/MusicPlayer.h

OBJECTIVE_SOURCES += \
Expand All @@ -356,41 +393,13 @@ macx {

INCLUDEPATH += $$DENG_MAC_INCLUDE_DIR
}
win32 {
DENG_PLATFORM_HEADERS += \
$$DENG_WIN_INCLUDE_DIR/dd_winit.h \
$$DENG_WIN_INCLUDE_DIR/directinput.h \
$$DENG_WIN_INCLUDE_DIR/mouse_win32.h \
$$DENG_WIN_INCLUDE_DIR/resource.h

INCLUDEPATH += $$DENG_WIN_INCLUDE_DIR
else:unix {
# Unix (non-Mac) only.
SOURCES += \
unix/src/displaymode_x11.cpp
}

INCLUDEPATH += \
$$DENG_INCLUDE_DIR \
$$DENG_API_DIR

HEADERS += \
$$DENG_API_HEADERS \
$$DENG_PLATFORM_HEADERS \
$$DENG_HEADERS

DENG_UNIX_SOURCES += \
unix/src/dd_uinit.c \
unix/src/joystick.c \
unix/src/sys_console.c \
unix/src/sys_findfile.c \
unix/src/sys_path.c

DENG_WIN32_SOURCES += \
win32/src/dd_winit.c \
win32/src/displaymode_win32.cpp \
win32/src/directinput.c \
win32/src/sys_console.c \
win32/src/sys_findfile.c \
win32/src/joystick.c \
win32/src/mouse_win32.c

# Platform-independent sources.
SOURCES += \
portable/src/abstractfile.c \
portable/src/abstractresource.c \
Expand Down Expand Up @@ -599,14 +608,6 @@ SOURCES += \
portable/src/writer.c \
portable/src/zipfile.c

unix {
SOURCES += $$DENG_UNIX_SOURCES
}

win32 {
SOURCES += $$DENG_WIN32_SOURCES
}

!deng_nosdlmixer {
HEADERS += portable/include/sys_audiod_sdlmixer.h
SOURCES += portable/src/sys_audiod_sdlmixer.c
Expand All @@ -618,7 +619,7 @@ SOURCES += ../plugins/common/src/m_fixed.c

OTHER_FILES += \
data/cphelp.txt \
portable/include/mapdata.hs \
portable/include/mapdata.hs \
portable/include/template.h.template \
portable/src/template.c.template

Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/src/displaymode.cpp
Expand Up @@ -30,7 +30,7 @@
#include <set>
#include <algorithm>

#include <qDebug>
#include <QDebug>

static bool inited = false;

Expand Down
91 changes: 91 additions & 0 deletions doomsday/engine/unix/src/displaymode_x11.cpp
@@ -0,0 +1,91 @@
/**
* @file displaymode_x11.cpp
* X11 implementation of the DisplayMode native functionality. @ingroup gl
*
* Uses the XRandR extension to manipulate the display.
*
* @authors Copyright © 2012 Jaakko Keränen <jaakko.keranen@iki.fi>
*
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
*
* <small>This program 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 2 of the License, or (at your
* option) any later version. This program 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 this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA</small>
*/

#include <QDebug>

#include "de_platform.h"
#include "displaymode_native.h"

#include <assert.h>
#include <vector>

#if 0
static std::vector<DEVMODE> devModes;
static DEVMODE currentDevMode;
#endif

void DisplayMode_Native_Init(void)
{
// Let's see which modes are available.

// And which is the current mode?
}

void DisplayMode_Native_Shutdown(void)
{
#if 0
devModes.clear();
#endif
}

int DisplayMode_Native_Count(void)
{
#if 0
return devModes.size();
#endif
}

void DisplayMode_Native_GetMode(int index, DisplayMode* mode)
{
#if 0
assert(index >= 0 && index < DisplayMode_Native_Count());
*mode = devToDisplayMode(devModes[index]);
#endif
}

void DisplayMode_Native_GetCurrentMode(DisplayMode* mode)
{
#if 0
*mode = devToDisplayMode(currentDevMode);
#endif
}

#if 0
static int findMode(const DisplayMode* mode)
{
for(int i = 0; i < DisplayMode_Native_Count(); ++i)
{
DisplayMode d = devToDisplayMode(devModes[i]);
if(DisplayMode_IsEqual(&d, mode))
{
return i;
}
}
return -1;
}
#endif

int DisplayMode_Native_Change(const DisplayMode* mode, boolean shouldCapture)
{
return false;
}
2 changes: 1 addition & 1 deletion doomsday/engine/win32/src/displaymode_win32.cpp
Expand Up @@ -20,7 +20,7 @@
* 02110-1301 USA</small>
*/

#include <qDebug>
#include <QDebug>

#include "de_platform.h"
//#include <windowsx.h>
Expand Down

0 comments on commit 928d6c7

Please sign in to comment.