diff options
| author | Michele Calgaro <michele.calgaro@yahoo.it> | 2025-03-12 10:22:28 +0900 |
|---|---|---|
| committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2025-03-12 20:25:48 +0900 |
| commit | f7d83fbf8c722615d0e791a692ee20126a7bacf1 (patch) | |
| tree | 8e77c9dd2d1eeb05686adbcee982a0b330bceec1 | |
| parent | d9988d6314d4901ce9dc807be5f48ca61554691c (diff) | |
| download | gwenview-f7d83fbf.tar.gz gwenview-f7d83fbf.zip | |
Improve code for detection of architecture and MMX support
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
(cherry picked from commit a453c2f10b555d82aaafacc8815071835c13e719)
| -rw-r--r-- | CMakeLists.txt | 1 | ||||
| -rw-r--r-- | ConfigureChecks.cmake | 33 | ||||
| -rw-r--r-- | src/imageutils/CMakeLists.txt | 18 |
3 files changed, 11 insertions, 41 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 2f09482..50545c3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,7 @@ include( CheckIncludeFile ) include( CheckLibraryExists ) include( CheckCSourceCompiles ) include( CheckCXXSourceCompiles ) +enable_language( ASM ) enable_testing() diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index 205f5f5..c22eb0b 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -103,37 +103,16 @@ endif( NOT HAVE_LROUND ) find_package( Threads ) -##### 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( ) - diff --git a/src/imageutils/CMakeLists.txt b/src/imageutils/CMakeLists.txt index 88257bd..4cfcc9a 100644 --- a/src/imageutils/CMakeLists.txt +++ b/src/imageutils/CMakeLists.txt @@ -8,21 +8,11 @@ include_directories( ##### gvimageutils (static) -set( gvimageutils_SRCS imageutils.cpp jpegcontent.cpp scale.cpp transupp.c croppedqimage.cpp ) - -if( HAVE_X86_MMX ) - list( APPEND gvimageutils_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( gvimageutils STATIC_PIC AUTOMOC - SOURCES ${gvimageutils_SRCS} - LINK tdecore-shared tdeio-shared ${EXIV2_LIBRARIES} ${JPEG_LIBRARIES} + SOURCES + imageutils.cpp jpegcontent.cpp scale.cpp transupp.c croppedqimage.cpp asm_scale.S + LINK + tdecore-shared tdeio-shared ${EXIV2_LIBRARIES} ${JPEG_LIBRARIES} ) |
