Android makefiles for triangle example (wip) (#97)

This commit is contained in:
saschawillems 2016-03-20 14:31:20 +01:00
parent 2ac9be7225
commit 92cdb2060e
5 changed files with 100 additions and 0 deletions

9
triangle/android/.gitignore vendored Normal file
View file

@ -0,0 +1,9 @@
/assets/
/bin/
/libs/
/obj/
/build.xml
/local.properties
/project.properties
/proguard-project.txt
*.apk

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="de.saschawillems.vulkanTriangle">
<uses-sdk android:minSdkVersion="19" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application android:label="vulkanTriangle" android:hasCode="false">
<activity android:name="android.app.NativeActivity"
android:label="vulkanTriangle"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:launchMode="singleTask"
android:configChanges="orientation|screenSize|keyboardHidden">
<meta-data android:name="android.app.lib_name" android:value="vulkanTriangle" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

View file

@ -0,0 +1,18 @@
cd jni
call ndk-build
if %ERRORLEVEL% GEQ 1 (
echo ndk-build has failed, build cancelled
cd..
exit \b %errorlevel%
)
cd..
mkdir "assets\shaders"
xcopy "..\..\data\shaders\triangle.vert.spv" "assets\shaders" /Y
xcopy "..\..\data\shaders\triangle.frag.spv" "assets\shaders" /Y
call ant debug -Dout.final.file=vulkanTriangle.apk
if "%1" == "-deploy" (
adb install -r vulkanTriangle.apk
)

View file

@ -0,0 +1,50 @@
LOCAL_PATH := $(call my-dir)/..
# assimp
include $(CLEAR_VARS)
LOCAL_MODULE := assimp
LOCAL_SRC_FILES = $(LOCAL_PATH)/../../libs/assimp/$(TARGET_ARCH_ABI)/libassimp.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../external/assimp/include
include $(PREBUILT_SHARED_LIBRARY)
# vulkan example
DATADIR := $(LOCAL_PATH)/../../data
include $(CLEAR_VARS)
LOCAL_MODULE := vulkanTriangle
PROJECT_FILES := $(wildcard $(LOCAL_PATH)/../triangle.cpp)
PROJECT_FILES += $(wildcard $(LOCAL_PATH)/../../base/*.cpp)
LOCAL_CPPFLAGS := -std=c++11
LOCAL_CPPFLAGS += -D__STDC_LIMIT_MACROS
LOCAL_CPPFLAGS += -DVK_NO_PROTOTYPES
LOCAL_CPPFLAGS += -DVK_USE_PLATFORM_ANDROID_KHR
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../external/
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../external/glm
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../external/gli
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../external/assimp
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../base/
#LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../base/android
LOCAL_SRC_FILES := $(PROJECT_FILES)
LOCAL_LDLIBS := -landroid -llog
LOCAL_DISABLE_FORMAT_STRING_CHECKS := true
#LOCAL_SHARED_LIBRARIES += assimp
LOCAL_STATIC_LIBRARIES += android_native_app_glue
LOCAL_STATIC_LIBRARIES += cpufeatures
include $(BUILD_SHARED_LIBRARY)
$(call import-module, android/native_app_glue)
$(call import-module, android/cpufeatures)

View file

@ -0,0 +1,5 @@
APP_PLATFORM := android-19
APP_ABI := armeabi-v7a
APP_STL := c++_static
APP_CPPFLAGS := -std=c++11
NDK_TOOLCHAIN_VERSION := clang