summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--cmake/FindLTDL.cmake30
-rw-r--r--cmake/mxe.cmake1
-rw-r--r--src/CBot/CMakeLists.txt3
-rw-r--r--src/CMakeLists.txt29
-rw-r--r--src/app/app.cpp7
-rw-r--r--src/app/app.h4
-rw-r--r--src/sound/oalsound/CMakeLists.txt24
-rw-r--r--src/sound/oalsound/alsound.cpp40
-rw-r--r--src/sound/oalsound/test/CMakeLists.txt14
-rw-r--r--src/sound/oalsound/test/plugin_test.cpp40
11 files changed, 40 insertions, 154 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fc172ee..a80e7d3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,6 +38,8 @@ option(CBOT_STATIC "Build CBot as static libary" OFF)
# Doxygen docs are optional for installation
option(INSTALL_DOCS "Install Doxygen-generated documentation" OFF)
+# Build openal sound support
+option(OPENAL_SOUND "Build openal sound support" OFF)
##
# Required packages
diff --git a/cmake/FindLTDL.cmake b/cmake/FindLTDL.cmake
deleted file mode 100644
index 051e70c..0000000
--- a/cmake/FindLTDL.cmake
+++ /dev/null
@@ -1,30 +0,0 @@
-# Find the native LTDL includes and library
-# Copied verbatim from
-# http://code.metager.de/source/xref/hshannover/trust/tnc-fhh/shared/cmake_modules/FindLTDL.cmake
-# The above version was under GPL-2, this one is under GPL-3, for consistency
-# with the rest of the colobot project.
-#
-# This module defines
-# LTDL_INCLUDE_DIR, where to find ltdl.h, etc.
-# LTDL_LIBRARY, where to find the LTDL library.
-# LTDL_FOUND, If false, do not try to use LTDL.
-
-FIND_PATH(LTDL_INCLUDE_DIR ltdl.h)
-
-FIND_LIBRARY(LTDL_LIBRARY ltdl)
-
-IF (LTDL_INCLUDE_DIR AND LTDL_LIBRARY)
- SET(LTDL_FOUND TRUE)
-ELSE(LTDL_INCLUDE_DIR AND LTDL_LIBRARY)
- SET(LTDL_FOUND FALSE)
-ENDIF (LTDL_INCLUDE_DIR AND LTDL_LIBRARY)
-
-IF (LTDL_FOUND)
- IF (NOT LTDL_FIND_QUIETLY)
- MESSAGE(STATUS "Found LTDL: ${LTDL_LIBRARY}")
- ENDIF (NOT LTDL_FIND_QUIETLY)
-ELSE (LTDL_FOUND)
- IF (LTDL_FIND_REQUIRED)
- MESSAGE(FATAL_ERROR "Could not find LTDL")
- ENDIF (LTDL_FIND_REQUIRED)
-ENDIF (LTDL_FOUND)
diff --git a/cmake/mxe.cmake b/cmake/mxe.cmake
index 4507a80..5c5ebde 100644
--- a/cmake/mxe.cmake
+++ b/cmake/mxe.cmake
@@ -23,6 +23,7 @@ if((${CMAKE_CROSSCOMPILING}) AND (DEFINED MSYS))
${CMAKE_FIND_ROOT_PATH}/lib/libjpeg.a
${CMAKE_FIND_ROOT_PATH}/lib/libwinmm.a
${CMAKE_FIND_ROOT_PATH}/lib/libdxguid.a
+ ${CMAKE_FIND_ROOT_PATH}/lib/libbz2.a
)
else()
set(MXE 0)
diff --git a/src/CBot/CMakeLists.txt b/src/CBot/CMakeLists.txt
index a347500..daf08c6 100644
--- a/src/CBot/CMakeLists.txt
+++ b/src/CBot/CMakeLists.txt
@@ -16,6 +16,5 @@ if(${CBOT_STATIC})
add_library(CBot STATIC ${SOURCES})
else()
add_library(CBot SHARED ${SOURCES})
+ install(TARGETS CBot LIBRARY DESTINATION ${COLOBOT_INSTALL_LIB_DIR})
endif()
-
-install(TARGETS CBot LIBRARY DESTINATION ${COLOBOT_INSTALL_LIB_DIR})
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 0c51a48..3339b1a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -27,9 +27,24 @@ endif()
# Additional libraries per platform
set(PLATFORM_LIBS "")
+set(OPENAL_LIBS "")
+
+if (${OPENAL_SOUND})
+ if (${MXE})
+ set(OPENAL_LIBS
+ ${CMAKE_FIND_ROOT_PATH}/lib/libOpenAL32.a
+ ${CMAKE_FIND_ROOT_PATH}/lib/libalut.a
+ )
+ else()
+ set(OPENAL_LIBS
+ openal
+ alut
+ )
+ endif()
+endif()
if (${MXE}) # MXE requires special treatment
- set(PLATFORM_LIBS ${MXE_LIBS})
+ set(PLATFORM_LIBS ${MXE_LIBS})
elseif (${PLATFORM_WINDOWS})
# because it isn't included in standard linking libraries
set(PLATFORM_LIBS "-lintl")
@@ -42,6 +57,15 @@ endif()
# Configure file
configure_file(common/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/common/config.h)
+set(OPENAL_SRC "")
+
+if (${OPENAL_SOUND})
+ set(OPENAL_SRC
+ sound/oalsound/alsound.cpp
+ sound/oalsound/buffer.cpp
+ sound/oalsound/channel.cpp
+ )
+endif()
# Source files
set(SOURCES
@@ -160,8 +184,10 @@ ui/slider.cpp
ui/studio.cpp
ui/target.cpp
ui/window.cpp
+${OPENAL_SRC}
)
+
set(LIBS
${SDL_LIBRARY}
${SDLIMAGE_LIBRARY}
@@ -172,6 +198,7 @@ ${OPTIONAL_LIBS}
${PLATFORM_LIBS}
${Boost_LIBRARIES}
CBot
+${OPENAL_LIBS}
)
include_directories(
diff --git a/src/app/app.cpp b/src/app/app.cpp
index 3073d77..924ec74 100644
--- a/src/app/app.cpp
+++ b/src/app/app.cpp
@@ -89,7 +89,6 @@ CApplication::CApplication()
m_private = new ApplicationPrivate();
m_iMan = new CInstanceManager();
m_eventQueue = new CEventQueue(m_iMan);
- m_pluginManager = new CPluginManager();
m_profile = new CProfile();
m_engine = nullptr;
@@ -158,9 +157,6 @@ CApplication::~CApplication()
delete m_eventQueue;
m_eventQueue = nullptr;
- delete m_pluginManager;
- m_pluginManager = nullptr;
-
delete m_profile;
m_profile = nullptr;
@@ -336,8 +332,7 @@ bool CApplication::Create()
if (GetProfile().GetLocalProfileString("Resources", "Data", path))
m_dataPath = path;
- m_pluginManager->LoadFromProfile();
- m_sound = static_cast<CSoundInterface*>(CInstanceManager::GetInstancePointer()->SearchInstance(CLASS_SOUND));
+ m_sound = static_cast<CSoundInterface*>(CInstanceManager::GetInstancePointer()->SearchInstance(CLASS_SOUND));
if (!m_sound) {
GetLogger()->Error("Sound not loaded, falling back to fake sound!\n");
diff --git a/src/app/app.h b/src/app/app.h
index 32f03f8..5bf6867 100644
--- a/src/app/app.h
+++ b/src/app/app.h
@@ -25,13 +25,12 @@
#include "common/global.h"
#include "common/singleton.h"
+#include "common/profile.h"
#include "graphics/core/device.h"
#include "graphics/engine/engine.h"
#include "graphics/opengl/gldevice.h"
-#include "plugins/pluginmanager.h"
-
#include <string>
#include <vector>
@@ -337,7 +336,6 @@ protected:
CSoundInterface* m_sound;
//! Main class of the proper game engine
CRobotMain* m_robotMain;
- CPluginManager* m_pluginManager;
CProfile* m_profile;
//! Code to return at exit
diff --git a/src/sound/oalsound/CMakeLists.txt b/src/sound/oalsound/CMakeLists.txt
deleted file mode 100644
index bb7e9ff..0000000
--- a/src/sound/oalsound/CMakeLists.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-cmake_minimum_required(VERSION 2.8)
-
-set(SOURCES
- alsound.cpp
- buffer.cpp
- channel.cpp
-)
-
-SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++0x -fPIC")
-SET (CMAKE_CXX_FLAGS_DEBUG "-g")
-
-include(FindPkgConfig)
-include(FindOpenAL)
-pkg_check_modules(OPENAL_LIB REQUIRED openal)
-
-set(OPENAL_LIBRARIES
- openal
- alut
-)
-
-include_directories(../../..)
-include_directories(.)
-add_library(openalsound SHARED ${SOURCES})
-target_link_libraries(openalsound ${OPENAL_LIBRARIES})
diff --git a/src/sound/oalsound/alsound.cpp b/src/sound/oalsound/alsound.cpp
index 83a4def..5f416da 100644
--- a/src/sound/oalsound/alsound.cpp
+++ b/src/sound/oalsound/alsound.cpp
@@ -23,51 +23,23 @@
#define MIN(a, b) (a > b ? b : a)
-
-PLUGIN_INTERFACE(ALSound)
-
-
-std::string ALSound::PluginName()
-{
- return "Sound plugin using OpenAL library to play sounds.";
-}
-
-
-int ALSound::PluginVersion()
-{
- return 2;
-}
-
-
-void ALSound::InstallPlugin()
-{
- auto pointer = CInstanceManager::GetInstancePointer();
- if (pointer != nullptr)
- CInstanceManager::GetInstancePointer()->AddInstance(CLASS_SOUND, this);
-}
-
-
-bool ALSound::UninstallPlugin(std::string &reason)
-{
- auto pointer = CInstanceManager::GetInstancePointer();
- if (pointer != nullptr)
- CInstanceManager::GetInstancePointer()->DeleteInstance(CLASS_SOUND, this);
- CleanUp();
- return true;
-}
-
-
ALSound::ALSound()
{
mEnabled = false;
m3D = false;
mAudioVolume = MAXVOLUME;
mMute = false;
+ auto pointer = CInstanceManager::GetInstancePointer();
+ if (pointer != nullptr)
+ CInstanceManager::GetInstancePointer()->AddInstance(CLASS_SOUND, this);
}
ALSound::~ALSound()
{
+ auto pointer = CInstanceManager::GetInstancePointer();
+ if (pointer != nullptr)
+ CInstanceManager::GetInstancePointer()->DeleteInstance(CLASS_SOUND, this);
CleanUp();
}
diff --git a/src/sound/oalsound/test/CMakeLists.txt b/src/sound/oalsound/test/CMakeLists.txt
deleted file mode 100644
index dd208ea..0000000
--- a/src/sound/oalsound/test/CMakeLists.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-cmake_minimum_required(VERSION 2.8)
-
-if(NOT CMAKE_BUILD_TYPE)
- set(CMAKE_BUILD_TYPE debug)
-endif(NOT CMAKE_BUILD_TYPE)
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -rdynamic")
-set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
-
-add_executable(plugin_test plugin_test.cpp ../../../../common/iman.cpp ../../../../common/logger.cpp ../../../../plugins/pluginloader.cpp)
-
-include_directories(".")
-include_directories("../../../../")
-
-target_link_libraries(plugin_test ${LTDL_LIBRARY})
diff --git a/src/sound/oalsound/test/plugin_test.cpp b/src/sound/oalsound/test/plugin_test.cpp
deleted file mode 100644
index 40c1cd2..0000000
--- a/src/sound/oalsound/test/plugin_test.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-#include <string>
-#include <cstdio>
-#include <unistd.h>
-
-#include <common/logger.h>
-#include <common/iman.h>
-#include <sound/sound.h>
-#include <plugins/pluginloader.h>
-
-
-int main() {
- new CLogger();
- new CInstanceManager();
-
- lt_dlinit();
-
- CPluginLoader *plugin = new CPluginLoader("libopenalsound");
- if (plugin->LoadPlugin()) {
- CSoundInterface *sound = static_cast<CSoundInterface*>(CInstanceManager::GetInstancePointer()->SearchInstance(CLASS_SOUND));
-
- sound->Create(true);
- sound->CacheAll();
- sound->Play((Sound)8);
- sound->Play((Sound)18);
-
- sleep(10);
- /*
- while (1)
- {
- // just a test, very slow
- plugin->FrameMove(0);
- //if ('n' == getchar())
- // break;
- }*/
- plugin->UnloadPlugin();
- }
-
- lt_dlexit();
- return 0;
-}