[cmake] Allow disabling AVX2 extensions

This commit is contained in:
Armin Novak 2024-10-02 15:13:06 +02:00
parent 3fe99c87a1
commit 0df01bcf8d
No known key found for this signature in database
GPG Key ID: 2CF4A2D2D3D72105
5 changed files with 15 additions and 2 deletions

View File

@ -23,6 +23,8 @@ option(WITH_PROFILER "Compile profiler." OFF)
option(WITH_GPROF "Compile with GProf profiler." OFF)
option(WITH_SSE2 "Enable SSE2 optimization." OFF)
cmake_dependent_option(WITH_AVX2 "Compile AVX2 optimizations" ON "WITH_SSE2" OFF)
option(WITH_NEON "Enable NEON optimization." OFF)
option(WITH_JPEG "Use JPEG decoding." OFF)

View File

@ -22,6 +22,7 @@
#cmakedefine WITH_PROFILER
#cmakedefine WITH_GPROF
#cmakedefine WITH_SSE2
#cmakedefine WITH_AVX2
#cmakedefine WITH_NEON
#cmakedefine WITH_CUPS
#cmakedefine WITH_JPEG

View File

@ -87,9 +87,14 @@ set(PRIMITIVES_OPT_SRCS
${PRIMITIVES_SSSE3_SRCS}
${PRIMITIVES_SSE4_1_SRCS}
${PRIMITIVES_SSE4_2_SRCS}
${PRIMITIVES_AVX2_SRCS}
${PRIMITIVES_OPENCL_SRCS})
if (WITH_AVX2)
list(APPEND PRIMITIVES_OPT_SRCS
${PRIMITIVES_AVX2_SRCS}
)
endif()
set(PRIMITIVES_SRCS ${PRIMITIVES_SRCS} ${PRIMITIVES_OPT_SRCS})
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
@ -117,7 +122,7 @@ if(WITH_SSE2)
if (PRIMITIVES_SSE4_2_SRCS)
set_source_files_properties(${PRIMITIVES_SSE4_2_SRCS} PROPERTIES COMPILE_FLAGS "-msse4.2" )
endif()
if (PRIMITIVES_AVX2_SRCS)
if (PRIMITIVES_AVX2_SRCS AND WITH_AVX2)
set_source_files_properties(${PRIMITIVES_AVX2_SRCS} PROPERTIES COMPILE_FLAGS "-mavx2" )
endif()
endif()

View File

@ -382,5 +382,7 @@ void primitives_init_copy(primitives_t* WINPR_RESTRICT prims)
void primitives_init_copy_opt(primitives_t* prims)
{
primitives_init_copy_sse41(prims);
#if defined(WITH_AVX2)
primitives_init_copy_avx2(prims);
#endif
}

View File

@ -39,6 +39,9 @@ pstatus_t generic_image_copy_no_overlap_memcpy(
UINT32 flags);
void primitives_init_copy_sse41(primitives_t* prims);
#if defined(WITH_AVX2)
void primitives_init_copy_avx2(primitives_t* prims);
#endif
#endif