From 45514031440880a9eecd2a8461e6741569d8119a Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Wed, 30 Dec 2020 00:03:09 +0000 Subject: Add support for macOS * Add 'macos' as an additional OS build option * Guard unsupported paths like thread scheduling control and hwcaps checking with the __APPLE__ macro * Map linker options to respective Mach-O linker options Change-Id: I67bd9fa3c20831427b218ca7d3b4b9d454ab4fec Signed-off-by: Georgios Pinitas Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4788 Reviewed-by: Sang-Hoon Park Reviewed-by: Giorgio Arena Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins --- tests/SConscript | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'tests/SConscript') diff --git a/tests/SConscript b/tests/SConscript index 565aeac4a1..92cf47b5c6 100644 --- a/tests/SConscript +++ b/tests/SConscript @@ -73,7 +73,13 @@ test_env.Append(CXXFLAGS = ['-ffp-contract=off']) if 'g++' in test_env['CXX'] and '-Wnoexcept' in test_env['CXXFLAGS']: test_env['CXXFLAGS'].remove("-Wnoexcept") -if env['os'] in ['android', 'bare_metal'] or env['standalone']: +load_whole_archive = '-Wl,--whole-archive' +noload_whole_archive = '-Wl,--no-whole-archive' +if 'macos' in test_env['os']: + load_whole_archive = '-Wl,-force_load' + noload_whole_archive = '-Wl,-noall_load' + +if env['os'] in ['android', 'macos', 'bare_metal'] or env['standalone']: Import("arm_compute_a") Import("arm_compute_core_a") Import("arm_compute_graph_a") @@ -152,7 +158,7 @@ if env['gles_compute']: extra_link_flags = [] if env['os'] == 'android': test_env.Append(LIBS = ["log"]) -elif env['os'] != 'bare_metal': +elif env['os'] not in ['bare_metal', 'macos']: test_env.Append(LIBS = ["rt"]) extra_link_flags += ['-fstack-protector-strong'] @@ -168,7 +174,7 @@ bm_link_flags = [] if test_env['linker_script']: bm_link_flags += ['-Wl,--build-id=none', '-T', env['linker_script']] -if test_env['reference_openmp'] and env['os'] != 'bare_metal': +if test_env['reference_openmp'] and env['os'] not in ['bare_metal', 'macos']: test_env['CXXFLAGS'].append('-fopenmp') test_env['LINKFLAGS'].append('-fopenmp') @@ -215,8 +221,8 @@ if test_env['validation_tests']: graph_utils = test_env.Object(source="../utils/GraphUtils.cpp", target="GraphUtils") for file in Glob("validate_examples/graph_*.cpp"): example = "validate_" + os.path.basename(os.path.splitext(str(file))[0]) - if env['os'] in ['android', 'bare_metal'] or env['standalone']: - prog = test_env.Program(example, [ test_env.Object(source=file, target=example), graph_utils]+ files_validate_examples, LIBS = test_env["LIBS"] + [ arm_compute_validation_framework ], LINKFLAGS=test_env["LINKFLAGS"]+['-Wl,--whole-archive',arm_compute_lib,'-Wl,--no-whole-archive'] + bm_link_flags + extra_link_flags) + if env['os'] in ['android', 'macos', 'bare_metal'] or env['standalone']: + prog = test_env.Program(example, [ test_env.Object(source=file, target=example), graph_utils]+ files_validate_examples, LIBS = test_env["LIBS"] + [ arm_compute_validation_framework ], LINKFLAGS=test_env["LINKFLAGS"]+[load_whole_archive, arm_compute_lib, noload_whole_archive] + bm_link_flags + extra_link_flags) arm_compute_validate_examples += [ prog ] else: #-Wl,--allow-shlib-undefined: Ignore dependencies of dependencies @@ -267,8 +273,8 @@ if test_env['benchmark_examples']: # Graph examples for file in Glob("%s/graph_*.cpp" % examples_folder ): example = "benchmark_" + os.path.basename(os.path.splitext(str(file))[0]) - if env['os'] in ['android', 'bare_metal'] or env['standalone']: - prog = test_env.Program(example, [ test_env.Object(source=file, target=example), graph_utils, graph_params]+ files_benchmark_examples, LIBS = test_env["LIBS"], LINKFLAGS=test_env["LINKFLAGS"]+['-Wl,--whole-archive',arm_compute_lib,'-Wl,--no-whole-archive'] + bm_link_flags + extra_link_flags) + if env['os'] in ['android', 'macos', 'bare_metal'] or env['standalone']: + prog = test_env.Program(example, [ test_env.Object(source=file, target=example), graph_utils, graph_params]+ files_benchmark_examples, LIBS = test_env["LIBS"], LINKFLAGS=test_env["LINKFLAGS"]+[load_whole_archive, arm_compute_lib, noload_whole_archive] + bm_link_flags + extra_link_flags) arm_compute_benchmark_examples += [ prog ] else: #-Wl,--allow-shlib-undefined: Ignore dependencies of dependencies -- cgit v1.2.1