Skip to content

Commit

Permalink
Fix support for X86 32-bit (#1842)
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Reid <[email protected]>
  • Loading branch information
markreidvfx committed Sep 4, 2023
1 parent caa20dd commit 16b3157
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,11 @@ option(OCIO_USE_OIIO_FOR_APPS "Request OIIO to build apps (ociolutimage, ociocon


if (NOT APPLE)
if ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(AMD64|IA64|EM64T|X86|x86_64|i386|i686)")
if ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(AMD64|IA64|EM64T|x86_64|X86|i386|i686)")
# Intel-based architecture (not APPLE)
if ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(X86|i386|i686)")
set(OCIO_ARCH_X86_32 1)
endif()
set(OCIO_ARCH_X86 1)
set(OCIO_BUILD_ENABLE_OPTIMIZATIONS_SSE ON)
set(OCIO_BUILD_ENABLE_OPTIMIZATIONS_AVX ON)
Expand Down
7 changes: 7 additions & 0 deletions src/OpenColorIO/CPUInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ static inline void cpuid(int index, int *data)
{
#if _MSC_VER
__cpuid(data, index);
#elif OCIO_ARCH_X86_32
__asm__ volatile (
"mov %%ebx, %%esi \n\t"
"cpuid \n\t"
"xchg %%ebx, %%esi"
: "=a" (data[0]), "=S" (data[1]), "=c" (data[2]), "=d" (data[3])
: "0" (index), "2"(0));
#else
__asm__ volatile (
"mov %%rbx, %%rsi \n\t"
Expand Down
1 change: 1 addition & 0 deletions src/OpenColorIO/CPUInfoConfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@


#cmakedefine01 OCIO_ARCH_X86
#cmakedefine01 OCIO_ARCH_X86_32

// Relevant only for arm64 architecture.
#if defined(__aarch64__)
Expand Down

0 comments on commit 16b3157

Please sign in to comment.