Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/osx'
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Feb 5, 2017
2 parents 15b3dd6 + 5d135f5 commit 9ebf86a
Show file tree
Hide file tree
Showing 29 changed files with 133 additions and 64 deletions.
7 changes: 6 additions & 1 deletion autogen.sh
@@ -1,6 +1,11 @@
#!/bin/sh
aclocal -I m4
libtoolize --force --copy
# Use the glibtoolize command in OSX
if [[ "$OSTYPE" == "darwin"* ]]; then
glibtoolize --force --copy
else
libtoolize --force --copy
fi
autoheader
autoconf
automake --add-missing --copy --foreign
Expand Down
61 changes: 44 additions & 17 deletions configure.ac
Expand Up @@ -4,6 +4,21 @@ AM_SILENT_RULES([yes])

AC_CONFIG_MACRO_DIR([m4])

# Get info about the OS we're on
AC_CANONICAL_HOST

build_linux=no
build_osx=no

case $host_os in
linux*)
build_linux=yes
;;
darwin* )
build_osx=yes
;;
esac

# Initialise Gettext
AM_GNU_GETTEXT_VERSION(0.18.1)
AM_GNU_GETTEXT([external])
Expand Down Expand Up @@ -98,36 +113,41 @@ if test "$wxWin" != 1; then
])
fi

# GTK etc
# Support libraries
PKG_CHECK_MODULES([XML], [libxml-2.0])
PKG_CHECK_MODULES([LIBSIGC], [sigc++-2.0])
PKG_CHECK_MODULES([PNG], [libpng])
PKG_CHECK_MODULES([FTGL], [ftgl])

# GTKSourceView
#PKG_CHECK_MODULES([GTKSOURCEVIEWMM],
# [gtksourceviewmm-2.0],
# [AC_DEFINE([HAVE_GTKSOURCEVIEW],
# [],
# [Define if GtkSourceView is available])],
# [true])

# GLEW
AC_CHECK_HEADER([GL/glew.h], [], [AC_MSG_ERROR([GLEW not found])])
AC_CHECK_LIB([GLEW], [main],
[GLEW_LIBS='-lGLEW'],
[AC_MSG_ERROR([GLEW not found])])
AC_SUBST([GLEW_LIBS])

# OpenGL and GLU
AC_CHECK_LIB([GL], [main],
# In OSX, OpenGL and GLU are handled through the -framework OpenGL switch
# In Linux we need to check for the libs
if test "$build_osx" != "no"; then
[GL_LIBS='-framework OpenGL']

# We need the libintl library in OSX
AC_CHECK_LIB([intl], [main],
[INTL_LIBS='-lintl'],
[AC_MSG_ERROR([intl library not found])])
AC_SUBST([INTL_LIBS])
fi

if test "$build_linux" != "no"; then
AC_CHECK_LIB([GL], [main],
[GL_LIBS='-lGL'],
[AC_MSG_ERROR([GL library not found.])])
AC_CHECK_LIB([GLU], [gluBuild2DMipmaps],
AC_CHECK_LIB([GLU], [gluBuild2DMipmaps],
[GLU_LIBS="-lGLU"],
[AC_MSG_ERROR([GLU library not found.])])
AC_SUBST([GL_LIBS])
AC_SUBST([GLU_LIBS])
AC_SUBST([GL_LIBS])
AC_SUBST([GLU_LIBS])
fi

# Boost
BOOST_REQUIRE([1.46.1])
Expand Down Expand Up @@ -178,9 +198,16 @@ AC_CHECK_HEADER([AL/alut.h],
AC_CHECK_LIB([vorbisfile], [ov_clear],
[VORBIS_LIBS='-lvorbisfile'],
[sound_module=''])
AC_CHECK_LIB([openal], [alGetError],

# Use the OpenAL framework in OSX
if test "$build_osx" != "no"; then
[AL_LIBS='-framework OpenAL']
else
AC_CHECK_LIB([openal], [alGetError],
[AL_LIBS='-lopenal'],
[sound_module=''])
fi

AC_CHECK_LIB([alut], [main],
[ALUT_LIBS='-lalut'],
[sound_module=''],
Expand All @@ -193,11 +220,11 @@ AC_SUBST([AL_LIBS])

# Configure global flags, cancelling any modifications we may have made during
# configuration
WARNING_FLAGS="-Wall -Wno-unused-variable -Werror=return-type"
WARNING_FLAGS="-Wall -Wno-unused-variable -Werror=return-type -Wno-inconsistent-missing-override -Wno-potentially-evaluated-expression"
CFLAGS="$USER_CFLAGS $WARNING_FLAGS $WX_CFLAGS"
CXXFLAGS="$USER_CXXFLAGS $WARNING_FLAGS $WX_CXXFLAGS_ONLY"
CPPFLAGS="$USER_CPPFLAGS -DPOSIX $WX_CPPFLAGS $LIBSIGC_CFLAGS -DWXINTL_NO_GETTEXT_MACRO"
LDFLAGS="$USER_LDFLAGS $LIBSIGC_LIBS -Wl,-z,defs"
LDFLAGS="$USER_LDFLAGS $LIBSIGC_LIBS"

# Debug/optimisation
if test "$debug_build" != 'no'
Expand Down
9 changes: 2 additions & 7 deletions include/iscript.h
@@ -1,10 +1,7 @@
#ifndef ISCRIPT_H_
#define ISCRIPT_H_
#pragma once

#include "imodule.h"

// Forward decl.
namespace boost { namespace python { class object; } }
#include <boost/python/object_fwd.hpp>

namespace script
{
Expand Down Expand Up @@ -76,5 +73,3 @@ inline IScriptingSystem& GlobalScriptingSystem() {
);
return _scriptingSystem;
}

#endif /*ISCRIPT_H_*/
1 change: 0 additions & 1 deletion include/precompiled_interfaces.h
Expand Up @@ -77,7 +77,6 @@
#include "iresourcechooser.h"
#include "iscenegraph.h"
#include "iscenegraphfactory.h"
#include "iscript.h"
#include "iselectable.h"
#include "iselection.h"
#include "iselectiongroup.h"
Expand Down
7 changes: 3 additions & 4 deletions libs/parser/DefBlockTokeniser.h
@@ -1,8 +1,9 @@
#ifndef DEF_BLOCK_TOKENISER_H_
#define DEF_BLOCK_TOKENISER_H_
#pragma once

#include "ParseException.h"

#include <ios>
#include <iostream>
#include <string>
#include <ctype.h>
#include <boost/tokenizer.hpp>
Expand Down Expand Up @@ -446,5 +447,3 @@ class BasicDefBlockTokeniser<std::istream> :
};

} // namespace parser

#endif /* DEF_BLOCK_TOKENISER_H_ */
2 changes: 2 additions & 0 deletions libs/parser/DefTokeniser.h
Expand Up @@ -3,6 +3,8 @@

#include "ParseException.h"

#include <iostream>
#include <ios>
#include <string>
#include <boost/tokenizer.hpp>

Expand Down
19 changes: 19 additions & 0 deletions libs/wxutil/ChoiceHelper.h
@@ -1,6 +1,7 @@
#pragma once

#include <wx/choice.h>
#include <wx/combobox.h>
#include "string/convert.h"

namespace wxutil
Expand Down Expand Up @@ -67,6 +68,24 @@ class ChoiceHelper
}
}
}

// Selects the item whose attached string is equal to <str>
static void SelectComboItemByStoredString(wxComboBox* combo, const wxString& str)
{
combo->SetSelection(wxNOT_FOUND);

// Get the iter into the liststore pointing at the correct STIM_YYYY type
for (unsigned int i = 0; i < combo->GetCount(); ++i)
{
wxStringClientData* data = static_cast<wxStringClientData*>(combo->GetClientObject(i));

if (data->GetData().ToStdString() == str)
{
combo->SetSelection(i);
return;
}
}
}
};

} // namespace
2 changes: 1 addition & 1 deletion libs/wxutil/preview/ModelPreview.cpp
Expand Up @@ -130,7 +130,7 @@ void ModelPreview::setupSceneGraph()

try
{
_rootNode.reset(new scene::BasicRootNode);
_rootNode = std::make_shared<scene::BasicRootNode>();

_entity = GlobalEntityCreator().createEntity(
GlobalEntityClassManager().findClass(FUNC_STATIC_CLASS));
Expand Down
2 changes: 1 addition & 1 deletion libs/wxutil/preview/ParticlePreview.cpp
Expand Up @@ -168,7 +168,7 @@ void ParticlePreview::setupSceneGraph()

try
{
_rootNode.reset(new scene::BasicRootNode);
_rootNode = std::make_shared<scene::BasicRootNode>();

_entity = GlobalEntityCreator().createEntity(
GlobalEntityClassManager().findClass(FUNC_EMITTER_CLASS));
Expand Down
2 changes: 1 addition & 1 deletion plugins/dm.objectives/Makefile.am
Expand Up @@ -6,7 +6,7 @@ plugins_LTLIBRARIES = dm_objectives.la

dm_objectives_la_LIBADD = $(top_builddir)/libs/wxutil/libwxutil.la \
$(top_builddir)/libs/xmlutil/libxmlutil.la
dm_objectives_la_LDFLAGS = -module -avoid-version -Wl,-z,defs \
dm_objectives_la_LDFLAGS = -module -avoid-version \
$(BOOST_REGEX_LIBS) $(WX_LIBS) $(XML_LIBS)
dm_objectives_la_SOURCES = ObjectivesEditor.cpp \
objectives.cpp \
Expand Down
1 change: 1 addition & 0 deletions plugins/dm.objectives/ce/specpanel/SpecifierPanel.h
@@ -1,5 +1,6 @@
#pragma once

#include <functional>
#include <memory>

class wxWindow;
Expand Down
2 changes: 1 addition & 1 deletion plugins/dm.stimresponse/ClassEditor.h
Expand Up @@ -19,7 +19,7 @@ class wxSpinDoubleEvent;
class wxBoxSizer;

// There's a bug in the MSW implementation of wxBitmapComboBox, don't use it in 3.0.0
#if (wxMAJOR_VERSION >= 3) && (wxMINOR_VERSION >= 0) && (wxRELEASE_NUMBER > 0)
#if (wxMAJOR_VERSION >= 3) && (wxMINOR_VERSION >= 0) && (wxRELEASE_NUMBER > 0) && defined(__WXMSW__)
#define USE_BMP_COMBO_BOX
#endif

Expand Down
2 changes: 1 addition & 1 deletion plugins/dm.stimresponse/EffectArgumentItem.cpp
Expand Up @@ -120,7 +120,7 @@ StimTypeArgument::StimTypeArgument(wxWindow* parent,

StimType stimType = _stimTypes.get(string::convert<int>(arg.value));

wxutil::ChoiceHelper::SelectItemByStoredString(_comboBox, stimType.name);
wxutil::ChoiceHelper::SelectComboItemByStoredString(_comboBox, stimType.name);
}

std::string StimTypeArgument::getValue()
Expand Down
19 changes: 12 additions & 7 deletions plugins/dm.stimresponse/ResponseEditor.cpp
Expand Up @@ -7,15 +7,16 @@
#include "i18n.h"
#include "EffectEditor.h"

#include "wxutil/ChoiceHelper.h"

#include <wx/combobox.h>
#include <wx/bmpcbox.h>
#include <wx/button.h>
#include <wx/menu.h>
#include <wx/spinctrl.h>
#include <wx/textctrl.h>
#include <wx/checkbox.h>

#include "wxutil/ChoiceHelper.h"

namespace ui
{

Expand Down Expand Up @@ -75,7 +76,7 @@ void ResponseEditor::update()

// Get the iter into the liststore pointing at the correct STIM_YYYY type
std::string typeToFind = sr.get("type");
wxutil::ChoiceHelper::SelectItemByStoredString (_type, typeToFind);
wxutil::ChoiceHelper:: SelectComboItemByStoredString (_type, typeToFind);

// Active
_propertyWidgets.active->SetValue(sr.get("state") == "1");
Expand Down Expand Up @@ -147,14 +148,18 @@ void ResponseEditor::populatePage(wxWindow* parent)
wxPanel* editingPanel = loadNamedPanel(parent, "ResponseEditorMainPanel");
packEditingPane(editingPanel);

#ifdef USE_BMP_COMBO_BOX
// Response property section
_type = findNamedObject<wxBitmapComboBox>(this, "ResponseEditorTypeCombo");
#else
// Response property section
wxControl* typeBox = findNamedObject<wxControl>(this, "ResponseEditorTypeCombo");

#ifndef USE_BMP_COMBO_BOX
// Replace the bitmap combo with an ordinary one
wxComboBox* combo = new wxComboBox(_type->GetParent(), wxID_ANY);
_type->GetContainingSizer()->Add(combo, 1, wxEXPAND);
_type->Destroy();
wxComboBox* combo = new wxComboBox(typeBox->GetParent(), wxID_ANY);
typeBox->GetContainingSizer()->Add(combo, 1, wxEXPAND);
typeBox->Destroy();

_type = combo;
_type->SetName("ResponseEditorTypeCombo");
#endif
Expand Down
14 changes: 9 additions & 5 deletions plugins/dm.stimresponse/StimEditor.cpp
Expand Up @@ -69,14 +69,18 @@ void StimEditor::setEntity(const SREntityPtr& entity)

void StimEditor::setupEditingPanel()
{
#ifdef USE_BMP_COMBO_BOX
// Type Selector
_type = findNamedObject<wxBitmapComboBox>(this, "StimEditorTypeCombo");
#else
// Response property section
wxControl* typeBox = findNamedObject<wxControl>(this, "StimEditorTypeCombo");

#ifndef USE_BMP_COMBO_BOX
// Replace the bitmap combo with an ordinary one
wxComboBox* combo = new wxComboBox(_type->GetParent(), wxID_ANY);
_type->GetContainingSizer()->Add(combo, 1, wxEXPAND);
_type->Destroy();
wxComboBox* combo = new wxComboBox(typeBox->GetParent(), wxID_ANY);
typeBox->GetContainingSizer()->Add(combo, 1, wxEXPAND);
typeBox->Destroy();

_type = combo;
_type->SetName("StimEditorTypeCombo");
#endif
Expand Down Expand Up @@ -431,7 +435,7 @@ void StimEditor::update()
std::string typeToFind = sr.get("type");

// Get the iter into the liststore pointing at the correct STIM_YYYY type
wxutil::ChoiceHelper::SelectItemByStoredString (_type, typeToFind);
wxutil::ChoiceHelper::SelectComboItemByStoredString(_type, typeToFind);

// Active
_propertyWidgets.active->SetValue(sr.get("state") == "1");
Expand Down
2 changes: 1 addition & 1 deletion plugins/scenegraph/SceneGraphFactory.cpp
Expand Up @@ -8,7 +8,7 @@ namespace scene

GraphPtr SceneGraphFactory::createSceneGraph()
{
return GraphPtr(new SceneGraph);
return std::make_shared<SceneGraph>();
}

const std::string& SceneGraphFactory::getName() const
Expand Down
7 changes: 7 additions & 0 deletions plugins/sound/SoundPlayer.h
@@ -1,8 +1,15 @@
#pragma once

#include <string>

#ifdef __APPLE__
#include <OpenAL/al.h>
#include <OpenAL/alc.h>
#else
#include <AL/al.h>
#include <AL/alc.h>
#endif

#include <wx/timer.h>

class ArchiveFile;
Expand Down
9 changes: 5 additions & 4 deletions plugins/sound/WavFileLoader.h
@@ -1,8 +1,11 @@
#ifndef WAV_FILE_LOADER_H_
#define WAV_FILE_LOADER_H_
#pragma once

#include <stdexcept>
#ifdef __APPLE__
#include <OpenAL/al.h>
#else
#include <AL/al.h>
#endif

class InputStream;

Expand Down Expand Up @@ -157,5 +160,3 @@ class WavFileLoader
};

} // namespace sound

#endif /* WAV_FILE_LOADER_H_ */
2 changes: 1 addition & 1 deletion plugins/uimanager/animationpreview/AnimationPreview.cpp
Expand Up @@ -148,7 +148,7 @@ void AnimationPreview::setupSceneGraph()
{
RenderPreview::setupSceneGraph();

_root.reset(new scene::BasicRootNode);
_root = std::make_shared<scene::BasicRootNode>();

_entity = GlobalEntityCreator().createEntity(
GlobalEntityClassManager().findClass(FUNC_STATIC_CLASS)
Expand Down

0 comments on commit 9ebf86a

Please sign in to comment.