Skip to content
Permalink
Browse files

Android build fixes for c++11

  • Loading branch information
stujones11 authored and nerzhul committed Mar 11, 2018
1 parent 69247ca commit 22a891a925d68a096420d3383a2e31b58e3eb244

Large diffs are not rendered by default.

@@ -80,7 +80,7 @@ LOCAL_CFLAGS := -D_IRR_ANDROID_PLATFORM_ \
ifndef NDEBUG
LOCAL_CFLAGS += -g -D_DEBUG -O0 -fno-omit-frame-pointer
else
LOCAL_CFLAGS += -O3
LOCAL_CFLAGS += $(TARGET_CFLAGS_ADDON)
endif

ifdef GPROF
@@ -91,7 +91,7 @@ endif
# LOCAL_CFLAGS += -fsanitize=address
# LOCAL_LDFLAGS += -fsanitize=address

ifeq ($(TARGET_ARCH_ABI),x86)
ifeq ($(TARGET_ABI),x86)
LOCAL_CFLAGS += -fno-stack-protector
endif

@@ -134,6 +134,7 @@ LOCAL_SRC_FILES := \
jni/src/craftdef.cpp \
jni/src/database/database-dummy.cpp \
jni/src/database/database-files.cpp \
jni/src/database/database-leveldb.cpp \
jni/src/database/database-sqlite3.cpp \
jni/src/database/database.cpp \
jni/src/debug.cpp \
@@ -149,6 +150,7 @@ LOCAL_SRC_FILES := \
jni/src/genericobject.cpp \
jni/src/gettext.cpp \
jni/src/gui/guiChatConsole.cpp \
jni/src/gui/guiConfirmRegistration.cpp \
jni/src/gui/guiEditBoxWithScrollbar.cpp \
jni/src/gui/guiEngine.cpp \
jni/src/gui/guiPathSelectMenu.cpp \
@@ -159,6 +161,7 @@ LOCAL_SRC_FILES := \
jni/src/guiscalingfilter.cpp \
jni/src/gui/guiVolumeChange.cpp \
jni/src/gui/profilergraph.cpp \
jni/src/gui/touchscreengui.cpp \
jni/src/httpfetch.cpp \
jni/src/hud.cpp \
jni/src/imagefilters.cpp \
@@ -196,6 +199,7 @@ LOCAL_SRC_FILES := \
jni/src/mapgen/mg_schematic.cpp \
jni/src/minimap.cpp \
jni/src/mods.cpp \
jni/src/modchannels.cpp \
jni/src/nameidmapping.cpp \
jni/src/nodedef.cpp \
jni/src/nodemetadata.cpp \
@@ -222,12 +226,12 @@ LOCAL_SRC_FILES := \
jni/src/serverobject.cpp \
jni/src/shader.cpp \
jni/src/sky.cpp \
jni/src/socket.cpp \
jni/src/sound.cpp \
jni/src/sound_openal.cpp \
jni/src/staticobject.cpp \
jni/src/subgame.cpp \
jni/src/tileanimation.cpp \
jni/src/translation.cpp \
jni/src/tool.cpp \
jni/src/mapgen/treegen.cpp \
jni/src/version.cpp \
@@ -250,6 +254,7 @@ LOCAL_SRC_FILES := \
jni/src/unittest/test_compression.cpp \
jni/src/unittest/test_connection.cpp \
jni/src/unittest/test_filepath.cpp \
jni/src/unittest/test_gameui.cpp \
jni/src/unittest/test_inventory.cpp \
jni/src/unittest/test_map_settings_manager.cpp \
jni/src/unittest/test_mapnode.cpp \
@@ -266,28 +271,39 @@ LOCAL_SRC_FILES := \
jni/src/unittest/test_utilities.cpp \
jni/src/unittest/test_voxelalgorithms.cpp \
jni/src/unittest/test_voxelmanipulator.cpp \
jni/src/touchscreengui.cpp \
jni/src/database-leveldb.cpp \
jni/src/settings.cpp \
jni/src/wieldmesh.cpp \
jni/src/client/clientlauncher.cpp \
jni/src/client/gameui.cpp \
jni/src/client/hud.cpp \
jni/src/client/inputhandler.cpp \
jni/src/client/renderingengine.cpp \
jni/src/client/tile.cpp \
jni/src/client/joystick_controller.cpp \
jni/src/irrlicht_changes/static_text.cpp
jni/src/client/render/factory.cpp \
jni/src/client/render/pageflip.cpp \
jni/src/client/render/sidebyside.cpp \
jni/src/client/render/plain.cpp \
jni/src/client/render/anaglyph.cpp \
jni/src/client/render/interlaced.cpp \
jni/src/client/render/core.cpp \
jni/src/client/render/stereo.cpp \
jni/src/irrlicht_changes/static_text.cpp \
jni/src/irrlicht_changes/CGUITTFont.cpp

# intentionally kept out (we already build openssl itself): jni/src/util/sha256.c

# Network
LOCAL_SRC_FILES += \
jni/src/network/address.cpp \
jni/src/network/connection.cpp \
jni/src/network/networkpacket.cpp \
jni/src/network/clientopcodes.cpp \
jni/src/network/clientpackethandler.cpp \
jni/src/network/connectionthreads.cpp \
jni/src/network/serveropcodes.cpp \
jni/src/network/serverpackethandler.cpp \
jni/src/network/socket.cpp \

# lua api
LOCAL_SRC_FILES += \
@@ -303,6 +319,7 @@ LOCAL_SRC_FILES += \
jni/src/script/cpp_api/s_inventory.cpp \
jni/src/script/cpp_api/s_item.cpp \
jni/src/script/cpp_api/s_mainmenu.cpp \
jni/src/script/cpp_api/s_modchannels.cpp \
jni/src/script/cpp_api/s_node.cpp \
jni/src/script/cpp_api/s_nodemeta.cpp \
jni/src/script/cpp_api/s_player.cpp \
@@ -322,6 +339,7 @@ LOCAL_SRC_FILES += \
jni/src/script/lua_api/l_mapgen.cpp \
jni/src/script/lua_api/l_metadata.cpp \
jni/src/script/lua_api/l_minimap.cpp \
jni/src/script/lua_api/l_modchannels.cpp \
jni/src/script/lua_api/l_nodemeta.cpp \
jni/src/script/lua_api/l_nodetimer.cpp \
jni/src/script/lua_api/l_noise.cpp \
@@ -341,7 +359,7 @@ LOCAL_SRC_FILES += \
jni/src/script/scripting_mainmenu.cpp

#freetype2 support
LOCAL_SRC_FILES += jni/src/cguittfont/xCGUITTFont.cpp
#LOCAL_SRC_FILES += jni/src/cguittfont/xCGUITTFont.cpp

# Lua
LOCAL_SRC_FILES += \
@@ -382,7 +400,6 @@ LOCAL_SRC_FILES += deps/sqlite/sqlite3.c
# Threading
LOCAL_SRC_FILES += \
jni/src/threading/event.cpp \
jni/src/threading/mutex.cpp \
jni/src/threading/semaphore.cpp \
jni/src/threading/thread.cpp

@@ -1,9 +1,11 @@
APP_PLATFORM := ${APP_PLATFORM}
APP_ABI := ${TARGET_ABI}
APP_STL := gnustl_static
NDK_TOOLCHAIN_VERSION := 4.9
APP_STL := c++_shared
NDK_TOOLCHAIN_VERSION := ${COMPILER_VERSION}
APP_DEPRECATED_HEADERS := true
APP_MODULES := minetest
ifndef NDEBUG
APP_OPTIM := debug
endif

APP_CPPFLAGS += -fexceptions
APP_GNUSTL_FORCE_CPP_FEATURES := rtti
APP_CPPFLAGS += -fexceptions -std=c++11 -frtti
@@ -4,5 +4,5 @@ APP_STL := c++_shared
NDK_TOOLCHAIN_VERSION := ${COMPILER_VERSION}
APP_DEPRECATED_HEADERS := true

APP_CLAFGS += -mfloat-abi=softfp -mfpu=vfpv3 -O3
APP_CPPFLAGS += -fexceptions
APP_CLAFGS += ${TARGET_CFLAGS_ADDON}
APP_CPPFLAGS += ${TARGET_CXXFLAGS_ADDON} -fexceptions -std=c++11
@@ -1,9 +1,9 @@
APP_PLATFORM := ${APP_PLATFORM}
APP_ABI := ${TARGET_ABI}
APP_STL := gnustl_static
NDK_TOOLCHAIN_VERSION := 4.9
APP_STL := c++_shared
NDK_TOOLCHAIN_VERSION := ${COMPILER_VERSION}
APP_DEPRECATED_HEADERS := true
APP_MODULES := Irrlicht

APP_CLAFGS += -mfloat-abi=softfp -mfpu=vfpv3 -O3
APP_CPPFLAGS += -fexceptions
APP_CLAFGS += ${TARGET_CFLAGS_ADDON}
APP_CPPFLAGS += ${TARGET_CXXFLAGS_ADDON} -fexceptions
@@ -84,8 +84,6 @@ protected void onActivityResult(int requestCode, int resultCode,
System.loadLibrary("openal");
System.loadLibrary("ogg");
System.loadLibrary("vorbis");
System.loadLibrary("ssl");
System.loadLibrary("crypto");
System.loadLibrary("gmp");
System.loadLibrary("iconv");

@@ -215,7 +215,7 @@ bool ClientLauncher::run(GameParams &game_params, const Settings &cmd_args)
video::ETCF_CREATE_MIP_MAPS, g_settings->getBool("mip_map"));

#ifdef HAVE_TOUCHSCREENGUI
receiver->m_touchscreengui = new TouchScreenGUI(device, receiver);
receiver->m_touchscreengui = new TouchScreenGUI(RenderingEngine::get_raw_device(), receiver);
g_touchscreengui = receiver->m_touchscreengui;
#endif

@@ -45,6 +45,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <X11/Xutil.h>
#endif

#ifdef __ANDROID__
#include "filesys.h"
#endif

RenderingEngine *RenderingEngine::s_singleton = nullptr;

RenderingEngine::RenderingEngine(IEventReceiver *receiver)
@@ -567,4 +571,15 @@ v2u32 RenderingEngine::getDisplaySize()

return deskres;
}

#else // __ANDROID__
float RenderingEngine::getDisplayDensity()
{
return porting::getDisplayDensity();
}

v2u32 RenderingEngine::getDisplaySize()
{
return porting::getDisplaySize();
}
#endif // __ANDROID__
@@ -794,7 +794,7 @@ video::ITexture* TextureSource::generateTextureFromMesh(
g_settings->getBool("inventory_image_hack")
) {
// Get a scene manager
scene::ISceneManager *smgr_main = m_device->getSceneManager();
scene::ISceneManager *smgr_main = RenderingEngine::get_raw_device()->getSceneManager();
sanity_check(smgr_main);
scene::ISceneManager *smgr = smgr_main->createNewSceneManager();
sanity_check(smgr);
@@ -28,6 +28,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <memory>
#include "util/numeric.h"

#if __ANDROID__
#include <IVideoDriver.h>
#endif

class IGameDef;
struct TileSpec;
struct TileDef;
@@ -153,7 +157,7 @@ class IWritableTextureSource : public ITextureSource
IWritableTextureSource *createTextureSource();

#ifdef __ANDROID__
video::IImage * Align2Npot2(video::IImage * image, video::IVideoDriver* driver);
video::IImage * Align2Npot2(video::IImage * image, irr::video::IVideoDriver* driver);
#endif

enum MaterialType{
@@ -2092,10 +2092,11 @@ void Game::toggleFreeMoveAlt()
void Game::toggleFast()
{
bool fast_move = !g_settings->getBool("fast_move");
bool has_fast_privs = client->checkPrivilege("fast");
g_settings->set("fast_move", bool_to_cstr(fast_move));

if (fast_move) {
if (client->checkPrivilege("fast")) {
if (has_fast_privs) {
m_game_ui->showTranslatedStatusText("Fast mode enabled");
} else {
m_game_ui->showTranslatedStatusText("Fast mode enabled (note: no 'fast' privilege)");
@@ -1522,3 +1522,10 @@ void GUIEditBoxWithScrollBar::deserializeAttributes(io::IAttributes* in, io::SAt
// setOverrideFont(in->getAttributeAsFont("OverrideFont"));
setWritable(in->getAttributeAsBool("Writable"));
}

bool GUIEditBoxWithScrollBar::isDrawBackgroundEnabled() const { return false; }
bool GUIEditBoxWithScrollBar::isDrawBorderEnabled() const { return false; }
void GUIEditBoxWithScrollBar::setCursorChar(const wchar_t cursorChar) { }
wchar_t GUIEditBoxWithScrollBar::getCursorChar() const { return '|'; }
void GUIEditBoxWithScrollBar::setCursorBlinkTime(irr::u32 timeMs) { }
irr::u32 GUIEditBoxWithScrollBar::getCursorBlinkTime() const { return 500; }
@@ -128,6 +128,13 @@ class GUIEditBoxWithScrollBar : public IGUIEditBox
//! Reads attributes of the element
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options);

virtual bool isDrawBackgroundEnabled() const;
virtual bool isDrawBorderEnabled() const;
virtual void setCursorChar(const wchar_t cursorChar);
virtual wchar_t getCursorChar() const;
virtual void setCursorBlinkTime(irr::u32 timeMs);
virtual irr::u32 getCursorBlinkTime() const;

protected:
//! Breaks the single text line.
void breakText();
@@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <IEventReceiver.h>
#include <IGUIButton.h>
#include <IGUIEnvironment.h>
#include <IrrlichtDevice.h>

#include <map>
#include <vector>
@@ -76,4 +76,9 @@ int getInputDialogState();
*/
std::string getInputDialogValue();

#ifndef SERVER
float getDisplayDensity();
v2u32 getDisplaySize();
#endif

}

0 comments on commit 22a891a

Please sign in to comment.