diff options
| author | Juan Ramos <juan@lunarg.com> | 2023-10-10 17:03:54 -0600 |
|---|---|---|
| committer | Juan Ramos <114601453+juan-lunarg@users.noreply.github.com> | 2023-10-10 17:28:58 -0600 |
| commit | d6a6498781cbdd63c0c018f5ffab39e16e920035 (patch) | |
| tree | e141912de38c710cab22d6da9d102cefe1315129 /cube/android | |
| parent | 72291571c8e569cbcd5d924e0b1ad24cdefa4442 (diff) | |
| download | usermoji-d6a6498781cbdd63c0c018f5ffab39e16e920035.tar.xz | |
cmake: Remove ndk-build
Successfully ran VkCube.apk on my Pixel3
closes #850
Diffstat (limited to 'cube/android')
| -rw-r--r-- | cube/android/.gitignore | 3 | ||||
| -rw-r--r-- | cube/android/AndroidManifest.xml (renamed from cube/android/cube/AndroidManifest.xml) | 5 | ||||
| -rw-r--r-- | cube/android/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | cube/android/README.md | 13 | ||||
| -rw-r--r-- | cube/android/cube-with-layers/AndroidManifest.xml | 27 | ||||
| -rw-r--r-- | cube/android/cube-with-layers/custom_rules.xml | 25 | ||||
| -rw-r--r-- | cube/android/cube-with-layers/res/values/strings.xml | 24 | ||||
| -rw-r--r-- | cube/android/cube/custom_rules.xml | 6 | ||||
| -rw-r--r-- | cube/android/cube/res/values/strings.xml | 24 | ||||
| -rw-r--r-- | cube/android/jni/Android.mk | 36 | ||||
| -rw-r--r-- | cube/android/jni/Application.mk | 20 |
11 files changed, 17 insertions, 168 deletions
diff --git a/cube/android/.gitignore b/cube/android/.gitignore deleted file mode 100644 index 8008f254..00000000 --- a/cube/android/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -bin -libs -obj diff --git a/cube/android/cube/AndroidManifest.xml b/cube/android/AndroidManifest.xml index 1bf9080b..fbec106d 100644 --- a/cube/android/cube/AndroidManifest.xml +++ b/cube/android/AndroidManifest.xml @@ -6,15 +6,14 @@ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.INTERNET"/> - <!-- This is the platform API where NativeActivity was introduced. --> <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="23"/> <!-- This .apk has no Java code itself, so set hasCode to false. --> - <application android:label="@string/app_name" android:hasCode="false" android:debuggable='true'> + <application android:label="VkCube" android:hasCode="false" android:debuggable='true'> <!-- Our activity is the built-in NativeActivity framework class. This will take care of integrating with our NDK code. --> - <activity android:name="android.app.NativeActivity" android:label="@string/app_name" android:exported="true"> + <activity android:name="android.app.NativeActivity" android:label="VkCube" android:exported="true"> <!-- Tell NativeActivity the name of or .so --> <meta-data android:name="android.app.lib_name" android:value="VkCube"/> <intent-filter> diff --git a/cube/android/CMakeLists.txt b/cube/android/CMakeLists.txt index 9d4e69c8..5783fa90 100644 --- a/cube/android/CMakeLists.txt +++ b/cube/android/CMakeLists.txt @@ -48,6 +48,8 @@ target_sources(android_glue PRIVATE ${native_app_glue_dir}/android_native_app_glue.h ) +set_target_properties(vkcube PROPERTIES OUTPUT_NAME "VkCube") + target_link_libraries(vkcube PRIVATE android_glue log diff --git a/cube/android/README.md b/cube/android/README.md index 75b1747f..08ed7488 100644 --- a/cube/android/README.md +++ b/cube/android/README.md @@ -26,3 +26,16 @@ Then run the script: ./generate_vulkan_wrapper.py ../cube/android/vulkan_wrapper.cpp clang-format -i vulkan_wrapper.h clang-format -i vulkan_wrapper.cpp + +# Running vkcube on Android + +```bash +cd build-android + +# Optional +adb uninstall com.example.VkCube + +adb install -r -g --no-incremental bin/VkCube.apk + +adb shell am start com.example.VkCube/android.app.NativeActivity +```
\ No newline at end of file diff --git a/cube/android/cube-with-layers/AndroidManifest.xml b/cube/android/cube-with-layers/AndroidManifest.xml deleted file mode 100644 index 50b216e4..00000000 --- a/cube/android/cube-with-layers/AndroidManifest.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.VkCubeWithLayers" android:versionCode="1" android:versionName="1.0"> - - <!-- Allow this app to read and write files (for use by tracing libraries). --> - <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> - <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> - <uses-permission android:name="android.permission.INTERNET"/> - - <!-- This is the platform API where NativeActivity was introduced. --> - <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="23"/> - - <!-- This .apk has no Java code itself, so set hasCode to false. --> - <application android:label="@string/app_name" android:hasCode="false" android:debuggable='true'> - - <!-- Our activity is the built-in NativeActivity framework class. - This will take care of integrating with our NDK code. --> - <activity android:name="android.app.NativeActivity" android:label="@string/app_name" android:exported="true"> - <!-- Tell NativeActivity the name of or .so --> - <meta-data android:name="android.app.lib_name" android:value="VkCube"/> - <intent-filter> - <action android:name="android.intent.action.MAIN"/> - <category android:name="android.intent.category.LAUNCHER"/> - </intent-filter> - </activity> - </application> - -</manifest> diff --git a/cube/android/cube-with-layers/custom_rules.xml b/cube/android/cube-with-layers/custom_rules.xml deleted file mode 100644 index 0ca5933e..00000000 --- a/cube/android/cube-with-layers/custom_rules.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project name="NativeActivity" default="help"> - -<property name="cubeWithLayersDir" location="../libs-with-layers" /> -<property name="cubeDir" location="../libs" /> -<property name="layersDir" location="../../../build-android/libs" /> - -<echo>VkCubeWithLayers: Creating libs-with-layers</echo> -<mkdir dir="${cubeWithLayersDir}"/> - -<echo>VkCubeWithLayers: Copying libs from demos/android</echo> -<copy todir="${cubeWithLayersDir}"> -<fileset dir="${cubeDir}"/> -</copy> - -<echo>VkCubeWithLayers: Copying layers from build-android</echo> -<copy todir="${cubeWithLayersDir}"> -<fileset dir="${layersDir}"/> -</copy> - -<!-- Point ndk-build at the libs-with-layers common dir --> -<echo>VkCubeWithLayers: Overriding native.libs.absolute.dir with ${cubeWithLayersDir}</echo> -<property name="native.libs.absolute.dir" location="${cubeWithLayersDir}" /> - -</project> diff --git a/cube/android/cube-with-layers/res/values/strings.xml b/cube/android/cube-with-layers/res/values/strings.xml deleted file mode 100644 index ecd779e4..00000000 --- a/cube/android/cube-with-layers/res/values/strings.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright 2013 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<!-- This file contains resource definitions for displayed strings, allowing - them to be changed based on the locale and options. --> - -<resources> - <!-- Simple strings. --> - <string name="app_name">VkCubeWithLayers</string> - -</resources> diff --git a/cube/android/cube/custom_rules.xml b/cube/android/cube/custom_rules.xml deleted file mode 100644 index 31eb31ad..00000000 --- a/cube/android/cube/custom_rules.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project name="NativeActivity" default="help"> -<!-- Point ndk-build at the libs created in common dir --> -<echo>vkcube: Overriding native.libs.absolute.dir with ../libs</echo> -<property name="native.libs.absolute.dir" location="../libs" /> -</project> diff --git a/cube/android/cube/res/values/strings.xml b/cube/android/cube/res/values/strings.xml deleted file mode 100644 index 8adead25..00000000 --- a/cube/android/cube/res/values/strings.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright 2013 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<!-- This file contains resource definitions for displayed strings, allowing - them to be changed based on the locale and options. --> - -<resources> - <!-- Simple strings. --> - <string name="app_name">VkCube</string> - -</resources> diff --git a/cube/android/jni/Android.mk b/cube/android/jni/Android.mk deleted file mode 100644 index 090f7862..00000000 --- a/cube/android/jni/Android.mk +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 2015 The Android Open Source Project -# Copyright (C) 2015 Valve Corporation - -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at - -# http://www.apache.org/licenses/LICENSE-2.0 - -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -LOCAL_PATH := $(abspath $(call my-dir)) -SRC_DIR := $(LOCAL_PATH)/../../.. -DEMO_DIR := $(SRC_DIR)/cube - -include $(CLEAR_VARS) -LOCAL_MODULE := VkCube -LOCAL_SRC_FILES += $(DEMO_DIR)/cube.c \ - $(DEMO_DIR)/android/vulkan_wrapper.cpp \ - $(DEMO_DIR)/android/android_util.cpp -LOCAL_C_INCLUDES += $(SRC_DIR)/build-android/third_party/Vulkan-Headers/include \ - $(DEMO_DIR)/android/include \ - $(SRC_DIR)/libs \ - $(DEMO_DIR)/android/ \ - $(SRC_DIR)/build-android/generated/include -LOCAL_CFLAGS += -DVK_USE_PLATFORM_ANDROID_KHR --include=$(DEMO_DIR)/android/vulkan_wrapper.h -LOCAL_WHOLE_STATIC_LIBRARIES += android_native_app_glue -LOCAL_LDLIBS := -llog -landroid -LOCAL_LDFLAGS := -u ANativeActivity_onCreate -include $(BUILD_SHARED_LIBRARY) - -$(call import-module,android/native_app_glue) diff --git a/cube/android/jni/Application.mk b/cube/android/jni/Application.mk deleted file mode 100644 index 788ff73b..00000000 --- a/cube/android/jni/Application.mk +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2015 The Android Open Source Project -# Copyright (C) 2015 Valve Corporation - -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at - -# http://www.apache.org/licenses/LICENSE-2.0 - -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -APP_ABI := armeabi-v7a arm64-v8a x86 x86_64 -APP_PLATFORM := android-23 -APP_STL := c++_static -APP_MODULES := VkCube -NDK_TOOLCHAIN_VERSION := clang |
