diff options
-rw-r--r-- | SConscript | 7 | ||||
-rw-r--r-- | src/cpu/CpuContext.cpp | 9 |
2 files changed, 12 insertions, 4 deletions
diff --git a/SConscript b/SConscript index 6198445b08..a8995aca92 100644 --- a/SConscript +++ b/SConscript @@ -540,7 +540,12 @@ if env['os'] != 'bare_metal' and not env['standalone']: Export('arm_compute_so') # Generate dummy core lib for backwards compatibility -arm_compute_core_a = build_library('arm_compute_core-static', arm_compute_env, [], static=True) +if env['os'] == 'macos': + # macos static library archiver fails if given an empty list of files + arm_compute_core_a = build_library('arm_compute_core-static', arm_compute_env, [lib_files], static=True) +else: + arm_compute_core_a = build_library('arm_compute_core-static', arm_compute_env, [], static=True) + Export('arm_compute_core_a') if env['os'] != 'bare_metal' and not env['standalone']: diff --git a/src/cpu/CpuContext.cpp b/src/cpu/CpuContext.cpp index 1a971a6a16..917bf68a0c 100644 --- a/src/cpu/CpuContext.cpp +++ b/src/cpu/CpuContext.cpp @@ -28,7 +28,10 @@ #include "src/cpu/CpuTensor.h" #include <cstdlib> +#if !defined(__APPLE__) #include <malloc.h> +#endif // !defined(__APPLE__) + namespace arm_compute { @@ -50,11 +53,11 @@ void *default_aligned_allocate(void *user_data, size_t size, size_t alignment) { ARM_COMPUTE_UNUSED(user_data); void *ptr = nullptr; -#if defined(BARE_METAL) || defined(__APPLE__) +#if defined(BARE_METAL) size_t rem = size % alignment; size_t real_size = (rem) ? (size + alignment - rem) : size; ptr = memalign(alignment, real_size); -#else /* defined(BARE_METAL) || defined(__APPLE__) */ +#else /* defined(BARE_METAL) */ if(posix_memalign(&ptr, alignment, size) != 0) { // posix_memalign returns non-zero on failures, the return values will be @@ -62,7 +65,7 @@ void *default_aligned_allocate(void *user_data, size_t size, size_t alignment) // - ENOMEM: insufficient memory ARM_COMPUTE_LOG_ERROR_ACL("posix_memalign failed, the returned pointer will be invalid"); } -#endif /* defined(BARE_METAL) || defined(__APPLE__) */ +#endif /* defined(BARE_METAL) */ return ptr; } void default_aligned_free(void *user_data, void *ptr) |