diff options
author | Michele Calgaro <[email protected]> | 2025-03-12 10:37:10 +0900 |
---|---|---|
committer | Michele Calgaro <[email protected]> | 2025-03-12 19:16:35 +0900 |
commit | 40cd903083b1bd7fe1e9cd3ae38c5b1ae0aeb3c0 (patch) | |
tree | e6158a972e13c6b7f053c89cc3fc4d62b5ced712 | |
parent | 4e458352db936ae1adc273089ce581f380886129 (diff) | |
download | tdemultimedia-40cd903083b1bd7fe1e9cd3ae38c5b1ae0aeb3c0.tar.gz tdemultimedia-40cd903083b1bd7fe1e9cd3ae38c5b1ae0aeb3c0.zip |
Improve code for detection of architecture and MMX support
Signed-off-by: Michele Calgaro <[email protected]>
-rw-r--r-- | CMakeLists.txt | 5 | ||||
-rw-r--r-- | ConfigureChecks.cmake | 68 |
2 files changed, 24 insertions, 49 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index d5054b54..6e27d43a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,11 +20,8 @@ tde_set_project_version( ) ##### general package setup ##################### project( tdemultimedia ) - set( PACKAGE tdemultimedia ) -enable_testing( ) - ##### include essential cmake modules ########### @@ -38,6 +35,8 @@ include( CheckCXXSourceCompiles ) include( CheckFunctionExists ) include( CheckLibraryExists ) include( CheckSymbolExists ) +enable_language( ASM ) +enable_testing( ) ##### include our cmake modules ################# diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index 5ffb8e27..76156fec 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -15,52 +15,28 @@ test_big_endian(WORDS_BIGENDIAN) tde_setup_largefiles( ) -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( NOT CMAKE_ARCHITECTURE ) - -if( ${CMAKE_ARCHITECTURE} MATCHES "i.86" ) - if( NOT ASM_COMPILER_VERSION ) - message( STATUS "Checking binutils version" ) - execute_process( - COMMAND echo - COMMAND as -v - OUTPUT_VARIABLE ASM_VERSION - ERROR_VARIABLE ASM_VERSION - ) - string(REGEX REPLACE ".*version ([0-9][^ \n]*).*" "\\1" ASM_COMPILER_VERSION ${ASM_VERSION} ) - set( ASM_COMPILER_VERSION "${ASM_COMPILER_VERSION}" CACHE INTERNAL "" FORCE ) - message( STATUS "Checking binutils version - ${ASM_COMPILER_VERSION}" ) - endif( NOT ASM_COMPILER_VERSION ) - - if( NOT MMX_SUPPORT ) - message( STATUS "Performing test MMX_SUPPORT" ) - if( ${ASM_COMPILER_VERSION} VERSION_LESS "2.10" ) - message( STATUS "Performing test MMX_SUPPORT - Failed" ) - else( ) - message( STATUS "Performing test MMX_SUPPORT - Success" ) - set( MMX_SUPPORT 1 CACHE INTERNAL "" FORCE ) - endif( ) - endif( NOT MMX_SUPPORT ) - - check_c_source_compiles( " - int main() { - #if defined(__GNUC__) && defined(__i386__) - __asm__(\"movups %xmm0, (%esp)\"); - #else - #error Not gcc on x86 - #endif - return 0; }" - HAVE_X86_SSE - ) -endif( ${CMAKE_ARCHITECTURE} MATCHES "i.86" ) + +##### check specific architecture dependant support + +if( CMAKE_SYSTEM_PROCESSOR MATCHES "i.86" ) + + # MMX support + message( STATUS "Performing MMX support test" ) + 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( ) + + # SSE support + message( STATUS "Performing SSE support test" ) + cmake_host_system_information( RESULT HAVE_X86_SSE QUERY HAS_SSE ) + if( HAVE_X86_SSE ) + message( STATUS "Performing SSE support test - Success" ) + set( CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -DHAVE_X86_SSE" ) + endif( ) + +endif( ) message( STATUS "Cheking system type - ${CMAKE_SYSTEM_NAME}" ) if( ${CMAKE_SYSTEM_NAME} MATCHES "AIX" ) |