- Bump CMake version requirement to 2.8.7. This means that generator expressions must be supported as well as empty else and endif expressions (like most sane languages). ZDoom probably didn't work with 2.4 anymore anyway.

This commit is contained in:
Braden Obrzut 2016-02-05 21:19:29 -05:00
parent 4fb65d74fd
commit dce3f0f757
18 changed files with 245 additions and 269 deletions

View file

@ -1,37 +1,29 @@
cmake_minimum_required( VERSION 2.4 )
cmake_minimum_required( VERSION 2.8.7 )
project(ZDoom)
if( COMMAND cmake_policy )
if( POLICY CMP0011 )
cmake_policy( SET CMP0011 NEW )
endif( POLICY CMP0011 )
endif()
if( POLICY CMP0054 )
cmake_policy( SET CMP0054 NEW )
endif( POLICY CMP0054 )
endif( COMMAND cmake_policy )
endif()
endif()
list( APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} )
include( CreateLaunchers )
include( FindPackageHandleStandardArgs )
# Generator expression are available some time in CMake 2.8. Due to
# cmake_minimum_required, we can assume a minor version of > 7 implies major >= 2
if(${CMAKE_MAJOR_VERSION} GREATER 2 OR ${CMAKE_MINOR_VERSION} GREATER 7)
option( NO_GENERATOR_EXPRESSIONS "Disable generator expressions (for building pk3s with IDEs)." OFF )
else(${CMAKE_MAJOR_VERSION} GREATER 2 OR ${CMAKE_MINOR_VERSION} GREATER 7)
set( NO_GENERATOR_EXPRESSIONS ON )
endif(${CMAKE_MAJOR_VERSION} GREATER 2 OR ${CMAKE_MINOR_VERSION} GREATER 7)
# Support cross compiling
option( FORCE_CROSSCOMPILE "Turn on cross compiling." NO )
if( FORCE_CROSSCOMPILE )
set( CMAKE_CROSSCOMPILING TRUE )
endif( FORCE_CROSSCOMPILE )
endif()
if(CMAKE_CROSSCOMPILING)
set(IMPORT_EXECUTABLES "IMPORTFILE-NOTFOUND" CACHE FILEPATH "Export file from native build.")
include(${IMPORT_EXECUTABLES})
endif(CMAKE_CROSSCOMPILING)
endif()
# Simplify pk3 building, add_pk3(filename srcdirectory)
function( add_pk3 PK3_NAME PK3_DIR )
@ -39,27 +31,25 @@ function( add_pk3 PK3_NAME PK3_DIR )
string( REPLACE "." "_" PK3_TARGET ${PK3_NAME} )
if( ${PK3_TARGET} STREQUAL "zdoom_pk3" )
set( PK3_TARGET "pk3" )
endif( ${PK3_TARGET} STREQUAL "zdoom_pk3" )
endif()
if( NOT NO_GENERATOR_EXPRESSIONS AND NOT ZDOOM_OUTPUT_OLDSTYLE )
if( NOT ZDOOM_OUTPUT_OLDSTYLE )
add_custom_command( OUTPUT ${ZDOOM_OUTPUT_DIR}/${PK3_NAME}
COMMAND zipdir -udf ${ZDOOM_OUTPUT_DIR}/${PK3_NAME} ${PK3_DIR}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ZDOOM_OUTPUT_DIR}/${PK3_NAME} $<TARGET_FILE_DIR:zdoom>/${PK3_NAME}
DEPENDS zipdir )
else( NOT NO_GENERATOR_EXPRESSIONS AND NOT ZDOOM_OUTPUT_OLDSTYLE )
else()
add_custom_command( OUTPUT ${ZDOOM_OUTPUT_DIR}/${PK3_NAME}
COMMAND zipdir -udf ${ZDOOM_OUTPUT_DIR}/${PK3_NAME} ${PK3_DIR}
DEPENDS zipdir )
endif( NOT NO_GENERATOR_EXPRESSIONS AND NOT ZDOOM_OUTPUT_OLDSTYLE )
endif()
if( NOT NO_GENERATOR_EXPRESSIONS )
# Touch the zipdir executable here so that the pk3s are forced to
# rebuild each time since their dependecy has "changed."
add_custom_target( ${PK3_TARGET} ALL
COMMAND ${CMAKE_COMMAND} -E touch $<TARGET_FILE:zipdir>
DEPENDS ${ZDOOM_OUTPUT_DIR}/${PK3_NAME} )
endif( NOT NO_GENERATOR_EXPRESSIONS )
endfunction( add_pk3 )
# Touch the zipdir executable here so that the pk3s are forced to
# rebuild each time since their dependecy has "changed."
add_custom_target( ${PK3_TARGET} ALL
COMMAND ${CMAKE_COMMAND} -E touch $<TARGET_FILE:zipdir>
DEPENDS ${ZDOOM_OUTPUT_DIR}/${PK3_NAME} )
endfunction()
# Macro for building libraries without debugging information
macro( make_release_only )
@ -69,13 +59,13 @@ macro( make_release_only )
set( CMAKE_CXX_FLAGS_MINSIZEREL ${CMAKE_CXX_FLAGS_RELEASE} )
set( CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS_RELEASE} )
string( REPLACE "/MT " "/MTd " CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_RELEASE} )
endmacro( make_release_only )
endmacro()
IF( NOT CMAKE_BUILD_TYPE )
SET( CMAKE_BUILD_TYPE Debug CACHE STRING
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
FORCE )
ENDIF( NOT CMAKE_BUILD_TYPE )
ENDIF()
set( ZDOOM_OUTPUT_DIR ${CMAKE_BINARY_DIR} CACHE PATH "Directory where zdoom.pk3 and the executable will be created." )
set( ZDOOM_EXE_NAME "zdoom" CACHE FILEPATH "Name of the executable to create." )
@ -83,26 +73,26 @@ if( MSVC )
# Allow the user to use ZDOOM_OUTPUT_DIR as a single release point.
# Use zdoom, zdoomd, zdoom64, and zdoomd64 for the binary names
option( ZDOOM_OUTPUT_OLDSTYLE "Don't use Release/Debug directories." OFF )
else( MSVC )
else()
set( ZDOOM_OUTPUT_OLDSTYLE OFF )
endif( MSVC )
endif()
# Replacement variables for a possible long list of C/C++ compilers compatible with GCC
if( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" )
set( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE TRUE )
else( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" )
else()
set( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE FALSE )
endif( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" )
endif()
if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" )
set( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE TRUE )
else( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" )
else()
set( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE FALSE )
endif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" )
endif()
if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
set( PROFILE 0 CACHE BOOL "Enable profiling with gprof for Debug and RelWithDebInfo build types." )
endif( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
endif()
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}")
@ -135,21 +125,21 @@ if( MSVC )
option (ZDOOM_USE_SSE2 "Use SSE2 instruction set")
if (ZDOOM_USE_SSE2)
set( ALL_C_FLAGS "${ALL_C_FLAGS} /arch:SSE2")
else (ZDOOM_USE_SSE2)
else ()
if (MSVC_VERSION GREATER 1699)
# On Visual C++ 2012 and later SSE2 is the default, so we need to switch it off explicitly
set( ALL_C_FLAGS "${ALL_C_FLAGS} /arch:IA32")
endif (MSVC_VERSION GREATER 1699)
endif (ZDOOM_USE_SSE2)
endif( CMAKE_SIZEOF_VOID_P MATCHES "4")
endif ()
endif ()
endif()
# Avoid CRT DLL dependancies in release builds, optionally generate assembly output for checking crash locations.
option( ZDOOM_GENERATE_ASM "Generate assembly output." OFF )
if( ZDOOM_GENERATE_ASM )
set( REL_C_FLAGS "/MT /Oy /Oi /FAcs" )
else( ZDOOM_GENERATE_ASM )
else()
set( REL_C_FLAGS "/MT /Oy /Oi" )
endif( ZDOOM_GENERATE_ASM )
endif()
# Debug allocations in debug builds
@ -158,7 +148,7 @@ if( MSVC )
# Disable warnings for unsecure CRT functions from VC8+
if( MSVC_VERSION GREATER 1399 )
set( ALL_C_FLAGS "${ALL_C_FLAGS} /wd4996" )
endif( MSVC_VERSION GREATER 1399 )
endif()
# The CMake configurations set /GR and /MD by default, which conflict with our settings.
string(REPLACE "/MD " " " CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE} )
@ -170,12 +160,12 @@ if( MSVC )
string(REPLACE "/MD " " " CMAKE_C_FLAGS_RELWITHDEBINFO ${CMAKE_C_FLAGS_RELWITHDEBINFO} )
string(REPLACE "/MDd " " " CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG} )
string(REPLACE " /GR" " " CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} )
else( MSVC )
else()
set( REL_LINKER_FLAGS "" )
set( ALL_C_FLAGS "" )
set( REL_C_FLAGS "" )
set( DEB_C_FLAGS "" )
endif( MSVC )
endif()
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}" )
@ -200,50 +190,50 @@ option(FORCE_INTERNAL_GME "Use internal gme" ON)
if( ZLIB_FOUND AND NOT FORCE_INTERNAL_ZLIB )
message( STATUS "Using system zlib" )
else( ZLIB_FOUND AND NOT FORCE_INTERNAL_ZLIB )
else()
message( STATUS "Using internal zlib" )
add_subdirectory( zlib )
set( ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zlib )
set( ZLIB_LIBRARIES z )
set( ZLIB_LIBRARY z )
endif( ZLIB_FOUND AND NOT FORCE_INTERNAL_ZLIB )
endif()
if( JPEG_FOUND AND NOT FORCE_INTERNAL_JPEG )
message( STATUS "Using system jpeg library" )
else( JPEG_FOUND AND NOT FORCE_INTERNAL_JPEG )
else()
message( STATUS "Using internal jpeg library" )
add_subdirectory( jpeg-6b )
set( JPEG_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/jpeg-6b )
set( JPEG_LIBRARIES jpeg )
set( JPEG_LIBRARY jpeg )
endif( JPEG_FOUND AND NOT FORCE_INTERNAL_JPEG )
endif()
if( BZIP2_FOUND AND NOT FORCE_INTERNAL_BZIP2 )
message( STATUS "Using system bzip2 library" )
else( BZIP2_FOUND AND NOT FORCE_INTERNAL_BZIP2 )
else()
message( STATUS "Using internal bzip2 library" )
add_subdirectory( bzip2 )
set( BZIP2_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bzip2" )
set( BZIP2_LIBRARIES bz2 )
set( BZIP2_LIBRARY bz2 )
endif( BZIP2_FOUND AND NOT FORCE_INTERNAL_BZIP2 )
endif()
if( GME_FOUND AND NOT FORCE_INTERNAL_GME )
message( STATUS "Using system gme library ${GME_INCLUDE_DIR}" )
else( GME_FOUND AND NOT FORCE_INTERNAL_GME )
else()
message( STATUS "Using internal gme library" )
add_subdirectory( game-music-emu )
set( GME_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/game-music-emu" )
set( GME_LIBRARIES gme )
endif( GME_FOUND AND NOT FORCE_INTERNAL_GME )
endif()
set( LZMA_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/lzma/C" )
if( NOT CMAKE_CROSSCOMPILING )
if( NOT CROSS_EXPORTS )
set( CROSS_EXPORTS "" )
endif( NOT CROSS_EXPORTS )
endif( NOT CMAKE_CROSSCOMPILING )
endif()
endif()
add_subdirectory( lzma )
add_subdirectory( tools )
@ -254,8 +244,8 @@ add_subdirectory( src )
if( NOT WIN32 AND NOT APPLE )
add_subdirectory( output_sdl )
endif( NOT WIN32 AND NOT APPLE )
endif()
if( NOT CMAKE_CROSSCOMPILING )
export(TARGETS ${CROSS_EXPORTS} FILE "${CMAKE_BINARY_DIR}/ImportExecutables.cmake" )
endif( NOT CMAKE_CROSSCOMPILING )
endif()

View file

@ -1,10 +1,10 @@
cmake_minimum_required( VERSION 2.4 )
cmake_minimum_required( VERSION 2.8.7 )
make_release_only()
if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -fomit-frame-pointer" )
endif( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE )
endif()
add_definitions( -DBZ_NO_STDIO )
add_library( bz2

View file

@ -1,4 +1,4 @@
cmake_minimum_required( VERSION 2.4 )
cmake_minimum_required( VERSION 2.8.7 )
make_release_only()
@ -12,12 +12,12 @@ if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE )
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "4.5")
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-but-set-variable" )
endif(NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "4.5")
endif( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE )
endif()
CHECK_FUNCTION_EXISTS( itoa ITOA_EXISTS )
if( NOT ITOA_EXISTS )
add_definitions( -DNEED_ITOA=1 )
endif( NOT ITOA_EXISTS )
endif()
include_directories( include )
@ -114,5 +114,5 @@ if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
if( DUMB_CAN_USE_SSE )
set_source_files_properties( src/helpers/resampler.c PROPERTIES COMPILE_FLAGS -msse )
endif( DUMB_CAN_USE_SSE )
endif( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
endif()
endif()

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 2.8.7)
project(libdumb C)
set(CMAKE_C_FLAGS "-Wall -DDUMB_DECLARE_DEPRECATED -D_USE_SSE -msse -Wno-unused-variable -Wno-unused-but-set-variable")
@ -108,7 +108,7 @@ set_target_properties(dumb PROPERTIES DEBUG_POSTFIX d)
# Make sure the dylib install name path is set on OSX so you can include dumb in app bundles
IF(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set_target_properties(dumb PROPERTIES INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib)
ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
ENDIF()
INSTALL(FILES ${INSTALL_HEADERS} DESTINATION include/)
INSTALL(TARGETS dumb

View file

@ -9,26 +9,25 @@ set(GME_VERSION 0.6.0 CACHE INTERNAL "libgme Version")
# 2.6+ always assumes FATAL_ERROR, but 2.4 and below don't.
# Of course, 2.4 might work, in which case you're welcome to drop
# down the requirement, but I can't test that.
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
cmake_minimum_required(VERSION 2.8.7 FATAL_ERROR)
make_release_only()
# I don't plan on debugging this, so make it a release build.
if( NOT CMAKE_BUILD_TYPE MATCHES "Release" )
set( CMAKE_BUILD_TYPE "RelWithDebInfo" )
endif( NOT CMAKE_BUILD_TYPE MATCHES "Release" )
endif()
if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra" )
if( NOT PROFILE )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fomit-frame-pointer" )
endif( NOT PROFILE )
endif()
check_cxx_compiler_flag( -Wno-array-bounds HAVE_NO_ARRAY_BOUNDS )
if( HAVE_NO_ARRAY_BOUNDS )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-array-bounds" )
endif( HAVE_NO_ARRAY_BOUNDS )
endif( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
endif()
endif()
# Default emulators to build (all of them! ;)
@ -99,7 +98,7 @@ if (CMAKE_COMPILER_IS_GNUCXX)
endif()
endif()
endif() # test visibility
endif (CMAKE_COMPILER_IS_GNUCXX)
endif()
# Cache this result
set( LIBGME_HAVE_GCC_VISIBILITY ${ENABLE_VISIBILITY} CACHE BOOL "GCC support for hidden visibility")

View file

@ -1,4 +1,4 @@
cmake_minimum_required( VERSION 2.4 )
cmake_minimum_required( VERSION 2.8.7 )
set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG" )
@ -6,11 +6,11 @@ set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG" )
# unreferenced labels (4102) from VC
if( MSVC )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4554 /wd4102" )
endif( MSVC )
endif()
if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra" )
endif( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
endif()
include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
add_definitions( -DINFNAN_CHECK -DMULTIPLE_THREADS )
@ -18,7 +18,7 @@ add_definitions( -DINFNAN_CHECK -DMULTIPLE_THREADS )
if( NOT MSVC AND NOT APPLE )
if( NOT CMAKE_CROSSCOMPILING )
add_executable( arithchk arithchk.c )
endif( NOT CMAKE_CROSSCOMPILING )
endif()
add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/arith.h
COMMAND arithchk >${CMAKE_CURRENT_BINARY_DIR}/arith.h
DEPENDS arithchk )
@ -26,14 +26,14 @@ if( NOT MSVC AND NOT APPLE )
if( NOT CMAKE_CROSSCOMPILING )
add_executable( qnan qnan.c arith.h )
set( CROSS_EXPORTS ${CROSS_EXPORTS} arithchk qnan PARENT_SCOPE )
endif( NOT CMAKE_CROSSCOMPILING )
endif()
add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gd_qnan.h
COMMAND qnan >${CMAKE_CURRENT_BINARY_DIR}/gd_qnan.h
DEPENDS qnan )
set( GEN_FP_FILES arith.h gd_qnan.h )
set( GEN_FP_DEPS ${CMAKE_CURRENT_BINARY_DIR}/arith.h ${CMAKE_CURRENT_BINARY_DIR}/gd_qnan.h )
endif( NOT MSVC AND NOT APPLE )
endif()
add_library( gdtoa
${GEN_FP_FILES}

View file

@ -1,10 +1,10 @@
cmake_minimum_required( VERSION 2.4 )
cmake_minimum_required( VERSION 2.8.7 )
make_release_only()
if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter -fomit-frame-pointer" )
endif( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE )
endif()
add_library( jpeg
jcomapi.c

View file

@ -1,10 +1,10 @@
cmake_minimum_required( VERSION 2.4 )
cmake_minimum_required( VERSION 2.8.7 )
make_release_only()
if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -fomit-frame-pointer" )
endif( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE )
endif()
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_7ZIP_PPMD_SUPPPORT" )
@ -30,9 +30,9 @@ set( LZMA_FILES
if( WIN32 )
set( LZMA_FILES ${LZMA_FILES} C/LzFindMt.c C/Threads.c )
else( WIN32 )
else()
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_7ZIP_ST" )
endif( WIN32 )
endif()
add_library( lzma ${LZMA_FILES} )
target_link_libraries( lzma )

View file

@ -1,4 +1,4 @@
cmake_minimum_required( VERSION 2.4 )
cmake_minimum_required( VERSION 2.8.7 )
if( NOT NO_FMOD AND FMOD_INCLUDE_DIR )
add_library( output_sdl MODULE output_sdl.c )
include_directories( ${FMOD_INCLUDE_DIR} ${SDL2_INCLUDE_DIR} )
@ -8,4 +8,4 @@ if( NOT NO_FMOD AND FMOD_INCLUDE_DIR )
add_custom_command( TARGET output_sdl POST_BUILD
COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/link-make
COMMAND /bin/sh -c ${CMAKE_CURRENT_BINARY_DIR}/link-make )
endif( NOT NO_FMOD AND FMOD_INCLUDE_DIR )
endif()

View file

@ -1,4 +1,4 @@
cmake_minimum_required( VERSION 2.4 )
cmake_minimum_required( VERSION 2.8.7 )
if( COMMAND cmake_policy )
cmake_policy( SET CMP0003 NEW )
@ -12,28 +12,28 @@ include( FindPkgConfig )
if( NOT APPLE )
option( NO_ASM "Disable assembly code" OFF )
else( NOT APPLE )
else()
# At the moment asm code doesn't work with OS X, so disable by default
option( NO_ASM "Disable assembly code" ON )
endif( NOT APPLE )
endif()
if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
option( NO_STRIP "Do not strip Release or MinSizeRel builds" )
# At least some versions of Xcode fail if you strip with the linker
# instead of the separate strip utility.
if( APPLE )
set( NO_STRIP ON )
endif( APPLE )
endif( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
endif()
endif()
option( DYN_FLUIDSYNTH "Dynamically load fluidsynth" ON )
if( APPLE )
option( OSX_COCOA_BACKEND "Use native Cocoa backend instead of SDL" ON )
endif( APPLE )
endif()
if( CMAKE_SIZEOF_VOID_P MATCHES "8" )
set( X64 64 )
endif( CMAKE_SIZEOF_VOID_P MATCHES "8" )
endif()
# You can either use "make install" on the FMOD distribution to put it
# in standard system locations, or you can unpack the FMOD distribution
@ -58,41 +58,41 @@ set( MAJOR_VERSIONS "44" "34" "28" "26" "24" "22" "20" )
if( NOT FMOD_DIR_VERSIONS )
set( FMOD_DIR_VERSIONS "" )
endif( NOT FMOD_DIR_VERSIONS )
endif()
if( NOT FMOD_VERSIONS )
set( FMOD_VERSIONS "" )
endif( NOT FMOD_VERSIONS )
endif()
if( NOT FMOD_LOCAL_INC_DIRS )
set( FMOD_LOCAL_INC_DIRS "" )
endif( NOT FMOD_LOCAL_INC_DIRS )
endif()
if( NOT FMOD_LOCAL_LIB_DIRS )
set( FMOD_LOCAL_LIB_DIRS "" )
endif( NOT FMOD_LOCAL_LIB_DIRS )
endif()
set( FMOD_DIR_VERSIONS ${FMOD_DIR_VERSIONS} "../fmod" )
foreach( majver ${MAJOR_VERSIONS} )
foreach( minver ${MINOR_VERSIONS} )
set( FMOD_VERSIONS ${FMOD_VERSIONS} "fmodex${X64}-4.${majver}.${minver}" )
set( FMOD_DIR_VERSIONS ${FMOD_DIR_VERSIONS} "${CMAKE_HOME_DIRECTORY}/fmodapi4${majver}${minver}linux${X64}" )
endforeach( minver ${MINOR_VERSIONS} )
endforeach()
foreach( dir ${FMOD_DIR_VERSIONS} )
set( FMOD_LOCAL_INC_DIRS ${FMOD_LOCAL_INC_DIRS} "${dir}/api/inc" )
set( FMOD_LOCAL_LIB_DIRS ${FMOD_LOCAL_LIB_DIRS} "${dir}/api/lib" )
endforeach( dir ${FMOD_DIR_VERSIONS} )
endforeach( majver ${MAJOR_VERSIONS} )
endforeach()
endforeach()
if( NOT ZDOOM_LIBS )
set( ZDOOM_LIBS "" )
endif( NOT ZDOOM_LIBS )
endif()
if( WIN32 )
if( X64 )
set( WIN_TYPE Win64 )
set( XBITS x64 )
else( X64 )
else()
set( WIN_TYPE Win32 )
set( XBITS x86 )
endif( X64 )
endif()
add_definitions( -D_WIN32 )
@ -113,9 +113,9 @@ if( WIN32 )
PATH_SUFFIXES Include )
if( NOT D3D_INCLUDE_DIR )
message( SEND_ERROR "Could not find DirectX 9 header files" )
else( NOT D3D_INCLUDE_DIR )
else()
include_directories( ${D3D_INCLUDE_DIR} )
endif( NOT D3D_INCLUDE_DIR )
endif()
find_path( XINPUT_INCLUDE_DIR xinput.h
PATHS ENV DXSDK_DIR
@ -123,9 +123,9 @@ if( WIN32 )
if( NOT XINPUT_INCLUDE_DIR )
message( WARNING "Could not find xinput.h. XInput will be disabled." )
add_definitions( -DNO_XINPUT )
else( NOT XINPUT_INCLUDE_DIR )
else()
include_directories( ${XINPUT_INCLUDE_DIR} )
endif( NOT XINPUT_INCLUDE_DIR )
endif()
find_library( DX_dxguid_LIBRARY dxguid
PATHS ENV DXSDK_DIR
@ -137,14 +137,14 @@ if( WIN32 )
set( DX_LIBS_FOUND YES )
if( NOT DX_dxguid_LIBRARY )
set( DX_LIBS_FOUND NO )
endif( NOT DX_dxguid_LIBRARY )
endif()
if( NOT DX_dinput8_LIBRARY )
set( DX_LIBS_FOUND NO )
endif( NOT DX_dinput8_LIBRARY )
endif()
if( NOT DX_LIBS_FOUND )
message( FATAL_ERROR "Could not find DirectX 9 libraries" )
endif( NOT DX_LIBS_FOUND )
endif()
set( ZDOOM_LIBS
wsock32
@ -160,13 +160,13 @@ if( WIN32 )
setupapi
oleaut32
DelayImp )
else( WIN32 )
else()
if( APPLE )
set( FMOD_SEARCH_PATHS "/Developer/FMOD Programmers API Mac/api" )
set( FMOD_INC_PATH_SUFFIXES PATH_SUFFIXES inc )
set( FMOD_LIB_PATH_SUFFIXES PATH_SUFFIXES lib )
set( NO_GTK ON )
else( APPLE )
else()
option( NO_GTK "Disable GTK+ dialogs (Not applicable to Windows)" )
option( VALGRIND "Add special Valgrind sequences to self-modifying code" )
@ -188,30 +188,30 @@ else( WIN32 )
set( ZDOOM_LIBS ${ZDOOM_LIBS} ${GTK2_LIBRARIES} )
include_directories( ${GTK2_INCLUDE_DIRS} )
link_directories( ${GTK2_LIBRARY_DIRS} )
else( GTK2_FOUND )
else()
set( NO_GTK ON )
endif( GTK2_FOUND )
endif( NOT NO_GTK )
endif( APPLE )
endif()
endif()
endif()
set( NASM_NAMES nasm )
if( NO_GTK )
add_definitions( -DNO_GTK=1 )
endif( NO_GTK )
endif()
# Non-Windows version also needs SDL except native OS X backend
if( NOT APPLE OR NOT OSX_COCOA_BACKEND )
find_package( SDL2 REQUIRED )
include_directories( "${SDL2_INCLUDE_DIR}" )
set( ZDOOM_LIBS ${ZDOOM_LIBS} "${SDL2_LIBRARY}" )
endif( NOT APPLE OR NOT OSX_COCOA_BACKEND )
endif()
find_path( FPU_CONTROL_DIR fpu_control.h )
if( FPU_CONTROL_DIR )
include_directories( ${FPU_CONTROL_DIR} )
add_definitions( -DHAVE_FPU_CONTROL )
endif( FPU_CONTROL_DIR )
endif( WIN32 )
endif()
endif()
if( NOT NO_OPENAL )
@ -220,76 +220,76 @@ if( NOT NO_OPENAL )
if( OPENAL_FOUND )
include_directories( ${OPENAL_INCLUDE_DIR} )
set( ZDOOM_LIBS ${OPENAL_LIBRARY} ${ZDOOM_LIBS} )
else( OPENAL_FOUND )
else()
set( NO_OPENAL ON )
endif( OPENAL_FOUND )
endif( NOT NO_OPENAL )
endif()
endif()
if( NOT NO_FMOD )
# Search for FMOD include files
if( NOT WIN32 )
find_path( FMOD_INCLUDE_DIR fmod.hpp
PATHS ${FMOD_LOCAL_INC_DIRS} )
endif( NOT WIN32 )
endif()
if( NOT FMOD_INCLUDE_DIR )
find_path( FMOD_INCLUDE_DIR fmod.hpp
PATHS ${FMOD_SEARCH_PATHS}
${FMOD_INC_PATH_SUFFIXES} )
endif( NOT FMOD_INCLUDE_DIR )
endif()
if( FMOD_INCLUDE_DIR )
message( STATUS "FMOD include files found at ${FMOD_INCLUDE_DIR}" )
include_directories( "${FMOD_INCLUDE_DIR}" )
else( FMOD_INCLUDE_DIR )
else()
message( STATUS "Could not find FMOD include files" )
set( NO_FMOD ON )
endif( FMOD_INCLUDE_DIR )
endif( NOT NO_FMOD )
endif()
endif()
if( NOT NO_FMOD )
# Decide on the name of the FMOD library we want to use.
if( NOT FMOD_LIB_NAME AND MSVC )
set( FMOD_LIB_NAME fmodex${X64}_vc )
endif( NOT FMOD_LIB_NAME AND MSVC )
endif()
if( NOT FMOD_LIB_NAME AND BORLAND )
set( FMOD_LIB_NAME fmodex${X64}_bc )
endif( NOT FMOD_LIB_NAME AND BORLAND )
endif()
if( NOT FMOD_LIB_NAME )
set( FMOD_LIB_NAME fmodex${X64} )
endif( NOT FMOD_LIB_NAME )
endif()
# Search for FMOD library
if( WIN32 OR APPLE )
find_library( FMOD_LIBRARY ${FMOD_LIB_NAME}
PATHS ${FMOD_SEARCH_PATHS}
${FMOD_LIB_PATH_SUFFIXES} )
else( WIN32 OR APPLE )
else()
find_library( FMOD_LIBRARY
NAMES ${FMOD_VERSIONS}
PATHS ${FMOD_LOCAL_LIB_DIRS} )
endif( WIN32 OR APPLE )
endif()
if( FMOD_LIBRARY )
message( STATUS "FMOD library found at ${FMOD_LIBRARY}" )
set( ZDOOM_LIBS ${ZDOOM_LIBS} "${FMOD_LIBRARY}" )
else( FMOD_LIBRARY )
else()
message( STATUS "Could not find FMOD library" )
set( NO_FMOD ON )
endif( FMOD_LIBRARY )
endif( NOT NO_FMOD )
endif()
endif()
if( NO_FMOD )
add_definitions( -DNO_FMOD=1 )
endif( NO_FMOD )
endif()
if( NO_OPENAL )
add_definitions( -DNO_OPENAL=1 )
set(MPG123_FOUND NO)
set(SNDFILE_FOUND NO)
else( NO_OPENAL )
else()
# Search for libSndFile
find_package( SndFile )
@ -297,7 +297,7 @@ else( NO_OPENAL )
# Search for libmpg123
find_package( MPG123 )
endif( NO_OPENAL )
endif()
# Search for FluidSynth
@ -311,30 +311,30 @@ if( NOT NO_ASM )
if( GAS_PATH )
set( ASSEMBLER ${GAS_PATH} )
else( GAS_PATH )
else()
message( STATUS "Could not find as. Disabling assembly code." )
set( NO_ASM ON )
endif( GAS_PATH )
else( UNIX AND X64 )
endif()
else()
find_program( NASM_PATH NAMES ${NASM_NAMES} )
find_program( YASM_PATH yasm )
if( X64 )
if( YASM_PATH )
set( ASSEMBLER ${YASM_PATH} )
else( YASM_PATH )
else()
message( STATUS "Could not find YASM. Disabling assembly code." )
set( NO_ASM ON )
endif( YASM_PATH )
else( X64 )
endif()
else()
if( NASM_PATH )
set( ASSEMBLER ${NASM_PATH} )
else( NASM_PATH )
else()
message( STATUS "Could not find NASM. Disabling assembly code." )
set( NO_ASM ON )
endif( NASM_PATH )
endif( X64 )
endif( UNIX AND X64 )
endif()
endif()
endif()
# I think the only reason there was a version requirement was because the
# executable name for Windows changed from 0.x to 2.0, right? This is
@ -346,7 +346,7 @@ if( NOT NO_ASM )
# if( NOT NASM_VER LESS 2 )
# message( SEND_ERROR "NASM version should be 2 or later. (Installed version is ${NASM_VER}.)" )
# endif( NOT NASM_VER LESS 2 )
endif( NOT NO_ASM )
endif()
if( NOT NO_ASM )
# Valgrind support is meaningless without assembly code.
@ -354,7 +354,7 @@ if( NOT NO_ASM )
add_definitions( -DVALGRIND_AWARE=1 )
# If you're Valgrinding, you probably want to keep symbols around.
set( NO_STRIP ON )
endif( VALGRIND )
endif()
# Tell CMake how to assemble our files
if( UNIX )
@ -362,45 +362,45 @@ if( NOT NO_ASM )
if( X64 )
set( ASM_FLAGS )
set( ASM_SOURCE_EXTENSION .s )
else( X64 )
else()
if( APPLE )
set( ASM_FLAGS -fmacho -DM_TARGET_MACHO )
else( APPLE )
else()
set( ASM_FLAGS -felf -DM_TARGET_LINUX )
endif( APPLE )
endif()
set( ASM_FLAGS "${ASM_FLAGS}" -i${CMAKE_CURRENT_SOURCE_DIR}/ )
set( ASM_SOURCE_EXTENSION .asm )
endif( X64 )
else( UNIX )
endif()
else()
set( ASM_OUTPUT_EXTENSION .obj )
set( ASM_SOURCE_EXTENSION .asm )
if( X64 )
set( ASM_FLAGS -f win64 -DWIN32 -DWIN64 )
else( X64 )
else()
set( ASM_FLAGS -f win32 -DWIN32 -i${CMAKE_CURRENT_SOURCE_DIR}/ )
endif( X64 )
endif( UNIX )
endif()
endif()
if( WIN32 AND NOT X64 )
set( FIXRTEXT fixrtext )
else( WIN32 AND NOT X64 )
else()
set( FIXRTEXT "" )
endif( WIN32 AND NOT X64 )
endif()
message( STATUS "Selected assembler: ${ASSEMBLER}" )
MACRO( ADD_ASM_FILE indir infile )
set( ASM_OUTPUT_${infile} "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/zdoom.dir/${indir}/${infile}${ASM_OUTPUT_EXTENSION}" )
if( WIN32 AND NOT X64 )
set( FIXRTEXT_${infile} COMMAND ${FIXRTEXT} "${ASM_OUTPUT_${infile}}" )
else( WIN32 AND NOT X64 )
else()
set( FIXRTEXT_${infile} COMMAND "" )
endif( WIN32 AND NOT X64 )
endif()
add_custom_command( OUTPUT ${ASM_OUTPUT_${infile}}
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/zdoom.dir/${indir}
COMMAND ${ASSEMBLER} ${ASM_FLAGS} -o"${ASM_OUTPUT_${infile}}" "${CMAKE_CURRENT_SOURCE_DIR}/${indir}/${infile}${ASM_SOURCE_EXTENSION}"
${FIXRTEXT_${infile}}
DEPENDS ${indir}/${infile}.asm ${FIXRTEXT} )
set( ASM_SOURCES ${ASM_SOURCES} "${ASM_OUTPUT_${infile}}" )
ENDMACRO( ADD_ASM_FILE )
endif( NOT NO_ASM )
ENDMACRO()
endif()
# Decide on SSE setup
@ -420,25 +420,25 @@ if (NOT ZDOOM_USE_SSE2)
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" AND NOT CMAKE_OSX_ARCHITECTURES MATCHES ppc )
endif (NOT ZDOOM_USE_SSE2)
endif( )
endif()
endif()
if( SSE_MATTERS )
if( WIN32 )
set( BACKPATCH 1 CACHE BOOL "Enable backpatching." )
else( WIN32 )
else()
CHECK_FUNCTION_EXISTS(mprotect HAVE_MPROTECT)
if( HAVE_MPROTECT )
set( BACKPATCH 1 CACHE BOOL "Enable backpatching." )
else( HAVE_MPROTECT )
else()
set( BACKPATCH 0 )
endif( HAVE_MPROTECT )
endif( WIN32 )
endif()
endif()
set( SSE 1 CACHE BOOL "Build SSE and SSE2 versions of key code." )
else( SSE_MATTERS )
else()
set( BACKPATCH 0 )
endif( SSE_MATTERS )
endif()
# Set up flags for GCC
@ -448,21 +448,21 @@ if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pg" )
set( CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -pg" )
set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -pg" )
endif( PROFILE )
endif()
set( REL_CXX_FLAGS "-fno-rtti" )
if( NOT PROFILE AND NOT APPLE )
# On OS X frame pointers are required for exception handling, at least with Clang
set( REL_CXX_FLAGS "${REL_CXX_FLAGS} -fomit-frame-pointer" )
endif( NOT PROFILE AND NOT APPLE )
endif()
set( CMAKE_CXX_FLAGS_RELEASE "${REL_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}" )
set( CMAKE_CXX_FLAGS_MINSIZEREL "${REL_CXX_FLAGS} ${CMAKE_CXX_FLAGS_MINSIZEREL}" )
set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${REL_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" )
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "4.5")
set( CMAKE_C_FLAGS "-Wno-unused-result ${CMAKE_C_FLAGS}" )
set( CMAKE_C_FLAGS "-Wno-unused-result ${CMAKE_C_FLAGS}" )
set( CMAKE_CXX_FLAGS "-Wno-unused-result ${CMAKE_CXX_FLAGS}" )
endif(NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "4.5")
endif()
set( CMAKE_C_FLAGS "-Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-missing-field-initializers ${CMAKE_C_FLAGS}" )
set( CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-missing-field-initializers ${CMAKE_CXX_FLAGS}" )
@ -471,44 +471,44 @@ if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
# which is a royal pain. The previous version I had been using was fine with them.
if( WIN32 )
set( CMAKE_CXX_FLAGS "-Wno-unknown-pragmas -Wno-comment -Wno-format ${CMAKE_CXX_FLAGS}" )
endif( WIN32 )
endif()
if( NOT NO_STRIP )
set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -s" )
set (CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} -s" )
endif( NOT NO_STRIP )
endif( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
endif()
endif()
# Check for functions that may or may not exist.
CHECK_FUNCTION_EXISTS( filelength FILELENGTH_EXISTS )
if( FILELENGTH_EXISTS )
add_definitions( -DHAVE_FILELENGTH=1 )
endif( FILELENGTH_EXISTS )
endif()
CHECK_FUNCTION_EXISTS( strupr STRUPR_EXISTS )
if( NOT STRUPR_EXISTS )
add_definitions( -DNEED_STRUPR=1 )
endif( NOT STRUPR_EXISTS )
endif()
CHECK_FUNCTION_EXISTS( stricmp STRICMP_EXISTS )
if( NOT STRICMP_EXISTS )
add_definitions( -Dstricmp=strcasecmp )
endif( NOT STRICMP_EXISTS )
endif()
CHECK_FUNCTION_EXISTS( strnicmp STRNICMP_EXISTS )
if( NOT STRNICMP_EXISTS )
add_definitions( -Dstrnicmp=strncasecmp )
endif( NOT STRNICMP_EXISTS )
endif()
if( NOT MSVC )
add_definitions( -D__forceinline=inline )
endif( NOT MSVC )
endif()
# Fix stat in v140_xp (broken in RTM and Update 1 so far)
if( MSVC AND MSVC_VERSION EQUAL 1900 AND CMAKE_GENERATOR_TOOLSET STREQUAL "v140_xp" )
add_definitions( -D_stat64i32=VS14Stat )
endif( MSVC AND MSVC_VERSION EQUAL 1900 AND CMAKE_GENERATOR_TOOLSET STREQUAL "v140_xp" )
endif()
if( UNIX )
CHECK_LIBRARY_EXISTS( rt clock_gettime "" CLOCK_GETTIME_IN_RT )
@ -517,11 +517,11 @@ if( UNIX )
if( NOT CLOCK_GETTIME_EXISTS )
message( STATUS "Could not find clock_gettime. Timing statistics will not be available." )
add_definitions( -DNO_CLOCK_GETTIME )
endif( NOT CLOCK_GETTIME_EXISTS )
endif()
else( NOT CLOCK_GETTIME_IN_RT )
set( ZDOOM_LIBS ${ZDOOM_LIBS} rt )
endif( NOT CLOCK_GETTIME_IN_RT )
endif( UNIX )
endif()
endif()
CHECK_CXX_SOURCE_COMPILES(
"#include <stdarg.h>
@ -534,16 +534,16 @@ if( NOT HAS_VA_COPY )
HAS___VA_COPY )
if( HAS___VA_COPY )
add_definitions( -Dva_copy=__va_copy )
else( HAS___VA_COPY )
else()
add_definitions( -DNO_VA_COPY )
endif( HAS___VA_COPY )
endif( NOT HAS_VA_COPY )
endif()
endif()
# Flags
if( BACKPATCH )
add_definitions( -DBACKPATCH )
endif( BACKPATCH )
endif()
# Update gitinfo.h
@ -561,19 +561,19 @@ include_directories( "${ZLIB_INCLUDE_DIR}" "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUD
if( SNDFILE_FOUND )
set( ZDOOM_LIBS ${ZDOOM_LIBS} "${SNDFILE_LIBRARIES}" )
include_directories( "${SNDFILE_INCLUDE_DIRS}" )
endif( SNDFILE_FOUND )
endif()
if( MPG123_FOUND )
set( ZDOOM_LIBS ${ZDOOM_LIBS} "${MPG123_LIBRARIES}" )
include_directories( "${MPG123_INCLUDE_DIR}" )
endif( MPG123_FOUND )
endif()
if( NOT DYN_FLUIDSYNTH)
if( FLUIDSYNTH_FOUND )
set( ZDOOM_LIBS ${ZDOOM_LIBS} "${FLUIDSYNTH_LIBRARIES}" )
include_directories( "${FLUIDSYNTH_INCLUDE_DIR}" )
endif( FLUIDSYNTH_FOUND )
endif()
else( NOT DYN_FLUIDSYNTH )
set( ZDOOM_LIBS ${ZDOOM_LIBS} ${CMAKE_DL_LIBS} )
endif( NOT DYN_FLUIDSYNTH )
endif()
# Start defining source files for ZDoom
set( PLAT_WIN32_SOURCES
@ -636,48 +636,48 @@ if( WIN32 )
COMMAND windres -o zdoom-rc.o -i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zdoom.rc
DEPENDS win32/zdoom.rc )
set( SYSTEM_SOURCES ${SYSTEM_SOURCES} zdoom-rc.o )
else( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
else()
set( SYSTEM_SOURCES ${SYSTEM_SOURCES} win32/zdoom.rc )
endif( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
endif()
elseif( APPLE )
if( OSX_COCOA_BACKEND )
set( SYSTEM_SOURCES_DIR posix posix/cocoa )
set( SYSTEM_SOURCES ${PLAT_COCOA_SOURCES} )
set( OTHER_SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} ${PLAT_SDL_SOURCES} )
else( OSX_COCOA_BACKEND )
else()
set( SYSTEM_SOURCES_DIR posix posix/sdl )
set( SYSTEM_SOURCES ${PLAT_SDL_SOURCES} )
set( PLAT_OSX_SOURCES ${PLAT_OSX_SOURCES} posix/sdl/i_system.mm )
set( OTHER_SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} ${PLAT_COCOA_SOURCES} )
endif( OSX_COCOA_BACKEND )
endif()
set( SYSTEM_SOURCES ${SYSTEM_SOURCES} ${PLAT_POSIX_SOURCES} ${PLAT_OSX_SOURCES} "${FMOD_LIBRARY}" )
set_source_files_properties( posix/osx/zdoom.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources )
set_source_files_properties( "${FMOD_LIBRARY}" PROPERTIES MACOSX_PACKAGE_LOCATION Frameworks )
else( WIN32 )
else()
set( SYSTEM_SOURCES_DIR posix posix/sdl )
set( SYSTEM_SOURCES ${PLAT_POSIX_SOURCES} ${PLAT_SDL_SOURCES} )
set( OTHER_SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} ${PLAT_OSX_SOURCES} ${PLAT_COCOA_SOURCES} )
endif( WIN32 )
endif()
if( NOT ASM_SOURCES )
set( ASM_SOURCES "" )
endif( NOT ASM_SOURCES )
endif()
if( NO_ASM )
add_definitions( -DNOASM )
else( NO_ASM )
else()
if( X64 )
ADD_ASM_FILE( asm_x86_64 tmap3 )
else( X64 )
else()
ADD_ASM_FILE( asm_ia32 a )
ADD_ASM_FILE( asm_ia32 misc )
ADD_ASM_FILE( asm_ia32 tmap )
ADD_ASM_FILE( asm_ia32 tmap2 )
ADD_ASM_FILE( asm_ia32 tmap3 )
endif( X64 )
endif( NO_ASM )
endif()
endif()
add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/xlat_parser.c ${CMAKE_CURRENT_BINARY_DIR}/xlat_parser.h
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/xlat/xlat_parser.y .
@ -701,25 +701,25 @@ if( SSE_MATTERS )
if( SSE )
set( X86_SOURCES nodebuild_classify_sse2.cpp )
set_source_files_properties( nodebuild_classify_sse2.cpp PROPERTIES COMPILE_FLAGS "${SSE2_ENABLE}" )
else( SSE )
else()
add_definitions( -DDISABLE_SSE )
endif( SSE )
else( SSE_MATTERS )
endif()
else()
add_definitions( -DDISABLE_SSE )
set( X86_SOURCES )
endif( SSE_MATTERS )
endif()
if( SNDFILE_FOUND )
add_definitions( -DHAVE_SNDFILE )
endif( SNDFILE_FOUND )
endif()
if( MPG123_FOUND )
add_definitions( -DHAVE_MPG123 )
endif( MPG123_FOUND )
endif()
if( DYN_FLUIDSYNTH )
add_definitions( -DHAVE_FLUIDSYNTH -DDYN_FLUIDSYNTH )
elseif( FLUIDSYNTH_FOUND )
add_definitions( -DHAVE_FLUIDSYNTH )
endif( DYN_FLUIDSYNTH )
endif()
# Project files should be aware of the header files. We can GLOB these since
# there's generally a new cpp for every header so this file will get changed
@ -728,12 +728,12 @@ if( WIN32 )
elseif( APPLE )
if( OSX_COCOA_BACKEND )
set( EXTRA_HEADER_DIRS posix/*.h posix/cocoa/*.h )
else( OSX_COCOA_BACKEND )
else()
set( EXTRA_HEADER_DIRS posix/*.h posix/sdl/*.h )
endif( OSX_COCOA_BACKEND )
else( WIN32 )
endif()
else()
set( EXTRA_HEADER_DIRS posix/*.h posix/sdl/*.h )
endif( WIN32 )
endif()
file( GLOB HEADER_FILES
${EXTRA_HEADER_DIRS}
fragglescript/*.h
@ -1200,7 +1200,7 @@ set_source_files_properties( ${NOT_COMPILED_SOURCE_FILES} PROPERTIES HEADER_FILE
if(${CMAKE_SYSTEM_NAME} STREQUAL "SunOS")
# [BL] Solaris requires these to be explicitly linked.
set( ZDOOM_LIBS ${ZDOOM_LIBS} nsl socket)
endif(${CMAKE_SYSTEM_NAME} STREQUAL "SunOS")
endif()
target_link_libraries( zdoom ${ZDOOM_LIBS} gdtoa dumb lzma )
include_directories( .
@ -1225,12 +1225,12 @@ include_directories( .
add_dependencies( zdoom revision_check )
# Due to some quirks, we need to do this in this order
if( NOT ZDOOM_OUTPUT_OLDSTYLE OR NO_GENERATOR_EXPRESSIONS )
if( NOT ZDOOM_OUTPUT_OLDSTYLE )
# RUNTIME_OUTPUT_DIRECTORY does not exist in CMake 2.4.
# Linux distributions are slow to adopt 2.6. :(
set_target_properties( zdoom PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${ZDOOM_OUTPUT_DIR} )
set_target_properties( zdoom PROPERTIES OUTPUT_NAME ${ZDOOM_EXE_NAME} )
else( NOT ZDOOM_OUTPUT_OLDSTYLE OR NO_GENERATOR_EXPRESSIONS )
else()
set_target_properties( zdoom PROPERTIES
RUNTIME_OUTPUT_NAME ${ZDOOM_EXE_NAME}
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${ZDOOM_OUTPUT_DIR}
@ -1241,47 +1241,40 @@ else( NOT ZDOOM_OUTPUT_OLDSTYLE OR NO_GENERATOR_EXPRESSIONS )
RUNTIME_OUTPUT_NAME_RELWITHDEBINFO ${ZDOOM_EXE_NAME}rd
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${ZDOOM_OUTPUT_DIR}
)
endif( NOT ZDOOM_OUTPUT_OLDSTYLE OR NO_GENERATOR_EXPRESSIONS )
endif()
if( MSVC )
option( ZDOOM_GENERATE_MAPFILE "Generate .map file for debugging." OFF )
if( ZDOOM_GENERATE_MAPFILE )
set_target_properties(zdoom PROPERTIES LINK_FLAGS "/MANIFEST:NO /DELAYLOAD:\"fmodex${X64}.dll\" /DELAYLOAD:\"openal32.dll\" /DELAYLOAD:\"libmpg123-0.dll\" /DELAYLOAD:\"libsndfile-1.dll\" /MAP")
else( ZDOOM_GENERATE_MAPFILE )
else()
set_target_properties(zdoom PROPERTIES LINK_FLAGS "/MANIFEST:NO /DELAYLOAD:\"fmodex${X64}.dll\" /DELAYLOAD:\"openal32.dll\" /DELAYLOAD:\"libmpg123-0.dll\" /DELAYLOAD:\"libsndfile-1.dll\"")
endif( ZDOOM_GENERATE_MAPFILE )
endif()
if( NO_GENERATOR_EXPRESSIONS )
add_custom_command(TARGET zdoom POST_BUILD
COMMAND "mt.exe" -manifest \"${CMAKE_CURRENT_SOURCE_DIR}\\win32\\zdoom.exe.manifest\" -outputresource:\"$(TargetDir)$(TargetFileName)\"\;\#1
COMMENT "Adding manifest..."
)
else( NO_GENERATOR_EXPRESSIONS )
add_custom_command(TARGET zdoom POST_BUILD
COMMAND "mt.exe" -manifest \"${CMAKE_CURRENT_SOURCE_DIR}\\win32\\zdoom.exe.manifest\" -outputresource:\"$<TARGET_FILE:zdoom>\"\;\#1
COMMENT "Adding manifest..."
)
endif( NO_GENERATOR_EXPRESSIONS )
add_custom_command(TARGET zdoom POST_BUILD
COMMAND "mt.exe" -manifest \"${CMAKE_CURRENT_SOURCE_DIR}\\win32\\zdoom.exe.manifest\" -outputresource:\"$<TARGET_FILE:zdoom>\"\;\#1
COMMENT "Adding manifest..."
)
create_default_target_launcher( zdoom WORKING_DIRECTORY ${ZDOOM_OUTPUT_DIR} )
endif( MSVC )
endif()
if( NOT WIN32 )
FILE( WRITE ${CMAKE_CURRENT_BINARY_DIR}/link-make "if [ ! -e ${ZDOOM_OUTPUT_DIR}/${ZDOOM_EXE_NAME} ]; then ln -sf ${CMAKE_CURRENT_BINARY_DIR}/${ZDOOM_EXE_NAME} ${ZDOOM_OUTPUT_DIR}/${ZDOOM_EXE_NAME}; fi" )
add_custom_command( TARGET zdoom POST_BUILD
COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/link-make
COMMAND /bin/sh -c ${CMAKE_CURRENT_BINARY_DIR}/link-make )
endif( NOT WIN32 )
endif()
if( CMAKE_COMPILER_IS_GNUCXX )
# GCC misoptimizes this file
set_source_files_properties( oplsynth/fmopl.cpp PROPERTIES COMPILE_FLAGS "-fno-tree-dominator-opts -fno-tree-fre" )
endif( CMAKE_COMPILER_IS_GNUCXX )
endif()
if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
# Need to enable intrinsics for this file.
if( SSE_MATTERS )
set_source_files_properties( x86.cpp PROPERTIES COMPILE_FLAGS "-msse2 -mmmx" )
endif( SSE_MATTERS )
endif( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
endif()
endif()
if( APPLE )
set_target_properties(zdoom PROPERTIES
@ -1301,8 +1294,8 @@ if( APPLE )
add_custom_command( TARGET zdoom POST_BUILD
COMMAND "${INSTALL_NAME_TOOL}" -change "${FMOD_LINK}" @executable_path/../Frameworks/libfmodex.dylib "$<TARGET_FILE:zdoom>"
COMMENT "Relinking FMOD Ex" )
endif( NOT NO_FMOD )
endif( APPLE )
endif()
endif()
source_group("Assembly Files\\ia32" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/asm_ia32/.+")
source_group("Assembly Files\\x86_64" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/asm_x86_64/.+")

View file

@ -1,10 +1,10 @@
cmake_minimum_required( VERSION 2.4 )
cmake_minimum_required( VERSION 2.8.7 )
add_subdirectory( lemon )
add_subdirectory( re2c )
if( WIN32 AND NOT CMAKE_SIZEOF_VOID_P MATCHES "8" )
add_subdirectory( fixrtext )
endif( WIN32 AND NOT CMAKE_SIZEOF_VOID_P MATCHES "8" )
endif()
add_subdirectory( updaterevision )
add_subdirectory( zipdir )

View file

@ -1,6 +1,6 @@
cmake_minimum_required( VERSION 2.4 )
cmake_minimum_required( VERSION 2.8.7 )
if( NOT CMAKE_CROSSCOMPILING )
add_executable( fixrtext fixrtext.c )
set( CROSS_EXPORTS ${CROSS_EXPORTS} fixrtext PARENT_SCOPE )
endif( NOT CMAKE_CROSSCOMPILING )
endif()

View file

@ -1,20 +1,14 @@
cmake_minimum_required( VERSION 2.4 )
cmake_minimum_required( VERSION 2.8.7 )
if( NOT CMAKE_CROSSCOMPILING )
set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG" )
add_executable( lemon lemon.c )
set( CROSS_EXPORTS ${CROSS_EXPORTS} lemon PARENT_SCOPE )
endif( NOT CMAKE_CROSSCOMPILING )
endif()
# Lemon wants lempar.c in its directory
if( NOT NO_GENERATOR_EXPRESSIONS )
add_custom_command( TARGET lemon
POST_BUILD
COMMAND echo $<TARGET_FILE_DIR:lemon>
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/lempar.c $<TARGET_FILE_DIR:lemon> )
else( NOT NO_GENERATOR_EXPRESSIONS )
add_custom_command( TARGET lemon
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/lempar.c ${CMAKE_CURRENT_BINARY_DIR} )
endif( NOT NO_GENERATOR_EXPRESSIONS )

View file

@ -1,4 +1,4 @@
cmake_minimum_required( VERSION 2.4 )
cmake_minimum_required( VERSION 2.8.7 )
if( NOT CMAKE_CROSSCOMPILING )
@ -36,4 +36,4 @@ add_executable( re2c
set( CROSS_EXPORTS ${CROSS_EXPORTS} re2c PARENT_SCOPE )
endif( NOT CMAKE_CROSSCOMPILING )
endif()

View file

@ -1,4 +1,4 @@
cmake_minimum_required( VERSION 2.4 )
cmake_minimum_required( VERSION 2.8.7 )
if( WIN32 )
if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE OR ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
@ -6,7 +6,7 @@ if( WIN32 )
COMMAND windres -o ${CMAKE_CURRENT_BINARY_DIR}/trustinfo.o -i ${CMAKE_CURRENT_SOURCE_DIR}/trustinfo.rc
DEPENDS trustinfo.rc )
set( TRUSTINFO trustinfo.o )
else( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE OR ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
else()
if( MSVC_VERSION GREATER 1399 )
# VC 8+ adds a manifest automatically to the executable. We need to
# merge ours with it.
@ -14,18 +14,18 @@ if( WIN32 )
else( MSVC_VERSION GREATER 1399 )
set( TRUSTINFO trustinfo.rc )
endif( MSVC_VERSION GREATER 1399 )
endif( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE OR ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
endif()
else( WIN32 )
set( TRUSTINFO "" )
endif( WIN32 )
endif()
if( NOT CMAKE_CROSSCOMPILING )
add_executable( updaterevision updaterevision.c ${TRUSTINFO} )
set( CROSS_EXPORTS ${CROSS_EXPORTS} updaterevision PARENT_SCOPE )
endif( NOT CMAKE_CROSSCOMPILING )
endif()
if( MT_MERGE )
add_custom_command(TARGET updaterevision POST_BUILD
COMMAND mt -inputresource:$<TARGET_FILE:updaterevision> -manifest ${CMAKE_CURRENT_SOURCE_DIR}/trustinfo.txt -outputresource:$<TARGET_FILE:updaterevision> -nologo
COMMENT "Embedding trustinfo into updaterevision" )
endif( MT_MERGE )
endif()

View file

@ -1,4 +1,4 @@
cmake_minimum_required( VERSION 2.4 )
cmake_minimum_required( VERSION 2.8.7 )
if(NOT CMAKE_CROSSCOMPILING)
message(STATUS "${ZLIB_INCLUDE_DIR}" )
@ -9,4 +9,4 @@ if(NOT CMAKE_CROSSCOMPILING)
zipdir.c )
target_link_libraries( zipdir ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES} lzma )
set( CROSS_EXPORTS ${CROSS_EXPORTS} zipdir PARENT_SCOPE )
endif(NOT CMAKE_CROSSCOMPILING)
endif()

View file

@ -1,3 +1,3 @@
cmake_minimum_required( VERSION 2.4 )
cmake_minimum_required( VERSION 2.8.7 )
add_pk3(zdoom.pk3 ${CMAKE_CURRENT_SOURCE_DIR}/static)

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.4.4)
cmake_minimum_required(VERSION 2.8.7)
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
make_release_only()
@ -135,7 +135,7 @@ if(MINGW)
-o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj
-i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc)
set(ZLIB_SRCS ${ZLIB_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj)
endif(MINGW)
endif()
add_library(${ZLIBNAME} ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
set_target_properties(${ZLIBNAME} PROPERTIES DEFINE_SYMBOL ZLIB_DLL)