mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-23 01:44:22 +00:00
Android updates to support NDK r7.
This commit is contained in:
parent
cd0683ef4d
commit
ba53323cbd
9 changed files with 53 additions and 65 deletions
|
|
@ -55,10 +55,10 @@ public:
|
|||
getTargetLocation() = getDefaultBuildsRootFolder() + "Android";
|
||||
|
||||
if (getSDKPath().toString().isEmpty())
|
||||
getSDKPath() = "${user.home}/SDKs/android-sdk-mac_x86";
|
||||
getSDKPath() = "${user.home}/SDKs/android-sdk-macosx";
|
||||
|
||||
if (getNDKPath().toString().isEmpty())
|
||||
getNDKPath() = "${user.home}/SDKs/android-ndk-r6b";
|
||||
getNDKPath() = "${user.home}/SDKs/android-ndk-r7";
|
||||
|
||||
if (getInternetNeeded().toString().isEmpty())
|
||||
getInternetNeeded() = true;
|
||||
|
|
@ -119,7 +119,7 @@ public:
|
|||
|
||||
{
|
||||
ScopedPointer<XmlElement> manifest (createManifestXML());
|
||||
writeXmlOrThrow (*manifest, target.getChildFile ("AndroidManifest.xml"), "utf-8", 100);
|
||||
writeXmlOrThrow (*manifest, target.getChildFile ("AndroidManifest.xml"), "utf-8", 100, true);
|
||||
}
|
||||
|
||||
writeApplicationMk (jniFolder.getChildFile ("Application.mk"));
|
||||
|
|
@ -230,7 +230,6 @@ private:
|
|||
<< newLine
|
||||
<< "include $(CLEAR_VARS)" << newLine
|
||||
<< newLine
|
||||
<< "LOCAL_CPP_EXTENSION := cpp" << newLine
|
||||
<< "LOCAL_MODULE := juce_jni" << newLine
|
||||
<< "LOCAL_SRC_FILES := \\" << newLine;
|
||||
|
||||
|
|
|
|||
|
|
@ -189,11 +189,21 @@ protected:
|
|||
throw SaveError ("Can't create folder: " + dirToCreate.getFullPathName());
|
||||
}
|
||||
|
||||
static void writeXmlOrThrow (const XmlElement& xml, const File& file, const String& encoding, int maxCharsPerLine)
|
||||
static void writeXmlOrThrow (const XmlElement& xml, const File& file, const String& encoding, int maxCharsPerLine, bool useUnixNewLines = false)
|
||||
{
|
||||
MemoryOutputStream mo;
|
||||
xml.writeToStream (mo, String::empty, false, true, encoding, maxCharsPerLine);
|
||||
overwriteFileIfDifferentOrThrow (file, mo);
|
||||
|
||||
if (useUnixNewLines)
|
||||
{
|
||||
MemoryOutputStream mo2;
|
||||
mo2 << mo.toString().replace ("\r\n", "\n");
|
||||
overwriteFileIfDifferentOrThrow (file, mo2);
|
||||
}
|
||||
else
|
||||
{
|
||||
overwriteFileIfDifferentOrThrow (file, mo);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0"
|
||||
package="com.juce">
|
||||
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:anyDensity="true"/>
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<application android:label="@string/app_name" android:icon="@drawable/icon">
|
||||
<activity android:name="JuceAppActivity" android:label="@string/app_name">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0"
|
||||
package="com.juce">
|
||||
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:anyDensity="true"/>
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<application android:label="@string/app_name" android:icon="@drawable/icon">
|
||||
<activity android:name="JuceAppActivity" android:label="@string/app_name">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ LOCAL_PATH := $(call my-dir)
|
|||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_CPP_EXTENSION := cpp
|
||||
LOCAL_MODULE := juce_jni
|
||||
LOCAL_SRC_FILES := \
|
||||
../../../Source/ApplicationStartup.cpp\
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# This file is used to override default values used by the Ant build system.
|
||||
# It is automatically generated by the Introjucer - DO NOT EDIT IT or your changes will be lost!.
|
||||
|
||||
sdk.dir=${user.home}/SDKs/android-sdk-mac_x86
|
||||
ndk.dir=${user.home}/SDKs/android-ndk-r6b
|
||||
sdk.dir=${user.home}/SDKs/android-sdk-macosx
|
||||
ndk.dir=${user.home}/SDKs/android-ndk-r7
|
||||
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@
|
|||
<LINUX_MAKE targetFolder="Builds/Linux" vstFolder="~/SDKs/vstsdk2.4" juceFolder="../../../juce"/>
|
||||
<VS2010 targetFolder="Builds/VisualStudio2010" vstFolder="c:\SDKs\vstsdk2.4"
|
||||
rtasFolder="c:\SDKs\PT_80_SDK" libraryType="1" juceFolder="../../../juce"/>
|
||||
<ANDROID targetFolder="Builds/Android" androidSDKPath="${user.home}/SDKs/android-sdk-mac_x86"
|
||||
androidNDKPath="${user.home}/SDKs/android-ndk-r6b" juceFolder="../../../juce"
|
||||
<ANDROID targetFolder="Builds/Android" androidSDKPath="${user.home}/SDKs/android-sdk-macosx"
|
||||
androidNDKPath="${user.home}/SDKs/android-ndk-r7" juceFolder="../../../juce"
|
||||
androidInternetNeeded="1"/>
|
||||
</EXPORTFORMATS>
|
||||
<CONFIGURATIONS>
|
||||
|
|
|
|||
|
|
@ -183,17 +183,12 @@ private:
|
|||
#define JUCE_64BIT_ATOMICS_UNAVAILABLE 1
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
#elif JUCE_ANDROID
|
||||
#define JUCE_ATOMICS_ANDROID 1 // Android atomic functions
|
||||
#define JUCE_64BIT_ATOMICS_UNAVAILABLE 1
|
||||
|
||||
//==============================================================================
|
||||
#elif JUCE_GCC
|
||||
#define JUCE_ATOMICS_GCC 1 // GCC with intrinsics
|
||||
|
||||
#if JUCE_IOS
|
||||
#define JUCE_64BIT_ATOMICS_UNAVAILABLE 1 // (on the iphone, the 64-bit ops will compile but not link)
|
||||
#if JUCE_IOS || JUCE_ANDROID // (64-bit ops will compile but not link on these mobile OSes)
|
||||
#define JUCE_64BIT_ATOMICS_UNAVAILABLE 1
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -255,8 +250,6 @@ inline Type Atomic<Type>::get() const noexcept
|
|||
#elif JUCE_ATOMICS_WINDOWS
|
||||
return sizeof (Type) == 4 ? castFrom32Bit ((int32) juce_InterlockedExchangeAdd ((volatile long*) &value, (long) 0))
|
||||
: castFrom64Bit ((int64) juce_InterlockedExchangeAdd64 ((volatile __int64*) &value, (__int64) 0));
|
||||
#elif JUCE_ATOMICS_ANDROID
|
||||
return value;
|
||||
#elif JUCE_ATOMICS_GCC
|
||||
return sizeof (Type) == 4 ? castFrom32Bit ((int32) __sync_add_and_fetch ((volatile int32*) &value, 0))
|
||||
: castFrom64Bit ((int64) __sync_add_and_fetch ((volatile int64*) &value, 0));
|
||||
|
|
@ -266,9 +259,7 @@ inline Type Atomic<Type>::get() const noexcept
|
|||
template <typename Type>
|
||||
inline Type Atomic<Type>::exchange (const Type newValue) noexcept
|
||||
{
|
||||
#if JUCE_ATOMICS_ANDROID
|
||||
return castFrom32Bit (__atomic_swap (castTo32Bit (newValue), (volatile int*) &value));
|
||||
#elif JUCE_ATOMICS_MAC || JUCE_ATOMICS_GCC
|
||||
#if JUCE_ATOMICS_MAC || JUCE_ATOMICS_GCC
|
||||
Type currentVal = value;
|
||||
while (! compareAndSetBool (newValue, currentVal)) { currentVal = value; }
|
||||
return currentVal;
|
||||
|
|
@ -287,14 +278,6 @@ inline Type Atomic<Type>::operator+= (const Type amountToAdd) noexcept
|
|||
#elif JUCE_ATOMICS_WINDOWS
|
||||
return sizeof (Type) == 4 ? (Type) (juce_InterlockedExchangeAdd ((volatile long*) &value, (long) amountToAdd) + (long) amountToAdd)
|
||||
: (Type) (juce_InterlockedExchangeAdd64 ((volatile __int64*) &value, (__int64) amountToAdd) + (__int64) amountToAdd);
|
||||
#elif JUCE_ATOMICS_ANDROID
|
||||
for (;;)
|
||||
{
|
||||
const Type oldValue (value);
|
||||
const Type newValue (castFrom32Bit (castTo32Bit (oldValue) + castTo32Bit (amountToAdd)));
|
||||
if (compareAndSetBool (newValue, oldValue))
|
||||
return newValue;
|
||||
}
|
||||
#elif JUCE_ATOMICS_GCC
|
||||
return (Type) __sync_add_and_fetch (&value, amountToAdd);
|
||||
#endif
|
||||
|
|
@ -315,8 +298,6 @@ inline Type Atomic<Type>::operator++() noexcept
|
|||
#elif JUCE_ATOMICS_WINDOWS
|
||||
return sizeof (Type) == 4 ? (Type) juce_InterlockedIncrement ((volatile long*) &value)
|
||||
: (Type) juce_InterlockedIncrement64 ((volatile __int64*) &value);
|
||||
#elif JUCE_ATOMICS_ANDROID
|
||||
return (Type) (__atomic_inc ((volatile int*) &value) + 1);
|
||||
#elif JUCE_ATOMICS_GCC
|
||||
return (Type) __sync_add_and_fetch (&value, 1);
|
||||
#endif
|
||||
|
|
@ -331,8 +312,6 @@ inline Type Atomic<Type>::operator--() noexcept
|
|||
#elif JUCE_ATOMICS_WINDOWS
|
||||
return sizeof (Type) == 4 ? (Type) juce_InterlockedDecrement ((volatile long*) &value)
|
||||
: (Type) juce_InterlockedDecrement64 ((volatile __int64*) &value);
|
||||
#elif JUCE_ATOMICS_ANDROID
|
||||
return (Type) (__atomic_dec ((volatile int*) &value) - 1);
|
||||
#elif JUCE_ATOMICS_GCC
|
||||
return (Type) __sync_add_and_fetch (&value, -1);
|
||||
#endif
|
||||
|
|
@ -346,8 +325,6 @@ inline bool Atomic<Type>::compareAndSetBool (const Type newValue, const Type val
|
|||
: OSAtomicCompareAndSwap64Barrier ((int64_t) castTo64Bit (valueToCompare), (int64_t) castTo64Bit (newValue), (JUCE_MAC_ATOMICS_VOLATILE int64_t*) &value);
|
||||
#elif JUCE_ATOMICS_WINDOWS
|
||||
return compareAndSetValue (newValue, valueToCompare) == valueToCompare;
|
||||
#elif JUCE_ATOMICS_ANDROID
|
||||
return __atomic_cmpxchg (castTo32Bit (valueToCompare), castTo32Bit (newValue), (volatile int*) &value) == 0;
|
||||
#elif JUCE_ATOMICS_GCC
|
||||
return sizeof (Type) == 4 ? __sync_bool_compare_and_swap ((volatile int32*) &value, castTo32Bit (valueToCompare), castTo32Bit (newValue))
|
||||
: __sync_bool_compare_and_swap ((volatile int64*) &value, castTo64Bit (valueToCompare), castTo64Bit (newValue));
|
||||
|
|
@ -357,7 +334,7 @@ inline bool Atomic<Type>::compareAndSetBool (const Type newValue, const Type val
|
|||
template <typename Type>
|
||||
inline Type Atomic<Type>::compareAndSetValue (const Type newValue, const Type valueToCompare) noexcept
|
||||
{
|
||||
#if JUCE_ATOMICS_MAC || JUCE_ATOMICS_ANDROID
|
||||
#if JUCE_ATOMICS_MAC
|
||||
for (;;) // Annoying workaround for only having a bool CAS operation..
|
||||
{
|
||||
if (compareAndSetBool (newValue, valueToCompare))
|
||||
|
|
|
|||
|
|
@ -114,6 +114,9 @@
|
|||
|
||||
//==============================================================================
|
||||
#elif JUCE_ANDROID
|
||||
#ifndef GL_GLEXT_PROTOTYPES
|
||||
#define GL_GLEXT_PROTOTYPES 1
|
||||
#endif
|
||||
#include <GLES/glext.h>
|
||||
#endif
|
||||
|
||||
|
|
@ -128,6 +131,18 @@
|
|||
#define JUCE_INSTANTIATE_GL_EXTENSION(name) \
|
||||
name = (type_ ## name) OpenGLHelpers::getExtensionFunction (#name);
|
||||
|
||||
#ifndef GL_BGRA_EXT
|
||||
#define GL_BGRA_EXT 0x80e1
|
||||
#endif
|
||||
|
||||
#ifndef GL_CLAMP_TO_EDGE
|
||||
#define GL_CLAMP_TO_EDGE 0x812f
|
||||
#endif
|
||||
|
||||
#ifndef GL_DEPTH_COMPONENT16
|
||||
#define GL_DEPTH_COMPONENT16 0x81a5
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
// START_AUTOINCLUDE opengl/*.cpp
|
||||
#include "opengl/juce_OpenGLComponent.cpp"
|
||||
|
|
|
|||
|
|
@ -66,18 +66,6 @@
|
|||
#include <GLES/gl.h>
|
||||
#endif
|
||||
|
||||
#ifndef GL_BGRA_EXT
|
||||
#define GL_BGRA_EXT 0x80e1
|
||||
#endif
|
||||
|
||||
#ifndef GL_CLAMP_TO_EDGE
|
||||
#define GL_CLAMP_TO_EDGE 0x812f
|
||||
#endif
|
||||
|
||||
#ifndef GL_DEPTH_COMPONENT16
|
||||
#define GL_DEPTH_COMPONENT16 0x81a5
|
||||
#endif
|
||||
|
||||
//=============================================================================
|
||||
BEGIN_JUCE_NAMESPACE
|
||||
#include "opengl/juce_OpenGLRenderingTarget.h"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue