Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix building on x86 32-bit Linux #1842

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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