From fc8fad0753932a25699f6a647682794f5cf3d626 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 31 Aug 2016 13:56:02 -0700 Subject: [PATCH] check SCRIBE_PATH for scribe, add instructions --- BUILD_ANDROID.md | 20 ++++++++++++-------- CMakeLists.txt | 1 - cmake/macros/AutoScribeShader.cmake | 17 +++++++++++++++++ 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/BUILD_ANDROID.md b/BUILD_ANDROID.md index 88294f3040..d5e5b88e70 100644 --- a/BUILD_ANDROID.md +++ b/BUILD_ANDROID.md @@ -4,13 +4,11 @@ Please read the [general build guide](BUILD.md) for information on dependencies You will need the following tools to build our Android targets. -* [cmake](http://www.cmake.org/download/) ~> 3.1.0 - * Note that this is a newer version required than the minimum for hifi desktop targets. -* [Qt](http://www.qt.io/download-open-source/#) ~> 5.4.0 - * Note that this is a newer version required than the minimum for hifi desktop targets. +* [cmake](http://www.cmake.org/download/) ~> 3.5.1 +* [Qt](http://www.qt.io/download-open-source/#) ~> 5.5.1 * [ant](http://ant.apache.org/bindownload.cgi) ~> 1.9.4 -* [Android NDK](https://developer.android.com/tools/sdk/ndk/index.html) = r10c -* [Android SDK](http://developer.android.com/sdk/installing/index.html) ~> 24.0.2 +* [Android NDK](https://developer.android.com/tools/sdk/ndk/index.html) ~> r11b +* [Android SDK](http://developer.android.com/sdk/installing/index.html) ~> 24.4.1.1 * Install the latest Platform-tools * Install the latest Build-tools * Install the SDK Platform for API Level 19 @@ -19,6 +17,12 @@ You will need the following tools to build our Android targets. You will also need to cross-compile the dependencies required for all platforms for Android, and help CMake find these compiled libraries on your machine. +####Scribe + +High Fidelity has a shader pre-processing tool called `scribe` that various libraries will call on during the build process. You must compile scribe using your native toolchain (following the build instructions for your platform) and then pass a CMake variable or set an ENV variable `SCRIBE_PATH` that is a path to the scribe executable. + +CMake will fatally error if it does not find the scribe executable while using the android toolchain. + ####Optional Components * [Oculus Mobile SDK](https://developer.oculus.com/downloads/#sdk=mobile) ~> 0.4.2 @@ -31,11 +35,11 @@ This is most easily accomplished by installing all Android dependencies in the s ####Qt -Install Qt 5.4 for Android for your host environment from the [Qt downloads page](http://www.qt.io/download/). Install Qt to ``$ANDROID_LIB_DIR/Qt``. This is required so that our root CMakeLists file can help CMake find your Android Qt installation. +Install Qt 5.5.1 for Android for your host environment from the [Qt downloads page](http://www.qt.io/download/). Install Qt to ``$ANDROID_LIB_DIR/Qt``. This is required so that our root CMakeLists file can help CMake find your Android Qt installation. The component required for the Android build is the `Android armv7` component. -If you would like to install Qt to a different location, or attempt to build with a different Qt version, you can pass `ANDROID_QT_CMAKE_PREFIX_PATH` to CMake. Point to the `cmake` folder inside `$VERSION_NUMBER/android_armv7/lib`. Otherwise, our root CMakeLists will set it to `$ANDROID_LIB_DIR/Qt/5.3/android_armv7/lib/cmake`. +If you would like to install Qt to a different location, or attempt to build with a different Qt version, you can pass `ANDROID_QT_CMAKE_PREFIX_PATH` to CMake. Point to the `cmake` folder inside `$VERSION_NUMBER/android_armv7/lib`. Otherwise, our root CMakeLists will set it to `$ANDROID_LIB_DIR/Qt/5.5/android_armv7/lib/cmake`. ####OpenSSL diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d9eddc0b3..b4eb5793ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -237,7 +237,6 @@ endif() if (ANDROID OR DESKTOP_GVR) add_subdirectory(interface) - add_subdirectory(tools) add_subdirectory(gvr-interface) endif () diff --git a/cmake/macros/AutoScribeShader.cmake b/cmake/macros/AutoScribeShader.cmake index 958b444672..8d46868baf 100755 --- a/cmake/macros/AutoScribeShader.cmake +++ b/cmake/macros/AutoScribeShader.cmake @@ -54,6 +54,23 @@ function(AUTOSCRIBE_SHADER SHADER_FILE) set(SCRIBE_ARGS -c++ -D GLPROFILE ${GLPROFILE} ${SCRIBE_INCLUDES} -o ${SHADER_TARGET} ${SHADER_FILE}) add_custom_command(OUTPUT ${SHADER_TARGET} COMMAND scribe ${SCRIBE_ARGS} DEPENDS scribe ${SHADER_INCLUDE_FILES} ${SHADER_FILE}) + elseif (ANDROID) + set(GLPROFILE LINUX_GL) + set(SCRIBE_ARGS -c++ -D GLPROFILE ${GLPROFILE} ${SCRIBE_INCLUDES} -o ${SHADER_TARGET} ${SHADER_FILE}) + + # for an android build, we can't use the scribe that cmake would normally produce as a target, + # since it's unrunnable by the cross-compiling build machine + + # so, we require the compiling user to point us at a compiled executable version for their native toolchain + find_program(NATIVE_SCRIBE scribe PATHS ${SCRIBE_PATH} ENV SCRIBE_PATH) + + if (NOT NATIVE_SCRIBE) + message(FATAL_ERROR "The High Fidelity scribe tool is required for shader pre-processing. \ + Please compile scribe using your native toolchain and set SCRIBE_PATH to the location of the executable in your ENV.\ + ") + endif () + + add_custom_command(OUTPUT ${SHADER_TARGET} COMMAND ${NATIVE_SCRIBE} ${SCRIBE_ARGS} DEPENDS ${SHADER_INCLUDE_FILES} ${SHADER_FILE}) elseif (UNIX) set(GLPROFILE LINUX_GL) set(SCRIBE_ARGS -c++ -D GLPROFILE ${GLPROFILE} ${SCRIBE_INCLUDES} -o ${SHADER_TARGET} ${SHADER_FILE})