COMPMID-652 - Graph examples shouldn't need to link against OpenCL

- Added --no-allow-shlib-undefined to library builds to make sure we
don't leave any unresolved symbol
- Added --allow-shlib-undefined to the graph examples build lines so that
it doesn't matter whether or not OpenCL is supported by the Graph
librarylibrary
- Don't link tests statically anymore on Android (This was probably
required in the past because we were duplicating symbols in the
core and runtime libraries, but it doesn't seem to be an issue
anymore)
- Updated Doxygen accordingly

Change-Id: I9905f388e0838bc8e3369de52838bf980b992ead
Reviewed-on: http://mpd-gerrit.cambridge.arm.com/95172
Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
diff --git a/examples/SConscript b/examples/SConscript
index 90b271d..e002d11 100644
--- a/examples/SConscript
+++ b/examples/SConscript
@@ -42,7 +42,7 @@
 # Build examples
 utils = examples_env.Object("../utils/Utils.cpp")
 
-if env['os'] in ['android', 'bare_metal'] or env['standalone']:
+if env['os'] in ['bare_metal'] or env['standalone']:
     Import('arm_compute_a')
     Import('arm_compute_core_a')
     arm_compute_libs = [ arm_compute_a, arm_compute_core_a ]
@@ -59,22 +59,16 @@
         Depends(prog, [arm_compute_dependency, opencl])
         alias = examples_env.Alias(example, prog)
         Default(alias)
-    if env['os'] == 'android':
-        Import('arm_compute_graph_a')
-        Import('arm_compute_core_a')
-        Import('arm_compute_a')
-        arm_compute_graph_libs = [ arm_compute_graph_a, arm_compute_a, arm_compute_core_a]
-        graph_dependency = arm_compute_graph_a
-    else:
-        Import('arm_compute_graph_so')
-        arm_compute_graph_libs = ["arm_compute_graph", "arm_compute", "arm_compute_core"]
-        graph_dependency = arm_compute_graph_so
+    Import('arm_compute_graph_so')
+    arm_compute_graph_libs = ["arm_compute_graph", "arm_compute", "arm_compute_core"]
+    graph_dependency = arm_compute_graph_so
 
     graph_utils = examples_env.Object("../utils/GraphUtils.cpp")
     for file in Glob("./graph_*.cpp"):
         example = os.path.basename(os.path.splitext(str(file))[0])
-        prog = examples_env.Program(example, ["{}.cpp".format(example), utils, graph_utils], CPPDEFINES=['ARM_COMPUTE_CL'], LIBS = arm_compute_graph_libs + ["OpenCL"])
-        Depends(prog, [graph_dependency, opencl])
+        #-Wl,--allow-shlib-undefined: Ignore dependencies of dependencies
+        prog = examples_env.Program(example, ["{}.cpp".format(example), utils, graph_utils], LIBS = arm_compute_graph_libs, LINKFLAGS=examples_env["LINKFLAGS"]+['-Wl,--allow-shlib-undefined'] )
+        Depends(prog, graph_dependency)
         alias = examples_env.Alias(example, prog)
         Default(alias)
 
diff --git a/examples/graph_alexnet.cpp b/examples/graph_alexnet.cpp
index b2a5be6..2d2ba6b 100644
--- a/examples/graph_alexnet.cpp
+++ b/examples/graph_alexnet.cpp
@@ -21,15 +21,9 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
-#ifndef ARM_COMPUTE_CL /* Needed by Utils.cpp to handle OpenCL exceptions properly */
-#error "This example needs to be built with -DARM_COMPUTE_CL"
-#endif /* ARM_COMPUTE_CL */
 
 #include "arm_compute/graph/Graph.h"
 #include "arm_compute/graph/Nodes.h"
-#include "arm_compute/runtime/CL/CLScheduler.h"
-#include "arm_compute/runtime/CPP/CPPScheduler.h"
-#include "arm_compute/runtime/Scheduler.h"
 #include "support/ToolchainSupport.h"
 #include "utils/GraphUtils.h"
 #include "utils/Utils.h"
@@ -40,7 +34,6 @@
 
 using namespace arm_compute::graph;
 using namespace arm_compute::graph_utils;
-using namespace arm_compute::logging;
 
 /** Example demonstrating how to implement AlexNet's network using the Compute Library's graph API
  *
@@ -86,9 +79,8 @@
 
     // Check if OpenCL is available and initialize the scheduler
     TargetHint hint = TargetHint::NEON;
-    if(arm_compute::opencl_is_available())
+    if(Graph::opencl_is_available())
     {
-        arm_compute::CLScheduler::get().default_init();
         hint = TargetHint::OPENCL;
     }
 
diff --git a/examples/graph_googlenet.cpp b/examples/graph_googlenet.cpp
index 354a2a3..e116633 100644
--- a/examples/graph_googlenet.cpp
+++ b/examples/graph_googlenet.cpp
@@ -21,22 +21,15 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
-#ifndef ARM_COMPUTE_CL /* Needed by Utils.cpp to handle OpenCL exceptions properly */
-#error "This example needs to be built with -DARM_COMPUTE_CL"
-#endif /* ARM_COMPUTE_CL */
 
 #include "arm_compute/graph/Graph.h"
 #include "arm_compute/graph/Nodes.h"
 #include "arm_compute/graph/SubGraph.h"
-#include "arm_compute/runtime/CL/CLScheduler.h"
-#include "arm_compute/runtime/Scheduler.h"
 #include "support/ToolchainSupport.h"
 #include "utils/GraphUtils.h"
 #include "utils/Utils.h"
 
 #include <cstdlib>
-#include <iostream>
-#include <memory>
 #include <tuple>
 
 using namespace arm_compute::graph;
@@ -141,14 +134,15 @@
     }
 
     // Check if OpenCL is available and initialize the scheduler
-    if(arm_compute::opencl_is_available())
+    TargetHint hint = TargetHint::NEON;
+    if(Graph::opencl_is_available())
     {
-        arm_compute::CLScheduler::get().default_init();
+        hint = TargetHint::OPENCL;
     }
 
     Graph graph;
 
-    graph << TargetHint::OPENCL
+    graph << hint
           << Tensor(TensorInfo(TensorShape(224U, 224U, 3U, 1U), 1, DataType::F32),
                     get_input_accessor(image, mean_r, mean_g, mean_b))
           << ConvolutionLayer(
diff --git a/examples/graph_lenet.cpp b/examples/graph_lenet.cpp
index 53b32d9..f6af14c 100644
--- a/examples/graph_lenet.cpp
+++ b/examples/graph_lenet.cpp
@@ -21,25 +21,17 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
-#ifndef ARM_COMPUTE_CL /* Needed by Utils.cpp to handle OpenCL exceptions properly */
-#error "This example needs to be built with -DARM_COMPUTE_CL"
-#endif /* ARM_COMPUTE_CL */
 
 #include "arm_compute/graph/Graph.h"
 #include "arm_compute/graph/Nodes.h"
-#include "arm_compute/runtime/CL/CLScheduler.h"
-#include "arm_compute/runtime/Scheduler.h"
 #include "support/ToolchainSupport.h"
 #include "utils/GraphUtils.h"
 #include "utils/Utils.h"
 
 #include <cstdlib>
-#include <iostream>
-#include <memory>
 
 using namespace arm_compute::graph;
 using namespace arm_compute::graph_utils;
-using namespace arm_compute::logging;
 
 /** Generates appropriate accessor according to the specified path
  *
@@ -95,9 +87,8 @@
 
     // Check if OpenCL is available and initialize the scheduler
     TargetHint hint = TargetHint::NEON;
-    if(arm_compute::opencl_is_available())
+    if(Graph::opencl_is_available())
     {
-        arm_compute::CLScheduler::get().default_init();
         hint = TargetHint::OPENCL;
     }
 
diff --git a/examples/graph_squeezenet.cpp b/examples/graph_squeezenet.cpp
index d38cec2..51c4de0 100644
--- a/examples/graph_squeezenet.cpp
+++ b/examples/graph_squeezenet.cpp
@@ -21,22 +21,15 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
-#ifndef ARM_COMPUTE_CL /* Needed by Utils.cpp to handle OpenCL exceptions properly */
-#error "This example needs to be built with -DARM_COMPUTE_CL"
-#endif /* ARM_COMPUTE_CL */
 
 #include "arm_compute/graph/Graph.h"
 #include "arm_compute/graph/Nodes.h"
 #include "arm_compute/graph/SubGraph.h"
-#include "arm_compute/runtime/CL/CLScheduler.h"
-#include "arm_compute/runtime/Scheduler.h"
 #include "support/ToolchainSupport.h"
 #include "utils/GraphUtils.h"
 #include "utils/Utils.h"
 
 #include <cstdlib>
-#include <iostream>
-#include <memory>
 #include <tuple>
 
 using namespace arm_compute::graph;
@@ -109,14 +102,15 @@
     }
 
     // Check if OpenCL is available and initialize the scheduler
-    if(arm_compute::opencl_is_available())
+    TargetHint hint = TargetHint::NEON;
+    if(Graph::opencl_is_available())
     {
-        arm_compute::CLScheduler::get().default_init();
+        hint = TargetHint::OPENCL;
     }
 
     Graph graph;
 
-    graph << TargetHint::OPENCL
+    graph << hint
           << Tensor(TensorInfo(TensorShape(224U, 224U, 3U, 1U), 1, DataType::F32),
                     get_input_accessor(image, mean_r, mean_g, mean_b))
           << ConvolutionLayer(
diff --git a/examples/graph_vgg16.cpp b/examples/graph_vgg16.cpp
index ba59503..44dd1f6 100644
--- a/examples/graph_vgg16.cpp
+++ b/examples/graph_vgg16.cpp
@@ -21,13 +21,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
-#ifndef ARM_COMPUTE_CL /* Needed by Utils.cpp to handle OpenCL exceptions properly */
-#error "This example needs to be built with -DARM_COMPUTE_CL"
-#endif /* ARM_COMPUTE_CL */
-
 #include "arm_compute/graph/Graph.h"
 #include "arm_compute/graph/Nodes.h"
-#include "arm_compute/runtime/CL/CLScheduler.h"
 #include "support/ToolchainSupport.h"
 #include "utils/GraphUtils.h"
 #include "utils/Utils.h"
@@ -81,9 +76,8 @@
 
     // Check if OpenCL is available and initialize the scheduler
     TargetHint hint = TargetHint::NEON;
-    if(arm_compute::opencl_is_available())
+    if(Graph::opencl_is_available())
     {
-        arm_compute::CLScheduler::get().default_init();
         hint = TargetHint::OPENCL;
     }
 
diff --git a/examples/graph_vgg19.cpp b/examples/graph_vgg19.cpp
index 74cb65a..61bb9a5 100644
--- a/examples/graph_vgg19.cpp
+++ b/examples/graph_vgg19.cpp
@@ -21,14 +21,9 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
-#ifndef ARM_COMPUTE_CL /* Needed by Utils.cpp to handle OpenCL exceptions properly */
-#error "This example needs to be built with -DARM_COMPUTE_CL"
-#endif /* ARM_COMPUTE_CL */
 
 #include "arm_compute/graph/Graph.h"
 #include "arm_compute/graph/Nodes.h"
-#include "arm_compute/runtime/CL/CLScheduler.h"
-#include "arm_compute/runtime/Scheduler.h"
 #include "support/ToolchainSupport.h"
 #include "utils/GraphUtils.h"
 #include "utils/Utils.h"
@@ -37,7 +32,6 @@
 
 using namespace arm_compute::graph;
 using namespace arm_compute::graph_utils;
-using namespace arm_compute::logging;
 
 /** Example demonstrating how to implement VGG19's network using the Compute Library's graph API
  *
@@ -83,9 +77,8 @@
 
     // Check if OpenCL is available and initialize the scheduler
     TargetHint hint = TargetHint::NEON;
-    if(arm_compute::opencl_is_available())
+    if(Graph::opencl_is_available())
     {
-        arm_compute::CLScheduler::get().default_init();
         hint = TargetHint::OPENCL;
     }