Commit ec5ae7c7 authored by math's avatar math
Browse files

* Refactored CMakeLists.txt so that GLEW package must be found

 * Outsourced the QApplication to QT GUI where it belongs
 * Outsourced GLEW to GraphicsEngine's CMakeLists.txt
 * Added FindGLEW module
parent d035db61
......@@ -23,9 +23,7 @@
#include <iostream>
#include <QtGui/QApplication>
#include "gui/qt4/BMainWindow.h"
#include "gui/qt4/BMainApplication.h"
/**
* The main routine starting up the whole application.
......@@ -43,13 +41,6 @@ int main( int argc, char* argv[] )
You should have received a copy of the GNU Lesser General Public License\n\
along with BrainCognize. If not, see <http://www.gnu.org/licenses/>." << std::endl;
QApplication appl( argc, argv );
QMainWindow *widget = new QMainWindow;
BMainWindow gui;
gui.setupGUI( widget );
widget->show();
int qtExecResult;
qtExecResult = appl.exec();
return qtExecResult;
BMainApplication app;
return app.runQT( argc, argv );
}
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT( BrainCognize )
# Include local CMake modules
LIST( APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../tools/CMakeModules )
# First of all find out which platform we are on
# and set our own platform variable
# First of all find out which platform we are on and set our own platform variable
SET( BRAINCOGNIZE_PLATFORM_LINUX "Linux" )
SET( BRAINCOGNIZE_PLATFORM_WINDOWS "Windows" )
IF( CMAKE_HOST_SYSTEM MATCHES Linux )
SET( BRAINCOGNIZE_PLATFORM
${BRAINCOGNIZE_PLATFORM_LINUX}
SET( BRAINCOGNIZE_PLATFORM
${BRAINCOGNIZE_PLATFORM_LINUX}
CACHE STRING "The platform we are building on." )
ENDIF( CMAKE_HOST_SYSTEM MATCHES Linux )
IF( CMAKE_HOST_SYSTEM MATCHES Windows )
SET( BRAINCOGNIZE_PLATFORM
SET( BRAINCOGNIZE_PLATFORM
${BRAINCOGNIZE_PLATFORM_WINDOWS}
CACHE STRING "The platform we are building on." )
ENDIF( CMAKE_HOST_SYSTEM MATCHES Windows )
# Package dependencies:
FIND_PACKAGE( Qt4 REQUIRED )
FIND_PACKAGE( OpenGL REQUIRED )
FIND_PACKAGE( Boost REQUIRED )
FIND_PACKAGE( CxxTest QUIET )
# Includes:
INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR} )
INCLUDE_DIRECTORIES( ${OPENGL_INCLUDE_DIR} )
INCLUDE_DIRECTORIES( ${GLEW_INCLUDE_PATH} )
# Libraries for linking:
SET( QT_LINK_LIBRARIES ${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY}
${QT_QTOPENGL_LIBRARY} )
# Platform dependencies
IF( BRAINCOGNIZE_PLATFORM MATCHES ${BRAINCOGNIZE_PLATFORM_WINDOWS} )
SET( LIBRARY_OUTPUT_PATH
${PROJECT_BINARY_DIR}/bin
SET( LIBRARY_OUTPUT_PATH
${PROJECT_BINARY_DIR}/bin
CACHE PATH "The libraries will be put into this directory.")
ELSE( BRAINCOGNIZE_PLATFORM MATCHES ${BRAINCOGNIZE_PLATFORM_WINDOWS} )
SET( LIBRARY_OUTPUT_PATH
${PROJECT_BINARY_DIR}/lib
SET( LIBRARY_OUTPUT_PATH
${PROJECT_BINARY_DIR}/lib
CACHE PATH "The libraries will be put into this directory.")
ENDIF( BRAINCOGNIZE_PLATFORM MATCHES ${BRAINCOGNIZE_PLATFORM_WINDOWS} )
MARK_AS_ADVANCED( LIBRARY_OUTPUT_PATH )
SET( EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin CACHE PATH "The executables will be put into this directory.")
MARK_AS_ADVANCED( EXECUTABLE_OUTPUT_PATH )
IF( CXXTEST_FOUND )
# Enable unit tests via CxxTest
IF( CXXTEST_FOUND )
INCLUDE_DIRECTORIES( ${CXXTEST_INCLUDE_DIR} )
# Package settings:
SET( CXXTEST_USE_PYTHON 1 )
......@@ -63,7 +59,7 @@ ENDIF( CXXTEST_FOUND )
#-----------------------
# -Wno-long-long since on Ubuntu 8.10 it won't compile without it
# -ansi force ISO-C++98 compliance (not GNU++98)
SET( CMAKE_CXX_FLAGS "-Wall -pedantic -ansi -Wno-long-long" )
SET( CMAKE_CXX_FLAGS "-Wall -pedantic -ansi -Wno-long-long" )
ADD_SUBDIRECTORY( math )
ADD_SUBDIRECTORY( dataHandler )
......@@ -72,7 +68,7 @@ ADD_SUBDIRECTORY( gui )
ADD_SUBDIRECTORY( plugins )
ADD_EXECUTABLE( BCognize BCognize.cpp )
TARGET_LINK_LIBRARIES( BCognize guiqt4 ${QT_LINK_LIBRARIES} )
TARGET_LINK_LIBRARIES( BCognize guiqt4 )
# Special targets:
......
# Package dependencies:
FIND_PACKAGE( GLEW REQUIRED )
# Includes:
INCLUDE_DIRECTORIES( ${GLEW_INCLUDE_PATH} )
FILE(GLOB GE_SRC "*.cpp")
ADD_LIBRARY( ge SHARED ${GE_SRC} )
TARGET_LINK_LIBRARIES( ge ${OPENGL_LIBRARIES} )
TARGET_LINK_LIBRARIES( ge ${GLEW_LIBRARY} )
//---------------------------------------------------------------------------
//
// Project: BrainCognize
//
// Copyright 2009 SomeCopyrightowner
//
// This file is part of BrainCognize.
//
// BrainCognize is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// BrainCognize 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BrainCognize. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#include <QtGui/QApplication>
#include "BMainApplication.h"
#include "BMainWindow.h"
int BMainApplication::runQT( int argc, char* argv[] )
{
QApplication appl( argc, argv );
QMainWindow *widget = new QMainWindow;
BMainWindow gui;
gui.setupGUI( widget );
widget->show();
int qtExecResult;
qtExecResult = appl.exec();
return qtExecResult;
}
//---------------------------------------------------------------------------
//
// Project: BrainCognize
//
// Copyright 2009 SomeCopyrightowner
//
// This file is part of BrainCognize.
//
// BrainCognize is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// BrainCognize 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BrainCognize. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef BMAINAPPLICATION_H
#define BMAINAPPLICATION_H
/**
* Starts up the QT GUI.
*/
class BMainApplication
{
public:
/**
* QT GUI needs a QApplication instance with passed argc and argv.
*
* \return Exitcode of QT GUI.
*/
int runQT( int argc, char* argv[] );
protected:
private:
};
#endif // BMAINAPPLICATION_H
# Package dependencies:
FIND_PACKAGE( Qt4 REQUIRED )
# Includes:
INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR} )
# Libraries for linking:
SET( QT_LINK_LIBRARIES ${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY}
${QT_QTOPENGL_LIBRARY} )
FILE(GLOB GUI_QT4_SRC "*.cpp")
ADD_LIBRARY( guiqt4 SHARED ${GUI_QT4_SRC} )
......
#
# Try to find GLEW library and include path.
# Once done this will define
#
# GLEW_FOUND
# GLEW_INCLUDE_PATH
# GLEW_LIBRARY
#
IF (WIN32)
FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h
$ENV{PROGRAMFILES}/GLEW/include
${PROJECT_SOURCE_DIR}/src/nvgl/glew/include
DOC "The directory where GL/glew.h resides")
FIND_LIBRARY( GLEW_LIBRARY
NAMES glew GLEW glew32 glew32s
PATHS
$ENV{PROGRAMFILES}/GLEW/lib
${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin
${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib
DOC "The GLEW library")
ELSE (WIN32)
FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h
/usr/include
/usr/local/include
/sw/include
/opt/local/include
DOC "The directory where GL/glew.h resides")
FIND_LIBRARY( GLEW_LIBRARY
NAMES GLEW glew
PATHS
/usr/lib64
/usr/lib
/usr/local/lib64
/usr/local/lib
/sw/lib
/opt/local/lib
DOC "The GLEW library")
ENDIF (WIN32)
IF (GLEW_INCLUDE_PATH)
SET( GLEW_FOUND 1 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise")
ELSE (GLEW_INCLUDE_PATH)
SET( GLEW_FOUND 0 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise")
ENDIF (GLEW_INCLUDE_PATH)
MARK_AS_ADVANCED( GLEW_FOUND )
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment