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 <georgios.pinitas@arm.com>
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4788
Reviewed-by: Sang-Hoon Park <sang-hoon.park@arm.com>
Reviewed-by: Giorgio Arena <giorgio.arena@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
diff --git a/tests/SConscript b/tests/SConscript
index 565aeac..92cf47b 100644
--- a/tests/SConscript
+++ b/tests/SConscript
@@ -73,7 +73,13 @@
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 @@
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 @@
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 @@
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 @@
# 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