- Fix printf warnings in p_setup.cpp.

- Fix buiding on PowerPC.



SVN r2522 (trunk)
This commit is contained in:
Randy Heit 2010-08-12 21:28:16 +00:00
parent 185bd2f15d
commit c3fa9a54a0
2 changed files with 57 additions and 19 deletions

View file

@ -327,6 +327,41 @@ if( NOT NO_ASM )
ENDMACRO( ADD_ASM_FILE ) ENDMACRO( ADD_ASM_FILE )
endif( NOT NO_ASM ) endif( NOT NO_ASM )
# Decide on SSE setup
set( SSE_MATTERS NO )
# SSE only matters on 32-bit targets. We check compiler flags to know if we can do it.
if( CMAKE_SIZEOF_VOID_P MATCHES "4" )
CHECK_CXX_COMPILER_FLAG( "-msse2 -mfpmath=sse" CAN_DO_MFPMATH )
CHECK_CXX_COMPILER_FLAG( -arch:SSE2 CAN_DO_ARCHSSE2 )
if( CAN_DO_MFPMATH )
set( SSE1_ENABLE "-msse -mfpmath=sse" )
set( SSE2_ENABLE "-msse2 -mfpmath=sse" )
set( SSE_MATTERS YES )
elseif( CAN_DO_ARCHSSE2 )
set( SSE1_ENABLE -arch:SSE )
set( SSE2_ENABLE -arch:SSE2 )
set( SSE_MATTERS YES )
endif( CAN_DO_MFPMATH )
endif( CMAKE_SIZEOF_VOID_P MATCHES "4" )
if( SSE_MATTERS )
if( WIN32 )
set( BACKPATCH 1 CACHE BOOL "Enable backpatching." )
else( WIN32 )
CHECK_FUNCTION_EXISTS(mprotect HAVE_MPROTECT)
if( HAVE_MPROTECT )
set( BACKPATCH 1 CACHE BOOL "Enable backpatching." )
else( HAVE_MPROTECT )
set( BACKPATCH 0 )
endif( HAVE_MPROTECT )
endif( WIN32 )
set( SSE 1 CACHE BOOL "Build SSE and SSE2 versions of key code." )
else( SSE_MATTERS )
set( BACKPATCH 0 )
endif( SSE_MATTERS )
# Set up flags for GCC # Set up flags for GCC
if( CMAKE_COMPILER_IS_GNUCXX ) if( CMAKE_COMPILER_IS_GNUCXX )
@ -422,6 +457,12 @@ if( NOT HAS_VA_COPY )
endif( HAS___VA_COPY ) endif( HAS___VA_COPY )
endif( NOT HAS_VA_COPY ) endif( NOT HAS_VA_COPY )
# Flags
if( BACKPATCH )
add_definitions( -DBACKPATCH )
endif( BACKPATCH )
# Update svnrevision.h # Update svnrevision.h
add_custom_target( revision_check ALL add_custom_target( revision_check ALL
@ -515,12 +556,18 @@ add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sc_man_scanner.h
include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
if( CMAKE_SYSTEM_PROCESSOR MATCHES powerpc OR CMAKE_OSX_ARCHITECTURES MATCHES ppc ) if( SSE_MATTERS )
set( X86_SOURCES ) if( SSE )
set( NOT_X86 ON )
else( CMAKE_SYSTEM_PROCESSOR MATCHES powerpc OR CMAKE_OSX_ARCHITECTURES MATCHES ppc )
set( X86_SOURCES nodebuild_classify_sse2.cpp ) set( X86_SOURCES nodebuild_classify_sse2.cpp )
endif( CMAKE_SYSTEM_PROCESSOR MATCHES powerpc OR CMAKE_OSX_ARCHITECTURES MATCHES ppc ) set_source_files_properties( nodebuild_classify_sse2.cpp PROPERTIES COMPILE_FLAGS "${SSE2_ENABLE}" )
else( SSE )
add_definitions( -DDISABLE_SSE )
endif( SSE )
else( SSE_MATTERS )
add_definitions( -DDISABLE_SSE )
set( X86_SOURCES )
endif( SSE_MATTERS )
add_executable( zdoom WIN32 add_executable( zdoom WIN32
autostart.cpp autostart.cpp
@ -824,21 +871,12 @@ if( NOT WIN32 )
COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/link-make COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/link-make
COMMAND /bin/sh -c ${CMAKE_CURRENT_BINARY_DIR}/link-make ) COMMAND /bin/sh -c ${CMAKE_CURRENT_BINARY_DIR}/link-make )
endif( NOT WIN32 ) endif( NOT WIN32 )
if( CMAKE_COMPILER_IS_GNUCXX ) if( CMAKE_COMPILER_IS_GNUCXX )
# GCC misoptimizes this file # GCC misoptimizes this file
set_source_files_properties( oplsynth/fmopl.cpp PROPERTIES COMPILE_FLAGS "-fno-tree-dominator-opts -fno-tree-fre" ) set_source_files_properties( oplsynth/fmopl.cpp PROPERTIES COMPILE_FLAGS "-fno-tree-dominator-opts -fno-tree-fre" )
# Compile this one file with SSE2 support.
set_source_files_properties( nodebuild_classify_sse2.cpp PROPERTIES COMPILE_FLAGS "-msse2 -mfpmath=sse" )
# Need to enable intrinsics for this file. # Need to enable intrinsics for this file.
if( NOT NOT_X86 ) if( SSE_MATTERS )
set_source_files_properties( x86.cpp PROPERTIES COMPILE_FLAGS "-msse2 -mmmx" ) set_source_files_properties( x86.cpp PROPERTIES COMPILE_FLAGS "-msse2 -mmmx" )
endif( NOT NOT_X86 ) endif( SSE_MATTERS )
endif( CMAKE_COMPILER_IS_GNUCXX ) endif( CMAKE_COMPILER_IS_GNUCXX )
if( MSVC )
# Compile this one file with SSE2 support.
set_source_files_properties( nodebuild_classify_sse2.cpp PROPERTIES COMPILE_FLAGS "/arch:SSE2" )
endif( MSVC )

View file

@ -1325,8 +1325,8 @@ void P_LoadSubsectors (MapData * map)
if ((size_t)subsectors[i].firstline >= maxseg) if ((size_t)subsectors[i].firstline >= maxseg)
{ {
Printf ("Subsector %d contains invalid segs %u-%u\n" Printf ("Subsector %d contains invalid segs %u-%u\n"
"The BSP will be rebuilt.\n", i, subsectors[i].firstline, "The BSP will be rebuilt.\n", i, (unsigned)subsectors[i].firstline,
subsectors[i].firstline + subsectors[i].numlines - 1); (unsigned)subsectors[i].firstline + subsectors[i].numlines - 1);
ForceNodeBuild = true; ForceNodeBuild = true;
delete[] nodes; delete[] nodes;
delete[] subsectors; delete[] subsectors;
@ -1336,7 +1336,7 @@ void P_LoadSubsectors (MapData * map)
{ {
Printf ("Subsector %d contains invalid segs %u-%u\n" Printf ("Subsector %d contains invalid segs %u-%u\n"
"The BSP will be rebuilt.\n", i, maxseg, "The BSP will be rebuilt.\n", i, maxseg,
subsectors[i].firstline + subsectors[i].numlines - 1); (unsigned)subsectors[i].firstline + subsectors[i].numlines - 1);
ForceNodeBuild = true; ForceNodeBuild = true;
delete[] nodes; delete[] nodes;
delete[] subsectors; delete[] subsectors;