Fix Android example app build.

Add VS solution gen batch file with Python.
This commit is contained in:
Syoyo Fujita
2023-05-15 04:24:06 +09:00
parent b7aa1ecdd3
commit aef0705f3e
9 changed files with 24 additions and 12 deletions

View File

@@ -28,6 +28,7 @@ android {
//version "3.18.1"
}
}
namespace 'com.example.hellotinyusdz'
}
dependencies {

View File

@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.hellotinyusdz">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:allowBackup="true"

View File

@@ -4,6 +4,7 @@ option(TINYUSDZ_USE_USDOBJ "Build with built-in .obj support" On)
set(TINYUSDZ_SOURCES
${PROJECT_SOURCE_DIR}/../../../../../src/tinyusdz.cc
${PROJECT_SOURCE_DIR}/../../../../../src/asset-resolution.cc
${PROJECT_SOURCE_DIR}/../../../../../src/prim-types.cc
${PROJECT_SOURCE_DIR}/../../../../../src/ascii-parser.cc
${PROJECT_SOURCE_DIR}/../../../../../src/ascii-parser-basetype.cc
@@ -28,9 +29,15 @@ set(TINYUSDZ_SOURCES
${PROJECT_SOURCE_DIR}/../../../../../src/usdGeom.cc
${PROJECT_SOURCE_DIR}/../../../../../src/xform.cc
${PROJECT_SOURCE_DIR}/../../../../../src/stage.cc
${PROJECT_SOURCE_DIR}/../../../../../src/str-util.cc
${PROJECT_SOURCE_DIR}/../../../../../src/path-util.cc
${PROJECT_SOURCE_DIR}/../../../../../src/image-util.cc
${PROJECT_SOURCE_DIR}/../../../../../src/image-writer.cc
${PROJECT_SOURCE_DIR}/../../../../../src/linear-algebra.cc
${PROJECT_SOURCE_DIR}/../../../../../src/tydra/scene-access.cc
${PROJECT_SOURCE_DIR}/../../../../../src/tydra/render-data.cc
${PROJECT_SOURCE_DIR}/../../../../../src/tydra/prim-apply.cc
${PROJECT_SOURCE_DIR}/../../../../../src/tydra/shader-network.cc
)
if (TINYUSDZ_USE_USDOBJ)

View File

@@ -1,14 +1,14 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.40'
ext.kotlin_version = '1.6.21'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.0'
classpath 'com.android.tools.build:gradle:8.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

View File

@@ -17,3 +17,6 @@ org.gradle.jvmargs=-Xmx1536m
# org.gradle.parallel=true
android.useAndroidX=true
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false

View File

@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip

View File

@@ -1127,7 +1127,7 @@ static par_shapes__rule* par_shapes__pick_rule(const char* name,
total += rule->weight;
}
}
float r = (float) rand() / RAND_MAX;
float r = (float) rand() / float(RAND_MAX);
float t = 0;
for (int i = 0; i < nrules; i++) {
rule = rules + i;

View File

@@ -513,7 +513,7 @@ bool FileExists(const std::string &filepath, void *userdata) {
bool ret{false};
#ifdef TINYUSDZ_ANDROID_LOAD_FROM_ASSETS
if (asset_manager) {
AAsset *asset = AAssetManager_open(asset_manager, abs_filename.c_str(),
AAsset *asset = AAssetManager_open(asset_manager, filepath.c_str(),
AASSET_MODE_STREAMING);
if (!asset) {
return false;

View File

@@ -1,15 +1,17 @@
rem assume
rmdir /s /q build
mkdir build
rmdir /s /q build_with_py
mkdir build_with_py
rem Specify absolute python.exe path if required.
rem Use `whre python` to find abosolute path to python.exe in cmd
rem Conda/Miniconda installed Python recommended.
rem
rem -DPython3_EXECUTABLE=C:\Users\%%HOME%%\miniconda3\envs\pytinyusdz\python.exe ^
cmake -G "Visual Studio 17 2022" -A x64 ^
-DTINYUSDZ_WITH_OPENSUBDIV=On ^
-DTINYUSDZ_WITH_PYTHON=1 ^
-DTINYUSDZ_PREFER_LOCAL_PYTHON_INSTALLATION=1 ^
-DPython3_EXECUTABLE=C:\Users\%%HOME%%\miniconda3\envs\pytinyusdz\python.exe
-Bbuild -S.
-Bbuild_with_py -S.