mirror of
https://github.com/ZDoom/zdbsp.git
synced 2024-11-21 19:32:31 +00:00
- 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:
parent
f824fe7a86
commit
983907fd20
1 changed files with 107 additions and 103 deletions
210
CMakeLists.txt
210
CMakeLists.txt
|
@ -1,11 +1,11 @@
|
||||||
cmake_minimum_required( VERSION 2.4 )
|
cmake_minimum_required( VERSION 2.4 )
|
||||||
if( COMMAND cmake_policy )
|
if( COMMAND cmake_policy )
|
||||||
cmake_policy( SET CMP0003 NEW )
|
cmake_policy( SET CMP0003 NEW )
|
||||||
endif( COMMAND cmake_policy )
|
endif( COMMAND cmake_policy )
|
||||||
|
|
||||||
|
|
||||||
include( CheckFunctionExists )
|
|
||||||
include( CheckCXXCompilerFlag )
|
include( CheckFunctionExists )
|
||||||
|
include( CheckCXXCompilerFlag )
|
||||||
|
|
||||||
IF( NOT CMAKE_BUILD_TYPE )
|
IF( NOT CMAKE_BUILD_TYPE )
|
||||||
SET( CMAKE_BUILD_TYPE Debug CACHE STRING
|
SET( CMAKE_BUILD_TYPE Debug CACHE STRING
|
||||||
|
@ -16,21 +16,21 @@ ENDIF( NOT CMAKE_BUILD_TYPE )
|
||||||
set( SSE_MATTERS NO )
|
set( SSE_MATTERS NO )
|
||||||
|
|
||||||
# SSE only matters on 32-bit targets. We check compiler flags to know if we can do it.
|
# 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" )
|
if( CMAKE_SIZEOF_VOID_P MATCHES "4" )
|
||||||
CHECK_CXX_COMPILER_FLAG( "-msse2 -mfpmath=sse" CAN_DO_MFPMATH )
|
CHECK_CXX_COMPILER_FLAG( "-msse2 -mfpmath=sse" CAN_DO_MFPMATH )
|
||||||
CHECK_CXX_COMPILER_FLAG( -arch:SSE2 CAN_DO_ARCHSSE2 )
|
CHECK_CXX_COMPILER_FLAG( -arch:SSE2 CAN_DO_ARCHSSE2 )
|
||||||
if( CAN_DO_MFPMATH )
|
if( CAN_DO_MFPMATH )
|
||||||
set( SSE1_ENABLE "-msse -mfpmath=sse" )
|
set( SSE1_ENABLE "-msse -mfpmath=sse" )
|
||||||
set( SSE2_ENABLE "-msse2 -mfpmath=sse" )
|
set( SSE2_ENABLE "-msse2 -mfpmath=sse" )
|
||||||
set( SSE_MATTERS YES )
|
set( SSE_MATTERS YES )
|
||||||
elseif( CAN_DO_ARCHSSE2 )
|
elseif( CAN_DO_ARCHSSE2 )
|
||||||
set( SSE1_ENABLE -arch:SSE )
|
set( SSE1_ENABLE -arch:SSE )
|
||||||
set( SSE2_ENABLE -arch:SSE2 )
|
set( SSE2_ENABLE -arch:SSE2 )
|
||||||
set( SSE_MATTERS YES )
|
set( SSE_MATTERS YES )
|
||||||
endif( CAN_DO_MFPMATH )
|
endif( CAN_DO_MFPMATH )
|
||||||
endif( CMAKE_SIZEOF_VOID_P MATCHES "4" )
|
endif( CMAKE_SIZEOF_VOID_P MATCHES "4" )
|
||||||
|
|
||||||
if( SSE_MATTERS )
|
if( SSE_MATTERS )
|
||||||
if( CMAKE_COMPILER_IS_GNUCXX AND WIN32 )
|
if( CMAKE_COMPILER_IS_GNUCXX AND WIN32 )
|
||||||
set( BACKPATCH 1 CACHE BOOL "Enable backpatching." )
|
set( BACKPATCH 1 CACHE BOOL "Enable backpatching." )
|
||||||
endif( CMAKE_COMPILER_IS_GNUCXX AND WIN32 )
|
endif( CMAKE_COMPILER_IS_GNUCXX AND WIN32 )
|
||||||
|
@ -74,19 +74,19 @@ endif( MSVC )
|
||||||
|
|
||||||
if( CMAKE_COMPILER_IS_GNUCXX )
|
if( CMAKE_COMPILER_IS_GNUCXX )
|
||||||
set( ALL_C_FLAGS "${ALL_C_FLAGS} -ffast-math -pipe" )
|
set( ALL_C_FLAGS "${ALL_C_FLAGS} -ffast-math -pipe" )
|
||||||
if( GPROF )
|
if( GPROF )
|
||||||
set( ALL_C_FLAGS "${ALL_C_FLAGS} -pg -g" )
|
set( ALL_C_FLAGS "${ALL_C_FLAGS} -pg -g" )
|
||||||
else( GPROF )
|
else( GPROF )
|
||||||
set( REL_C_FLAGS "${REL_C_FLAGS} -fomit-frame-pointer" )
|
set( REL_C_FLAGS "${REL_C_FLAGS} -fomit-frame-pointer" )
|
||||||
endif( GPROF )
|
endif( GPROF )
|
||||||
if( PROFILE EQUAL 1 )
|
if( PROFILE EQUAL 1 )
|
||||||
message( STATUS "Generating profile coverage information" )
|
message( STATUS "Generating profile coverage information" )
|
||||||
set( ALL_C_FLAGS "${ALL_C_FLAGS} -fprofile-generate" )
|
set( ALL_C_FLAGS "${ALL_C_FLAGS} -fprofile-generate" )
|
||||||
set( PROF_LIB "gcov" )
|
set( PROF_LIB "gcov" )
|
||||||
elseif( PROFILE EQUAL 2 )
|
elseif( PROFILE EQUAL 2 )
|
||||||
message( STATUS "Using profile coverage information" )
|
message( STATUS "Using profile coverage information" )
|
||||||
set( ALL_C_FLAGS "${ALL_C_FLAGS} -fprofile-use" )
|
set( ALL_C_FLAGS "${ALL_C_FLAGS} -fprofile-use" )
|
||||||
endif( PROFILE EQUAL 1 )
|
endif( PROFILE EQUAL 1 )
|
||||||
endif( CMAKE_COMPILER_IS_GNUCXX )
|
endif( CMAKE_COMPILER_IS_GNUCXX )
|
||||||
|
|
||||||
if( ZLIB_FOUND )
|
if( ZLIB_FOUND )
|
||||||
|
@ -99,71 +99,75 @@ else( ZLIB_FOUND )
|
||||||
set( ZLIB_LIBRARY z )
|
set( ZLIB_LIBRARY z )
|
||||||
endif( ZLIB_FOUND )
|
endif( ZLIB_FOUND )
|
||||||
|
|
||||||
CHECK_FUNCTION_EXISTS( stricmp STRICMP_EXISTS )
|
CHECK_FUNCTION_EXISTS( stricmp STRICMP_EXISTS )
|
||||||
if( NOT STRICMP_EXISTS )
|
if( NOT STRICMP_EXISTS )
|
||||||
add_definitions( -Dstricmp=strcasecmp )
|
add_definitions( -Dstricmp=strcasecmp )
|
||||||
endif( NOT STRICMP_EXISTS )
|
endif( NOT STRICMP_EXISTS )
|
||||||
|
|
||||||
CHECK_FUNCTION_EXISTS( strnicmp STRNICMP_EXISTS )
|
CHECK_FUNCTION_EXISTS( strnicmp STRNICMP_EXISTS )
|
||||||
if( NOT STRNICMP_EXISTS )
|
if( NOT STRNICMP_EXISTS )
|
||||||
add_definitions( -Dstrnicmp=strncasecmp )
|
add_definitions( -Dstrnicmp=strncasecmp )
|
||||||
endif( NOT STRNICMP_EXISTS )
|
endif( NOT STRNICMP_EXISTS )
|
||||||
|
|
||||||
set( ZDBSP_LIBS "${ZLIB_LIBRARIES}" )
|
set( ZDBSP_LIBS "${ZLIB_LIBRARIES}" )
|
||||||
set( SOURCES
|
set( SOURCES
|
||||||
main.cpp
|
main.cpp
|
||||||
getopt.c
|
getopt.c
|
||||||
getopt1.c
|
getopt1.c
|
||||||
blockmapbuilder.cpp
|
blockmapbuilder.cpp
|
||||||
processor.cpp
|
processor.cpp
|
||||||
processor_udmf.cpp
|
processor_udmf.cpp
|
||||||
sc_man.cpp
|
sc_man.cpp
|
||||||
view.cpp
|
wad.cpp
|
||||||
wad.cpp
|
nodebuild.cpp
|
||||||
nodebuild.cpp
|
nodebuild_events.cpp
|
||||||
nodebuild_events.cpp
|
nodebuild_extract.cpp
|
||||||
nodebuild_extract.cpp
|
nodebuild_gl.cpp
|
||||||
nodebuild_gl.cpp
|
nodebuild_utility.cpp
|
||||||
nodebuild_utility.cpp
|
nodebuild_classify_nosse2.cpp
|
||||||
nodebuild_classify_nosse2.cpp
|
)
|
||||||
)
|
if( WIN32 )
|
||||||
|
set( SOURCES "${SOURCES} view.cpp" )
|
||||||
if( SSE_MATTERS )
|
else( WIN32 )
|
||||||
if( FULL_SSE2 )
|
add_definitions( -DNO_MAP_VIEWER )
|
||||||
message( STATUS "Using SSE2 math everywhere." )
|
endif( WIN32 )
|
||||||
# Building everything with SSE2 is much like disabling it, in that we
|
|
||||||
# need not check for its existance while running.
|
if( SSE_MATTERS )
|
||||||
set( ALL_C_FLAGS "${ALL_C_FLAGS} -DDISABLE_SSE ${SSE2_ENABLE}" )
|
if( FULL_SSE2 )
|
||||||
else( FULL_SSE2 )
|
message( STATUS "Using SSE2 math everywhere." )
|
||||||
if( SSE )
|
# Building everything with SSE2 is much like disabling it, in that we
|
||||||
message( STATUS "Using SSE math for ClassifyLine only." )
|
# need not check for its existance while running.
|
||||||
set( SOURCES ${SOURCES} nodebuild_classify_sse1.cpp nodebuild_classify_sse2.cpp )
|
set( ALL_C_FLAGS "${ALL_C_FLAGS} -DDISABLE_SSE ${SSE2_ENABLE}" )
|
||||||
set_source_files_properties( nodebuild_classify_sse1.cpp PROPERTIES COMPILE_FLAGS "${SSE1_ENABLE}" )
|
else( FULL_SSE2 )
|
||||||
set_source_files_properties( nodebuild_classify_sse2.cpp PROPERTIES COMPILE_FLAGS "${SSE2_ENABLE}" )
|
if( SSE )
|
||||||
else( SSE )
|
message( STATUS "Using SSE math for ClassifyLine only." )
|
||||||
message( STATUS "SSE math is completely disabled." )
|
set( SOURCES ${SOURCES} nodebuild_classify_sse1.cpp nodebuild_classify_sse2.cpp )
|
||||||
set( ALL_C_FLAGS "${ALL_C_FLAGS} -DDISABLE_SSE" )
|
set_source_files_properties( nodebuild_classify_sse1.cpp PROPERTIES COMPILE_FLAGS "${SSE1_ENABLE}" )
|
||||||
endif( SSE )
|
set_source_files_properties( nodebuild_classify_sse2.cpp PROPERTIES COMPILE_FLAGS "${SSE2_ENABLE}" )
|
||||||
endif( FULL_SSE2 )
|
else( SSE )
|
||||||
else( SSE_MATTERS )
|
message( STATUS "SSE math is completely disabled." )
|
||||||
set( ALL_C_FLAGS "${ALL_C_FLAGS} -DDISABLE_SSE" )
|
set( ALL_C_FLAGS "${ALL_C_FLAGS} -DDISABLE_SSE" )
|
||||||
endif( SSE_MATTERS )
|
endif( SSE )
|
||||||
|
endif( FULL_SSE2 )
|
||||||
if( WIN32 )
|
else( SSE_MATTERS )
|
||||||
set( ZDBSP_LIBS ${ZDBSP_LIBS} user32 gdi32 )
|
set( ALL_C_FLAGS "${ALL_C_FLAGS} -DDISABLE_SSE" )
|
||||||
|
endif( SSE_MATTERS )
|
||||||
if( CMAKE_COMPILER_IS_GNUCXX )
|
|
||||||
# CMake is not set up to compile and link rc files with GCC. :(
|
if( WIN32 )
|
||||||
add_custom_command( OUTPUT zdbsp-rc.o
|
set( ZDBSP_LIBS ${ZDBSP_LIBS} user32 gdi32 )
|
||||||
COMMAND windres -o zdbsp-rc.o -i ${CMAKE_CURRENT_SOURCE_DIR}/resource.rc
|
|
||||||
DEPENDS resource.rc )
|
if( CMAKE_COMPILER_IS_GNUCXX )
|
||||||
set( SOURCES ${SOURCES} zdbsp-rc.o )
|
# CMake is not set up to compile and link rc files with GCC. :(
|
||||||
else( CMAKE_COMPILER_IS_GNUCXX )
|
add_custom_command( OUTPUT zdbsp-rc.o
|
||||||
set( SOURCES ${SOURCES} resource.rc )
|
COMMAND windres -o zdbsp-rc.o -i ${CMAKE_CURRENT_SOURCE_DIR}/resource.rc
|
||||||
endif( CMAKE_COMPILER_IS_GNUCXX )
|
DEPENDS resource.rc )
|
||||||
endif( WIN32 )
|
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_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_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} ${REL_LINKER_FLAGS}" )
|
||||||
set( CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} ${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_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} ${REL_C_FLAGS}" )
|
||||||
set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${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" )
|
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${DEB_C_FLAGS} -D_DEBUG" )
|
||||||
|
|
||||||
add_executable( zdbsp ${SOURCES} )
|
add_executable( zdbsp ${SOURCES} )
|
||||||
target_link_libraries( zdbsp ${ZDBSP_LIBS} ${PROF_LIB} )
|
target_link_libraries( zdbsp ${ZDBSP_LIBS} ${PROF_LIB} )
|
||||||
include_directories( "${ZLIB_INCLUDE_DIR}" )
|
include_directories( "${ZLIB_INCLUDE_DIR}" )
|
||||||
|
|
Loading…
Reference in a new issue