From f3ddeca2c242f4067290ca2820391874d181bf5c Mon Sep 17 00:00:00 2001 From: codereader Date: Sat, 4 Feb 2017 13:16:18 +0100 Subject: [PATCH 1/9] Some experiments to get code to compile in OSX --- configure.ac | 21 +++++++++++++++------ libs/wxutil/preview/ModelPreview.cpp | 2 +- libs/wxutil/preview/ParticlePreview.cpp | 2 +- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index af71464acf..09da9866ed 100644 --- a/configure.ac +++ b/configure.ac @@ -120,14 +120,23 @@ AC_CHECK_LIB([GLEW], [main], AC_SUBST([GLEW_LIBS]) # OpenGL and GLU -AC_CHECK_LIB([GL], [main], +AC_CANONICAL_HOST + +case $host_os in + darwin* ) + [GL_LIBS='-framework OpenGL'] + ;; + *) + 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]) + ;; +esac # Boost BOOST_REQUIRE([1.46.1]) @@ -193,11 +202,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" 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' diff --git a/libs/wxutil/preview/ModelPreview.cpp b/libs/wxutil/preview/ModelPreview.cpp index 4b15ac75cf..fef3dfb1b0 100644 --- a/libs/wxutil/preview/ModelPreview.cpp +++ b/libs/wxutil/preview/ModelPreview.cpp @@ -130,7 +130,7 @@ void ModelPreview::setupSceneGraph() try { - _rootNode.reset(new scene::BasicRootNode); + _rootNode = std::make_shared(); _entity = GlobalEntityCreator().createEntity( GlobalEntityClassManager().findClass(FUNC_STATIC_CLASS)); diff --git a/libs/wxutil/preview/ParticlePreview.cpp b/libs/wxutil/preview/ParticlePreview.cpp index c2d26d019a..84305780e4 100644 --- a/libs/wxutil/preview/ParticlePreview.cpp +++ b/libs/wxutil/preview/ParticlePreview.cpp @@ -168,7 +168,7 @@ void ParticlePreview::setupSceneGraph() try { - _rootNode.reset(new scene::BasicRootNode); + _rootNode = std::make_shared(); _entity = GlobalEntityCreator().createEntity( GlobalEntityClassManager().findClass(FUNC_EMITTER_CLASS)); From 8176ff84111d9c886ce0e27005699a4134942e67 Mon Sep 17 00:00:00 2001 From: codereader Date: Sat, 4 Feb 2017 14:05:30 +0100 Subject: [PATCH 2/9] Some more compilation fixes --- configure.ac | 2 +- libs/parser/DefTokeniser.h | 2 ++ radiant/brush/BrushModule.cpp | 2 +- radiant/brush/BrushNode.cpp | 2 +- radiant/main.cpp | 1 + radiant/map/Map.cpp | 2 +- radiant/patch/PatchCreators.cpp | 4 ++-- radiant/patch/PatchNode.cpp | 5 +++-- 8 files changed, 12 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index 09da9866ed..ac0dc89e8a 100644 --- a/configure.ac +++ b/configure.ac @@ -202,7 +202,7 @@ 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 -Wno-inconsistent-missing-override" +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" diff --git a/libs/parser/DefTokeniser.h b/libs/parser/DefTokeniser.h index e3bdbc0d2f..e45cb8e788 100644 --- a/libs/parser/DefTokeniser.h +++ b/libs/parser/DefTokeniser.h @@ -3,6 +3,8 @@ #include "ParseException.h" +#include +#include #include #include diff --git a/radiant/brush/BrushModule.cpp b/radiant/brush/BrushModule.cpp index c13381dedb..f6439e5c7c 100644 --- a/radiant/brush/BrushModule.cpp +++ b/radiant/brush/BrushModule.cpp @@ -68,7 +68,7 @@ void BrushModuleImpl::toggleTextureLock() { scene::INodePtr BrushModuleImpl::createBrush() { - scene::INodePtr node(new BrushNode); + scene::INodePtr node = std::make_shared(); // Move it to the active layer node->moveToLayer(GlobalLayerSystem().getActiveLayer()); diff --git a/radiant/brush/BrushNode.cpp b/radiant/brush/BrushNode.cpp index 3f88c44aab..ed77fb4eef 100644 --- a/radiant/brush/BrushNode.cpp +++ b/radiant/brush/BrushNode.cpp @@ -230,7 +230,7 @@ void BrushNode::translate(const Vector3& translation) } scene::INodePtr BrushNode::clone() const { - return scene::INodePtr(new BrushNode(*this)); + return std::make_shared(*this); } void BrushNode::onInsertIntoScene(scene::IMapRootNode& root) diff --git a/radiant/main.cpp b/radiant/main.cpp index e63e79d10f..adc4b4c8d8 100644 --- a/radiant/main.cpp +++ b/radiant/main.cpp @@ -17,6 +17,7 @@ #include #include +#include #include #if defined (_DEBUG) && defined (WIN32) && defined (_MSC_VER) diff --git a/radiant/map/Map.cpp b/radiant/map/Map.cpp index 7f381516f1..f148f28c79 100644 --- a/radiant/map/Map.cpp +++ b/radiant/map/Map.cpp @@ -876,7 +876,7 @@ void Map::rename(const std::string& filename) { void Map::importSelected(std::istream& in) { - scene::INodePtr root(new scene::BasicRootNode); + scene::INodePtr root = std::make_shared(); // Instantiate the default import filter class MapImportFilter : diff --git a/radiant/patch/PatchCreators.cpp b/radiant/patch/PatchCreators.cpp index 77c4bd2fd8..4be4b0f01e 100644 --- a/radiant/patch/PatchCreators.cpp +++ b/radiant/patch/PatchCreators.cpp @@ -22,7 +22,7 @@ scene::INodePtr Doom3PatchCreator::createPatch() { // Note the true as function argument: // this means that patchDef3 = true in the PatchNode constructor. - scene::INodePtr node(new PatchNode(true)); + scene::INodePtr node = std::make_shared(true); // Determine the layer patches should be created in int layer = GlobalLayerSystem().getActiveLayer(); @@ -138,7 +138,7 @@ void Doom3PatchCreator::registerPatchCommands() scene::INodePtr Doom3PatchDef2Creator::createPatch() { // The PatchNodeDoom3 constructor takes false == patchDef2 - scene::INodePtr node(new PatchNode(false)); + scene::INodePtr node = std::make_shared(false); // Determine the layer patches should be created in int layer = GlobalLayerSystem().getActiveLayer(); diff --git a/radiant/patch/PatchNode.cpp b/radiant/patch/PatchNode.cpp index ea21ebeb38..36173fe952 100644 --- a/radiant/patch/PatchNode.cpp +++ b/radiant/patch/PatchNode.cpp @@ -232,8 +232,9 @@ void PatchNode::selectedChangedComponent(const ISelectable& selectable) { } // Clones this node, allocates a new Node on the heap and passes itself to the constructor of the new node -scene::INodePtr PatchNode::clone() const { - return scene::INodePtr(new PatchNode(*this)); +scene::INodePtr PatchNode::clone() const +{ + return std::make_shared(*this); } void PatchNode::onInsertIntoScene(scene::IMapRootNode& root) From de00ea5b94871b8f3c4e52f1bb5a926ae8a0e001 Mon Sep 17 00:00:00 2001 From: codereader Date: Sat, 4 Feb 2017 14:38:52 +0100 Subject: [PATCH 3/9] More compilation fixup --- configure.ac | 5 +++++ plugins/scenegraph/SceneGraphFactory.cpp | 2 +- plugins/uimanager/animationpreview/AnimationPreview.cpp | 2 +- plugins/uimanager/colourscheme/ColourScheme.h | 2 +- radiant/Makefile.am | 1 + 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index ac0dc89e8a..22281b33f0 100644 --- a/configure.ac +++ b/configure.ac @@ -176,6 +176,11 @@ AC_CHECK_LIB([dl], [main], [AC_MSG_ERROR([DL library not found])]) AC_SUBST([DL_LIBS]) +AC_CHECK_LIB([intl], [main], + [INTL_LIBS='-lintl'], + [AC_MSG_ERROR([intl library not found])]) +AC_SUBST([INTL_LIBS]) + # Dependent Boost headers AC_CHECK_HEADER([boost/serialization/access.hpp], [], [AC_MSG_ERROR([Boost.Serialization headers not found])]) diff --git a/plugins/scenegraph/SceneGraphFactory.cpp b/plugins/scenegraph/SceneGraphFactory.cpp index bd9a7f41c9..58bf231292 100644 --- a/plugins/scenegraph/SceneGraphFactory.cpp +++ b/plugins/scenegraph/SceneGraphFactory.cpp @@ -8,7 +8,7 @@ namespace scene GraphPtr SceneGraphFactory::createSceneGraph() { - return GraphPtr(new SceneGraph); + return std::make_shared(); } const std::string& SceneGraphFactory::getName() const diff --git a/plugins/uimanager/animationpreview/AnimationPreview.cpp b/plugins/uimanager/animationpreview/AnimationPreview.cpp index 5658e8eabe..b9624a19a7 100644 --- a/plugins/uimanager/animationpreview/AnimationPreview.cpp +++ b/plugins/uimanager/animationpreview/AnimationPreview.cpp @@ -148,7 +148,7 @@ void AnimationPreview::setupSceneGraph() { RenderPreview::setupSceneGraph(); - _root.reset(new scene::BasicRootNode); + _root = std::make_shared(); _entity = GlobalEntityCreator().createEntity( GlobalEntityClassManager().findClass(FUNC_STATIC_CLASS) diff --git a/plugins/uimanager/colourscheme/ColourScheme.h b/plugins/uimanager/colourscheme/ColourScheme.h index 0ec3d6fcc2..36ceb03e13 100644 --- a/plugins/uimanager/colourscheme/ColourScheme.h +++ b/plugins/uimanager/colourscheme/ColourScheme.h @@ -31,7 +31,7 @@ class ColourItem : {} }; -typedef std::map ColourItemMap; +typedef std::map ColourItemMap; /* A colourscheme is basically a collection of ColourItems */ diff --git a/radiant/Makefile.am b/radiant/Makefile.am index 7c9783901e..d06de80625 100644 --- a/radiant/Makefile.am +++ b/radiant/Makefile.am @@ -20,6 +20,7 @@ darkradiant_LDFLAGS = $(XML_LIBS) \ $(BOOST_SYSTEM_LIBS) \ $(BOOST_REGEX_LIBS) \ $(DL_LIBS) \ + $(INTL_LIBS) \ $(WX_LIBS) darkradiant_LDADD = $(top_builddir)/libs/scene/libscenegraph.la \ $(top_builddir)/libs/wxutil/libwxutil.la \ From 0f6adb55873a8fc51d1e3bb9a754dbf1f766e3e0 Mon Sep 17 00:00:00 2001 From: codereader Date: Sat, 4 Feb 2017 16:05:32 +0100 Subject: [PATCH 4/9] Code compiles, except for the dm.stimresponse module --- configure.ac | 2 +- include/iscript.h | 9 ++------- plugins/dm.objectives/Makefile.am | 2 +- plugins/dm.objectives/ce/specpanel/SpecifierPanel.h | 1 + 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index 22281b33f0..52fcf6a3fc 100644 --- a/configure.ac +++ b/configure.ac @@ -53,7 +53,7 @@ AC_ARG_ENABLE([python], if [[ "$darkmod_plugins" != 'no' ]] then # Enable conditional directories (used by plugins/Makefile.am) - sr_plugin="dm.stimresponse" + #sr_plugin="dm.stimresponse" obj_plugin="dm.objectives" difficulty_plugin="dm.difficulty" conv_plugin="dm.conversation" diff --git a/include/iscript.h b/include/iscript.h index f0050f2386..530291691e 100644 --- a/include/iscript.h +++ b/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 namespace script { @@ -76,5 +73,3 @@ inline IScriptingSystem& GlobalScriptingSystem() { ); return _scriptingSystem; } - -#endif /*ISCRIPT_H_*/ diff --git a/plugins/dm.objectives/Makefile.am b/plugins/dm.objectives/Makefile.am index d3446c2e09..749948423b 100644 --- a/plugins/dm.objectives/Makefile.am +++ b/plugins/dm.objectives/Makefile.am @@ -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 \ diff --git a/plugins/dm.objectives/ce/specpanel/SpecifierPanel.h b/plugins/dm.objectives/ce/specpanel/SpecifierPanel.h index e0fba91d0f..90c94ac6fb 100644 --- a/plugins/dm.objectives/ce/specpanel/SpecifierPanel.h +++ b/plugins/dm.objectives/ce/specpanel/SpecifierPanel.h @@ -1,5 +1,6 @@ #pragma once +#include #include class wxWindow; From 5817ae66e32e8c3d4535dc0a3ba95536c157263b Mon Sep 17 00:00:00 2001 From: codereader Date: Sat, 4 Feb 2017 17:41:09 +0100 Subject: [PATCH 5/9] Compilation fixes in dm.stimresponse module --- configure.ac | 2 +- libs/wxutil/ChoiceHelper.h | 19 +++++++++++++++++++ plugins/dm.stimresponse/ClassEditor.h | 2 +- .../dm.stimresponse/EffectArgumentItem.cpp | 2 +- plugins/dm.stimresponse/ResponseEditor.cpp | 19 ++++++++++++------- plugins/dm.stimresponse/StimEditor.cpp | 14 +++++++++----- 6 files changed, 43 insertions(+), 15 deletions(-) diff --git a/configure.ac b/configure.ac index 52fcf6a3fc..22281b33f0 100644 --- a/configure.ac +++ b/configure.ac @@ -53,7 +53,7 @@ AC_ARG_ENABLE([python], if [[ "$darkmod_plugins" != 'no' ]] then # Enable conditional directories (used by plugins/Makefile.am) - #sr_plugin="dm.stimresponse" + sr_plugin="dm.stimresponse" obj_plugin="dm.objectives" difficulty_plugin="dm.difficulty" conv_plugin="dm.conversation" diff --git a/libs/wxutil/ChoiceHelper.h b/libs/wxutil/ChoiceHelper.h index bf47afa4d4..090e0dec72 100644 --- a/libs/wxutil/ChoiceHelper.h +++ b/libs/wxutil/ChoiceHelper.h @@ -1,6 +1,7 @@ #pragma once #include +#include #include "string/convert.h" namespace wxutil @@ -67,6 +68,24 @@ class ChoiceHelper } } } + + // Selects the item whose attached string is equal to + 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(combo->GetClientObject(i)); + + if (data->GetData().ToStdString() == str) + { + combo->SetSelection(i); + return; + } + } + } }; } // namespace diff --git a/plugins/dm.stimresponse/ClassEditor.h b/plugins/dm.stimresponse/ClassEditor.h index bd4112265a..2469d57831 100644 --- a/plugins/dm.stimresponse/ClassEditor.h +++ b/plugins/dm.stimresponse/ClassEditor.h @@ -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 diff --git a/plugins/dm.stimresponse/EffectArgumentItem.cpp b/plugins/dm.stimresponse/EffectArgumentItem.cpp index 9e4bdb85e7..673930a528 100644 --- a/plugins/dm.stimresponse/EffectArgumentItem.cpp +++ b/plugins/dm.stimresponse/EffectArgumentItem.cpp @@ -120,7 +120,7 @@ StimTypeArgument::StimTypeArgument(wxWindow* parent, StimType stimType = _stimTypes.get(string::convert(arg.value)); - wxutil::ChoiceHelper::SelectItemByStoredString(_comboBox, stimType.name); + wxutil::ChoiceHelper::SelectComboItemByStoredString(_comboBox, stimType.name); } std::string StimTypeArgument::getValue() diff --git a/plugins/dm.stimresponse/ResponseEditor.cpp b/plugins/dm.stimresponse/ResponseEditor.cpp index c6d24f8082..180af47a7c 100644 --- a/plugins/dm.stimresponse/ResponseEditor.cpp +++ b/plugins/dm.stimresponse/ResponseEditor.cpp @@ -7,8 +7,7 @@ #include "i18n.h" #include "EffectEditor.h" -#include "wxutil/ChoiceHelper.h" - +#include #include #include #include @@ -16,6 +15,8 @@ #include #include +#include "wxutil/ChoiceHelper.h" + namespace ui { @@ -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"); @@ -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(this, "ResponseEditorTypeCombo"); +#else + // Response property section + wxControl* typeBox = findNamedObject(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 diff --git a/plugins/dm.stimresponse/StimEditor.cpp b/plugins/dm.stimresponse/StimEditor.cpp index 6bbd1efd9c..3c70b667f5 100644 --- a/plugins/dm.stimresponse/StimEditor.cpp +++ b/plugins/dm.stimresponse/StimEditor.cpp @@ -69,14 +69,18 @@ void StimEditor::setEntity(const SREntityPtr& entity) void StimEditor::setupEditingPanel() { +#ifdef USE_BMP_COMBO_BOX // Type Selector _type = findNamedObject(this, "StimEditorTypeCombo"); +#else + // Response property section + wxControl* typeBox = findNamedObject(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 @@ -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"); From f57afc7ca8bb63e88bf75cc078bd0cca087af19f Mon Sep 17 00:00:00 2001 From: codereader Date: Sat, 4 Feb 2017 18:31:39 +0100 Subject: [PATCH 6/9] Adjust configure.ac for Linux and OSX --- configure.ac | 54 +++++++++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/configure.ac b/configure.ac index 22281b33f0..eccf4da635 100644 --- a/configure.ac +++ b/configure.ac @@ -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]) @@ -98,20 +113,12 @@ 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], @@ -119,15 +126,20 @@ AC_CHECK_LIB([GLEW], [main], [AC_MSG_ERROR([GLEW not found])]) AC_SUBST([GLEW_LIBS]) -# OpenGL and GLU -AC_CANONICAL_HOST +# 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 -case $host_os in - darwin* ) - [GL_LIBS='-framework OpenGL'] - ;; - *) - AC_CHECK_LIB([GL], [main], +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], @@ -135,8 +147,7 @@ case $host_os in [AC_MSG_ERROR([GLU library not found.])]) AC_SUBST([GL_LIBS]) AC_SUBST([GLU_LIBS]) - ;; -esac +fi # Boost BOOST_REQUIRE([1.46.1]) @@ -176,11 +187,6 @@ AC_CHECK_LIB([dl], [main], [AC_MSG_ERROR([DL library not found])]) AC_SUBST([DL_LIBS]) -AC_CHECK_LIB([intl], [main], - [INTL_LIBS='-lintl'], - [AC_MSG_ERROR([intl library not found])]) -AC_SUBST([INTL_LIBS]) - # Dependent Boost headers AC_CHECK_HEADER([boost/serialization/access.hpp], [], [AC_MSG_ERROR([Boost.Serialization headers not found])]) From e16277b86baa001e2a43cde62a6de7effd3d840e Mon Sep 17 00:00:00 2001 From: codereader Date: Sat, 4 Feb 2017 19:36:46 +0100 Subject: [PATCH 7/9] Fix Windows compilation --- include/precompiled_interfaces.h | 1 - radiant/main.cpp | 2 ++ radiant/selection/ManipulateMouseTool.cpp | 4 ++-- radiant/selection/ManipulateMouseTool.h | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/precompiled_interfaces.h b/include/precompiled_interfaces.h index 57e19bf2ad..85c318c62d 100644 --- a/include/precompiled_interfaces.h +++ b/include/precompiled_interfaces.h @@ -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" diff --git a/radiant/main.cpp b/radiant/main.cpp index adc4b4c8d8..0f0122192d 100644 --- a/radiant/main.cpp +++ b/radiant/main.cpp @@ -17,7 +17,9 @@ #include #include +#ifdef POSIX #include +#endif #include #if defined (_DEBUG) && defined (WIN32) && defined (_MSC_VER) diff --git a/radiant/selection/ManipulateMouseTool.cpp b/radiant/selection/ManipulateMouseTool.cpp index 630c33ed9e..2d9dd9f476 100644 --- a/radiant/selection/ManipulateMouseTool.cpp +++ b/radiant/selection/ManipulateMouseTool.cpp @@ -158,7 +158,7 @@ void ManipulateMouseTool::handleMouseMove(const render::View& view, const Vector GlobalUndoSystem().start(); } -#if _DEBUG +#ifdef _DEBUG Matrix4 device2pivot = constructDevice2Pivot(_pivot2worldStart, view); Matrix4 pivot2device = constructPivot2Device(_pivot2worldStart, view); @@ -314,7 +314,7 @@ bool ManipulateMouseTool::nothingSelected() const void ManipulateMouseTool::renderOverlay() { -#if _DEBUG +#ifdef _DEBUG std::vector lines; boost::algorithm::split(lines, _debugText, boost::algorithm::is_any_of("\n")); diff --git a/radiant/selection/ManipulateMouseTool.h b/radiant/selection/ManipulateMouseTool.h index 9c8f3db615..52abf61ad0 100644 --- a/radiant/selection/ManipulateMouseTool.h +++ b/radiant/selection/ManipulateMouseTool.h @@ -31,7 +31,7 @@ class ManipulateMouseTool : Vector2 _deviceStart; bool _undoBegun; -#if _DEBUG +#ifdef _DEBUG std::string _debugText; #endif From e490f808203e5e8082364e0261db6af080142a9d Mon Sep 17 00:00:00 2001 From: codereader Date: Sat, 4 Feb 2017 17:48:42 +0100 Subject: [PATCH 8/9] Let autogen.sh switch to glibtoolize in OSX --- autogen.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/autogen.sh b/autogen.sh index 47c1f61aa3..e80809beb8 100755 --- a/autogen.sh +++ b/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 From 4bde386e5e73c00d05fa3e952504514e000ebcc0 Mon Sep 17 00:00:00 2001 From: codereader Date: Sun, 5 Feb 2017 07:08:14 +0100 Subject: [PATCH 9/9] Sound module is compiling now --- configure.ac | 9 ++++++++- libs/parser/DefBlockTokeniser.h | 7 +++---- plugins/sound/SoundPlayer.h | 7 +++++++ plugins/sound/WavFileLoader.h | 9 +++++---- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index eccf4da635..7935165d8a 100644 --- a/configure.ac +++ b/configure.ac @@ -198,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=''], diff --git a/libs/parser/DefBlockTokeniser.h b/libs/parser/DefBlockTokeniser.h index 652b94a6f9..79b74dbebf 100644 --- a/libs/parser/DefBlockTokeniser.h +++ b/libs/parser/DefBlockTokeniser.h @@ -1,8 +1,9 @@ -#ifndef DEF_BLOCK_TOKENISER_H_ -#define DEF_BLOCK_TOKENISER_H_ +#pragma once #include "ParseException.h" +#include +#include #include #include #include @@ -446,5 +447,3 @@ class BasicDefBlockTokeniser : }; } // namespace parser - -#endif /* DEF_BLOCK_TOKENISER_H_ */ diff --git a/plugins/sound/SoundPlayer.h b/plugins/sound/SoundPlayer.h index 3addfebb31..e22306b37f 100644 --- a/plugins/sound/SoundPlayer.h +++ b/plugins/sound/SoundPlayer.h @@ -1,8 +1,15 @@ #pragma once #include + +#ifdef __APPLE__ +#include +#include +#else #include #include +#endif + #include class ArchiveFile; diff --git a/plugins/sound/WavFileLoader.h b/plugins/sound/WavFileLoader.h index 06a666ed6d..cd924fc153 100644 --- a/plugins/sound/WavFileLoader.h +++ b/plugins/sound/WavFileLoader.h @@ -1,8 +1,11 @@ -#ifndef WAV_FILE_LOADER_H_ -#define WAV_FILE_LOADER_H_ +#pragma once #include +#ifdef __APPLE__ +#include +#else #include +#endif class InputStream; @@ -157,5 +160,3 @@ class WavFileLoader }; } // namespace sound - -#endif /* WAV_FILE_LOADER_H_ */ \ No newline at end of file