Android gradle build files (triangle)
This commit is contained in:
parent
2d48a76138
commit
3cde83945e
13 changed files with 508 additions and 0 deletions
37
android/examples/triangle/CMakeLists.txt
Normal file
37
android/examples/triangle/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
cmake_minimum_required(VERSION 3.4.1 FATAL_ERROR)
|
||||
|
||||
set(NAME triangle)
|
||||
|
||||
set(SRC_DIR ../../../examples/${NAME})
|
||||
set(BASE_DIR ../../../base)
|
||||
set(EXTERNAL_DIR ../../../external)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -DVK_USE_PLATFORM_ANDROID_KHR -DVK_NO_PROTOTYPES")
|
||||
|
||||
file(GLOB EXAMPLE_SRC "${SRC_DIR}/*.cpp")
|
||||
file(GLOB BASE_SRC "${BASE_DIR}/*.cpp")
|
||||
|
||||
add_library(
|
||||
native-lib SHARED
|
||||
${EXAMPLE_SRC}
|
||||
${BASE_SRC}
|
||||
${EXTERNAL_DIR}/imgui/imgui.cpp
|
||||
${EXTERNAL_DIR}/imgui/imgui_draw.cpp
|
||||
)
|
||||
|
||||
add_library(native-app-glue STATIC ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
|
||||
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate")
|
||||
|
||||
include_directories(${BASE_DIR})
|
||||
include_directories(${EXTERNAL_DIR}/glm)
|
||||
include_directories(${EXTERNAL_DIR}/gli)
|
||||
include_directories(${EXTERNAL_DIR}/imgui)
|
||||
include_directories(${ANDROID_NDK}/sources/android/native_app_glue)
|
||||
|
||||
target_link_libraries(
|
||||
native-lib
|
||||
native-app-glue
|
||||
android
|
||||
log
|
||||
)
|
||||
58
android/examples/triangle/build.gradle
Normal file
58
android/examples/triangle/build.gradle
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 26
|
||||
defaultConfig {
|
||||
applicationId "de.saschawillems.vulkanTriangle"
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 26
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
ndk {
|
||||
abiFilters "armeabi-v7a"
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
cppFlags "-std=c++11"
|
||||
arguments "-DANDROID_STL=c++_static"
|
||||
}
|
||||
}
|
||||
}
|
||||
sourceSets {
|
||||
main.assets.srcDirs = ['assets']
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
path "CMakeLists.txt"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task copyRes(type: Copy) {
|
||||
from '../../common/res/drawable'
|
||||
into "src/main/res/drawable"
|
||||
include 'icon.png'
|
||||
}
|
||||
|
||||
task copyBaseShaders(type: Copy) {
|
||||
from '../../../data/shaders/base'
|
||||
into "assets/shaders/base"
|
||||
include '*.spv'
|
||||
}
|
||||
|
||||
task copyShaders(type: Copy) {
|
||||
from '../../../data/shaders/triangle'
|
||||
into "assets/shaders/triangle"
|
||||
include '*.spv'
|
||||
}
|
||||
|
||||
preBuild.dependsOn copyRes
|
||||
preBuild.dependsOn copyBaseShaders
|
||||
preBuild.dependsOn copyShaders
|
||||
25
android/examples/triangle/proguard-rules.pro
vendored
Normal file
25
android/examples/triangle/proguard-rules.pro
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in /home/SERILOCAL/l.west/Android/Sdk/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the proguardFiles
|
||||
# directive in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
24
android/examples/triangle/src/main/AndroidManifest.xml
Normal file
24
android/examples/triangle/src/main/AndroidManifest.xml
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="de.saschawillems.vulkanTriangle">
|
||||
|
||||
<application
|
||||
android:label="Vulkan Triangle"
|
||||
android:icon="@drawable/icon"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
||||
<activity android:name="de.saschawillems.vulkanSample.VulkanActivity"
|
||||
android:screenOrientation="landscape"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
<meta-data android:name="android.app.lib_name"
|
||||
android:value="native-lib" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.gamepad" android:required="false" />
|
||||
|
||||
</manifest>
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Copyright (C) 2018 by Sascha Willems - www.saschawillems.de
|
||||
*
|
||||
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
|
||||
*/
|
||||
package de.saschawillems.vulkanSample;
|
||||
|
||||
import android.app.NativeActivity;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class VulkanActivity extends NativeActivity {
|
||||
static {
|
||||
// Load native library
|
||||
System.loadLibrary("native-lib");
|
||||
}
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue