Skip to content

Commit

Permalink
move X86 detection to library and simplify logic (#430)
Browse files Browse the repository at this point in the history
  • Loading branch information
farindk committed Nov 21, 2023
1 parent 9393983 commit c140f01
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
12 changes: 0 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,6 @@ if(CMAKE_COMPILER_IS_GNUCXX OR ${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
add_definitions(-Wall)
endif()

set(DISABLE_SSE ON)
check_c_source_compiles(
"#if !defined(__x86_64) && !defined(__i386__) \
&& !defined(_M_IX86) && !defined(_M_AMD64)
#error not x86
#endif
int main(){return 0;}"
HAVE_X86)
if (HAVE_X86)
set(DISABLE_SSE OFF)
endif()

option(BUILD_SHARED_LIBS "Build shared library" ON)
if(NOT BUILD_SHARED_LIBS)
add_definitions(-DLIBDE265_STATIC_BUILD)
Expand Down
10 changes: 9 additions & 1 deletion libde265/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,15 @@ add_definitions(-DLIBDE265_EXPORTS)

add_subdirectory (encoder)

if(NOT DISABLE_SSE)
check_c_source_compiles(
"#if !defined(__x86_64) && !defined(__i386__) \
&& !defined(_M_IX86) && !defined(_M_AMD64)
#error not x86
#endif
int main(){return 0;}"
HAVE_X86)

if(HAVE_X86)
if (MSVC)
set(SUPPORTS_SSE2 1)
set(SUPPORTS_SSSE3 1)
Expand Down

0 comments on commit c140f01

Please sign in to comment.