Advertisement
doomgod

Zandronum V2 PPC patch

Apr 16th, 2014
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 3.30 KB | None | 0 0
  1. --- src/CMakeLists.txt
  2. +++ src/CMakeLists.txt
  3. @@ -279,13 +279,6 @@ endif( FMOD_LIBRARY )
  4.  
  5.  # Search for NASM
  6.  
  7. -if( CMAKE_SYSTEM_PROCESSOR MATCHES powerpc )
  8. -   if( NOT NO_ASM )
  9. -       message( STATUS "Disabling assembly code for PowerPC." )
  10. -       set( NO_ASM ON )
  11. -   endif( NOT NO_ASM )
  12. -endif( CMAKE_SYSTEM_PROCESSOR MATCHES powerpc )
  13. -
  14.  if( NOT NO_ASM )
  15.     if( UNIX AND X64 )
  16.         find_program( GAS_PATH as )
  17. @@ -388,6 +381,41 @@ if( APPLE )
  18.     endif( GLEW_INCLUDE_DIR )
  19.  endif( APPLE )
  20.  
  21. +# Decide on SSE setup
  22. +
  23. +set( SSE_MATTERS NO )
  24. +
  25. +# SSE only matters on 32-bit targets. We check compiler flags to know if we can do it.
  26. +if( CMAKE_SIZEOF_VOID_P MATCHES "4" AND NOT CMAKE_OSX_ARCHITECTURES MATCHES ppc )
  27. +   CHECK_CXX_COMPILER_FLAG( "-msse2 -mfpmath=sse" CAN_DO_MFPMATH )
  28. +   CHECK_CXX_COMPILER_FLAG( -arch:SSE2 CAN_DO_ARCHSSE2 )
  29. +   if( CAN_DO_MFPMATH )
  30. +       set( SSE1_ENABLE "-msse -mfpmath=sse" )
  31. +       set( SSE2_ENABLE "-msse2 -mfpmath=sse" )
  32. +       set( SSE_MATTERS YES )
  33. +   elseif( CAN_DO_ARCHSSE2 )
  34. +       set( SSE1_ENABLE -arch:SSE )
  35. +       set( SSE2_ENABLE -arch:SSE2 )
  36. +       set( SSE_MATTERS YES )
  37. +   endif( CAN_DO_MFPMATH )
  38. +endif( CMAKE_SIZEOF_VOID_P MATCHES "4" AND NOT CMAKE_OSX_ARCHITECTURES MATCHES ppc )
  39. +
  40. +if( SSE_MATTERS )
  41. +   if( WIN32 )
  42. +       set( BACKPATCH 1 CACHE BOOL "Enable backpatching." )
  43. +   else( WIN32 )
  44. +       CHECK_FUNCTION_EXISTS(mprotect HAVE_MPROTECT)
  45. +       if( HAVE_MPROTECT )
  46. +           set( BACKPATCH 1 CACHE BOOL "Enable backpatching." )
  47. +       else( HAVE_MPROTECT )
  48. +           set( BACKPATCH 0 )
  49. +       endif( HAVE_MPROTECT )
  50. +   endif( WIN32 )
  51. +   set( SSE 1 CACHE BOOL "Build SSE and SSE2 versions of key code." )
  52. +else( SSE_MATTERS )
  53. +   set( BACKPATCH 0 )
  54. +endif( SSE_MATTERS )
  55. +
  56.  # Set up flags for GCC
  57.  
  58.  if( CMAKE_COMPILER_IS_GNUCXX )
  59. @@ -583,13 +611,6 @@ add_custom_command( OUTPUT ${CMAKE_CURRE
  60.  
  61.  include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
  62.  
  63. -if( CMAKE_SYSTEM_PROCESSOR MATCHES powerpc )
  64. -   set( X86_SOURCES )
  65. -   set( NOT_X86 ON )
  66. -else( CMAKE_SYSTEM_PROCESSOR MATCHES powerpc )
  67. -   set( X86_SOURCES nodebuild_classify_sse2.cpp )
  68. -endif( CMAKE_SYSTEM_PROCESSOR MATCHES powerpc )
  69. -
  70.  # [BB] Only complile the gl sources, if we want GL support.
  71.  if( NOT NO_GL )
  72.     set( GL_SOURCES
  73. @@ -638,6 +659,17 @@ else( NOT NO_GL )
  74.     set( GL_SOURCES sdl/glstubs.cpp )
  75.  endif( NOT NO_GL )
  76.  
  77. +if( SSE_MATTERS )
  78. +   if( SSE )
  79. +       set( X86_SOURCES nodebuild_classify_sse2.cpp )
  80. +       set_source_files_properties( nodebuild_classify_sse2.cpp PROPERTIES COMPILE_FLAGS "${SSE2_ENABLE}" )
  81. +   else( SSE )
  82. +       add_definitions( -DDISABLE_SSE )
  83. +   endif( SSE )
  84. +else( SSE_MATTERS )
  85. +   add_definitions( -DDISABLE_SSE )
  86. +   set( X86_SOURCES )
  87. +endif( SSE_MATTERS )
  88.  
  89.  add_executable( zdoom WIN32
  90.     autostart.cpp
  91. @@ -1013,13 +1045,10 @@ if( CMAKE_COMPILER_IS_GNUCXX )
  92.     # GCC misoptimizes this file
  93.     set_source_files_properties( oplsynth/fmopl.cpp PROPERTIES COMPILE_FLAGS "-fno-tree-dominator-opts -fno-tree-fre" )
  94.    
  95. -   # Compile this one file with SSE2 support.
  96. -   set_source_files_properties( nodebuild_classify_sse2.cpp PROPERTIES COMPILE_FLAGS "-msse2 -mfpmath=sse" )
  97. -
  98.     # Need to enable intrinsics for this file.
  99. -   if( NOT NOT_X86 )
  100. +   if( SSE_MATTERS )
  101.         set_source_files_properties( x86.cpp PROPERTIES COMPILE_FLAGS "-msse2 -mmmx" )
  102. -   endif( NOT NOT_X86 )
  103. +   endif( SSE_MATTERS )
  104.  endif( CMAKE_COMPILER_IS_GNUCXX )
  105.  
  106.  if( MSVC )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement