- Fix ZDBSP compilation on non-Windows system. It tried to use the

viewer regardless of target OS.



SVN r2399 (trunk)
This commit is contained in:
Randy Heit 2010-07-01 00:00:55 +00:00
parent f824fe7a86
commit 983907fd20

View file

@ -1,11 +1,11 @@
cmake_minimum_required( VERSION 2.4 )
if( COMMAND cmake_policy )
cmake_policy( SET CMP0003 NEW )
endif( COMMAND cmake_policy )
if( COMMAND cmake_policy )
cmake_policy( SET CMP0003 NEW )
endif( COMMAND cmake_policy )
include( CheckFunctionExists )
include( CheckCXXCompilerFlag )
include( CheckFunctionExists )
include( CheckCXXCompilerFlag )
IF( NOT CMAKE_BUILD_TYPE )
SET( CMAKE_BUILD_TYPE Debug CACHE STRING
@ -16,21 +16,21 @@ ENDIF( NOT CMAKE_BUILD_TYPE )
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( 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( CMAKE_COMPILER_IS_GNUCXX AND WIN32 )
set( BACKPATCH 1 CACHE BOOL "Enable backpatching." )
endif( CMAKE_COMPILER_IS_GNUCXX AND WIN32 )
@ -74,19 +74,19 @@ endif( MSVC )
if( CMAKE_COMPILER_IS_GNUCXX )
set( ALL_C_FLAGS "${ALL_C_FLAGS} -ffast-math -pipe" )
if( GPROF )
set( ALL_C_FLAGS "${ALL_C_FLAGS} -pg -g" )
else( GPROF )
set( REL_C_FLAGS "${REL_C_FLAGS} -fomit-frame-pointer" )
endif( GPROF )
if( PROFILE EQUAL 1 )
message( STATUS "Generating profile coverage information" )
set( ALL_C_FLAGS "${ALL_C_FLAGS} -fprofile-generate" )
set( PROF_LIB "gcov" )
elseif( PROFILE EQUAL 2 )
message( STATUS "Using profile coverage information" )
set( ALL_C_FLAGS "${ALL_C_FLAGS} -fprofile-use" )
endif( PROFILE EQUAL 1 )
if( GPROF )
set( ALL_C_FLAGS "${ALL_C_FLAGS} -pg -g" )
else( GPROF )
set( REL_C_FLAGS "${REL_C_FLAGS} -fomit-frame-pointer" )
endif( GPROF )
if( PROFILE EQUAL 1 )
message( STATUS "Generating profile coverage information" )
set( ALL_C_FLAGS "${ALL_C_FLAGS} -fprofile-generate" )
set( PROF_LIB "gcov" )
elseif( PROFILE EQUAL 2 )
message( STATUS "Using profile coverage information" )
set( ALL_C_FLAGS "${ALL_C_FLAGS} -fprofile-use" )
endif( PROFILE EQUAL 1 )
endif( CMAKE_COMPILER_IS_GNUCXX )
if( ZLIB_FOUND )
@ -99,71 +99,75 @@ else( ZLIB_FOUND )
set( ZLIB_LIBRARY z )
endif( ZLIB_FOUND )
CHECK_FUNCTION_EXISTS( stricmp STRICMP_EXISTS )
if( NOT STRICMP_EXISTS )
add_definitions( -Dstricmp=strcasecmp )
endif( NOT STRICMP_EXISTS )
CHECK_FUNCTION_EXISTS( strnicmp STRNICMP_EXISTS )
if( NOT STRNICMP_EXISTS )
add_definitions( -Dstrnicmp=strncasecmp )
endif( NOT STRNICMP_EXISTS )
set( ZDBSP_LIBS "${ZLIB_LIBRARIES}" )
set( SOURCES
main.cpp
getopt.c
getopt1.c
blockmapbuilder.cpp
processor.cpp
processor_udmf.cpp
sc_man.cpp
view.cpp
wad.cpp
nodebuild.cpp
nodebuild_events.cpp
nodebuild_extract.cpp
nodebuild_gl.cpp
nodebuild_utility.cpp
nodebuild_classify_nosse2.cpp
)
if( SSE_MATTERS )
if( FULL_SSE2 )
message( STATUS "Using SSE2 math everywhere." )
# Building everything with SSE2 is much like disabling it, in that we
# need not check for its existance while running.
set( ALL_C_FLAGS "${ALL_C_FLAGS} -DDISABLE_SSE ${SSE2_ENABLE}" )
else( FULL_SSE2 )
if( SSE )
message( STATUS "Using SSE math for ClassifyLine only." )
set( SOURCES ${SOURCES} nodebuild_classify_sse1.cpp nodebuild_classify_sse2.cpp )
set_source_files_properties( nodebuild_classify_sse1.cpp PROPERTIES COMPILE_FLAGS "${SSE1_ENABLE}" )
set_source_files_properties( nodebuild_classify_sse2.cpp PROPERTIES COMPILE_FLAGS "${SSE2_ENABLE}" )
else( SSE )
message( STATUS "SSE math is completely disabled." )
set( ALL_C_FLAGS "${ALL_C_FLAGS} -DDISABLE_SSE" )
endif( SSE )
endif( FULL_SSE2 )
else( SSE_MATTERS )
set( ALL_C_FLAGS "${ALL_C_FLAGS} -DDISABLE_SSE" )
endif( SSE_MATTERS )
if( WIN32 )
set( ZDBSP_LIBS ${ZDBSP_LIBS} user32 gdi32 )
if( CMAKE_COMPILER_IS_GNUCXX )
# CMake is not set up to compile and link rc files with GCC. :(
add_custom_command( OUTPUT zdbsp-rc.o
COMMAND windres -o zdbsp-rc.o -i ${CMAKE_CURRENT_SOURCE_DIR}/resource.rc
DEPENDS resource.rc )
set( SOURCES ${SOURCES} zdbsp-rc.o )
else( CMAKE_COMPILER_IS_GNUCXX )
set( SOURCES ${SOURCES} resource.rc )
endif( CMAKE_COMPILER_IS_GNUCXX )
endif( WIN32 )
CHECK_FUNCTION_EXISTS( stricmp STRICMP_EXISTS )
if( NOT STRICMP_EXISTS )
add_definitions( -Dstricmp=strcasecmp )
endif( NOT STRICMP_EXISTS )
CHECK_FUNCTION_EXISTS( strnicmp STRNICMP_EXISTS )
if( NOT STRNICMP_EXISTS )
add_definitions( -Dstrnicmp=strncasecmp )
endif( NOT STRNICMP_EXISTS )
set( ZDBSP_LIBS "${ZLIB_LIBRARIES}" )
set( SOURCES
main.cpp
getopt.c
getopt1.c
blockmapbuilder.cpp
processor.cpp
processor_udmf.cpp
sc_man.cpp
wad.cpp
nodebuild.cpp
nodebuild_events.cpp
nodebuild_extract.cpp
nodebuild_gl.cpp
nodebuild_utility.cpp
nodebuild_classify_nosse2.cpp
)
if( WIN32 )
set( SOURCES "${SOURCES} view.cpp" )
else( WIN32 )
add_definitions( -DNO_MAP_VIEWER )
endif( WIN32 )
if( SSE_MATTERS )
if( FULL_SSE2 )
message( STATUS "Using SSE2 math everywhere." )
# Building everything with SSE2 is much like disabling it, in that we
# need not check for its existance while running.
set( ALL_C_FLAGS "${ALL_C_FLAGS} -DDISABLE_SSE ${SSE2_ENABLE}" )
else( FULL_SSE2 )
if( SSE )
message( STATUS "Using SSE math for ClassifyLine only." )
set( SOURCES ${SOURCES} nodebuild_classify_sse1.cpp nodebuild_classify_sse2.cpp )
set_source_files_properties( nodebuild_classify_sse1.cpp PROPERTIES COMPILE_FLAGS "${SSE1_ENABLE}" )
set_source_files_properties( nodebuild_classify_sse2.cpp PROPERTIES COMPILE_FLAGS "${SSE2_ENABLE}" )
else( SSE )
message( STATUS "SSE math is completely disabled." )
set( ALL_C_FLAGS "${ALL_C_FLAGS} -DDISABLE_SSE" )
endif( SSE )
endif( FULL_SSE2 )
else( SSE_MATTERS )
set( ALL_C_FLAGS "${ALL_C_FLAGS} -DDISABLE_SSE" )
endif( SSE_MATTERS )
if( WIN32 )
set( ZDBSP_LIBS ${ZDBSP_LIBS} user32 gdi32 )
if( CMAKE_COMPILER_IS_GNUCXX )
# CMake is not set up to compile and link rc files with GCC. :(
add_custom_command( OUTPUT zdbsp-rc.o
COMMAND windres -o zdbsp-rc.o -i ${CMAKE_CURRENT_SOURCE_DIR}/resource.rc
DEPENDS resource.rc )
set( SOURCES ${SOURCES} zdbsp-rc.o )
else( CMAKE_COMPILER_IS_GNUCXX )
set( SOURCES ${SOURCES} resource.rc )
endif( CMAKE_COMPILER_IS_GNUCXX )
endif( WIN32 )
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${REL_LINKER_FLAGS}" )
set( CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} ${REL_LINKER_FLAGS}" )
set( CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} ${REL_LINKER_FLAGS}" )
@ -179,7 +183,7 @@ set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${REL_C_FLAGS}" )
set( CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} ${REL_C_FLAGS}" )
set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${REL_C_FLAGS}" )
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${DEB_C_FLAGS} -D_DEBUG" )
add_executable( zdbsp ${SOURCES} )
target_link_libraries( zdbsp ${ZDBSP_LIBS} ${PROF_LIB} )
include_directories( "${ZLIB_INCLUDE_DIR}" )
add_executable( zdbsp ${SOURCES} )
target_link_libraries( zdbsp ${ZDBSP_LIBS} ${PROF_LIB} )
include_directories( "${ZLIB_INCLUDE_DIR}" )