Skip to content

Commit

Permalink
Fixed Android build issues
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMostDiligent committed Nov 17, 2017
1 parent a2da93a commit 68db615
Show file tree
Hide file tree
Showing 42 changed files with 6,819 additions and 19 deletions.
4 changes: 3 additions & 1 deletion Common/include/DebugUtilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

#ifdef _DEBUG

#include <typeinfo>

// This function is only requried to ensure that Message argument passed to the macro
// is actually string and not something else
inline void EnsureStr( const char* ){}
Expand Down Expand Up @@ -58,7 +60,7 @@ inline void EnsureStr( const char* ){}
template<typename DstType, typename SrcType>
void CheckDynamicType( SrcType *pSrcPtr )
{
VERIFY( pSrcPtr == nullptr || dynamic_cast<DstType*> (pSrcPtr) != nullptr, "Dynamic type cast failed!" );
VERIFY(pSrcPtr == nullptr || dynamic_cast<DstType*> (pSrcPtr) != nullptr, "Dynamic type cast failed. Src typeid: \'", typeid(*pSrcPtr).name(), "\' Dst typeid: \'", typeid(DstType).name(), '\'');
}
# define CHECK_DYNAMIC_TYPE(DstType, pSrcPtr) CheckDynamicType<DstType>(pSrcPtr)

Expand Down
2 changes: 1 addition & 1 deletion Common/include/FixedBlockMemoryAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class FixedBlockMemoryAllocator : public IMemoryAllocator

std::vector<MemoryPage, STDAllocatorRawMem<MemoryPage> > m_PagePool;
std::unordered_set<size_t, std::hash<size_t>, std::equal_to<size_t>, STDAllocatorRawMem<size_t> > m_AvailablePages;
typedef std::pair<void*, size_t> AddrToPageIdMapElem;
typedef std::pair<void* const, size_t> AddrToPageIdMapElem;
std::unordered_map<void*, size_t, std::hash<void*>, std::equal_to<void*>, STDAllocatorRawMem<AddrToPageIdMapElem> > m_AddrToPageId;

std::mutex m_Mutex;
Expand Down
2 changes: 1 addition & 1 deletion Common/include/ValidatedCast.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ DstType* ValidatedCast( SrcType *Ptr )
CHECK_DYNAMIC_TYPE( DstType, Ptr );
}
#endif
return static_cast<DstType*>( Ptr );
return Ptr != nullptr ? static_cast<DstType*>( Ptr ) : nullptr;
}
6 changes: 3 additions & 3 deletions Common/make/AppCommon.mk
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@

APP_PLATFORM := android-19
APP_ABI := armeabi-v7a
# NDK_TOOLCHAIN_VERSION := clang
NDK_TOOLCHAIN_VERSION := 4.9
APP_STL := gnustl_static
# NDK_TOOLCHAIN_VERSION := clang
# APP_STL := c++_static

ifeq ($(APP_OPTIM),release)
APP_CFLAGS := -O2 -DNDEBUG -g $(APP_CFLAGS)
else
APP_CFLAGS := -O0 -g -D_DEBUG $(APP_CFLAGS)
# APP_CPPFLAGS := -frtti $(APP_CPPFLAGS)
APP_CPPFLAGS := --rtti $(APP_CPPFLAGS)
APP_CPPFLAGS := -frtti $(APP_CPPFLAGS)
endif
2 changes: 1 addition & 1 deletion Common/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ Initial release

**Copyright 2015-2017 Egor Yusov**

[Diligent Graphics](http://diligentgraphics.com)
[Diligent Graphics](http://diligentgraphics.com)
76 changes: 76 additions & 0 deletions External/Android/ndk_helper/build/NdkHelper-Debug.vgdbsettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?xml version="1.0"?>
<VisualGDBProjectSettings2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ConfigurationName>Debug</ConfigurationName>
<Project xsi:type="com.visualgdb.project.android">
<CustomSourceDirectories>
<Directories />
<PathStyle>MinGWWindowsSlash</PathStyle>
</CustomSourceDirectories>
<AndroidProjectPath>$(ProjectDir)</AndroidProjectPath>
</Project>
<Build xsi:type="com.visualgdb.build.android">
<AndroidPlatform>android-19</AndroidPlatform>
<IsDebugConfiguration>true</IsDebugConfiguration>
<JNIOnlyBuild>true</JNIOnlyBuild>
<AdditionalDirectoriesToDeleteOnClean>bin;obj</AdditionalDirectoriesToDeleteOnClean>
<DeleteANTFilesOnClean>false</DeleteANTFilesOnClean>
<DoNotEditAndroidManifest>false</DoNotEditAndroidManifest>
<CustomActions />
</Build>
<Debug xsi:type="com.visualgdb.debug.android">
<AdditionalStartupCommands />
<AdditionalGDBSettings>
<FilterSpuriousStoppedNotifications>false</FilterSpuriousStoppedNotifications>
<ForceSingleThreadedMode>false</ForceSingleThreadedMode>
<PendingBreakpointsSupported>true</PendingBreakpointsSupported>
<DisableChildRanges>false</DisableChildRanges>
<UseAppleExtensions>false</UseAppleExtensions>
<CanAcceptCommandsWhileRunning>false</CanAcceptCommandsWhileRunning>
<MakeLogFile>false</MakeLogFile>
<IgnoreModuleEventsWhileStepping>true</IgnoreModuleEventsWhileStepping>
<UseRelativePathsOnly>false</UseRelativePathsOnly>
<ExitAction>KillApp</ExitAction>
<Features>
<DisableAutoDetection>false</DisableAutoDetection>
<UseFrameParameter>false</UseFrameParameter>
<SimpleValuesFlagSupported>false</SimpleValuesFlagSupported>
<ListLocalsSupported>false</ListLocalsSupported>
<ByteLevelMemoryCommandsAvailable>false</ByteLevelMemoryCommandsAvailable>
<ThreadInfoSupported>false</ThreadInfoSupported>
<PendingBreakpointsSupported>false</PendingBreakpointsSupported>
<SupportTargetCommand>false</SupportTargetCommand>
</Features>
<DisableDisassembly>false</DisableDisassembly>
<ExamineMemoryWithXCommand>false</ExamineMemoryWithXCommand>
<StepIntoNewInstanceEntry>main</StepIntoNewInstanceEntry>
<ExamineRegistersInRawFormat>true</ExamineRegistersInRawFormat>
</AdditionalGDBSettings>
<LaunchGDBSettings xsi:type="GDBLaunchParametersAndroid" />
<GenerateCtrlBreakInsteadOfCtrlC>false</GenerateCtrlBreakInsteadOfCtrlC>
<UseDefaultInstallDir>false</UseDefaultInstallDir>
<RemotePort>5039</RemotePort>
<LocalPort>5039</LocalPort>
<GDBServerStartupTimeout>10000</GDBServerStartupTimeout>
<AdditionalGDBServerStartupDelay>0</AdditionalGDBServerStartupDelay>
<DoubleSlashWorkaround>false</DoubleSlashWorkaround>
<AlreadyRunningDecision>Ask</AlreadyRunningDecision>
<ShowLogCat>true</ShowLogCat>
<EnableThreadNameWatcher>true</EnableThreadNameWatcher>
</Debug>
<CustomBuild>
<PreBuildActions />
<PostBuildActions />
<PreCleanActions />
<PostCleanActions />
</CustomBuild>
<CustomDebug>
<PreDebugActions />
<PostDebugActions />
<BreakMode>Default</BreakMode>
</CustomDebug>
<CustomShortcuts>
<Shortcuts />
<ShowMessageAfterExecuting>true</ShowMessageAfterExecuting>
</CustomShortcuts>
<UserDefinedVariables />
</VisualGDBProjectSettings2>
76 changes: 76 additions & 0 deletions External/Android/ndk_helper/build/NdkHelper-Release.vgdbsettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?xml version="1.0"?>
<VisualGDBProjectSettings2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ConfigurationName>Release</ConfigurationName>
<Project xsi:type="com.visualgdb.project.android">
<CustomSourceDirectories>
<Directories />
<PathStyle>MinGWWindowsSlash</PathStyle>
</CustomSourceDirectories>
<AndroidProjectPath>$(ProjectDir)</AndroidProjectPath>
</Project>
<Build xsi:type="com.visualgdb.build.android">
<AndroidPlatform>android-19</AndroidPlatform>
<IsDebugConfiguration>false</IsDebugConfiguration>
<JNIOnlyBuild>true</JNIOnlyBuild>
<AdditionalDirectoriesToDeleteOnClean>bin;obj</AdditionalDirectoriesToDeleteOnClean>
<DeleteANTFilesOnClean>false</DeleteANTFilesOnClean>
<DoNotEditAndroidManifest>false</DoNotEditAndroidManifest>
<CustomActions />
</Build>
<Debug xsi:type="com.visualgdb.debug.android">
<AdditionalStartupCommands />
<AdditionalGDBSettings>
<FilterSpuriousStoppedNotifications>false</FilterSpuriousStoppedNotifications>
<ForceSingleThreadedMode>false</ForceSingleThreadedMode>
<PendingBreakpointsSupported>true</PendingBreakpointsSupported>
<DisableChildRanges>false</DisableChildRanges>
<UseAppleExtensions>false</UseAppleExtensions>
<CanAcceptCommandsWhileRunning>false</CanAcceptCommandsWhileRunning>
<MakeLogFile>false</MakeLogFile>
<IgnoreModuleEventsWhileStepping>true</IgnoreModuleEventsWhileStepping>
<UseRelativePathsOnly>false</UseRelativePathsOnly>
<ExitAction>KillApp</ExitAction>
<Features>
<DisableAutoDetection>false</DisableAutoDetection>
<UseFrameParameter>false</UseFrameParameter>
<SimpleValuesFlagSupported>false</SimpleValuesFlagSupported>
<ListLocalsSupported>false</ListLocalsSupported>
<ByteLevelMemoryCommandsAvailable>false</ByteLevelMemoryCommandsAvailable>
<ThreadInfoSupported>false</ThreadInfoSupported>
<PendingBreakpointsSupported>false</PendingBreakpointsSupported>
<SupportTargetCommand>false</SupportTargetCommand>
</Features>
<DisableDisassembly>false</DisableDisassembly>
<ExamineMemoryWithXCommand>false</ExamineMemoryWithXCommand>
<StepIntoNewInstanceEntry>main</StepIntoNewInstanceEntry>
<ExamineRegistersInRawFormat>true</ExamineRegistersInRawFormat>
</AdditionalGDBSettings>
<LaunchGDBSettings xsi:type="GDBLaunchParametersAndroid" />
<GenerateCtrlBreakInsteadOfCtrlC>false</GenerateCtrlBreakInsteadOfCtrlC>
<UseDefaultInstallDir>false</UseDefaultInstallDir>
<RemotePort>5039</RemotePort>
<LocalPort>5039</LocalPort>
<GDBServerStartupTimeout>10000</GDBServerStartupTimeout>
<AdditionalGDBServerStartupDelay>0</AdditionalGDBServerStartupDelay>
<DoubleSlashWorkaround>false</DoubleSlashWorkaround>
<AlreadyRunningDecision>Ask</AlreadyRunningDecision>
<ShowLogCat>true</ShowLogCat>
<EnableThreadNameWatcher>true</EnableThreadNameWatcher>
</Debug>
<CustomBuild>
<PreBuildActions />
<PostBuildActions />
<PreCleanActions />
<PostCleanActions />
</CustomBuild>
<CustomDebug>
<PreDebugActions />
<PostDebugActions />
<BreakMode>Default</BreakMode>
</CustomDebug>
<CustomShortcuts>
<Shortcuts />
<ShowMessageAfterExecuting>true</ShowMessageAfterExecuting>
</CustomShortcuts>
<UserDefinedVariables />
</VisualGDBProjectSettings2>
60 changes: 60 additions & 0 deletions External/Android/ndk_helper/build/NdkHelper.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{22BA09AE-E0B5-49F1-8403-2A824762376E}</ProjectGuid>
<RootNamespace>AndroidPlatform</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<PlatformToolset>v120</PlatformToolset>
<ConfigurationType>Makefile</ConfigurationType>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<PlatformToolset>v120</PlatformToolset>
<ConfigurationType>Makefile</ConfigurationType>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<Import Project="..\..\..\..\Shared\build\Windows\Android32d.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<Import Project="..\..\..\..\Shared\build\Windows\Android32r.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemGroup>
<None Include="jni\Android.mk" />
<None Include="jni\Application.mk" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\gestureDetector.cpp" />
<ClCompile Include="..\src\JNIHelper.cpp" />
<ClCompile Include="..\src\perfMonitor.cpp" />
<ClCompile Include="..\src\sensorManager.cpp" />
<ClCompile Include="..\src\tapCamera.cpp" />
<ClCompile Include="..\src\vecmath.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\include\gestureDetector.h" />
<ClInclude Include="..\include\JNIHelper.h" />
<ClInclude Include="..\include\perfMonitor.h" />
<ClInclude Include="..\include\sensorManager.h" />
<ClInclude Include="..\include\tapCamera.h" />
<ClInclude Include="..\include\vecmath.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
64 changes: 64 additions & 0 deletions External/Android/ndk_helper/build/NdkHelper.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="jni">
<UniqueIdentifier>{5af229be-bfa0-48dc-9c77-f42bceac4839}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="jni\Android.mk">
<Filter>jni</Filter>
</None>
<None Include="jni\Application.mk">
<Filter>jni</Filter>
</None>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\gestureDetector.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\JNIHelper.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\sensorManager.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\tapCamera.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\perfMonitor.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\vecmath.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\include\gestureDetector.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\include\JNIHelper.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\include\tapCamera.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\include\perfMonitor.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\include\sensorManager.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\include\vecmath.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
26 changes: 26 additions & 0 deletions External/Android/ndk_helper/build/jni/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Android NDK project makefile autogenerated by Premake

# Preamble
DEPENDENCY_PATH := $(call my-dir)
LOCAL_PATH := $(abspath $(DEPENDENCY_PATH))
include $(CLEAR_VARS)


# Project configuration
LOCAL_MODULE := NdkHelper
LOCAL_CFLAGS := -std=c++11
LOCAL_CPP_FEATURES := exceptions
LOCAL_STATIC_LIBRARIES := cpufeatures android_native_app_glue
LOCAL_EXPORT_LDLIBS := -llog -landroid

# Include paths
PROJECT_ROOT := $(LOCAL_PATH)/../..
LOCAL_C_INCLUDES := $(PROJECT_ROOT)/include

# Source files
#VisualGDBAndroid: AutoUpdateSourcesInNextLine
LOCAL_SRC_FILES := ../../src/gestureDetector.cpp ../../src/JNIHelper.cpp ../../src/perfMonitor.cpp ../../src/sensorManager.cpp ../../src/tapCamera.cpp ../../src/vecmath.cpp

include $(BUILD_STATIC_LIBRARY)

$(call import-module,android/native_app_glue)
7 changes: 7 additions & 0 deletions External/Android/ndk_helper/build/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Generated by VisualGDB

DEPENDENCY_PATH := $(call my-dir)
LOCAL_PATH := $(abspath $(DEPENDENCY_PATH))
include $(LOCAL_PATH)/../../../../../Common/make/AppCommon.mk

APP_MODULES := NdkHelper
Loading

0 comments on commit 68db615

Please sign in to comment.