Improve code for detection of architecture and MMX support

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
(cherry picked from commit 1c5de88934)
remotes/origin/r14.1.x
Michele Calgaro 5 months ago
parent 0a362fbf4f
commit 39f2157d6d
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -29,6 +29,7 @@ include( CheckCSourceCompiles )
include( CheckIncludeFile )
include( CheckLibraryExists )
include( CheckSymbolExists )
enable_language( ASM )
##### include our cmake modules #################

@ -245,36 +245,16 @@ if( WITH_LAME )
endif( )
##### check architecture
if( NOT CMAKE_ARCHITECTURE )
execute_process(
COMMAND ${CMAKE_C_COMPILER} -dumpmachine
OUTPUT_VARIABLE CMAKE_ARCHITECTURE
ERROR_VARIABLE CMAKE_ARCHITECTURE
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE )
set( CMAKE_ARCHITECTURE "${CMAKE_ARCHITECTURE}" CACHE INTERNAL "" FORCE )
message( STATUS "Detected ${CMAKE_ARCHITECTURE} target architecture" )
endif( )
##### check specific architecture dependant support
if( ${CMAKE_ARCHITECTURE} MATCHES "i.86" )
if( CMAKE_SYSTEM_PROCESSOR MATCHES "i.86" )
# MMX support
message( STATUS "Performing MMX support test" )
check_c_source_compiles( "
int main() {
#if defined(__GNUC__)
__asm__(\"pxor %mm0, %mm0\");
#else
#error Not gcc on x86/x86_64
#endif
return 0;
}"
HAVE_X86_MMX
)
cmake_host_system_information( RESULT HAVE_X86_MMX QUERY HAS_MMX )
if( HAVE_X86_MMX )
message( STATUS "Performing MMX support test - Success" )
set( CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -DHAVE_X86_MMX" )
endif( )
endif( )

@ -24,19 +24,7 @@ link_directories(
##### fastscale (static) ########################
set( fastscale_SRCS scale.cpp )
if( HAVE_X86_MMX )
list( APPEND fastscale_SRCS asm_scale.S )
# Force to use C compiler for asm_scale.S instead of ASM
# because it contains mixed code - ASM with C definitions
set_source_files_properties( asm_scale.S PROPERTIES LANGUAGE C )
add_compile_options( -DHAVE_X86_MMX )
endif( )
tde_add_library( fastscale STATIC_PIC AUTOMOC
SOURCES ${fastscale_SRCS}
SOURCES scale.cpp asm_scale.S
LINK tdecore-shared
)

Loading…
Cancel
Save