summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-10-08 19:48:26 +0300
committerAndrei Karas <akaras@inbox.ru>2012-10-08 19:48:26 +0300
commit196cc38da19b867eaa9419343dd6ecd8212af354 (patch)
treeafb2d39f88c213702a339cae6fa08f8248b5c1af /src
parenta80a1c69f8a5f4db88ade16e3b9d53f7b648be47 (diff)
downloadmanaplus-196cc38da19b867eaa9419343dd6ecd8212af354.tar.gz
manaplus-196cc38da19b867eaa9419343dd6ecd8212af354.tar.bz2
manaplus-196cc38da19b867eaa9419343dd6ecd8212af354.tar.xz
manaplus-196cc38da19b867eaa9419343dd6ecd8212af354.zip
Fix compilation errors and warnings in different modes.
Diffstat (limited to 'src')
-rw-r--r--src/client.cpp4
-rw-r--r--src/graphicsmanager.cpp127
-rw-r--r--src/graphicsmanager.h33
-rw-r--r--src/gui/setup_video.cpp2
-rw-r--r--src/guichan/widgets/textfield.cpp2
-rw-r--r--src/map.cpp4
-rw-r--r--src/maplayer.cpp40
-rw-r--r--src/maplayer.h7
-rw-r--r--src/normalopenglgraphics.cpp2
-rw-r--r--src/normalopenglgraphics.h2
-rw-r--r--src/resources/openglimagehelper.h4
-rw-r--r--src/resources/resourcemanager.cpp2
-rw-r--r--src/resources/resourcemanager.h2
-rw-r--r--src/test/testlauncher.cpp3
-rw-r--r--src/test/testlauncher.h5
-rw-r--r--src/test/testmain.cpp17
-rw-r--r--src/test/testmain.h4
17 files changed, 128 insertions, 132 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 5bf560d32..66a895264 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -798,6 +798,7 @@ void Client::gameClear()
int Client::testsExec() const
{
+#ifdef USE_OPENGL
if (mOptions.test.empty())
{
TestMain test;
@@ -808,6 +809,9 @@ int Client::testsExec() const
TestLauncher launcher(mOptions.test);
return launcher.exec();
}
+#else
+ return 0;
+#endif
}
int Client::gameExec()
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp
index 21fea5738..c69937073 100644
--- a/src/graphicsmanager.cpp
+++ b/src/graphicsmanager.cpp
@@ -46,6 +46,7 @@
#include "debug.h"
+#ifdef USE_OPENGL
#ifndef GL_MAX_RENDERBUFFER_SIZE
#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
#endif
@@ -59,6 +60,7 @@
#define assignFunction(func, name) m##func \
= reinterpret_cast<func##_t>(getFunction(name))
+#endif
GraphicsManager graphicsManager;
@@ -85,20 +87,16 @@ GraphicsManager::~GraphicsManager()
#endif
}
+#ifdef USE_OPENGL
TestMain *GraphicsManager::startDetection()
{
-#ifdef USE_OPENGL
TestMain *test = new TestMain();
test->exec(false);
return test;
-#else
- return nullptr;
-#endif
}
int GraphicsManager::detectGraphics()
{
-#ifdef USE_OPENGL
logger->log("start detecting best mode...");
logger->log("enable opengl mode");
int textureSampler = 0;
@@ -176,14 +174,10 @@ int GraphicsManager::detectGraphics()
logger->log("detection complete");
return mode | (1024 * textureSampler) | (2048 * compressTextures);
-#else
- return 0;
-#endif
}
void GraphicsManager::initGraphics(bool noOpenGL)
{
-#ifdef USE_OPENGL
int useOpenGL = 0;
if (!noOpenGL)
useOpenGL = config.getIntValue("opengl");
@@ -218,6 +212,8 @@ void GraphicsManager::initGraphics(bool noOpenGL)
mUseAtlases = imageHelper->useOpenGL()
&& config.getBoolValue("useAtlases");
#else
+void GraphicsManager::initGraphics(bool noOpenGL A_UNUSED)
+{
// Create the graphics context
imageHelper = new SDLImageHelper;
sdlImageHelper = imageHelper;
@@ -243,9 +239,49 @@ Graphics *GraphicsManager::createGraphics()
#endif
}
-void GraphicsManager::updateExtensions()
+void GraphicsManager::setVideoMode()
{
+ const int width = config.getIntValue("screenwidth");
+ const int height = config.getIntValue("screenheight");
+ const int bpp = 0;
+ const bool fullscreen = config.getBoolValue("screen");
+ const bool hwaccel = config.getBoolValue("hwaccel");
+ const bool enableResize = config.getBoolValue("enableresize");
+ const bool noFrame = config.getBoolValue("noframe");
+
+ // Try to set the desired video mode
+ if (!mainGraphics->setVideoMode(width, height, bpp,
+ fullscreen, hwaccel, enableResize, noFrame))
+ {
+ logger->log(strprintf("Couldn't set %dx%dx%d video mode: %s",
+ width, height, bpp, SDL_GetError()));
+
+ const int oldWidth = config.getValueInt("oldscreenwidth", -1);
+ const int oldHeight = config.getValueInt("oldscreenheight", -1);
+ const int oldFullscreen = config.getValueInt("oldscreen", -1);
+ if (oldWidth != -1 && oldHeight != -1 && oldFullscreen != -1)
+ {
+ config.deleteKey("oldscreenwidth");
+ config.deleteKey("oldscreenheight");
+ config.deleteKey("oldscreen");
+
+ config.setValueInt("screenwidth", oldWidth);
+ config.setValueInt("screenheight", oldHeight);
+ config.setValue("screen", oldFullscreen == 1);
+ if (!mainGraphics->setVideoMode(oldWidth, oldHeight, bpp,
+ oldFullscreen, hwaccel, enableResize, noFrame))
+ {
+ logger->safeError(strprintf("Couldn't restore %dx%dx%d "
+ "video mode: %s", oldWidth, oldHeight, bpp,
+ SDL_GetError()));
+ }
+ }
+ }
+}
+
#ifdef USE_OPENGL
+void GraphicsManager::updateExtensions()
+{
if (checkGLVersion(3, 0))
assignFunction(glGetStringi, "glGetStringi");
@@ -273,12 +309,10 @@ void GraphicsManager::updateExtensions()
splitToStringSet(mExtensions, extensions, ' ');
}
-#endif
}
void GraphicsManager::updatePlanformExtensions()
{
-#ifdef USE_OPENGL
SDL_SysWMinfo info;
SDL_VERSION(&info.version);
if (SDL_GetWMInfo(&info))
@@ -352,7 +386,6 @@ void GraphicsManager::updatePlanformExtensions()
}
#endif
}
-#endif
}
bool GraphicsManager::supportExtension(const std::string &ext)
@@ -362,7 +395,6 @@ bool GraphicsManager::supportExtension(const std::string &ext)
void GraphicsManager::updateTextureFormat()
{
-#ifdef USE_OPENGL
if (config.getBoolValue("compresstextures"))
{
// using extensions if can
@@ -421,31 +453,24 @@ void GraphicsManager::updateTextureFormat()
OpenGLImageHelper::setInternalTextureType(4);
logger->log1("using 4 texture format");
}
-#endif
}
+#endif
+
+#ifdef USE_OPENGL
void GraphicsManager::logString(const char *format, int num)
{
-#ifdef USE_OPENGL
const char *str = reinterpret_cast<const char*>(glGetString(num));
if (!str)
logger->log(format, "?");
else
logger->log(format, str);
-#endif
}
std::string GraphicsManager::getGLString(int num) const
{
-#ifdef USE_OPENGL
const char *str = reinterpret_cast<const char*>(glGetString(num));
- if (str)
- return str;
- else
- return "";
-#else
- return "";
-#endif
+ return str ? str : "";
}
void GraphicsManager::setGLVersion()
@@ -463,47 +488,6 @@ void GraphicsManager::logVersion()
logger->log("gl version: " + mGlVersionString);
}
-void GraphicsManager::setVideoMode()
-{
- const int width = config.getIntValue("screenwidth");
- const int height = config.getIntValue("screenheight");
- const int bpp = 0;
- const bool fullscreen = config.getBoolValue("screen");
- const bool hwaccel = config.getBoolValue("hwaccel");
- const bool enableResize = config.getBoolValue("enableresize");
- const bool noFrame = config.getBoolValue("noframe");
-
- // Try to set the desired video mode
- if (!mainGraphics->setVideoMode(width, height, bpp,
- fullscreen, hwaccel, enableResize, noFrame))
- {
- logger->log(strprintf("Couldn't set %dx%dx%d video mode: %s",
- width, height, bpp, SDL_GetError()));
-
- const int oldWidth = config.getValueInt("oldscreenwidth", -1);
- const int oldHeight = config.getValueInt("oldscreenheight", -1);
- const int oldFullscreen = config.getValueInt("oldscreen", -1);
- if (oldWidth != -1 && oldHeight != -1 && oldFullscreen != -1)
- {
- config.deleteKey("oldscreenwidth");
- config.deleteKey("oldscreenheight");
- config.deleteKey("oldscreen");
-
- config.setValueInt("screenwidth", oldWidth);
- config.setValueInt("screenheight", oldHeight);
- config.setValue("screen", oldFullscreen == 1);
- if (!mainGraphics->setVideoMode(oldWidth, oldHeight, bpp,
- oldFullscreen, hwaccel, enableResize, noFrame))
- {
- logger->safeError(strprintf("Couldn't restore %dx%dx%d "
- "video mode: %s", oldWidth, oldHeight, bpp,
- SDL_GetError()));
- }
- }
- }
-}
-
-
bool GraphicsManager::checkGLVersion(int major, int minor) const
{
return mMajor > major || (mMajor == major && mMinor >= minor);
@@ -517,7 +501,6 @@ bool GraphicsManager::checkPlatformVersion(int major, int minor) const
void GraphicsManager::createFBO(int width, int height, FBOInfo *fbo)
{
-#ifdef USE_OPENGL
if (!fbo)
return;
@@ -557,12 +540,10 @@ void GraphicsManager::createFBO(int width, int height, FBOInfo *fbo)
mglBindFramebuffer(GL_FRAMEBUFFER, fbo->fboId);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-#endif
}
void GraphicsManager::deleteFBO(FBOInfo *fbo)
{
-#ifdef USE_OPENGL
if (!fbo)
return;
@@ -583,12 +564,10 @@ void GraphicsManager::deleteFBO(FBOInfo *fbo)
glDeleteTextures(1, &fbo->textureId);
fbo->textureId = 0;
}
-#endif
}
void GraphicsManager::initOpenGLFunctions()
{
-#ifdef USE_OPENGL
if (!checkGLVersion(1, 1))
return;
@@ -642,12 +621,10 @@ void GraphicsManager::initOpenGLFunctions()
#ifdef WIN32
assignFunction(wglGetExtensionsString, "wglGetExtensionsStringARB");
#endif
-#endif
}
void GraphicsManager::updateLimits()
{
-#ifdef USE_OPENGL
GLint value;
glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, &value);
logger->log("GL_MAX_ELEMENTS_VERTICES: %d", value);
@@ -664,19 +641,16 @@ void GraphicsManager::updateLimits()
glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &value);
logger->log("Max FBO size: %d", value);
mMaxFboSize = value;
-#endif
}
void GraphicsManager::initOpenGL()
{
-#ifdef USE_OPENGL
setGLVersion();
updateExtensions();
initOpenGLFunctions();
updatePlanformExtensions();
createTextureSampler();
updateLimits();
-#endif
}
void GraphicsManager::createTextureSampler()
@@ -738,3 +712,4 @@ void GraphicsManager::detectVideoSettings()
delete test;
}
}
+#endif
diff --git a/src/graphicsmanager.h b/src/graphicsmanager.h
index 2373e598f..db2a8afc4 100644
--- a/src/graphicsmanager.h
+++ b/src/graphicsmanager.h
@@ -50,6 +50,11 @@ class GraphicsManager final
void initGraphics(bool noOpenGL);
+ void setVideoMode();
+
+ Graphics *createGraphics();
+
+#ifdef USE_OPENGL
TestMain *startDetection();
int detectGraphics();
@@ -58,14 +63,6 @@ class GraphicsManager final
void updateTextureFormat();
- void logString(const char *format, int num);
-
- std::string getGLString(int num) const;
-
- void setGLVersion();
-
- void setVideoMode();
-
bool checkGLVersion(int major, int minor) const;
bool checkPlatformVersion(int major, int minor) const;
@@ -84,12 +81,6 @@ class GraphicsManager final
void updateLimits();
- void detectVideoSettings();
-
- Graphics *createGraphics();
-
- void createTextureSampler();
-
int getMaxVertices() const
{ return mMaxVertices; }
@@ -98,11 +89,21 @@ class GraphicsManager final
void logVersion();
-#ifdef USE_OPENGL
+ void setGLVersion();
+
+ std::string getGLString(int num) const;
+
+ void logString(const char *format, int num);
+
+ void detectVideoSettings();
+
+ void createTextureSampler();
+
bool isUseTextureSampler() const
{ return mUseTextureSampler; }
-#endif
+
unsigned int getLastError();
+#endif
private:
std::set<std::string> mExtensions;
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp
index 35293fec4..9c6b3f064 100644
--- a/src/gui/setup_video.cpp
+++ b/src/gui/setup_video.cpp
@@ -559,6 +559,7 @@ void Setup_Video::action(const gcn::ActionEvent &event)
{
config.setValue("noframe", mNoFrameCheckBox->isSelected());
}
+#ifdef USE_OPENGL
else if (id == "detect")
{
TestMain *test = graphicsManager.startDetection();
@@ -570,6 +571,7 @@ void Setup_Video::action(const gcn::ActionEvent &event)
delete test;
}
}
+#endif
}
void Setup_Video::externalUpdated()
diff --git a/src/guichan/widgets/textfield.cpp b/src/guichan/widgets/textfield.cpp
index 52aefee54..94bf208fe 100644
--- a/src/guichan/widgets/textfield.cpp
+++ b/src/guichan/widgets/textfield.cpp
@@ -94,7 +94,7 @@ namespace gcn
mText = text;
}
- void TextField::drawCaret(Graphics* graphics, int x)
+ void TextField::drawCaret(Graphics* graphics A_UNUSED, int x A_UNUSED)
{
}
diff --git a/src/map.cpp b/src/map.cpp
index e68f063d9..c31356276 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -358,6 +358,7 @@ void Map::draw(Graphics *graphics, int scrollX, int scrollY)
graphics->mWidth, graphics->mHeight));
}
+#ifdef USE_OPENGL
int updateFlag = 0;
if (mOpenGL == 1)
@@ -382,6 +383,7 @@ void Map::draw(Graphics *graphics, int scrollX, int scrollY)
updateFlag = 1;
}
}
+#endif
if (mDebugFlags == MAP_SPECIAL3 || mDebugFlags == MAP_BLACKWHITE)
{
@@ -412,6 +414,7 @@ void Map::draw(Graphics *graphics, int scrollX, int scrollY)
}
else
{
+#ifdef USE_OPENGL
if (mOpenGL == 1 && updateFlag != 2)
{
if (updateFlag)
@@ -423,6 +426,7 @@ void Map::draw(Graphics *graphics, int scrollX, int scrollY)
(*layeri)->drawOGL(graphics);
}
else
+#endif
{
/*
if (updateFlag)
diff --git a/src/maplayer.cpp b/src/maplayer.cpp
index 654cb7997..fcecb17bd 100644
--- a/src/maplayer.cpp
+++ b/src/maplayer.cpp
@@ -147,6 +147,25 @@ void MapLayer::draw(Graphics *const graphics,
}
}
+void MapLayer::drawSDL(Graphics *const graphics)
+{
+ MapRows::const_iterator rit = mTempRows.begin();
+ const MapRows::const_iterator rit_end = mTempRows.end();
+ while (rit != rit_end)
+ {
+ MepRowImages *const images = &(*rit)->images;
+ MepRowImages::const_iterator iit = images->begin();
+ const MepRowImages::const_iterator iit_end = images->end();
+ while (iit != iit_end)
+ {
+ graphics->drawTile(*iit);
+ ++ iit;
+ }
+ ++ rit;
+ }
+}
+
+#ifdef USE_OPENGL
void MapLayer::updateSDL(Graphics *const graphics, int startX, int startY,
int endX, int endY,
const int scrollX, const int scrollY,
@@ -209,30 +228,11 @@ void MapLayer::updateSDL(Graphics *const graphics, int startX, int startY,
}
}
-void MapLayer::drawSDL(Graphics *const graphics)
-{
- MapRows::const_iterator rit = mTempRows.begin();
- const MapRows::const_iterator rit_end = mTempRows.end();
- while (rit != rit_end)
- {
- MepRowImages *const images = &(*rit)->images;
- MepRowImages::const_iterator iit = images->begin();
- const MepRowImages::const_iterator iit_end = images->end();
- while (iit != iit_end)
- {
- graphics->drawTile(*iit);
- ++ iit;
- }
- ++ rit;
- }
-}
-
void MapLayer::updateOGL(Graphics *const graphics, int startX, int startY,
int endX, int endY,
const int scrollX, const int scrollY,
const int debugFlags)
{
-#ifdef USE_OPENGL
delete_all(mTempRows);
mTempRows.clear();
@@ -303,7 +303,6 @@ void MapLayer::updateOGL(Graphics *const graphics, int startX, int startY,
}
}
}
-#endif
}
void MapLayer::drawOGL(Graphics *const graphics)
@@ -326,6 +325,7 @@ void MapLayer::drawOGL(Graphics *const graphics)
}
// logger->log("draws: %d", k);
}
+#endif
void MapLayer::drawFringe(Graphics *const graphics, int startX, int startY,
int endX, int endY,
diff --git a/src/maplayer.h b/src/maplayer.h
index 355ae3f80..59a612cbb 100644
--- a/src/maplayer.h
+++ b/src/maplayer.h
@@ -26,6 +26,7 @@
#include "actor.h"
#include "configlistener.h"
#include "position.h"
+#include "main.h"
#include <string>
#include <vector>
@@ -114,15 +115,17 @@ class MapLayer final: public ConfigListener
const int scrollX, const int scrollY,
const int mDebugFlags) const;
- void drawOGL(Graphics *const graphics);
-
void drawSDL(Graphics *const graphics);
+#ifdef USE_OPENGL
+ void drawOGL(Graphics *const graphics);
+
void updateOGL(Graphics *const graphics,
int startX, int startY,
int endX, int endY,
const int scrollX, const int scrollY,
const int mDebugFlags);
+#endif
void updateSDL(Graphics *const graphics,
int startX, int startY,
diff --git a/src/normalopenglgraphics.cpp b/src/normalopenglgraphics.cpp
index df52526bc..0004e2b59 100644
--- a/src/normalopenglgraphics.cpp
+++ b/src/normalopenglgraphics.cpp
@@ -828,7 +828,7 @@ void NormalOpenGLGraphics::calcTile(ImageVertexes *const vert,
NormalOpenGLGraphicsVertexes &ogl = vert->ogl;
- std::vector<int> *vps = ogl.getVp();
+// std::vector<int> *vps = ogl.getVp();
unsigned int vp = ogl.continueVp();
// Draw a set of textured rectangles
diff --git a/src/normalopenglgraphics.h b/src/normalopenglgraphics.h
index 46f88bfe3..57815af38 100644
--- a/src/normalopenglgraphics.h
+++ b/src/normalopenglgraphics.h
@@ -23,10 +23,10 @@
#ifndef OPENGLGRAPHICS_H
#define OPENGLGRAPHICS_H
+#include "main.h"
#ifdef USE_OPENGL
#include "localconsts.h"
-#include "main.h"
#include "graphics.h"
#include "resources/fboinfo.h"
diff --git a/src/resources/openglimagehelper.h b/src/resources/openglimagehelper.h
index e1a6d48cc..e5c0cab5e 100644
--- a/src/resources/openglimagehelper.h
+++ b/src/resources/openglimagehelper.h
@@ -26,16 +26,15 @@
#include "localconsts.h"
#include "main.h"
+#ifdef USE_OPENGL
#include "utils/stringvector.h"
#include "resources/imagehelper.h"
#include <SDL.h>
-#ifdef USE_OPENGL
#define GL_GLEXT_PROTOTYPES 1
#include <SDL_opengl.h>
-#endif
class Dye;
class Image;
@@ -125,3 +124,4 @@ class OpenGLImageHelper final : public ImageHelper
};
#endif
+#endif
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index f67bbf71b..3c5e35738 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -720,6 +720,7 @@ Image *ResourceManager::getSubImage(Image *const parent,
return static_cast<Image*>(get(ss.str(), SubImageLoader::load, &rl));
}
+#ifdef USE_OPENGL
struct AtlasLoader
{
const std::string name;
@@ -745,6 +746,7 @@ Resource *ResourceManager::getAtlas(const std::string &name,
return get("atlas_" + name, AtlasLoader::load, &rl);
}
+#endif
struct SpriteDefLoader
{
diff --git a/src/resources/resourcemanager.h b/src/resources/resourcemanager.h
index 6f8b386f0..80461ce19 100644
--- a/src/resources/resourcemanager.h
+++ b/src/resources/resourcemanager.h
@@ -212,7 +212,9 @@ class ResourceManager final
Image *getSubImage(Image *const parent, const int x, const int y,
const int width, const int height);
+#ifdef USE_OPENGL
Resource *getAtlas(const std::string &name, const StringVect &files);
+#endif
/**
* Creates a sprite definition based on a given path and the supplied
diff --git a/src/test/testlauncher.cpp b/src/test/testlauncher.cpp
index 609198a97..6d79f2e8e 100644
--- a/src/test/testlauncher.cpp
+++ b/src/test/testlauncher.cpp
@@ -20,6 +20,8 @@
#include "test/testlauncher.h"
+#ifdef USE_OPENGL
+
#include "client.h"
#include "configuration.h"
#include "graphics.h"
@@ -248,3 +250,4 @@ int TestLauncher::calcFps(const timeval *const start, const timeval *const end,
return static_cast<long>(calls) * 1000 / mtime;
}
+#endif
diff --git a/src/test/testlauncher.h b/src/test/testlauncher.h
index af5c53578..baa20c921 100644
--- a/src/test/testlauncher.h
+++ b/src/test/testlauncher.h
@@ -21,6 +21,10 @@
#ifndef TEST_TESTLAUNCHER_H
#define TEST_TESTLAUNCHER_H
+#include "main.h"
+
+#ifdef USE_OPENGL
+
#include <fstream>
#include <string>
#include <sys/time.h>
@@ -57,4 +61,5 @@ class TestLauncher
std::ofstream file;
};
+#endif
#endif // TEST_TESTLAUNCHER_H
diff --git a/src/test/testmain.cpp b/src/test/testmain.cpp
index 535cfebc4..dec7b3248 100644
--- a/src/test/testmain.cpp
+++ b/src/test/testmain.cpp
@@ -18,8 +18,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "test/testmain.h"
+#ifdef USE_OPENGL
#include "utils/gettext.h"
#include "client.h"
@@ -205,7 +207,7 @@ int TestMain::exec(const bool testAudio)
void TestMain::writeConfig(const int openGLMode, const int rescale,
const int sound, const std::string &info,
- const int batchSize, const int detectMode)
+ const int batchSize A_UNUSED, const int detectMode)
{
mConfig.init(Client::getConfigDirectory() + "/config.xml");
@@ -297,39 +299,28 @@ int TestMain::invokeSoftwareRenderTest(std::string test)
int TestMain::invokeFastOpenGLRenderTest(std::string test)
{
-#if defined USE_OPENGL
mConfig.setValue("opengl", 1);
mConfig.write();
const int ret = execFileWait(fileName, fileName, "-t", test, 30);
log->log("%s: %d", test.c_str(), ret);
return ret;
-#else
- return -1;
-#endif
}
int TestMain::invokeFastOpenBatchTest(std::string test)
{
-#if defined USE_OPENGL
mConfig.setValue("opengl", 1);
mConfig.write();
const int ret = execFileWait(fileName, fileName, "-t", test, 30);
// log->log("%s: %d", test.c_str(), ret);
return ret;
-#else
- return -1;
-#endif
}
int TestMain::invokeSafeOpenGLRenderTest(std::string test)
{
-#if defined USE_OPENGL
mConfig.setValue("opengl", 2);
mConfig.write();
const int ret = execFileWait(fileName, fileName, "-t", test, 30);
log->log("%s: %d", test.c_str(), ret);
return ret;
-#else
- return -1;
-#endif
}
+#endif
diff --git a/src/test/testmain.h b/src/test/testmain.h
index 2367b7d1b..69d2b8f77 100644
--- a/src/test/testmain.h
+++ b/src/test/testmain.h
@@ -23,6 +23,9 @@
#include "configuration.h"
#include "logger.h"
+#include "main.h"
+
+#ifdef USE_OPENGL
#include <string>
@@ -70,4 +73,5 @@ class TestMain
Configuration mConfig;
};
+#endif
#endif // TEST_TESTMAIN_H