Commit 5f7407ed authored by Jussi Lindgren's avatar Jussi Lindgren

Everything: Allowed compilation without GTK.

Subprojects heavily depending on GTK are entirely disabled
if the user disables GTK in the main CMakeLists.txt.
Other projects have limited functionality via include guards.
parent b8c298ad
......@@ -59,9 +59,13 @@ MESSAGE(STATUS " CMAKE_CXX_FLAGS_DEBUG = '${CMAKE_CXX_FLAGS_DEBUG}'")
# if want to compile tests, use the following.
SET(OV_COMPILE_TESTS "true")
# if you don't want an Ogre dependency, use the following. All 3D visualizations and 3D apps will be unavailable. The result will also compile faster.
# if you don't want an Ogre dependency, use the following. All 3D visualizations and 3D apps will be unavailable. The result will compile faster.
# SET(OV_DISABLE_OGRE "true")
# if you don't want a GTK dependency, set the following. Note that most applications including Acquisition Server and Designer will NOT be built.
# This option is mostly of interest to hackers who are interested in using a minimal OpenViBE kernel in their own projects.
# SET(OV_DISABLE_GTK "true")
# By setting SKIP[_FOLDER]* you can skip a subtree (example: SKIP_A_B_C skips folder a/b/c and all its subfolders if any)
# Skip building documentation
......
IF(OV_DISABLE_GTK)
MESSAGE(STATUS "Skipping Plugin Inspector, no GTK")
RETURN()
ENDIF(OV_DISABLE_GTK)
PROJECT(openvibe-plugin-inspector)
SET(PROJECT_VERSION_MAJOR ${OV_GLOBAL_VERSION_MAJOR})
......
IF(OV_DISABLE_GTK)
MESSAGE(STATUS "Skipping Skeleton Generator, no GTK")
RETURN()
ENDIF(OV_DISABLE_GTK)
PROJECT(openvibe-skeleton-generator)
SET(PROJECT_VERSION_MAJOR ${OV_GLOBAL_VERSION_MAJOR})
......
IF(OV_DISABLE_GTK)
MESSAGE(STATUS "Skipping VRPN Simulator, no GTK")
RETURN()
ENDIF(OV_DISABLE_GTK)
PROJECT(openvibe-vrpn-simulator)
SET(PROJECT_VERSION_MAJOR ${OV_GLOBAL_VERSION_MAJOR})
......
IF(OV_DISABLE_GTK)
MESSAGE(STATUS "Skipping Acquisition Server, no GTK")
RETURN()
ENDIF(OV_DISABLE_GTK)
PROJECT(openvibe-acquisition-server)
SET(PROJECT_VERSION_MAJOR ${OV_GLOBAL_VERSION_MAJOR})
......
IF(OV_DISABLE_GTK)
MESSAGE(STATUS "Skipping Designer, no GTK")
RETURN()
ENDIF(OV_DISABLE_GTK)
PROJECT(openvibe-designer)
SET(PROJECT_VERSION_MAJOR ${OV_GLOBAL_VERSION_MAJOR})
......
......@@ -11,6 +11,11 @@
# Sets GTK_CFLAGS_OTHERS
# ---------------------------------
IF(OV_DISABLE_GTK)
MESSAGE(STATUS " GTK disabled")
RETURN()
ENDIF(OV_DISABLE_GTK)
INCLUDE("FindThirdPartyPkgConfig")
IF(WIN32)
pkg_check_modules(GTK gtk+-win32-2.0 gthread-2.0)
......@@ -21,7 +26,9 @@ ENDIF(WIN32)
IF(GTK_FOUND)
MESSAGE(STATUS " Found GTK+...")
INCLUDE_DIRECTORIES(${GTK_INCLUDE_DIRS} ${GTHREAD_INCLUDE_DIRS})
# optimistic...
SET(GTK_FOUND_EVERYTHING "True")
#shouldn't add GTK_CFLAGS, this results in AdditionalIncludeDirectories becoming broken in visual studio
#ADD_DEFINITIONS(${GTK_CFLAGS} ${GTK_CFLAGS_OTHERS} ${GTHREAD_CFLAGS}${GTHREAD_CFLAGS_OTHERS})
#LINK_DIRECTORIES(${GTK_LIBRARY_DIRS} ${GTHREAD_LIBRARY_DIRS})
......@@ -48,11 +55,17 @@ IF(GTK_FOUND)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${GTK_LIB1})
ELSE(GTK_LIB1)
MESSAGE(STATUS " [FAILED] Third party lib ${GTK_LIB}")
SET(GTK_FOUND_EVERYTHING "-NotFound")
ENDIF(GTK_LIB1)
ENDFOREACH(GTK_LIB)
ELSE(GTK_FOUND)
MESSAGE(STATUS " FAILED to find GTK+...")
ENDIF(GTK_FOUND)
IF(GTK_FOUND_EVERYTHING)
INCLUDE_DIRECTORIES(${GTK_INCLUDE_DIRS} ${GTHREAD_INCLUDE_DIRS})
ADD_DEFINITIONS(-DTARGET_HAS_ThirdPartyGTK)
ELSE(GTK_FOUND_EVERYTHING)
MESSAGE(STATUS " FAILED to find GTK+ or its components...")
IF(NOT PKG_CONFIG_FOUND)
MESSAGE(STATUS " Did not even find pkg-config exe")
MESSAGE(STATUS " Did not even find pkg-config exe")
ENDIF(NOT PKG_CONFIG_FOUND)
ENDIF(GTK_FOUND)
ENDIF(GTK_FOUND_EVERYTHING)
IF(OV_DISABLE_GTK)
MESSAGE(STATUS "Skipping CoAdapt P300 Stimulator, no GTK")
RETURN()
ENDIF(OV_DISABLE_GTK)
PROJECT(openvibe-coadapt-p300-stimulator)
SET(PROJECT_VERSION_MAJOR ${OV_GLOBAL_VERSION_MAJOR})
......
......@@ -36,7 +36,9 @@ IObject* Kernel::CKernelObjectFactory::createObject(
create(rClassIdentifier, OV_ClassId_Kernel_Plugins_PluginModule, l_pResult, Kernel::CPluginModule);
#if defined(TARGET_HAS_ThirdPartyGTK)
create(rClassIdentifier, OV_ClassId_Kernel_Visualisation_VisualisationTree, l_pResult, Kernel::CVisualisationTree);
#endif
create(rClassIdentifier, OV_ClassId_Kernel_Visualisation_VisualisationWidget, l_pResult, Kernel::CVisualisationWidget);
create(rClassIdentifier, OV_ClassId_Kernel_Configurable, l_pResult, Kernel::CConfigurable);
......
......@@ -22,6 +22,8 @@
#include "ovkIGtkOVCustomHandler.h"
#include "ovkGtkOVCustom.h"
#if defined(TARGET_HAS_ThirdPartyGTK)
#if defined( __WIN32__ ) || defined( _WIN32 )
# include <gdk/gdkwin32.h>
#else
......@@ -424,3 +426,6 @@ void GtkOVCustom::show_cb(GtkWidget *pWidget, gpointer user_data)
void GtkOVCustom::visibility_notify_event_cb(GtkWidget *pWidget, GdkEventVisibility* pEvent, gpointer user_data)
{
}
#endif
#ifndef __OpenViBEKernel_Kernel_Player_GtkOVCustom_H__
#define __OpenViBEKernel_Kernel_Player_GtkOVCustom_H__
#if defined(TARGET_HAS_ThirdPartyGTK)
#include <gtk/gtkwidget.h>
#include <openvibe/ov_all.h>
......@@ -208,3 +210,5 @@ private:
};
#endif // __OpenViBEKernel_Kernel_Player_GtkOVCustom_H__
#endif
......@@ -10,17 +10,6 @@
#include "ovkCOgreVisualisation.h"
#include "ovkCOgreScene.h"
#if defined TARGET_OS_Windows
# include <gdk/gdkwin32.h>
#elif defined TARGET_OS_Linux
# include <gdk/gdkx.h>
#elif defined TARGET_OS_MacOS
# define Cursor XCursor
# include <gdk/gdkx.h>
# undef Cursor
#else
#endif
using namespace std;
using namespace OpenViBE;
using namespace OpenViBE::Kernel;
......@@ -140,12 +129,12 @@ void COgreScene::getBoundingBox(float32& rMinX, float32& rMinY, float32& rMinZ,
{
std::map < CIdentifier, COgreObject* >::iterator it;
rMinX = FLT_MAX;
rMinY = FLT_MAX;
rMinZ = FLT_MAX;
rMaxX = -FLT_MAX;
rMaxY = -FLT_MAX;
rMaxZ = -FLT_MAX;
rMinX = std::numeric_limits<float>::max();
rMinY = std::numeric_limits<float>::max();
rMinZ = std::numeric_limits<float>::max();
rMaxX = -std::numeric_limits<float>::max();
rMaxY = -std::numeric_limits<float>::max();
rMaxZ = -std::numeric_limits<float>::max();
//get each object's bounding box and update global bounding box
for(it = m_mOgreObjectIds.begin(); it != m_mOgreObjectIds.end(); it++)
......
......@@ -19,6 +19,8 @@
#include <openvibe/ovITimeArithmetics.h>
#if defined(TARGET_HAS_ThirdPartyGTK)
#if defined TARGET_OS_Windows
# include <gdk/gdkwin32.h>
#elif defined TARGET_OS_Linux
......@@ -30,6 +32,8 @@
#else
#endif
#endif
using namespace std;
using namespace OpenViBE;
using namespace OpenViBE::Kernel;
......@@ -106,6 +110,7 @@ CSimulatedBox::CSimulatedBox(const IKernelContext& rKernelContext, CScheduler& r
#endif
m_pOgreVis = ((CVisualisationManager*)(&rKernelContext.getVisualisationManager()))->getOgreVisualisation();
}
CSimulatedBox::~CSimulatedBox(void)
......@@ -114,6 +119,8 @@ CSimulatedBox::~CSimulatedBox(void)
this->getLogManager() << LogLevel_Debug << __OV_FUNC__ << " - " << __OV_FILE__ << ":" << __OV_LINE__ << "\n";
#endif
#if defined(TARGET_HAS_ThirdPartyGTK)
//delete OgreWidgets
std::map<GtkWidget*, CIdentifier>::iterator it;
for(it = m_mOgreWindows.begin(); it != m_mOgreWindows.end(); it = m_mOgreWindows.begin())
......@@ -123,20 +130,20 @@ CSimulatedBox::~CSimulatedBox(void)
gtk_widget_destroy(it->first);
}
#endif
//clear simulated objects map
m_mSimulatedObjects.clear();
//delete OgreScene
#if defined(TARGET_HAS_ThirdPartyOgre3D)
if(m_pOgreVis)
{
m_pOgreVis->deleteScene(m_oSceneIdentifier);
}
#endif
}
#if defined(TARGET_HAS_ThirdPartyOgre3D)
#if defined(TARGET_HAS_ThirdPartyOgre3D) && defined(TARGET_HAS_ThirdPartyGTK)
boolean CSimulatedBox::handleDestroyEvent(GtkWidget* pOVCustomWidget)
{
......@@ -684,7 +691,7 @@ CIdentifier CSimulatedBox::createOgreWindow()
}
#else
// NO ogre
// NO (ogre AND gtk), dummy versions of the functions
boolean CSimulatedBox::handleDestroyEvent(GtkWidget* /* pOVCustomWidget*/ )
{
......
......@@ -7,7 +7,8 @@
#include "ovkCMessageWithData.h"
#include <gtk/gtk.h>
// #include <gtk/gtk.h>
#include <system/CChrono.h>
#include <vector>
#include <string>
......
......@@ -2,11 +2,13 @@
#include "ovkCVisualisationManager.h"
#include "../ovkGtkOVCustom.h"
#if defined(TARGET_HAS_ThirdPartyOgre3D)
#include "../player/ovkCOgreVisualisation.h"
#endif
#if defined(TARGET_HAS_ThirdPartyGTK)
#if defined TARGET_OS_Windows
# include <gdk/gdkwin32.h>
#elif defined TARGET_OS_Linux
......@@ -18,6 +20,8 @@
#else
#endif
#endif
using namespace std;
using namespace OpenViBE;
using namespace OpenViBE::Kernel;
......@@ -48,11 +52,15 @@ CVisualisationManager::CVisualisationManager(const IKernelContext& rKernelContex
CVisualisationManager::~CVisualisationManager()
{
#if defined(TARGET_HAS_ThirdPartyGTK)
if(m_pPrimaryRenderWindowWidget != NULL)
{
//destroy Gtk widget only - the primary RenderWindow it contains will be deleted by Ogre
gtk_widget_destroy(GTK_WIDGET(m_pPrimaryRenderWindowWidget));
}
#endif
#if defined(TARGET_HAS_ThirdPartyOgre3D)
delete m_pOgreVisualisation;
#endif
......@@ -88,6 +96,8 @@ boolean CVisualisationManager::initialize3DContext(void)
try
{
#if defined(TARGET_HAS_ThirdPartyGTK)
this->getLogManager() << LogLevel_Trace << "Creating primary render window\n";
//create primary render window
//----------------------------
......@@ -100,6 +110,10 @@ boolean CVisualisationManager::initialize3DContext(void)
gtk_widget_show_all(m_pPrimaryRenderWindowWidget);
//hide window from now on
gtk_widget_hide_all(m_pPrimaryRenderWindowWidget);
#else
this->getLogManager() << LogLevel_Info << "No GTK, visualisation context has been disabled.\n";
return false;
#endif
}
catch(std::exception& e)
{
......@@ -182,7 +196,7 @@ COgreVisualisation* CVisualisationManager::getOgreVisualisation()
boolean CVisualisationManager::handleRealizeEvent(::GtkWidget* pOVCustomWidget)
{
#if defined(TARGET_HAS_ThirdPartyOgre3D)
#if defined(TARGET_HAS_ThirdPartyOgre3D) && defined(TARGET_HAS_ThirdPartyGTK)
//ensure Ogre could be initialized
if(m_pOgreVisualisation == NULL || m_pOgreVisualisation->ogreInitialized() == false)
{
......@@ -346,3 +360,4 @@ CIdentifier CVisualisationManager::getUnusedIdentifier(void) const
while(it!=m_vVisualisationTree.end() || l_oResult==OV_UndefinedIdentifier);
return l_oResult;
}
#if defined(TARGET_HAS_ThirdPartyGTK)
#include "ovkCVisualisationTree.h"
#include "../ovkCObjectVisitorContext.h"
......@@ -998,3 +1001,5 @@ boolean CVisualisationTree::acceptVisitor(IObjectVisitor& rObjectVisitor)
return true;
}
#endif
#ifndef __OpenViBEKernel_Kernel_Visualisation_CVisualisationTree_H__
#define __OpenViBEKernel_Kernel_Visualisation_CVisualisationTree_H__
#if defined(TARGET_HAS_ThirdPartyGTK)
#include "../ovkTKernelObject.h"
#include "../scenario/ovkTAttributable.h"
......@@ -275,3 +277,5 @@ namespace OpenViBE
};
#endif // __OpenViBEKernel_Kernel_Visualisation_CVisualisationTree_H__
#endif
IF(OV_DISABLE_GTK)
MESSAGE(STATUS "Skipping Plugins: Simple Visualisation, no GTK")
RETURN()
ENDIF(OV_DISABLE_GTK)
PROJECT(openvibe-plugins-simple-visualisation)
SET(PROJECT_VERSION_MAJOR ${OV_GLOBAL_VERSION_MAJOR})
......
#if defined(TARGET_HAS_ThirdPartyGTK)
#include "ovpCKeyboardStimulator.h"
#include <fstream>
......@@ -257,3 +260,5 @@ namespace OpenViBEPlugins
}
};
};
#endif
#ifndef __OpenViBEPlugins_Stimulation_CKeyboardStimulator_H__
#define __OpenViBEPlugins_Stimulation_CKeyboardStimulator_H__
#if defined(TARGET_HAS_ThirdPartyGTK)
#include "../ovp_defines.h"
#include <openvibe/ov_all.h>
......@@ -113,3 +115,5 @@ namespace OpenViBEPlugins
#endif
#endif
......@@ -35,7 +35,10 @@ OVP_Declare_Begin();
rPluginModuleContext.getTypeManager().registerEnumerationEntry(OV_TypeId_PlayerAction, "Pause", OV_TypeId_PlayerAction_Pause.toUInteger());
rPluginModuleContext.getTypeManager().registerEnumerationEntry(OV_TypeId_PlayerAction, "Forward", OV_TypeId_PlayerAction_Forward.toUInteger());
#if defined(TARGET_HAS_ThirdPartyGTK)
OVP_Declare_New(OpenViBEPlugins::Stimulation::CKeyboardStimulatorDesc);
#endif
OVP_Declare_New(OpenViBEPlugins::Stimulation::CSignChangeDetectorDesc);
OVP_Declare_New(OpenViBEPlugins::Stimulation::CBoxAlgorithmPlayerControllerDesc);
......
#if defined(TARGET_HAS_ThirdPartyGTK)
#include "ovpCBoxAlgorithmMouseTracking.h"
#include <openvibe/ovITimeArithmetics.h>
......@@ -162,3 +164,5 @@ void motion_event_handler(GtkWidget* widget, GdkEventMotion* event, gpointer dat
}
#endif
#ifndef __OpenViBEPlugins_BoxAlgorithm_MouseTracking_H__
#define __OpenViBEPlugins_BoxAlgorithm_MouseTracking_H__
#if defined(TARGET_HAS_ThirdPartyGTK)
#include "../ovp_defines.h"
#include <openvibe/ov_all.h>
......@@ -146,4 +148,8 @@ namespace OpenViBEPlugins
};
};
#endif
#endif // __OpenViBEPlugins_BoxAlgorithm_MouseTracking_H__
......@@ -16,5 +16,7 @@ OVP_Declare_Begin();
// OVP_Declare_New(OpenViBEPlugins::Tools::CBoxAlgorithmLatencyEvaluationDesc);
OVP_Declare_New(OpenViBEPlugins::Tools::CBoxAlgorithmMatrixValidityCheckerDesc);
OVP_Declare_New(OpenViBEPlugins::Tools::CBoxAlgorithmMessageSpyDesc);
#if defined(TARGET_HAS_ThirdPartyGTK)
OVP_Declare_New(OpenViBEPlugins::Tools::CBoxAlgorithmMouseTrackingDesc);
#endif
OVP_Declare_End();
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