Merge pull request #2103 from kainino0x/web-cmake-typo

Fix typo in Web CMakeLists
diff --git a/README.md b/README.md
index 4316ead..5188ab4 100755
--- a/README.md
+++ b/README.md
@@ -104,7 +104,7 @@
 The following steps assume a Bash shell. On Windows, that could be the Git Bash
 shell or some other shell of your choosing.
 
-#### 1) Check-Out this project 
+#### 1) Check-Out this project
 
 ```bash
 cd <parent of where you want glslang to be>
@@ -152,6 +152,14 @@
 # "Release" (for CMAKE_BUILD_TYPE) could also be "Debug" or "RelWithDebInfo"
 ```
 
+For building on Android:
+```bash
+cmake $SOURCE_DIR -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$(pwd)/install" -DANDROID_ABI=arm64-v8a -DCMAKE_BUILD_TYPE=Release -DANDROID_STL=c++_static -DANDROID_PLATFORM=android-24 -DCMAKE_SYSTEM_NAME=Android -DANDROID_TOOLCHAIN=clang -DANDROID_ARM_MODE=arm -DCMAKE_MAKE_PROGRAM=$ANDROID_NDK_ROOT/prebuilt/linux-x86_64/bin/make -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake
+# If on Windows will be -DCMAKE_MAKE_PROGRAM=%ANDROID_NDK_ROOT%\prebuilt\windows-x86_64\bin\make.exe
+# -G is needed for building on Windows
+# -DANDROID_ABI can also be armeabi-v7a for 32 bit
+```
+
 For building on Windows:
 
 ```bash
diff --git a/StandAlone/CMakeLists.txt b/StandAlone/CMakeLists.txt
index 2cf2899..591ac34 100644
--- a/StandAlone/CMakeLists.txt
+++ b/StandAlone/CMakeLists.txt
@@ -1,5 +1,6 @@
 add_library(glslang-default-resource-limits
-            ${CMAKE_CURRENT_SOURCE_DIR}/ResourceLimits.cpp)
+            ${CMAKE_CURRENT_SOURCE_DIR}/ResourceLimits.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/resource_limits_c.cpp)
 set_property(TARGET glslang-default-resource-limits PROPERTY FOLDER glslang)
 set_property(TARGET glslang-default-resource-limits PROPERTY POSITION_INDEPENDENT_CODE ON)
 
diff --git a/StandAlone/resource_limits_c.cpp b/StandAlone/resource_limits_c.cpp
new file mode 100644
index 0000000..1b33f5f
--- /dev/null
+++ b/StandAlone/resource_limits_c.cpp
@@ -0,0 +1,51 @@
+/**
+BSD 2-Clause License
+
+Copyright (c) 2020, Travis Fort
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**/
+
+#include "resource_limits_c.h"
+#include "ResourceLimits.h"
+#include <stdlib.h>
+#include <string.h>
+#include <string>
+
+const glslang_resource_t* glslang_default_resource(void)
+{
+    return reinterpret_cast<const glslang_resource_t*>(&glslang::DefaultTBuiltInResource);
+}
+
+const char* glslang_default_resource_string()
+{
+    std::string cpp_str = glslang::GetDefaultTBuiltInResourceString();
+    char* c_str = (char*)malloc(cpp_str.length() + 1);
+    strcpy(c_str, cpp_str.c_str());
+    return c_str;
+}
+
+void glslang_decode_resource_limits(glslang_resource_t* resources, char* config)
+{
+    glslang::DecodeResourceLimits(reinterpret_cast<TBuiltInResource*>(resources), config);
+}
diff --git a/StandAlone/resource_limits_c.h b/StandAlone/resource_limits_c.h
new file mode 100644
index 0000000..108fd5e
--- /dev/null
+++ b/StandAlone/resource_limits_c.h
@@ -0,0 +1,54 @@
+/**
+BSD 2-Clause License
+
+Copyright (c) 2020, Travis Fort
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**/
+
+#ifndef _STAND_ALONE_RESOURCE_LIMITS_C_INCLUDED_
+#define _STAND_ALONE_RESOURCE_LIMITS_C_INCLUDED_
+
+#include "../glslang/Include/glslang_c_interface.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// These are the default resources for TBuiltInResources, used for both
+//  - parsing this string for the case where the user didn't supply one,
+//  - dumping out a template for user construction of a config file.
+const glslang_resource_t* glslang_default_resource(void);
+
+// Returns the DefaultTBuiltInResource as a human-readable string.
+// NOTE: User is responsible for freeing this string.
+const char* glslang_default_resource_string();
+
+// Decodes the resource limits from |config| to |resources|.
+void glslang_decode_resource_limits(glslang_resource_t* resources, char* config);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // _STAND_ALONE_RESOURCE_LIMITS_C_INCLUDED_
diff --git a/glslang/CInterface/glslang_c_interface.cpp b/glslang/CInterface/glslang_c_interface.cpp
index 59d509b..68446c2 100644
--- a/glslang/CInterface/glslang_c_interface.cpp
+++ b/glslang/CInterface/glslang_c_interface.cpp
@@ -167,11 +167,6 @@
 
 void glslang_finalize_process() { glslang::FinalizeProcess(); }
 
-const glslang_resource_t* glslang_default_resource(void)
-{
-    return reinterpret_cast<const glslang_resource_t*>(&glslang::DefaultTBuiltInResource);
-}
-
 static EShLanguage c_shader_stage(glslang_stage_t stage)
 {
     switch (stage) {
diff --git a/glslang/Include/glslang_c_interface.h b/glslang/Include/glslang_c_interface.h
index 25da08a..5a450e0 100644
--- a/glslang/Include/glslang_c_interface.h
+++ b/glslang/Include/glslang_c_interface.h
@@ -205,8 +205,6 @@
 int glslang_initialize_process();
 void glslang_finalize_process();
 
-const glslang_resource_t* glslang_default_resource(void);
-
 glslang_shader_t* glslang_shader_create(const glslang_input_t* input);
 void glslang_shader_delete(glslang_shader_t* shader);
 int glslang_shader_preprocess(glslang_shader_t* shader, const glslang_input_t* input);