Add bullet and draco to precompiled libraries

This commit is contained in:
Bradley Austin Davis 2017-11-24 14:10:07 -08:00 committed by Brad Davis
parent 113844384a
commit d6072f2bf2
11 changed files with 121 additions and 18 deletions

View file

@ -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

View file

@ -1,4 +1,3 @@
apply plugin: 'com.android.application'
android {

View file

@ -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'

View file

@ -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) { }

26
android/setupDraco.gradle Normal file
View file

@ -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) { }

View file

@ -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()

18
cmake/macros/TargetDraco.cmake Executable file
View file

@ -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()

View file

@ -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()

View file

@ -11,7 +11,6 @@
#include "Image.h"
#include <nvtt/nvtt.h>
#include <glm/gtc/packing.hpp>
#include <QtCore/QtGlobal>
@ -20,6 +19,15 @@
#include <QBuffer>
#include <QImageReader>
#if defined(Q_OS_ANDROID)
#define CPU_MIPMAPS 0
#else
#define CPU_MIPMAPS 1
#include <nvtt/nvtt.h>
#endif
#include <Finally.h>
#include <Profile.h>
#include <StatTracker.h>
@ -29,13 +37,6 @@
using namespace gpu;
#if defined(Q_OS_ANDROID)
#define CPU_MIPMAPS 0
#else
#define CPU_MIPMAPS 1
#include <nvtt/nvtt.h>
#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<boo
compressor.process(inputOptions, compressionOptions, outputOptions);
}
#endif
void generateMips(gpu::Texture* texture, QImage& image, const std::atomic<bool>& abortProcessing = false, int face = -1) {
#if CPU_MIPMAPS
PROFILE_RANGE(resource_parse, "generateMips");

View file

@ -13,6 +13,7 @@
#include <QtCore/QJsonArray>
#include <QtCore/QJsonDocument>
#include <QtCore/QJsonObject>
#include <QtCore/QDateTime>
#include <gpu/Batch.h>
#include <SharedUtil.h>

View file

@ -11,7 +11,8 @@
#include "DebugDeferredBuffer.h"
#include <QFile>
#include <QtCore/QFile>
#include <QtCore/QDateTime>
#include <gpu/Batch.h>
#include <gpu/Context.h>