diff --git a/.gitignore b/.gitignore index 711240b..2c0b3d9 100644 --- a/.gitignore +++ b/.gitignore @@ -6,19 +6,26 @@ PanoPainter.vcxproj.user ipch/ PanoPainter.VC.opendb PanoPainter.sdf -android/build/ -android/.gradle/ -android/.externalNativeBuild/ -android/src/main/assets/ +*.pano +*.iml android/.idea -android/android.iml +android/android/build/ +android/android/.gradle/ +android/android/.externalNativeBuild/ +android/android/.idea +android/android/src/main/assets/ +android/quest/build/ +android/quest/.gradle/ +android/quest/.externalNativeBuild/ +android/quest/.idea +android/quest/src/main/assets/ android/local.properties + data/brushes data/thumbs PanoPainter.aps panopainter-log.txt -*.pano frames/ src/version.gen.h com_omixlab_panopainter_MainActivity.h diff --git a/android/CMakeLists.txt b/android/CMakeLists.txt deleted file mode 100644 index e660f2a..0000000 --- a/android/CMakeLists.txt +++ /dev/null @@ -1,141 +0,0 @@ -# Sets the minimum version of CMake required to build your native library. -# This ensures that a certain set of CMake features is available to -# your build. - -cmake_minimum_required(VERSION 3.4.1) - -# build native_app_glue as a static lib -add_library( - app-glue STATIC - ../libs/native_app_glue/android_native_app_glue.c -) - -# Specifies a library name, specifies whether the library is STATIC or -# SHARED, and provides relative paths to the source code. You can -# define multiple libraries by adding multiple add.library() commands, -# and CMake builds them for you. When you build your app, Gradle -# automatically packages shared libraries with your APK. - -# now build app's shared lib -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") - -add_library( - native-lib SHARED - ../libs/yoga/yoga/log.cpp - ../libs/yoga/yoga/Utils.cpp - ../libs/yoga/yoga/YGConfig.cpp - ../libs/yoga/yoga/YGEnums.cpp - ../libs/yoga/yoga/YGLayout.cpp - ../libs/yoga/yoga/YGMarker.cpp - ../libs/yoga/yoga/YGNode.cpp - ../libs/yoga/yoga/YGNodePrint.cpp - ../libs/yoga/yoga/YGStyle.cpp - ../libs/yoga/yoga/YGValue.cpp - ../libs/yoga/yoga/Yoga.cpp - ../libs/tinyxml2/tinyxml2.cpp - ../libs/jpeg/jpgd.cpp - ../libs/jpeg/jpge.cpp - ../libs/poly2tri/poly2tri/common/shapes.cc - ../libs/poly2tri/poly2tri/sweep/advancing_front.cc - ../libs/poly2tri/poly2tri/sweep/cdt.cc - ../libs/poly2tri/poly2tri/sweep/sweep_context.cc - ../libs/poly2tri/poly2tri/sweep/sweep.cc - ../libs/fmt/src/format.cc - src/main/cpp/main.cpp - ../src/pch.cpp - ../src/util.cpp - ../src/rtt.cpp - ../src/bezier.cpp - ../src/asset.cpp - ../src/image.cpp - ../src/texture.cpp - ../src/font.cpp - ../src/shader.cpp - ../src/shape.cpp - ../src/app.cpp - ../src/app_cloud.cpp - ../src/app_dialogs.cpp - ../src/app_events.cpp - ../src/app_layout.cpp - ../src/app_shaders.cpp - ../src/app_vr.cpp - ../src/brush.cpp - ../src/canvas.cpp - ../src/canvas_modes.cpp - ../src/log.cpp - ../src/action.cpp - ../src/layout.cpp - ../src/version.cpp - ../src/node.cpp - ../src/node_about.cpp - ../src/node_border.cpp - ../src/node_button.cpp - ../src/node_button_custom.cpp - ../src/node_canvas.cpp - ../src/node_checkbox.cpp - ../src/node_color_quad.cpp - ../src/node_colorwheel.cpp - ../src/node_combobox.cpp - ../src/node_changelog.cpp - ../src/node_dialog_browse.cpp - ../src/node_dialog_cloud.cpp - ../src/node_dialog_open.cpp - ../src/node_dialog_picker.cpp - ../src/node_dialog_layer_rename.cpp - ../src/node_dialog_resize.cpp - ../src/node_icon.cpp - ../src/node_image.cpp - ../src/node_image_texture.cpp - ../src/node_message_box.cpp - ../src/node_panel_brush.cpp - ../src/node_panel_color.cpp - ../src/node_panel_grid.cpp - ../src/node_panel_floating.cpp - ../src/node_panel_layer.cpp - ../src/node_panel_stroke.cpp - ../src/node_panel_quick.cpp - ../src/node_popup_menu.cpp - ../src/node_progress_bar.cpp - ../src/node_settings.cpp - ../src/node_slider.cpp - ../src/node_stroke_preview.cpp - ../src/node_text.cpp - ../src/node_text_input.cpp - ../src/node_usermanual.cpp - ../src/node_viewport.cpp - ../src/node_scroll.cpp - ../src/abr.cpp - ../src/binary_stream.cpp - ../src/serializer.cpp - ../src/settings.cpp -) - -target_include_directories(native-lib PRIVATE - src/main/cpp - ../src - ../libs/glm - ../libs/tinyxml2 - ../libs/yoga - ../libs/stb - ../libs/jpeg - ../libs/curl-android-ios/android/include - ../libs/poly2tri/poly2tri - ../libs/base64 - ../libs/sqlite3 - ../libs/nanort - ../libs/native_app_glue - ../libs/hash-library - ../libs/fmt/include -) - -# add lib dependencies -target_link_libraries( - native-lib - android - app-glue - ${CMAKE_SOURCE_DIR}/../libs/curl-android-ios/android/${ANDROID_ABI}/libcurl.a - EGL - GLESv3 - log - z -) diff --git a/android/android/CMakeLists.txt b/android/android/CMakeLists.txt new file mode 100644 index 0000000..2a5755c --- /dev/null +++ b/android/android/CMakeLists.txt @@ -0,0 +1,141 @@ +# Sets the minimum version of CMake required to build your native library. +# This ensures that a certain set of CMake features is available to +# your build. + +cmake_minimum_required(VERSION 3.4.1) + +# build native_app_glue as a static lib +add_library( + app-glue STATIC + ../../libs/native_app_glue/android_native_app_glue.c +) + +# Specifies a library name, specifies whether the library is STATIC or +# SHARED, and provides relative paths to the source code. You can +# define multiple libraries by adding multiple add.library() commands, +# and CMake builds them for you. When you build your app, Gradle +# automatically packages shared libraries with your APK. + +# now build app's shared lib +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") + +add_library( + native-lib SHARED + ../../libs/yoga/yoga/log.cpp + ../../libs/yoga/yoga/Utils.cpp + ../../libs/yoga/yoga/YGConfig.cpp + ../../libs/yoga/yoga/YGEnums.cpp + ../../libs/yoga/yoga/YGLayout.cpp + ../../libs/yoga/yoga/YGMarker.cpp + ../../libs/yoga/yoga/YGNode.cpp + ../../libs/yoga/yoga/YGNodePrint.cpp + ../../libs/yoga/yoga/YGStyle.cpp + ../../libs/yoga/yoga/YGValue.cpp + ../../libs/yoga/yoga/Yoga.cpp + ../../libs/tinyxml2/tinyxml2.cpp + ../../libs/jpeg/jpgd.cpp + ../../libs/jpeg/jpge.cpp + ../../libs/poly2tri/poly2tri/common/shapes.cc + ../../libs/poly2tri/poly2tri/sweep/advancing_front.cc + ../../libs/poly2tri/poly2tri/sweep/cdt.cc + ../../libs/poly2tri/poly2tri/sweep/sweep_context.cc + ../../libs/poly2tri/poly2tri/sweep/sweep.cc + ../../libs/fmt/src/format.cc + ../src/cpp/main.cpp + ../../src/pch.cpp + ../../src/util.cpp + ../../src/rtt.cpp + ../../src/bezier.cpp + ../../src/asset.cpp + ../../src/image.cpp + ../../src/texture.cpp + ../../src/font.cpp + ../../src/shader.cpp + ../../src/shape.cpp + ../../src/app.cpp + ../../src/app_cloud.cpp + ../../src/app_dialogs.cpp + ../../src/app_events.cpp + ../../src/app_layout.cpp + ../../src/app_shaders.cpp + ../../src/app_vr.cpp + ../../src/brush.cpp + ../../src/canvas.cpp + ../../src/canvas_modes.cpp + ../../src/log.cpp + ../../src/action.cpp + ../../src/layout.cpp + ../../src/version.cpp + ../../src/node.cpp + ../../src/node_about.cpp + ../../src/node_border.cpp + ../../src/node_button.cpp + ../../src/node_button_custom.cpp + ../../src/node_canvas.cpp + ../../src/node_checkbox.cpp + ../../src/node_color_quad.cpp + ../../src/node_colorwheel.cpp + ../../src/node_combobox.cpp + ../../src/node_changelog.cpp + ../../src/node_dialog_browse.cpp + ../../src/node_dialog_cloud.cpp + ../../src/node_dialog_open.cpp + ../../src/node_dialog_picker.cpp + ../../src/node_dialog_layer_rename.cpp + ../../src/node_dialog_resize.cpp + ../../src/node_icon.cpp + ../../src/node_image.cpp + ../../src/node_image_texture.cpp + ../../src/node_message_box.cpp + ../../src/node_panel_brush.cpp + ../../src/node_panel_color.cpp + ../../src/node_panel_grid.cpp + ../../src/node_panel_floating.cpp + ../../src/node_panel_layer.cpp + ../../src/node_panel_stroke.cpp + ../../src/node_panel_quick.cpp + ../../src/node_popup_menu.cpp + ../../src/node_progress_bar.cpp + ../../src/node_settings.cpp + ../../src/node_slider.cpp + ../../src/node_stroke_preview.cpp + ../../src/node_text.cpp + ../../src/node_text_input.cpp + ../../src/node_usermanual.cpp + ../../src/node_viewport.cpp + ../../src/node_scroll.cpp + ../../src/abr.cpp + ../../src/binary_stream.cpp + ../../src/serializer.cpp + ../../src/settings.cpp +) + +target_include_directories(native-lib PRIVATE + ../src/cpp + ../../src + ../../libs/glm + ../../libs/tinyxml2 + ../../libs/yoga + ../../libs/stb + ../../libs/jpeg + ../../libs/curl-android-ios/android/include + ../../libs/poly2tri/poly2tri + ../../libs/base64 + ../../libs/sqlite3 + ../../libs/nanort + ../../libs/native_app_glue + ../../libs/hash-library + ../../libs/fmt/include +) + +# add lib dependencies +target_link_libraries( + native-lib + android + app-glue + ${CMAKE_SOURCE_DIR}/../../libs/curl-android-ios/android/${ANDROID_ABI}/libcurl.a + EGL + GLESv3 + log + z +) diff --git a/android/build-run.bat b/android/android/build-run.bat similarity index 100% rename from android/build-run.bat rename to android/android/build-run.bat diff --git a/android/build.gradle b/android/android/build.gradle similarity index 93% rename from android/build.gradle rename to android/android/build.gradle index f3c5482..40bba67 100644 --- a/android/build.gradle +++ b/android/android/build.gradle @@ -134,16 +134,27 @@ android { path "CMakeLists.txt" } } + + sourceSets { + main { + manifest.srcFile 'src/main/AndroidManifest.xml' + java.srcDirs = ['../src/java'] + //jniLibs.srcDir 'libs' + res.srcDirs = ['../src/res'] + //assets.srcDirs = ['../../assets'] + } + } + } task copyFiles(type: Copy) { - from '../data/' + from '../../data/' into 'src/main/assets/data' } preBuild.dependsOn(copyFiles) task generateVersioning(type: Exec) { - workingDir "$projectDir/../" + workingDir "$projectDir/../../" commandLine 'python', 'scripts/pre-build.py', flavor } copyFiles.dependsOn(generateVersioning) diff --git a/android/gradle.properties b/android/android/gradle.properties similarity index 100% rename from android/gradle.properties rename to android/android/gradle.properties diff --git a/android/gradle/wrapper/gradle-wrapper.jar b/android/android/gradle/wrapper/gradle-wrapper.jar similarity index 100% rename from android/gradle/wrapper/gradle-wrapper.jar rename to android/android/gradle/wrapper/gradle-wrapper.jar diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/android/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from android/gradle/wrapper/gradle-wrapper.properties rename to android/android/gradle/wrapper/gradle-wrapper.properties diff --git a/android/gradlew b/android/android/gradlew old mode 100755 new mode 100644 similarity index 100% rename from android/gradlew rename to android/android/gradlew diff --git a/android/gradlew.bat b/android/android/gradlew.bat similarity index 96% rename from android/gradlew.bat rename to android/android/gradlew.bat index aec9973..8a0b282 100644 --- a/android/gradlew.bat +++ b/android/android/gradlew.bat @@ -1,90 +1,90 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windowz variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/android/android/local.properties b/android/android/local.properties new file mode 100644 index 0000000..4d3a32a --- /dev/null +++ b/android/android/local.properties @@ -0,0 +1,9 @@ +## This file must *NOT* be checked into Version Control Systems, +# as it contains information specific to your local configuration. +# +# Location of the SDK. This is only used by Gradle. +# For customization when using a Version Control System, please read the +# header note. +#Mon Oct 08 14:04:19 CEST 2018 +ndk.dir=C\:\\Users\\omar\\AppData\\Local\\Android\\Sdk\\ndk-bundle +sdk.dir=C\:\\Users\\omar\\AppData\\Local\\Android\\Sdk diff --git a/android/ppkey.jks b/android/android/ppkey.jks similarity index 100% rename from android/ppkey.jks rename to android/android/ppkey.jks diff --git a/android/src/main/AndroidManifest.xml b/android/android/src/main/AndroidManifest.xml similarity index 100% rename from android/src/main/AndroidManifest.xml rename to android/android/src/main/AndroidManifest.xml diff --git a/android/quest/CMakeLists.txt b/android/quest/CMakeLists.txt new file mode 100644 index 0000000..86de1d8 --- /dev/null +++ b/android/quest/CMakeLists.txt @@ -0,0 +1,148 @@ +# Sets the minimum version of CMake required to build your native library. +# This ensures that a certain set of CMake features is available to +# your build. + +cmake_minimum_required(VERSION 3.4.1) + +# build native_app_glue as a static lib +add_library( + app-glue STATIC + ../../libs/native_app_glue/android_native_app_glue.c +) + +add_library(vrapi SHARED IMPORTED) +set_target_properties(vrapi PROPERTIES IMPORTED_LOCATION + C:/ovr_sdk_mobile_1.23/VrApi/Libs/Android/${ANDROID_ABI}/Release/libvrapi.so) + + +# Specifies a library name, specifies whether the library is STATIC or +# SHARED, and provides relative paths to the source code. You can +# define multiple libraries by adding multiple add.library() commands, +# and CMake builds them for you. When you build your app, Gradle +# automatically packages shared libraries with your APK. + +# now build app's shared lib +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") + +add_library( + native-lib SHARED + ../../libs/yoga/yoga/log.cpp + ../../libs/yoga/yoga/Utils.cpp + ../../libs/yoga/yoga/YGConfig.cpp + ../../libs/yoga/yoga/YGEnums.cpp + ../../libs/yoga/yoga/YGLayout.cpp + ../../libs/yoga/yoga/YGMarker.cpp + ../../libs/yoga/yoga/YGNode.cpp + ../../libs/yoga/yoga/YGNodePrint.cpp + ../../libs/yoga/yoga/YGStyle.cpp + ../../libs/yoga/yoga/YGValue.cpp + ../../libs/yoga/yoga/Yoga.cpp + ../../libs/tinyxml2/tinyxml2.cpp + ../../libs/jpeg/jpgd.cpp + ../../libs/jpeg/jpge.cpp + ../../libs/poly2tri/poly2tri/common/shapes.cc + ../../libs/poly2tri/poly2tri/sweep/advancing_front.cc + ../../libs/poly2tri/poly2tri/sweep/cdt.cc + ../../libs/poly2tri/poly2tri/sweep/sweep_context.cc + ../../libs/poly2tri/poly2tri/sweep/sweep.cc + ../../libs/fmt/src/format.cc + ../src/cpp/main.cpp + ../../src/pch.cpp + ../../src/util.cpp + ../../src/rtt.cpp + ../../src/bezier.cpp + ../../src/asset.cpp + ../../src/image.cpp + ../../src/texture.cpp + ../../src/font.cpp + ../../src/shader.cpp + ../../src/shape.cpp + ../../src/app.cpp + ../../src/app_cloud.cpp + ../../src/app_dialogs.cpp + ../../src/app_events.cpp + ../../src/app_layout.cpp + ../../src/app_shaders.cpp + ../../src/app_vr.cpp + ../../src/brush.cpp + ../../src/canvas.cpp + ../../src/canvas_modes.cpp + ../../src/log.cpp + ../../src/action.cpp + ../../src/layout.cpp + ../../src/version.cpp + ../../src/node.cpp + ../../src/node_about.cpp + ../../src/node_border.cpp + ../../src/node_button.cpp + ../../src/node_button_custom.cpp + ../../src/node_canvas.cpp + ../../src/node_checkbox.cpp + ../../src/node_color_quad.cpp + ../../src/node_colorwheel.cpp + ../../src/node_combobox.cpp + ../../src/node_changelog.cpp + ../../src/node_dialog_browse.cpp + ../../src/node_dialog_cloud.cpp + ../../src/node_dialog_open.cpp + ../../src/node_dialog_picker.cpp + ../../src/node_dialog_layer_rename.cpp + ../../src/node_dialog_resize.cpp + ../../src/node_icon.cpp + ../../src/node_image.cpp + ../../src/node_image_texture.cpp + ../../src/node_message_box.cpp + ../../src/node_panel_brush.cpp + ../../src/node_panel_color.cpp + ../../src/node_panel_grid.cpp + ../../src/node_panel_floating.cpp + ../../src/node_panel_layer.cpp + ../../src/node_panel_stroke.cpp + ../../src/node_panel_quick.cpp + ../../src/node_popup_menu.cpp + ../../src/node_progress_bar.cpp + ../../src/node_settings.cpp + ../../src/node_slider.cpp + ../../src/node_stroke_preview.cpp + ../../src/node_text.cpp + ../../src/node_text_input.cpp + ../../src/node_usermanual.cpp + ../../src/node_viewport.cpp + ../../src/node_scroll.cpp + ../../src/abr.cpp + ../../src/binary_stream.cpp + ../../src/serializer.cpp + ../../src/settings.cpp +) + +target_include_directories(native-lib PRIVATE + C:/ovr_sdk_mobile_1.23/VrApi/Include + ../src/cpp + ../../src + ../../libs/glm + ../../libs/tinyxml2 + ../../libs/yoga + ../../libs/stb + ../../libs/jpeg + ../../libs/curl-android-ios/android/include + ../../libs/poly2tri/poly2tri + ../../libs/base64 + ../../libs/sqlite3 + ../../libs/nanort + ../../libs/native_app_glue + ../../libs/hash-library + ../../libs/fmt/include +) + +# add lib dependencies +target_link_libraries( + native-lib + vrapi + android + app-glue + ${CMAKE_SOURCE_DIR}/../../libs/curl-android-ios/android/${ANDROID_ABI}/libcurl.a + EGL + GLESv3 + log + z +) diff --git a/android/quest/build-run.bat b/android/quest/build-run.bat new file mode 100644 index 0000000..9036f94 --- /dev/null +++ b/android/quest/build-run.bat @@ -0,0 +1,4 @@ +xcopy /I /D /Y /S /E ..\data src\main\assets\data +call gradlew installDebug +call adb shell am start -n com.omigamedev/android.app.NativeActivity +pause \ No newline at end of file diff --git a/android/quest/build.gradle b/android/quest/build.gradle new file mode 100644 index 0000000..7dd082e --- /dev/null +++ b/android/quest/build.gradle @@ -0,0 +1,179 @@ +import java.util.regex.Matcher +import java.util.regex.Pattern + +buildscript { + repositories { + google() + jcenter() + maven { + url "https://plugins.gradle.org/m2/" + } + } + dependencies { + classpath 'com.android.tools.build:gradle:3.3.0' + classpath "gradle.plugin.com.gladed.gradle.androidgitversion:gradle-android-git-version:0.4.5" + } +} + +allprojects { + repositories { + google() // and here + jcenter() + } +} + +apply plugin: "com.android.application" +apply plugin: "com.gladed.androidgitversion" + +def getCurrentFlavor() { + Gradle gradle = getGradle() + + if (gradle.getStartParameter().getTaskRequests().args.size() == 0) + return "" + String tskReqStr = gradle.getStartParameter().getTaskRequests().args[0][0] + Pattern pattern + + pattern = Pattern.compile("(\\w*)(Release|Debug)") + + Matcher matcher = pattern.matcher( tskReqStr ) + + if( matcher.find() ) + return matcher.group(2).toLowerCase() + else + { + println "NO MATCH FOUND" + return "" + } +} + +def flavor = getCurrentFlavor() +def flavor_cap = getCurrentFlavor().capitalize() + +Properties properties = new Properties() +properties.load(project.rootProject.file('local.properties').newDataInputStream()) +def sdkDir = properties.getProperty("sdk.dir") +def classpath = "build/intermediates/javac/${flavor}/compile${flavor_cap}JavaWithJavac/classes;${sdkDir}/platforms/android-26/android.jar" +def activity = "com.omixlab.panopainter.MainActivity" +def outpath = "src/main/cpp" + +def ver_branch = "git rev-parse --abbrev-ref HEAD".execute().text.trim() +def ver_hash = "git log --pretty=format:%h -n 1".execute().text.trim() +def ver_count = Integer.parseInt("git rev-list --count HEAD".execute().text.trim()) +def ver_tag = "git describe --tags --abbrev=0".execute().text.trim() + +println classpath + +android { + compileSdkVersion 26 + android.buildToolsVersion "28.0.3" + + defaultConfig { + applicationId = 'com.omixlab.panopainter' + minSdkVersion 19 + targetSdkVersion 26 + versionCode ver_count + versionName "${ver_tag}.${ver_count}" + // This block is different from the one you use to link Gradle + // to your CMake or ndk-build script. + externalNativeBuild { + // For ndk-build, instead use the ndkBuild block + cmake { + // Passes optional arguments to CMake. + //arguments "-DANDROID_ARM_NEON=TRUE", "-DANDROID_TOOLCHAIN=clang" + // Sets optional flags for the C compiler. + //cFlags "-D_EXAMPLE_C_FLAG1", "-D_EXAMPLE_C_FLAG2" + // Sets a flag to enable format macro constants for the C++ compiler. + //cppFlags "-D__STDC_FORMAT_MACROS" + arguments "-DANDROID_TOOLCHAIN=clang", + //"-DANDROID_PLATFORM=android-19", + "-DANDROID_STL=c++_shared", + "-DCMAKE_BUILD_TYPE=${flavor_cap}", + "-DANDROID_ARM_NEON=TRUE" + } + } + ndk { + // Specifies the ABI configurations of your native + // libraries Gradle should build and package with your APK. + // abiFilters 'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'arm64-v8a' + abiFilters 'armeabi-v7a', 'arm64-v8a' + } + } + + // productFlavors { + // main { + // externalNativeBuild { + // cmake { + // targets "native-lib-demo" + // } + // } + // } + // } + + signingConfigs { + release { + storeFile file("ppkey.jks") + storePassword "om4r@Pano#Painter_2018" + keyAlias "PanoPainter" + keyPassword "om4r@Pano#Painter_2018" + } + } + + buildTypes { + release { + minifyEnabled false + proguardFile getDefaultProguardFile('proguard-android.txt') + signingConfig signingConfigs.release + } + } + + // Encapsulates your external native build configurations. + externalNativeBuild { + // Encapsulates your CMake build configurations. + cmake { + // Provides a relative path to your CMake build script. + path "CMakeLists.txt" + } + } + + sourceSets { + main { + manifest.srcFile 'src/main/AndroidManifest.xml' + java.srcDirs = ['../src/java'] + //jniLibs.srcDir 'libs' + res.srcDirs = ['../src/res'] + //assets.srcDirs = ['../../assets'] + } + } + +} + +task copyFiles(type: Copy) { + from '../../data/' + into 'src/main/assets/data' +} +preBuild.dependsOn(copyFiles) + +task generateVersioning(type: Exec) { + workingDir "$projectDir/../../" + commandLine 'python', 'scripts/pre-build.py', flavor +} +copyFiles.dependsOn(generateVersioning) + +task generateJavaH(type: Exec) { + ignoreExitValue true + workingDir "$projectDir" + commandLine 'javah', "-jni", "-force", "-cp", "$classpath", "-d", "$outpath", "$activity" +} +//generateVersioning.dependsOn(generateJavaH) + +tasks.whenTaskAdded { task -> + if (task.name.contains('externalNativeBuild')) { + // This dependecy *is* set. This can be seen by using task copyLibs(type: Copy, dependsOn: 'bundleDebug') + // together with this and get a circular dependency. + task.dependsOn generateJavaH + } +} + +repositories { + google() +} \ No newline at end of file diff --git a/android/quest/gradle.properties b/android/quest/gradle.properties new file mode 100644 index 0000000..8bd86f6 --- /dev/null +++ b/android/quest/gradle.properties @@ -0,0 +1 @@ +org.gradle.jvmargs=-Xmx1536M diff --git a/android/quest/gradle/wrapper/gradle-wrapper.jar b/android/quest/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..8c0fb64 Binary files /dev/null and b/android/quest/gradle/wrapper/gradle-wrapper.jar differ diff --git a/android/quest/gradle/wrapper/gradle-wrapper.properties b/android/quest/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..b0a0ae5 --- /dev/null +++ b/android/quest/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Mon May 27 02:40:42 CEST 2019 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-all.zip diff --git a/android/quest/gradlew b/android/quest/gradlew new file mode 100644 index 0000000..91a7e26 --- /dev/null +++ b/android/quest/gradlew @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/android/quest/gradlew.bat b/android/quest/gradlew.bat new file mode 100644 index 0000000..8a0b282 --- /dev/null +++ b/android/quest/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/android/quest/local.properties b/android/quest/local.properties new file mode 100644 index 0000000..4d3a32a --- /dev/null +++ b/android/quest/local.properties @@ -0,0 +1,9 @@ +## This file must *NOT* be checked into Version Control Systems, +# as it contains information specific to your local configuration. +# +# Location of the SDK. This is only used by Gradle. +# For customization when using a Version Control System, please read the +# header note. +#Mon Oct 08 14:04:19 CEST 2018 +ndk.dir=C\:\\Users\\omar\\AppData\\Local\\Android\\Sdk\\ndk-bundle +sdk.dir=C\:\\Users\\omar\\AppData\\Local\\Android\\Sdk diff --git a/android/quest/ppkey.jks b/android/quest/ppkey.jks new file mode 100644 index 0000000..0e2fae0 Binary files /dev/null and b/android/quest/ppkey.jks differ diff --git a/android/quest/src/main/AndroidManifest.xml b/android/quest/src/main/AndroidManifest.xml new file mode 100644 index 0000000..bad0994 --- /dev/null +++ b/android/quest/src/main/AndroidManifest.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + diff --git a/android/src/main/cpp/keymap.h b/android/src/cpp/keymap.h similarity index 100% rename from android/src/main/cpp/keymap.h rename to android/src/cpp/keymap.h diff --git a/android/src/main/cpp/main.cpp b/android/src/cpp/main.cpp old mode 100755 new mode 100644 similarity index 97% rename from android/src/main/cpp/main.cpp rename to android/src/cpp/main.cpp index 285111d..81f4ade --- a/android/src/main/cpp/main.cpp +++ b/android/src/cpp/main.cpp @@ -24,6 +24,13 @@ #include #include #include +#include +#include // for prctl( PR_SET_NAME ) + +#include "VrApi.h" +#include "VrApi_Helpers.h" +#include "VrApi_SystemUtils.h" +#include "VrApi_Input.h" #include "pch.h" #include "app.h" @@ -1040,6 +1047,28 @@ void android_main(struct android_app* state) { state->onInputEvent = engine_handle_input; g_engine.app = state; + // BEGIN OVR + + ANativeActivity_setWindowFlags(state->activity, AWINDOW_FLAG_KEEP_SCREEN_ON, 0 ); + + ovrJava java; + java.Vm = state->activity->vm; + (*java.Vm).AttachCurrentThread(&java.Env, NULL ); + java.ActivityObject = state->activity->clazz; + + // Note that AttachCurrentThread will reset the thread name. + prctl( PR_SET_NAME, (long)"OVR::Main", 0, 0, 0 ); + + const ovrInitParms initParms = vrapi_DefaultInitParms( &java ); + int32_t initResult = vrapi_Initialize( &initParms ); + if ( initResult != VRAPI_INITIALIZE_SUCCESS ) + { + // If intialization failed, vrapi_* function calls will not be available. + exit( 0 ); + } + + // END OVR + // Prepare to monitor accelerometer /* g_engine.sensorManager = ASensorManager_getInstance(); diff --git a/android/src/main/cpp/main.h b/android/src/cpp/main.h old mode 100755 new mode 100644 similarity index 100% rename from android/src/main/cpp/main.h rename to android/src/cpp/main.h diff --git a/android/src/main/cpp/native-lib.cpp b/android/src/cpp/native-lib.cpp similarity index 100% rename from android/src/main/cpp/native-lib.cpp rename to android/src/cpp/native-lib.cpp diff --git a/android/src/main/java/com/omixlab/panopainter/FileUtils.java b/android/src/java/com/omixlab/panopainter/FileUtils.java similarity index 100% rename from android/src/main/java/com/omixlab/panopainter/FileUtils.java rename to android/src/java/com/omixlab/panopainter/FileUtils.java diff --git a/android/src/main/java/com/omixlab/panopainter/MainActivity.java b/android/src/java/com/omixlab/panopainter/MainActivity.java similarity index 100% rename from android/src/main/java/com/omixlab/panopainter/MainActivity.java rename to android/src/java/com/omixlab/panopainter/MainActivity.java diff --git a/android/src/main/java/com/omixlab/panopainter/PathUtil.java b/android/src/java/com/omixlab/panopainter/PathUtil.java similarity index 100% rename from android/src/main/java/com/omixlab/panopainter/PathUtil.java rename to android/src/java/com/omixlab/panopainter/PathUtil.java diff --git a/android/src/main/res/layout/main.xml b/android/src/res/layout/main.xml similarity index 100% rename from android/src/main/res/layout/main.xml rename to android/src/res/layout/main.xml diff --git a/android/src/main/res/mipmap-hdpi/ic_launcher.png b/android/src/res/mipmap-hdpi/ic_launcher.png old mode 100755 new mode 100644 similarity index 100% rename from android/src/main/res/mipmap-hdpi/ic_launcher.png rename to android/src/res/mipmap-hdpi/ic_launcher.png diff --git a/android/src/main/res/mipmap-mdpi/ic_launcher.png b/android/src/res/mipmap-mdpi/ic_launcher.png old mode 100755 new mode 100644 similarity index 100% rename from android/src/main/res/mipmap-mdpi/ic_launcher.png rename to android/src/res/mipmap-mdpi/ic_launcher.png diff --git a/android/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/src/res/mipmap-xhdpi/ic_launcher.png old mode 100755 new mode 100644 similarity index 100% rename from android/src/main/res/mipmap-xhdpi/ic_launcher.png rename to android/src/res/mipmap-xhdpi/ic_launcher.png diff --git a/android/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/src/res/mipmap-xxhdpi/ic_launcher.png old mode 100755 new mode 100644 similarity index 100% rename from android/src/main/res/mipmap-xxhdpi/ic_launcher.png rename to android/src/res/mipmap-xxhdpi/ic_launcher.png diff --git a/android/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/src/res/mipmap-xxxhdpi/ic_launcher.png old mode 100755 new mode 100644 similarity index 100% rename from android/src/main/res/mipmap-xxxhdpi/ic_launcher.png rename to android/src/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/android/src/main/res/values/strings.xml b/android/src/res/values/strings.xml similarity index 100% rename from android/src/main/res/values/strings.xml rename to android/src/res/values/strings.xml