diff --git a/triangle/android/.gitignore b/triangle/android/.gitignore new file mode 100644 index 00000000..72d1fbf7 --- /dev/null +++ b/triangle/android/.gitignore @@ -0,0 +1,9 @@ +/assets/ +/bin/ +/libs/ +/obj/ +/build.xml +/local.properties +/project.properties +/proguard-project.txt +*.apk \ No newline at end of file diff --git a/triangle/android/AndroidManifest.xml b/triangle/android/AndroidManifest.xml new file mode 100644 index 00000000..3c9012a7 --- /dev/null +++ b/triangle/android/AndroidManifest.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + diff --git a/triangle/android/build.bat b/triangle/android/build.bat new file mode 100644 index 00000000..17470d55 --- /dev/null +++ b/triangle/android/build.bat @@ -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 +) \ No newline at end of file diff --git a/triangle/android/jni/Android.mk b/triangle/android/jni/Android.mk new file mode 100644 index 00000000..9bf90529 --- /dev/null +++ b/triangle/android/jni/Android.mk @@ -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) diff --git a/triangle/android/jni/Application.mk b/triangle/android/jni/Application.mk new file mode 100644 index 00000000..62020feb --- /dev/null +++ b/triangle/android/jni/Application.mk @@ -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