Updated triangle build files

This commit is contained in:
saschawillems 2018-05-10 17:22:01 +02:00
parent 46795c4b6b
commit fad4f25676
5 changed files with 17 additions and 42 deletions

View file

@ -9,29 +9,28 @@ set(EXTERNAL_DIR ../../../external)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -DVK_USE_PLATFORM_ANDROID_KHR -DVK_NO_PROTOTYPES") 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 EXAMPLE_SRC "${SRC_DIR}/*.cpp")
file(GLOB BASE_SRC "${BASE_DIR}/*.cpp")
add_library( add_library(native-lib SHARED ${EXAMPLE_SRC})
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) add_library(native-app-glue STATIC ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
add_subdirectory(../base ${CMAKE_SOURCE_DIR}/../base)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate")
include_directories(${BASE_DIR}) include_directories(${BASE_DIR})
include_directories(${EXTERNAL_DIR})
include_directories(${EXTERNAL_DIR}/glm) include_directories(${EXTERNAL_DIR}/glm)
include_directories(${EXTERNAL_DIR}/gli) include_directories(${EXTERNAL_DIR}/gli)
include_directories(${EXTERNAL_DIR}/imgui) include_directories(${EXTERNAL_DIR}/imgui)
include_directories(${EXTERNAL_DIR}/assimp)
include_directories(${ANDROID_NDK}/sources/android/native_app_glue) include_directories(${ANDROID_NDK}/sources/android/native_app_glue)
target_link_libraries( target_link_libraries(
native-lib native-lib
native-app-glue native-app-glue
libbase
android android
log log
z
) )

View file

@ -4,19 +4,18 @@ apply from: '../gradle/outputfilename.gradle'
android { android {
compileSdkVersion 26 compileSdkVersion 26
defaultConfig { defaultConfig {
applicationId "de.saschawillems.VulkanTriangle" applicationId "de.saschawillems.vulkanTriangle"
minSdkVersion 19 minSdkVersion 19
targetSdkVersion 26 targetSdkVersion 26
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
ndk { ndk {
abiFilters "armeabi-v7a" abiFilters "armeabi-v7a"
} }
externalNativeBuild { externalNativeBuild {
cmake { cmake {
cppFlags "-std=c++11" cppFlags "-std=c++14"
arguments "-DANDROID_STL=c++_static" arguments "-DANDROID_STL=c++_shared", '-DANDROID_TOOLCHAIN=clang'
} }
} }
} }
@ -50,10 +49,12 @@ task copyTask << {
} }
copy { copy {
from '../../../data/shaders/triangle' from '../../../data/shaders/triangle'
into "assets/shaders/triangle" into 'assets/shaders/triangle'
include '*.spv' include '*.*'
} }
} }
preBuild.dependsOn copyTask preBuild.dependsOn copyTask

View file

@ -1,25 +0,0 @@
# 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

View file

@ -3,7 +3,7 @@
package="de.saschawillems.vulkanTriangle"> package="de.saschawillems.vulkanTriangle">
<application <application
android:label="Vulkan Triangle" android:label="Vulkan triangle"
android:icon="@drawable/icon" android:icon="@drawable/icon"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
<activity android:name="de.saschawillems.vulkanSample.VulkanActivity" <activity android:name="de.saschawillems.vulkanSample.VulkanActivity"

View file

@ -37,7 +37,7 @@ public class VulkanActivity extends NativeActivity {
this.runOnUiThread(new Runnable() { this.runOnUiThread(new Runnable() {
public void run() { public void run() {
AlertDialog.Builder builder = new AlertDialog.Builder(activity, AlertDialog.THEME_HOLO_DARK); AlertDialog.Builder builder = new AlertDialog.Builder(activity, android.R.style.Theme_Material_Dialog_Alert);
builder.setTitle(applicationName); builder.setTitle(applicationName);
builder.setMessage(message); builder.setMessage(message);
builder.setPositiveButton("Close", new DialogInterface.OnClickListener() { builder.setPositiveButton("Close", new DialogInterface.OnClickListener() {