diff --git a/android/app/CMakeLists.txt b/android/app/CMakeLists.txt index 65709f7547..74957583a1 100644 --- a/android/app/CMakeLists.txt +++ b/android/app/CMakeLists.txt @@ -1,8 +1,20 @@ set(TARGET_NAME native-lib) setup_hifi_library() -link_hifi_libraries(shared networking gl gpu gpu-gles) +link_hifi_libraries(shared networking gl gpu gpu-gles image fbx render-utils physics) target_opengl() target_link_libraries(native-lib android log m) set(GVR_ROOT "${HIFI_ANDROID_PRECOMPILED}/gvr/gvr-android-sdk-1.101.0/") target_include_directories(native-lib PRIVATE "${GVR_ROOT}/libraries/headers") target_link_libraries(native-lib "${HIFI_ANDROID_PRECOMPILED}/jni/arm64-v8a/libgvr.so") + +# finished libraries +# core -> qt +# networking -> openssl, tbb +# fbx -> draco +# physics -> bullet + +# unfinished libraries +# image -> nvtt (doesn't look good, but can be made optional) +# script-engine -> quazip (probably not required for the android client) +# entities-renderer -> polyvox + diff --git a/android/app/build.gradle b/android/app/build.gradle index 18eb91bceb..005ec1a3ad 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -1,4 +1,3 @@ - apply plugin: 'com.android.application' android { diff --git a/android/build.gradle b/android/build.gradle index 2a67707c39..e2546e524f 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -35,6 +35,12 @@ setupDependencies.dependsOn setupTBB apply from: 'setupGVR.gradle' setupDependencies.dependsOn setupGVR +apply from: 'setupDraco.gradle' +setupDependencies.dependsOn setupDraco + +apply from: 'setupBullet.gradle' +setupDependencies.dependsOn setupBullet + task copyDependencies(type: Copy) { from HIFI_ANDROID_PRECOMPILED + '/jni/arm64-v8a' into 'app/src/main/jniLibs/arm64-v8a' diff --git a/android/setupBullet.gradle b/android/setupBullet.gradle new file mode 100644 index 0000000000..5fb1bd4369 --- /dev/null +++ b/android/setupBullet.gradle @@ -0,0 +1,26 @@ +buildscript { + repositories { + jcenter() + google() + } + dependencies { + classpath 'com.android.tools.build:gradle:3.0.1' + classpath 'de.undercouch:gradle-download-task:3.3.0' + } +} + +def file='bullet-2.83_armv8-libcpp.tgz ' +def url='https://hifi-public.s3.amazonaws.com/austin/android/' + file +def destFile = new File(HIFI_ANDROID_PRECOMPILED, file) + +task downloadBullet(type: de.undercouch.gradle.tasks.download.Download) { + src url + dest destFile +} + +task extractBullet(dependsOn: downloadBullet, type: Copy) { + from tarTree(resources.gzip(destFile)) + into new File(HIFI_ANDROID_PRECOMPILED, 'bullet') +} + +task setupBullet(dependsOn: extractBullet) { } diff --git a/android/setupDraco.gradle b/android/setupDraco.gradle new file mode 100644 index 0000000000..cae24b8a0f --- /dev/null +++ b/android/setupDraco.gradle @@ -0,0 +1,26 @@ +buildscript { + repositories { + jcenter() + google() + } + dependencies { + classpath 'com.android.tools.build:gradle:3.0.1' + classpath 'de.undercouch:gradle-download-task:3.3.0' + } +} + +def file='draco_armv8-libcpp.tgz' +def url='https://hifi-public.s3.amazonaws.com/austin/android/' + file +def destFile = new File(HIFI_ANDROID_PRECOMPILED, file) + +task downloadDraco(type: de.undercouch.gradle.tasks.download.Download) { + src url + dest destFile +} + +task extractDraco(dependsOn: downloadDraco, type: Copy) { + from tarTree(resources.gzip(destFile)) + into new File(HIFI_ANDROID_PRECOMPILED, 'draco') +} + +task setupDraco(dependsOn: extractDraco) { } diff --git a/cmake/macros/TargetBullet.cmake b/cmake/macros/TargetBullet.cmake index 207595d23f..48fe0e0c05 100644 --- a/cmake/macros/TargetBullet.cmake +++ b/cmake/macros/TargetBullet.cmake @@ -6,8 +6,19 @@ # See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html # macro(TARGET_BULLET) - add_dependency_external_projects(bullet) - find_package(Bullet REQUIRED) + if (ANDROID) + set(INSTALL_DIR ${HIFI_ANDROID_PRECOMPILED}/bullet) + set(BULLET_INCLUDE_DIRS "${INSTALL_DIR}/include/bullet" CACHE TYPE INTERNAL) + + set(LIB_DIR ${INSTALL_DIR}/lib) + list(APPEND BULLET_LIBRARIES ${LIB_DIR}/libBulletDynamics.a) + list(APPEND BULLET_LIBRARIES ${LIB_DIR}/libBulletCollision.a) + list(APPEND BULLET_LIBRARIES ${LIB_DIR}/libLinearMath.a) + list(APPEND BULLET_LIBRARIES ${LIB_DIR}/libBulletSoftBody.a) + else() + add_dependency_external_projects(bullet) + find_package(Bullet REQUIRED) + endif() # perform the system include hack for OS X to ignore warnings if (APPLE) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${BULLET_INCLUDE_DIRS}") @@ -16,3 +27,5 @@ macro(TARGET_BULLET) endif() target_link_libraries(${TARGET_NAME} ${BULLET_LIBRARIES}) endmacro() + + diff --git a/cmake/macros/TargetDraco.cmake b/cmake/macros/TargetDraco.cmake new file mode 100755 index 0000000000..c198ac35b0 --- /dev/null +++ b/cmake/macros/TargetDraco.cmake @@ -0,0 +1,18 @@ +macro(TARGET_DRACO) + if (ANDROID) + set(INSTALL_DIR ${HIFI_ANDROID_PRECOMPILED}/draco) + set(DRACO_INCLUDE_DIRS "${INSTALL_DIR}/include" CACHE TYPE INTERNAL) + + set(LIB_DIR ${INSTALL_DIR}/lib) + list(APPEND DRACO_LIBRARIES ${LIB_DIR}/libdraco.a) + list(APPEND DRACO_LIBRARIES ${LIB_DIR}/libdracodec.a) + list(APPEND DRACO_LIBRARIES ${LIB_DIR}/libdracoenc.a) + else() + add_dependency_external_projects(draco) + find_package(Draco REQUIRED) + list(APPEND DRACO_LIBRARIES ${DRACO_LIBRARY}) + list(APPEND DRACO_LIBRARIES ${DRACO_ENCODER_LIBRARY}) + endif() + target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${DRACO_INCLUDE_DIRS}) + target_link_libraries(${TARGET_NAME} ${DRACO_LIBRARIES}) +endmacro() diff --git a/libraries/fbx/CMakeLists.txt b/libraries/fbx/CMakeLists.txt index 7cead5aa4f..683ddb52f7 100644 --- a/libraries/fbx/CMakeLists.txt +++ b/libraries/fbx/CMakeLists.txt @@ -4,7 +4,4 @@ setup_hifi_library() link_hifi_libraries(shared model networking image) include_hifi_library_headers(gpu image) -add_dependency_external_projects(draco) -find_package(Draco REQUIRED) -target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${DRACO_INCLUDE_DIRS}) -target_link_libraries(${TARGET_NAME} ${DRACO_LIBRARY} ${DRACO_ENCODER_LIBRARY}) +target_draco() diff --git a/libraries/image/src/image/Image.cpp b/libraries/image/src/image/Image.cpp index 5959714cd8..9f584c844f 100644 --- a/libraries/image/src/image/Image.cpp +++ b/libraries/image/src/image/Image.cpp @@ -11,7 +11,6 @@ #include "Image.h" -#include #include #include @@ -20,6 +19,15 @@ #include #include + +#if defined(Q_OS_ANDROID) +#define CPU_MIPMAPS 0 +#else +#define CPU_MIPMAPS 1 +#include +#endif + + #include #include #include @@ -29,13 +37,6 @@ using namespace gpu; -#if defined(Q_OS_ANDROID) -#define CPU_MIPMAPS 0 -#else -#define CPU_MIPMAPS 1 -#include -#endif - static const glm::uvec2 SPARSE_PAGE_SIZE(128); static const glm::uvec2 MAX_TEXTURE_SIZE(4096); @@ -410,7 +411,6 @@ struct MyErrorHandler : public nvtt::ErrorHandler { qCWarning(imagelogging) << "Texture compression error:" << nvtt::errorString(e); } }; -#endif class SequentialTaskDispatcher : public nvtt::TaskDispatcher { public: @@ -637,6 +637,10 @@ void generateLDRMips(gpu::Texture* texture, QImage& image, const std::atomic& abortProcessing = false, int face = -1) { #if CPU_MIPMAPS PROFILE_RANGE(resource_parse, "generateMips"); diff --git a/libraries/procedural/src/procedural/Procedural.cpp b/libraries/procedural/src/procedural/Procedural.cpp index 69e9768ccd..7b718515a8 100644 --- a/libraries/procedural/src/procedural/Procedural.cpp +++ b/libraries/procedural/src/procedural/Procedural.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include diff --git a/libraries/render-utils/src/DebugDeferredBuffer.cpp b/libraries/render-utils/src/DebugDeferredBuffer.cpp index d334a53fa1..02a5496151 100644 --- a/libraries/render-utils/src/DebugDeferredBuffer.cpp +++ b/libraries/render-utils/src/DebugDeferredBuffer.cpp @@ -11,7 +11,8 @@ #include "DebugDeferredBuffer.h" -#include +#include +#include #include #include