2024-06-11 10:30:18 +03:00
|
|
|
# primitives
|
|
|
|
|
|
|
|
set(PRIMITIVES_SRCS
|
|
|
|
prim_add.c
|
2024-06-17 12:51:03 +03:00
|
|
|
prim_add.h
|
2024-06-11 10:30:18 +03:00
|
|
|
prim_andor.c
|
2024-06-17 12:51:03 +03:00
|
|
|
prim_andor.h
|
2024-06-11 10:30:18 +03:00
|
|
|
prim_alphaComp.c
|
2024-06-17 12:51:03 +03:00
|
|
|
prim_alphaComp.h
|
2024-06-11 10:30:18 +03:00
|
|
|
prim_colors.c
|
2024-06-17 12:51:03 +03:00
|
|
|
prim_colors.h
|
2024-06-11 10:30:18 +03:00
|
|
|
prim_copy.c
|
2024-06-11 10:51:29 +03:00
|
|
|
prim_copy.h
|
2024-06-11 10:30:18 +03:00
|
|
|
prim_set.c
|
2024-06-17 12:51:03 +03:00
|
|
|
prim_set.h
|
2024-06-11 10:30:18 +03:00
|
|
|
prim_shift.c
|
2024-06-17 12:51:03 +03:00
|
|
|
prim_shift.h
|
2024-06-11 10:30:18 +03:00
|
|
|
prim_sign.c
|
2024-06-17 12:51:03 +03:00
|
|
|
prim_sign.h
|
2024-06-11 10:30:18 +03:00
|
|
|
prim_YUV.c
|
2024-06-17 12:51:03 +03:00
|
|
|
prim_YUV.h
|
2024-06-11 10:30:18 +03:00
|
|
|
prim_YCoCg.c
|
2024-06-17 12:51:03 +03:00
|
|
|
prim_YCoCg.h
|
2024-06-11 10:30:18 +03:00
|
|
|
primitives.c
|
|
|
|
prim_internal.h)
|
|
|
|
|
2024-06-17 12:51:03 +03:00
|
|
|
set(PRIMITIVES_SSE2_SRCS
|
|
|
|
sse/prim_colors_sse2.c
|
|
|
|
sse/prim_set_sse2.c
|
|
|
|
)
|
|
|
|
|
|
|
|
set(PRIMITIVES_SSE3_SRCS
|
|
|
|
sse/prim_add_sse3.c
|
|
|
|
sse/prim_alphaComp_sse3.c
|
|
|
|
sse/prim_andor_sse3.c
|
|
|
|
sse/prim_shift_sse3.c
|
|
|
|
)
|
|
|
|
|
|
|
|
set(PRIMITIVES_SSSE3_SRCS
|
|
|
|
sse/prim_YUV_ssse3.c
|
|
|
|
sse/prim_sign_ssse3.c
|
|
|
|
sse/prim_YCoCg_ssse3.c
|
|
|
|
)
|
|
|
|
|
|
|
|
set(PRIMITIVES_SSE4_1_SRCS
|
|
|
|
sse/prim_copy_sse4_1.c
|
|
|
|
)
|
|
|
|
|
|
|
|
set(PRIMITIVES_SSE4_2_SRCS
|
|
|
|
)
|
|
|
|
|
|
|
|
set(PRIMITIVES_AVX2_SRCS
|
|
|
|
sse/prim_copy_avx2.c
|
|
|
|
)
|
|
|
|
|
|
|
|
set(PRIMITIVES_NEON_SRCS
|
|
|
|
neon/prim_colors_neon.c
|
|
|
|
neon/prim_YCoCg_neon.c
|
|
|
|
neon/prim_YUV_neon.c
|
|
|
|
)
|
|
|
|
|
|
|
|
set(PRIMITIVES_OPENCL_SRCS
|
|
|
|
opencl/prim_YUV_opencl.c
|
|
|
|
)
|
2024-06-11 10:30:18 +03:00
|
|
|
|
|
|
|
if (WITH_OPENCL)
|
2024-09-25 08:20:10 +03:00
|
|
|
set(FILENAME "opencl/primitives.cl")
|
|
|
|
set_source_files_properties(${FILENAME} PROPERTIES HEADER_FILE_ONLY ON)
|
|
|
|
list(APPEND PRIMITIVES_OPENCL_SRCS ${FILENAME})
|
2024-06-11 10:30:18 +03:00
|
|
|
|
2024-09-25 08:20:10 +03:00
|
|
|
include(ConvertFileToHexArray)
|
|
|
|
file_to_hex_array(${FILENAME} FILEDATA)
|
|
|
|
|
|
|
|
set(HDR_FILE "${CMAKE_CURRENT_BINARY_DIR}/opencl/primitives-opencl-program.h")
|
|
|
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/opencl/primitives.h.in" ${HDR_FILE} @ONLY)
|
|
|
|
list(APPEND PRIMITIVES_OPENCL_SRCS ${HDR_FILE})
|
|
|
|
|
|
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR}/opencl)
|
|
|
|
freerdp_include_directory_add(${OpenCL_INCLUDE_DIRS})
|
|
|
|
freerdp_library_add(OpenCL::OpenCL)
|
2024-06-11 10:30:18 +03:00
|
|
|
endif()
|
|
|
|
|
|
|
|
set(PRIMITIVES_OPT_SRCS
|
2024-06-17 12:51:03 +03:00
|
|
|
${PRIMITIVES_NEON_SRCS}
|
2024-06-11 10:30:18 +03:00
|
|
|
${PRIMITIVES_SSE2_SRCS}
|
|
|
|
${PRIMITIVES_SSE3_SRCS}
|
|
|
|
${PRIMITIVES_SSSE3_SRCS}
|
2024-06-17 12:51:03 +03:00
|
|
|
${PRIMITIVES_SSE4_1_SRCS}
|
|
|
|
${PRIMITIVES_SSE4_2_SRCS}
|
2024-06-11 10:30:18 +03:00
|
|
|
${PRIMITIVES_OPENCL_SRCS})
|
|
|
|
|
2024-10-02 16:13:06 +03:00
|
|
|
if (WITH_AVX2)
|
|
|
|
list(APPEND PRIMITIVES_OPT_SRCS
|
|
|
|
${PRIMITIVES_AVX2_SRCS}
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2024-06-11 10:30:18 +03:00
|
|
|
set(PRIMITIVES_SRCS ${PRIMITIVES_SRCS} ${PRIMITIVES_OPT_SRCS})
|
|
|
|
|
2024-06-17 12:51:03 +03:00
|
|
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
2024-06-11 10:30:18 +03:00
|
|
|
add_library(freerdp-primitives OBJECT
|
|
|
|
${PRIMITIVES_SRCS}
|
|
|
|
)
|
|
|
|
|
2024-06-25 10:08:54 +03:00
|
|
|
include(CompilerDetect)
|
2024-07-04 14:25:40 +03:00
|
|
|
include (DetectIntrinsicSupport)
|
2024-06-11 10:30:18 +03:00
|
|
|
if(WITH_SSE2)
|
2024-07-04 14:25:40 +03:00
|
|
|
if (HAVE_SSE_OR_AVX)
|
2024-06-25 10:08:54 +03:00
|
|
|
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
|
2024-06-11 10:30:18 +03:00
|
|
|
if(PRIMITIVES_SSE2_SRCS)
|
|
|
|
set_source_files_properties(${PRIMITIVES_SSE2_SRCS} PROPERTIES COMPILE_FLAGS "-msse2" )
|
|
|
|
endif()
|
|
|
|
if (PRIMITIVES_SSE3_SRCS)
|
|
|
|
set_source_files_properties(${PRIMITIVES_SSE3_SRCS} PROPERTIES COMPILE_FLAGS "-msse3" )
|
|
|
|
endif()
|
|
|
|
if (PRIMITIVES_SSSE3_SRCS)
|
|
|
|
set_source_files_properties(${PRIMITIVES_SSSE3_SRCS} PROPERTIES COMPILE_FLAGS "-mssse3" )
|
|
|
|
endif()
|
2024-06-17 12:51:03 +03:00
|
|
|
if (PRIMITIVES_SSE4_1_SRCS)
|
|
|
|
set_source_files_properties(${PRIMITIVES_SSE4_1_SRCS} PROPERTIES COMPILE_FLAGS "-msse4.1" )
|
|
|
|
endif()
|
|
|
|
if (PRIMITIVES_SSE4_2_SRCS)
|
|
|
|
set_source_files_properties(${PRIMITIVES_SSE4_2_SRCS} PROPERTIES COMPILE_FLAGS "-msse4.2" )
|
|
|
|
endif()
|
2024-10-02 16:13:06 +03:00
|
|
|
if (PRIMITIVES_AVX2_SRCS AND WITH_AVX2)
|
2024-06-17 12:51:03 +03:00
|
|
|
set_source_files_properties(${PRIMITIVES_AVX2_SRCS} PROPERTIES COMPILE_FLAGS "-mavx2" )
|
|
|
|
endif()
|
2024-06-11 10:30:18 +03:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
set_source_files_properties(${PRIMITIVES_OPT_SRCS} PROPERTIES COMPILE_FLAGS "/arch:SSE2")
|
2024-07-04 14:25:40 +03:00
|
|
|
endif()
|
|
|
|
endif()
|
2024-06-11 10:30:18 +03:00
|
|
|
elseif(WITH_NEON)
|
2024-07-05 10:44:45 +03:00
|
|
|
# aarch64 requires NEON by default, no flag required
|
|
|
|
if (HAVE_NEON AND NOT HAVE_NEON64)
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
|
|
|
|
if (NOT MSVC_ARM64 AND NOT ARCH_ARM64)
|
|
|
|
set_source_files_properties(${PRIMITIVES_OPT_SRCS} PROPERTIES COMPILE_FLAGS "-mfpu=neon")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
# TODO: Add MSVC equivalent
|
2024-07-04 14:25:40 +03:00
|
|
|
endif()
|
2024-06-11 10:30:18 +03:00
|
|
|
endif()
|
|
|
|
|
|
|
|
freerdp_object_library_add(freerdp-primitives)
|
|
|
|
|
|
|
|
if(BUILD_TESTING AND NOT WIN32 AND NOT APPLE)
|
|
|
|
add_subdirectory(test)
|
|
|
|
endif()
|