| @@ -55,10 +55,10 @@ public: | |||||
| getTargetLocation() = getDefaultBuildsRootFolder() + "Android"; | getTargetLocation() = getDefaultBuildsRootFolder() + "Android"; | ||||
| if (getSDKPath().toString().isEmpty()) | if (getSDKPath().toString().isEmpty()) | ||||
| getSDKPath() = "${user.home}/SDKs/android-sdk-mac_x86"; | |||||
| getSDKPath() = "${user.home}/SDKs/android-sdk-macosx"; | |||||
| if (getNDKPath().toString().isEmpty()) | if (getNDKPath().toString().isEmpty()) | ||||
| getNDKPath() = "${user.home}/SDKs/android-ndk-r6b"; | |||||
| getNDKPath() = "${user.home}/SDKs/android-ndk-r7"; | |||||
| if (getInternetNeeded().toString().isEmpty()) | if (getInternetNeeded().toString().isEmpty()) | ||||
| getInternetNeeded() = true; | getInternetNeeded() = true; | ||||
| @@ -119,7 +119,7 @@ public: | |||||
| { | { | ||||
| ScopedPointer<XmlElement> manifest (createManifestXML()); | 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")); | writeApplicationMk (jniFolder.getChildFile ("Application.mk")); | ||||
| @@ -230,7 +230,6 @@ private: | |||||
| << newLine | << newLine | ||||
| << "include $(CLEAR_VARS)" << newLine | << "include $(CLEAR_VARS)" << newLine | ||||
| << newLine | << newLine | ||||
| << "LOCAL_CPP_EXTENSION := cpp" << newLine | |||||
| << "LOCAL_MODULE := juce_jni" << newLine | << "LOCAL_MODULE := juce_jni" << newLine | ||||
| << "LOCAL_SRC_FILES := \\" << newLine; | << "LOCAL_SRC_FILES := \\" << newLine; | ||||
| @@ -189,11 +189,21 @@ protected: | |||||
| throw SaveError ("Can't create folder: " + dirToCreate.getFullPathName()); | 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; | MemoryOutputStream mo; | ||||
| xml.writeToStream (mo, String::empty, false, true, encoding, maxCharsPerLine); | 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: | 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) | include $(CLEAR_VARS) | ||||
| LOCAL_CPP_EXTENSION := cpp | |||||
| LOCAL_MODULE := juce_jni | LOCAL_MODULE := juce_jni | ||||
| LOCAL_SRC_FILES := \ | LOCAL_SRC_FILES := \ | ||||
| ../../../Source/ApplicationStartup.cpp\ | ../../../Source/ApplicationStartup.cpp\ | ||||
| @@ -1,6 +1,6 @@ | |||||
| # This file is used to override default values used by the Ant build system. | # 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!. | # 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"/> | <LINUX_MAKE targetFolder="Builds/Linux" vstFolder="~/SDKs/vstsdk2.4" juceFolder="../../../juce"/> | ||||
| <VS2010 targetFolder="Builds/VisualStudio2010" vstFolder="c:\SDKs\vstsdk2.4" | <VS2010 targetFolder="Builds/VisualStudio2010" vstFolder="c:\SDKs\vstsdk2.4" | ||||
| rtasFolder="c:\SDKs\PT_80_SDK" libraryType="1" juceFolder="../../../juce"/> | 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"/> | androidInternetNeeded="1"/> | ||||
| </EXPORTFORMATS> | </EXPORTFORMATS> | ||||
| <CONFIGURATIONS> | <CONFIGURATIONS> | ||||
| @@ -183,17 +183,12 @@ private: | |||||
| #define JUCE_64BIT_ATOMICS_UNAVAILABLE 1 | #define JUCE_64BIT_ATOMICS_UNAVAILABLE 1 | ||||
| #endif | #endif | ||||
| //============================================================================== | |||||
| #elif JUCE_ANDROID | |||||
| #define JUCE_ATOMICS_ANDROID 1 // Android atomic functions | |||||
| #define JUCE_64BIT_ATOMICS_UNAVAILABLE 1 | |||||
| //============================================================================== | //============================================================================== | ||||
| #elif JUCE_GCC | #elif JUCE_GCC | ||||
| #define JUCE_ATOMICS_GCC 1 // GCC with intrinsics | #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 | #endif | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -255,8 +250,6 @@ inline Type Atomic<Type>::get() const noexcept | |||||
| #elif JUCE_ATOMICS_WINDOWS | #elif JUCE_ATOMICS_WINDOWS | ||||
| return sizeof (Type) == 4 ? castFrom32Bit ((int32) juce_InterlockedExchangeAdd ((volatile long*) &value, (long) 0)) | return sizeof (Type) == 4 ? castFrom32Bit ((int32) juce_InterlockedExchangeAdd ((volatile long*) &value, (long) 0)) | ||||
| : castFrom64Bit ((int64) juce_InterlockedExchangeAdd64 ((volatile __int64*) &value, (__int64) 0)); | : castFrom64Bit ((int64) juce_InterlockedExchangeAdd64 ((volatile __int64*) &value, (__int64) 0)); | ||||
| #elif JUCE_ATOMICS_ANDROID | |||||
| return value; | |||||
| #elif JUCE_ATOMICS_GCC | #elif JUCE_ATOMICS_GCC | ||||
| return sizeof (Type) == 4 ? castFrom32Bit ((int32) __sync_add_and_fetch ((volatile int32*) &value, 0)) | return sizeof (Type) == 4 ? castFrom32Bit ((int32) __sync_add_and_fetch ((volatile int32*) &value, 0)) | ||||
| : castFrom64Bit ((int64) __sync_add_and_fetch ((volatile int64*) &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> | template <typename Type> | ||||
| inline Type Atomic<Type>::exchange (const Type newValue) noexcept | 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; | Type currentVal = value; | ||||
| while (! compareAndSetBool (newValue, currentVal)) { currentVal = value; } | while (! compareAndSetBool (newValue, currentVal)) { currentVal = value; } | ||||
| return currentVal; | return currentVal; | ||||
| @@ -287,14 +278,6 @@ inline Type Atomic<Type>::operator+= (const Type amountToAdd) noexcept | |||||
| #elif JUCE_ATOMICS_WINDOWS | #elif JUCE_ATOMICS_WINDOWS | ||||
| return sizeof (Type) == 4 ? (Type) (juce_InterlockedExchangeAdd ((volatile long*) &value, (long) amountToAdd) + (long) amountToAdd) | return sizeof (Type) == 4 ? (Type) (juce_InterlockedExchangeAdd ((volatile long*) &value, (long) amountToAdd) + (long) amountToAdd) | ||||
| : (Type) (juce_InterlockedExchangeAdd64 ((volatile __int64*) &value, (__int64) amountToAdd) + (__int64) 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 | #elif JUCE_ATOMICS_GCC | ||||
| return (Type) __sync_add_and_fetch (&value, amountToAdd); | return (Type) __sync_add_and_fetch (&value, amountToAdd); | ||||
| #endif | #endif | ||||
| @@ -315,8 +298,6 @@ inline Type Atomic<Type>::operator++() noexcept | |||||
| #elif JUCE_ATOMICS_WINDOWS | #elif JUCE_ATOMICS_WINDOWS | ||||
| return sizeof (Type) == 4 ? (Type) juce_InterlockedIncrement ((volatile long*) &value) | return sizeof (Type) == 4 ? (Type) juce_InterlockedIncrement ((volatile long*) &value) | ||||
| : (Type) juce_InterlockedIncrement64 ((volatile __int64*) &value); | : (Type) juce_InterlockedIncrement64 ((volatile __int64*) &value); | ||||
| #elif JUCE_ATOMICS_ANDROID | |||||
| return (Type) (__atomic_inc ((volatile int*) &value) + 1); | |||||
| #elif JUCE_ATOMICS_GCC | #elif JUCE_ATOMICS_GCC | ||||
| return (Type) __sync_add_and_fetch (&value, 1); | return (Type) __sync_add_and_fetch (&value, 1); | ||||
| #endif | #endif | ||||
| @@ -331,8 +312,6 @@ inline Type Atomic<Type>::operator--() noexcept | |||||
| #elif JUCE_ATOMICS_WINDOWS | #elif JUCE_ATOMICS_WINDOWS | ||||
| return sizeof (Type) == 4 ? (Type) juce_InterlockedDecrement ((volatile long*) &value) | return sizeof (Type) == 4 ? (Type) juce_InterlockedDecrement ((volatile long*) &value) | ||||
| : (Type) juce_InterlockedDecrement64 ((volatile __int64*) &value); | : (Type) juce_InterlockedDecrement64 ((volatile __int64*) &value); | ||||
| #elif JUCE_ATOMICS_ANDROID | |||||
| return (Type) (__atomic_dec ((volatile int*) &value) - 1); | |||||
| #elif JUCE_ATOMICS_GCC | #elif JUCE_ATOMICS_GCC | ||||
| return (Type) __sync_add_and_fetch (&value, -1); | return (Type) __sync_add_and_fetch (&value, -1); | ||||
| #endif | #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); | : OSAtomicCompareAndSwap64Barrier ((int64_t) castTo64Bit (valueToCompare), (int64_t) castTo64Bit (newValue), (JUCE_MAC_ATOMICS_VOLATILE int64_t*) &value); | ||||
| #elif JUCE_ATOMICS_WINDOWS | #elif JUCE_ATOMICS_WINDOWS | ||||
| return compareAndSetValue (newValue, valueToCompare) == valueToCompare; | return compareAndSetValue (newValue, valueToCompare) == valueToCompare; | ||||
| #elif JUCE_ATOMICS_ANDROID | |||||
| return __atomic_cmpxchg (castTo32Bit (valueToCompare), castTo32Bit (newValue), (volatile int*) &value) == 0; | |||||
| #elif JUCE_ATOMICS_GCC | #elif JUCE_ATOMICS_GCC | ||||
| return sizeof (Type) == 4 ? __sync_bool_compare_and_swap ((volatile int32*) &value, castTo32Bit (valueToCompare), castTo32Bit (newValue)) | 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)); | : __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> | template <typename Type> | ||||
| inline Type Atomic<Type>::compareAndSetValue (const Type newValue, const Type valueToCompare) noexcept | 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.. | for (;;) // Annoying workaround for only having a bool CAS operation.. | ||||
| { | { | ||||
| if (compareAndSetBool (newValue, valueToCompare)) | if (compareAndSetBool (newValue, valueToCompare)) | ||||
| @@ -114,6 +114,9 @@ | |||||
| //============================================================================== | //============================================================================== | ||||
| #elif JUCE_ANDROID | #elif JUCE_ANDROID | ||||
| #ifndef GL_GLEXT_PROTOTYPES | |||||
| #define GL_GLEXT_PROTOTYPES 1 | |||||
| #endif | |||||
| #include <GLES/glext.h> | #include <GLES/glext.h> | ||||
| #endif | #endif | ||||
| @@ -128,6 +131,18 @@ | |||||
| #define JUCE_INSTANTIATE_GL_EXTENSION(name) \ | #define JUCE_INSTANTIATE_GL_EXTENSION(name) \ | ||||
| name = (type_ ## name) OpenGLHelpers::getExtensionFunction (#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 | // START_AUTOINCLUDE opengl/*.cpp | ||||
| #include "opengl/juce_OpenGLComponent.cpp" | #include "opengl/juce_OpenGLComponent.cpp" | ||||
| @@ -66,18 +66,6 @@ | |||||
| #include <GLES/gl.h> | #include <GLES/gl.h> | ||||
| #endif | #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 | BEGIN_JUCE_NAMESPACE | ||||
| #include "opengl/juce_OpenGLRenderingTarget.h" | #include "opengl/juce_OpenGLRenderingTarget.h" | ||||