diff options
-rw-r--r-- | SConscript | 11 | ||||
-rw-r--r-- | SConstruct | 2 | ||||
-rw-r--r-- | docs/00_introduction.dox | 12 | ||||
-rw-r--r-- | examples/SConscript | 26 | ||||
-rw-r--r-- | examples/graph_alexnet.cpp | 1 | ||||
-rw-r--r-- | examples/graph_googlenet.cpp | 1 | ||||
-rw-r--r-- | examples/graph_lenet.cpp | 1 | ||||
-rw-r--r-- | examples/graph_mobilenet.cpp | 1 | ||||
-rw-r--r-- | examples/graph_squeezenet.cpp | 1 | ||||
-rw-r--r-- | examples/graph_vgg19.cpp | 1 | ||||
-rw-r--r-- | tests/SConscript | 2 |
11 files changed, 32 insertions, 27 deletions
diff --git a/SConscript b/SConscript index 3637858626..2544d1f64c 100644 --- a/SConscript +++ b/SConscript @@ -231,17 +231,16 @@ if env['neon'] and env['opencl']: shared_graph_objects = [arm_compute_env.SharedObject(f) for f in graph_files] static_graph_objects = [arm_compute_env.StaticObject(f) for f in graph_files] - #FIXME OpenCL can't be linked statically: revisit when we can have a NEON only build of the graph library - #arm_compute_graph_a = build_library('arm_compute_graph-static', static_graph_objects, static=True, libs = [ arm_compute_a ]) - #Export('arm_compute_graph_a') + arm_compute_graph_a = build_library('arm_compute_graph-static', static_graph_objects, static=True, libs = [ arm_compute_a ]) + Export('arm_compute_graph_a') arm_compute_env.Append(LIBPATH = ["#build/%s/opencl-1.2-stubs" % env['build_dir']]) arm_compute_graph_so = build_library('arm_compute_graph', shared_graph_objects, static=False, libs = [ "arm_compute", "arm_compute_core", "OpenCL" ]) - Depends(arm_compute_graph_so, [ arm_compute_so, opencl]) + Depends(arm_compute_graph_so, arm_compute_so) + Depends(arm_compute_graph_so, opencl) Export('arm_compute_graph_so') - #graph_alias = arm_compute_env.Alias("arm_compute_graph", [arm_compute_graph_a, arm_compute_graph_so]) - graph_alias = arm_compute_env.Alias("arm_compute_graph", [arm_compute_graph_so]) + graph_alias = arm_compute_env.Alias("arm_compute_graph", [arm_compute_graph_a, arm_compute_graph_so]) Default(graph_alias) if env['standalone']: diff --git a/SConstruct b/SConstruct index e7504228d3..9f772f408b 100644 --- a/SConstruct +++ b/SConstruct @@ -188,7 +188,7 @@ if env['Werror']: if env['os'] == 'android': env.Append(CPPDEFINES = ['ANDROID']) - env.Append(LINKFLAGS = ['-pie']) + env.Append(LINKFLAGS = ['-pie', '-static-libstdc++']) elif env['os'] == 'bare_metal': env.Append(LINKFLAGS = ['-static']) env.Append(LINKFLAGS = ['-specs=rdimon.specs']) diff --git a/docs/00_introduction.dox b/docs/00_introduction.dox index 9d478e051a..bf43b3abb3 100644 --- a/docs/00_introduction.dox +++ b/docs/00_introduction.dox @@ -609,24 +609,24 @@ Once you've got your Android standalone toolchain built and added to your path y To cross compile a NEON example: #32 bit: - arm-linux-androideabi-clang++ examples/neon_convolution.cpp utils/Utils.cpp -I. -Iinclude -std=c++11 -larm_compute -larm_compute_core -L. -o neon_convolution_arm -pie + arm-linux-androideabi-clang++ examples/neon_convolution.cpp utils/Utils.cpp -I. -Iinclude -std=c++11 -larm_compute-static -larm_compute_core-static -L. -o neon_convolution_arm -static-libstdc++ -pie #64 bit: - aarch64-linux-android-g++ examples/neon_convolution.cpp utils/Utils.cpp -I. -Iinclude -std=c++11 -larm_compute -larm_compute_core -L. -o neon_convolution_aarch64 -pie + aarch64-linux-android-g++ examples/neon_convolution.cpp utils/Utils.cpp -I. -Iinclude -std=c++11 -larm_compute-static -larm_compute_core-static -L. -o neon_convolution_aarch64 -static-libstdc++ -pie To cross compile an OpenCL example: #32 bit: - arm-linux-androideabi-clang++ examples/cl_convolution.cpp utils/Utils.cpp -I. -Iinclude -std=c++11 -larm_compute -larm_compute_core -L. -o cl_convolution_arm -pie -lOpenCL -DARM_COMPUTE_CL + arm-linux-androideabi-clang++ examples/cl_convolution.cpp utils/Utils.cpp -I. -Iinclude -std=c++11 -larm_compute-static -larm_compute_core-static -L. -o cl_convolution_arm -static-libstdc++ -pie -lOpenCL -DARM_COMPUTE_CL #64 bit: - aarch64-linux-android-g++ examples/cl_convolution.cpp utils/Utils.cpp -I. -Iinclude -std=c++11 -larm_compute -larm_compute_core -L. -o cl_convolution_aarch64 -pie -lOpenCL -DARM_COMPUTE_CL + aarch64-linux-android-g++ examples/cl_convolution.cpp utils/Utils.cpp -I. -Iinclude -std=c++11 -larm_compute-static -larm_compute_core-static -L. -o cl_convolution_aarch64 -static-libstdc++ -pie -lOpenCL -DARM_COMPUTE_CL To cross compile the examples with the Graph API, such as graph_lenet.cpp, you need to link the library arm_compute_graph also. (notice the compute library has to be built with both neon and opencl enabled - neon=1 and opencl=1) #32 bit: - arm-linux-androideabi-clang++ examples/graph_lenet.cpp utils/Utils.cpp utils/GraphUtils.cpp -I. -Iinclude -std=c++11 -larm_compute_graph -larm_compute -larm_compute_core -L. -o graph_lenet_arm -pie -Wl,--allow-shlib-undefined + arm-linux-androideabi-clang++ examples/graph_lenet.cpp utils/Utils.cpp utils/GraphUtils.cpp -I. -Iinclude -std=c++11 -larm_compute_graph-static -larm_compute-static -larm_compute_core -static-L. -o graph_lenet_arm -static-libstdc++ -pie -lOpenCL -DARM_COMPUTE_CL #64 bit: - aarch64-linux-android-g++ examples/graph_lenet.cpp utils/Utils.cpp utils/GraphUtils.cpp -I. -Iinclude -std=c++11 -larm_compute_graph -larm_compute -larm_compute_core -L. -o graph_lenet_aarch64 -pie -Wl,--allow-shlib-undefined + aarch64-linux-android-g++ examples/graph_lenet.cpp utils/Utils.cpp utils/GraphUtils.cpp -I. -Iinclude -std=c++11 -larm_compute_graph-static -larm_compute-static -larm_compute_core-static -L. -o graph_lenet_aarch64 -static-libstdc++ -pie -lOpenCL -DARM_COMPUTE_CL @note Due to some issues in older versions of the Mali OpenCL DDK (<= r13p0), we recommend to link arm_compute statically on Android. diff --git a/examples/SConscript b/examples/SConscript index e002d11edd..3357ccaf33 100644 --- a/examples/SConscript +++ b/examples/SConscript @@ -42,7 +42,7 @@ if env['gles_compute'] and env['os'] != 'android': # Build examples utils = examples_env.Object("../utils/Utils.cpp") -if env['os'] in ['bare_metal'] or env['standalone']: +if env['os'] in ['android', '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,16 +59,28 @@ if env['opencl'] and env['neon']: Depends(prog, [arm_compute_dependency, opencl]) alias = examples_env.Alias(example, prog) Default(alias) - Import('arm_compute_graph_so') - arm_compute_graph_libs = ["arm_compute_graph", "arm_compute", "arm_compute_core"] - graph_dependency = arm_compute_graph_so + 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, "OpenCL"] + 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 graph_utils = examples_env.Object("../utils/GraphUtils.cpp") for file in Glob("./graph_*.cpp"): example = os.path.basename(os.path.splitext(str(file))[0]) - #-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) + prog = None + if env['os'] == 'android': + prog = examples_env.Program(example, ["{}.cpp".format(example), utils, graph_utils], LIBS = arm_compute_graph_libs + ["OpenCL"]) + Depends(prog, [graph_dependency, opencl]) + else: + #-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 2d2ba6bb11..534ee45bcd 100644 --- a/examples/graph_alexnet.cpp +++ b/examples/graph_alexnet.cpp @@ -21,7 +21,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ - #include "arm_compute/graph/Graph.h" #include "arm_compute/graph/Nodes.h" #include "support/ToolchainSupport.h" diff --git a/examples/graph_googlenet.cpp b/examples/graph_googlenet.cpp index e116633a02..b7ff4e4bf0 100644 --- a/examples/graph_googlenet.cpp +++ b/examples/graph_googlenet.cpp @@ -21,7 +21,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ - #include "arm_compute/graph/Graph.h" #include "arm_compute/graph/Nodes.h" #include "arm_compute/graph/SubGraph.h" diff --git a/examples/graph_lenet.cpp b/examples/graph_lenet.cpp index f6af14c4cf..ad4a4e02c7 100644 --- a/examples/graph_lenet.cpp +++ b/examples/graph_lenet.cpp @@ -21,7 +21,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ - #include "arm_compute/graph/Graph.h" #include "arm_compute/graph/Nodes.h" #include "support/ToolchainSupport.h" diff --git a/examples/graph_mobilenet.cpp b/examples/graph_mobilenet.cpp index 2b2da9e517..081fae67e2 100644 --- a/examples/graph_mobilenet.cpp +++ b/examples/graph_mobilenet.cpp @@ -21,7 +21,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ - #include "arm_compute/graph/Graph.h" #include "arm_compute/graph/Nodes.h" #include "support/ToolchainSupport.h" diff --git a/examples/graph_squeezenet.cpp b/examples/graph_squeezenet.cpp index 51c4de0ec1..1743509256 100644 --- a/examples/graph_squeezenet.cpp +++ b/examples/graph_squeezenet.cpp @@ -21,7 +21,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ - #include "arm_compute/graph/Graph.h" #include "arm_compute/graph/Nodes.h" #include "arm_compute/graph/SubGraph.h" diff --git a/examples/graph_vgg19.cpp b/examples/graph_vgg19.cpp index 61bb9a5190..a39e255ad0 100644 --- a/examples/graph_vgg19.cpp +++ b/examples/graph_vgg19.cpp @@ -21,7 +21,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ - #include "arm_compute/graph/Graph.h" #include "arm_compute/graph/Nodes.h" #include "support/ToolchainSupport.h" diff --git a/tests/SConscript b/tests/SConscript index 240a8fba45..336ec5eb7f 100644 --- a/tests/SConscript +++ b/tests/SConscript @@ -50,7 +50,7 @@ vars.Update(test_env) Help(new_options.GenerateHelpText(test_env)) -if env['os'] in ['bare_metal'] or env['standalone']: +if env['os'] in ['android', 'bare_metal'] or env['standalone']: Import("arm_compute_a") Import("arm_compute_core_a") test_env.Append(LIBS = [arm_compute_a, arm_compute_core_a]) |