Skip to content

Commit

Permalink
Another attempt on fixing MacOS issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
aous72 committed May 1, 2024
1 parent 7915b53 commit 44f225a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
9 changes: 8 additions & 1 deletion src/core/common/ojph_arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
///////////////////////////////////////////////////////////////////////////////
// preprocessor directives for architecture
///////////////////////////////////////////////////////////////////////////////
#if defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(__arm64e__)
#if defined(__arm__) || defined(__TARGET_ARCH_ARM) \
|| defined(__aarch64__) || defined(_M_ARM64)
#define OJPH_ARCH_ARM
#elif defined(__i386) || defined(__i386__) || defined(_M_IX86)
#define OJPH_ARCH_I386
Expand All @@ -88,6 +89,12 @@
#endif

namespace ojph {
////////////////////////////////////////////////////////////////////////////
// disable SIMD for unknown architecture
////////////////////////////////////////////////////////////////////////////
#if !defined(OJPH_ARCH_X86_64) && !defined(OJPH_ARCH_I386)
#define OJPH_DISABLE_SIMD
#endif // !OJPH_ARCH_UNKNOWN

////////////////////////////////////////////////////////////////////////////
// OS detection definitions
Expand Down
13 changes: 1 addition & 12 deletions src/core/others/ojph_arch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@

namespace ojph {

#ifndef OJPH_DISABLE_SIMD

#if (defined(OJPH_ARCH_X86_64) || defined(OJPH_ARCH_I386))
#if (defined(OJPH_ARCH_X86_64) || defined(OJPH_ARCH_I386))

////////////////////////////////////////////////////////////////////////////
// This snippet is borrowed from Intel; see for example
Expand Down Expand Up @@ -160,15 +158,6 @@ namespace ojph {
return true;
}

#elif defined(OJPH_ARCH_ARM) || defined(OJPH_ARCH_UNKNOWN)

bool init_cpu_ext_level(int& level) {
level = 0;
return true;
}

#endif // !(defined(OJPH_ARCH_X86_64) || defined(OJPH_ARCH_I386))

#elif defined(OJPH_ENABLE_WASM_SIMD) && defined(OJPH_EMSCRIPTEN)

////////////////////////////////////////////////////////////////////////////
Expand Down
3 changes: 2 additions & 1 deletion target_arch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
# https://qt.gitorious.org/qt/qtbase/blobs/master/src/corelib/global/qprocessordetection.h

set(archdetect_c_code "
#if defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(__arm64e__)
#if defined(__arm__) || defined(__TARGET_ARCH_ARM) \
|| defined(__aarch64__) || defined(_M_ARM64)
#error cmake_ARCH OJPH_ARCH_ARM
#elif defined(__i386) || defined(__i386__) || defined(_M_IX86)
#error cmake_ARCH OJPH_ARCH_I386
Expand Down

0 comments on commit 44f225a

Please sign in to comment.