From b9a1528747b5d98af77070518f2027612efdbd37 Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Thu, 10 Oct 2013 17:40:15 -0700 Subject: [PATCH] - DYN_FLUIDSYNTH now defaults to ON. - Added ZDOOM_OUTPUT_OLDSTYLE (could probably use a more descriptive name) which causes CMake to vary the executable name by build type and place the exes and pk3s into the directory specified in ZDOOM_OUTPUT_DIR. - ALL_BUILD will now launch ZDoom. --- CMakeLists.txt | 16 +- CleanDirectoryList.cmake | 48 +++ CreateLaunchers.cmake | 336 +++++++++++++++++++ launcher-templates/genericlauncher.cmd.in | 14 + launcher-templates/launcher.env.cmd.in | 1 + launcher-templates/perconfig.vcproj.user.in | 28 ++ launcher-templates/perconfig.vcxproj.user.in | 7 + launcher-templates/targetlauncher.cmd.in | 8 + launcher-templates/vcproj.user.in | 10 + launcher-templates/vcxproj.user.in | 4 + src/CMakeLists.txt | 40 ++- 11 files changed, 496 insertions(+), 16 deletions(-) create mode 100644 CleanDirectoryList.cmake create mode 100644 CreateLaunchers.cmake create mode 100644 launcher-templates/genericlauncher.cmd.in create mode 100644 launcher-templates/launcher.env.cmd.in create mode 100644 launcher-templates/perconfig.vcproj.user.in create mode 100644 launcher-templates/perconfig.vcxproj.user.in create mode 100644 launcher-templates/targetlauncher.cmd.in create mode 100644 launcher-templates/vcproj.user.in create mode 100644 launcher-templates/vcxproj.user.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 087535b69..ecb4a5be7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,9 @@ cmake_minimum_required( VERSION 2.4 ) project(ZDoom) +list( APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ) +include( CreateLaunchers ) + # 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) @@ -19,16 +22,16 @@ function( add_pk3 PK3_NAME PK3_DIR ) set( PK3_TARGET "pk3" ) endif( ${PK3_TARGET} STREQUAL "zdoom_pk3" ) - if( NOT NO_GENERATOR_EXPRESSIONS ) + if( NOT NO_GENERATOR_EXPRESSIONS AND NOT ZDOOM_OUTPUT_OLDSTYLE ) add_custom_command( OUTPUT ${ZDOOM_OUTPUT_DIR}/${PK3_NAME} COMMAND ${ZIPDIR_EXE} -udf ${ZDOOM_OUTPUT_DIR}/${PK3_NAME} ${PK3_DIR} COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ZDOOM_OUTPUT_DIR}/${PK3_NAME} $ DEPENDS zipdir ${PK3_DIR} ) - else( NOT NO_GENERATOR_EXPRESSIONS ) + else( NOT NO_GENERATOR_EXPRESSIONS AND NOT ZDOOM_OUTPUT_OLDSTYLE ) add_custom_command( OUTPUT ${ZDOOM_OUTPUT_DIR}/${PK3_NAME} COMMAND ${ZIPDIR_EXE} -udf ${ZDOOM_OUTPUT_DIR}/${PK3_NAME} ${PK3_DIR} DEPENDS zipdir ${PK3_DIR} ) - endif( NOT NO_GENERATOR_EXPRESSIONS ) + endif( NOT NO_GENERATOR_EXPRESSIONS AND NOT ZDOOM_OUTPUT_OLDSTYLE ) add_custom_target( ${PK3_TARGET} ALL DEPENDS ${ZDOOM_OUTPUT_DIR}/${PK3_NAME} ) @@ -42,6 +45,13 @@ ENDIF( NOT CMAKE_BUILD_TYPE ) 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." ) +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 ) + set( ZDOOM_OUTPUT_OLDSTYLE OFF ) +endif( MSVC ) if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) set( PROFILE 0 CACHE BOOL "Enable profiling with gprof for Debug and RelWithDebInfo build types." ) diff --git a/CleanDirectoryList.cmake b/CleanDirectoryList.cmake new file mode 100644 index 000000000..58b8963f9 --- /dev/null +++ b/CleanDirectoryList.cmake @@ -0,0 +1,48 @@ +# - Removes duplicate entries and non-directories from a provided list +# +# clean_directory_list( [...]) +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010. +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(__clean_directory_list) + return() +endif() +set(__clean_directory_list YES) + +function(clean_directory_list _var) + # combine variable's current value with additional list items + set(_in ${${_var}} ${ARGN}) + + if(_in) + # Initial list cleaning + list(REMOVE_DUPLICATES _in) + + # Grab the absolute path of each actual directory + set(_out) + foreach(_dir ${_in}) + if(IS_DIRECTORY "${_dir}") + get_filename_component(_dir "${_dir}" ABSOLUTE) + file(TO_CMAKE_PATH "${_dir}" _dir) + list(APPEND _out "${_dir}") + endif() + endforeach() + + if(_out) + # Clean up the output list now + list(REMOVE_DUPLICATES _out) + endif() + + # return _out + set(${_var} "${_out}" PARENT_SCOPE) + endif() +endfunction() diff --git a/CreateLaunchers.cmake b/CreateLaunchers.cmake new file mode 100644 index 000000000..8acca1c17 --- /dev/null +++ b/CreateLaunchers.cmake @@ -0,0 +1,336 @@ +# - Create launchers to set working directory, env. vars, etc. +# +# include(CreateLaunchers) - to make these available +# guess_runtime_library_dirs( [ ...]) +# create_default_target_launcher( +# [ARGS ] +# [FORWARD_ARGS] +# [RUNTIME_LIBRARY_DIRS ] +# [WORKING_DIRECTORY ] +# [ENVIRONMENT [...]]) +# +# create_target_launcher( +# [ARGS ] +# [FORWARD_ARGS] +# [RUNTIME_LIBRARY_DIRS ] +# [WORKING_DIRECTORY ] +# [ENVIRONMENT [...]]) +# +# create_generic_launcher( +# [RUNTIME_LIBRARY_DIRS ] +# [WORKING_DIRECTORY ] +# [ENVIRONMENT [...]]) +# - sets GENERIC_LAUNCHER_COMMAND and GENERIC_LAUNCHER_FAIL_REGULAR_EXPRESSION +# +# Requires these CMake modules: +# ListFilter +# ProgramFilesGlob +# CleanDirectoryList +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010. +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(__create_launchers) + return() +endif() +set(__create_launchers YES) + +include(CleanDirectoryList) + +# We must run the following at "include" time, not at function call time, +# to find the path to this module rather than the path to a calling list file +get_filename_component(_launchermoddir + ${CMAKE_CURRENT_LIST_FILE} + PATH) +set(_launchermoddir "${_launchermoddir}/launcher-templates") + +macro(_launcher_system_settings) + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(BITS 64) + else() + set(BITS 32) + endif() + + if(WIN32) + # Find user and system name + set(SYSTEM_NAME $ENV{USERDOMAIN}) + set(USER_NAME $ENV{USERNAME}) + set(VCPROJ_TYPE vcproj) + set(USERFILE_EXTENSION ${SYSTEM_NAME}.${USER_NAME}.user) + set(LAUNCHER_LINESEP " ") + if(MSVC90) + set(USERFILE_VC_VERSION 9.00) + elseif(MSVC80) + set(USERFILE_VC_VERSION 8.00) + elseif(MSVC71) + set(USERFILE_VC_VERSION 7.10) + elseif(MSVC10 OR (MSVC AND MSVC_VERSION GREATER 1600)) # 2010 or newer + set(LAUNCHER_LINESEP "\n") + set(USERFILE_VC_VERSION 10.00) + set(USERFILE_EXTENSION user) + set(VCPROJ_TYPE vcxproj) + endif() + if(BITS EQUAL 64) + set(USERFILE_PLATFORM x64) + else() + set(USERFILE_PLATFORM Win${BITS}) + endif() + set(_pathdelim ";") + set(_suffix "cmd") + else() + set(_pathdelim ":") + set(USERFILE_PLATFORM ${CMAKE_SYSTEM_NAME}${BITS}) + set(_suffix "sh") + find_package(GDB QUIET) + if(GDB_FOUND) + set(LAUNCHERS_GOT_GDB YES) + if(GDB_HAS_RETURN_CHILD_RESULT) + set(LAUNCHERS_GDB_ARG --return-child-result) + endif() + else() + set(LAUNCHERS_GOT_GDB) + endif() + endif() + + if(WIN32 AND NOT USERFILE_REMOTE_MACHINE) + site_name(USERFILE_REMOTE_MACHINE) + mark_as_advanced(USERFILE_REMOTE_MACHINE) + endif() +endmacro() + +macro(_launcher_process_args) + set(_nowhere) + set(_curdest _nowhere) + set(_val_args + ARGS + RUNTIME_LIBRARY_DIRS + WORKING_DIRECTORY + ENVIRONMENT) + set(_bool_args FORWARD_ARGS) + foreach(_arg ${_val_args} ${_bool_args}) + set(${_arg}) + endforeach() + foreach(_element ${ARGN}) + list(FIND _val_args "${_element}" _val_arg_find) + list(FIND _bool_args "${_element}" _bool_arg_find) + if("${_val_arg_find}" GREATER "-1") + set(_curdest "${_element}") + elseif("${_bool_arg_find}" GREATER "-1") + set("${_element}" ON) + set(_curdest _nowhere) + else() + list(APPEND ${_curdest} "${_element}") + endif() + endforeach() + + if(_nowhere) + message(FATAL_ERROR + "Syntax error in use of a function in CreateLaunchers!") + endif() + + # Turn into a list of native paths + set(_runtime_lib_dirs) + foreach(_dlldir ${RUNTIME_LIBRARY_DIRS}) + file(TO_NATIVE_PATH "${_dlldir}" _path) + set(_runtime_lib_dirs "${_runtime_lib_dirs}${_path}${_pathdelim}") + endforeach() + + if(NOT WORKING_DIRECTORY) + set(WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") + endif() + + if(FORWARD_ARGS) + if(WIN32) + set(FWD_ARGS %*) + else() + set(FWD_ARGS $*) + endif() + else() + set(FWD_ARGS) + endif() + + set(USERFILE_WORKING_DIRECTORY "${WORKING_DIRECTORY}") + set(USERFILE_COMMAND_ARGUMENTS "${ARGS}") + set(LAUNCHERSCRIPT_COMMAND_ARGUMENTS "${ARGS} ${FWD_ARGS}") + + if(WIN32) + set(RUNTIME_LIBRARIES_ENVIRONMENT "PATH=${_runtime_lib_dirs};%PATH%") + file(READ + "${_launchermoddir}/launcher.env.cmd.in" + _cmdenv) + else() + if(APPLE) + set(RUNTIME_LIBRARIES_ENVIRONMENT + "DYLD_LIBRARY_PATH=${_runtime_lib_dirs}:$DYLD_LIBRARY_PATH") + else() + set(RUNTIME_LIBRARIES_ENVIRONMENT + "LD_LIBRARY_PATH=${_runtime_lib_dirs}:$LD_LIBRARY_PATH") + endif() + file(READ + "${_launchermoddir}/launcher.env.sh.in" + _cmdenv) + endif() + set(USERFILE_ENVIRONMENT "${RUNTIME_LIBRARIES_ENVIRONMENT}") + + set(USERFILE_ENV_COMMANDS) + foreach(_arg "${RUNTIME_LIBRARIES_ENVIRONMENT}" ${ENVIRONMENT}) + string(CONFIGURE + "@USERFILE_ENVIRONMENT@@LAUNCHER_LINESEP@@_arg@" + USERFILE_ENVIRONMENT + @ONLY) + string(CONFIGURE + "@USERFILE_ENV_COMMANDS@${_cmdenv}" + USERFILE_ENV_COMMANDS + @ONLY) + endforeach() +endmacro() + +macro(_launcher_produce_vcproj_user) + if(MSVC) + file(READ + "${_launchermoddir}/perconfig.${VCPROJ_TYPE}.user.in" + _perconfig) + set(USERFILE_CONFIGSECTIONS) + foreach(USERFILE_CONFIGNAME ${CMAKE_CONFIGURATION_TYPES}) + get_target_property(USERFILE_${USERFILE_CONFIGNAME}_COMMAND + ${_targetname} + LOCATION_${USERFILE_CONFIGNAME}) + file(TO_NATIVE_PATH + "${USERFILE_${USERFILE_CONFIGNAME}_COMMAND}" + USERFILE_${USERFILE_CONFIGNAME}_COMMAND) + string(CONFIGURE "${_perconfig}" _temp @ONLY ESCAPE_QUOTES) + string(CONFIGURE + "${USERFILE_CONFIGSECTIONS}${_temp}" + USERFILE_CONFIGSECTIONS + ESCAPE_QUOTES) + endforeach() + + + configure_file("${_launchermoddir}/${VCPROJ_TYPE}.user.in" + ${VCPROJNAME}.${VCPROJ_TYPE}.${USERFILE_EXTENSION} + @ONLY) + endif() + +endmacro() + +macro(_launcher_configure_executable _src _tmp _target) +# get_filename_component(_targetname "${_target}" NAME) + get_filename_component(_targetpath "${_target}" PATH) + configure_file("${_src}" + "${_tmp}" + @ONLY) + file(COPY "${_tmp}" + DESTINATION "${_targetpath}" + FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) +endmacro() + +macro(_launcher_create_target_launcher) + if(CMAKE_CONFIGURATION_TYPES) + # Multi-config generator - multiple launchers + foreach(_config ${CMAKE_CONFIGURATION_TYPES}) + get_target_property(USERFILE_${_config}_COMMAND + ${_targetname} + LOCATION_${_config}) + file(TO_NATIVE_PATH + "${USERFILE_${_config}_COMMAND}" + USERFILE_COMMAND) + set(_fn "launch-${_targetname}-${_config}.${_suffix}") + _launcher_configure_executable("${_launchermoddir}/targetlauncher.${_suffix}.in" + "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${_fn}" + "${CMAKE_CURRENT_BINARY_DIR}/${_fn}") + endforeach() + else() + # Single-config generator - single launcher + get_target_property(USERFILE_COMMAND + ${_targetname} + LOCATION) + file(TO_NATIVE_PATH + "${USERFILE_COMMAND}" + USERFILE_COMMAND) + _launcher_configure_executable("${_launchermoddir}/targetlauncher.${_suffix}.in" + "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/launch-${_targetname}.${_suffix}" + "${CMAKE_CURRENT_BINARY_DIR}/launch-${_targetname}.${_suffix}" + @ONLY) + endif() +endmacro() + +function(create_default_target_launcher _targetname) + _launcher_system_settings() + _launcher_process_args(${ARGN}) + + set(VCPROJNAME "${CMAKE_BINARY_DIR}/ALL_BUILD") + _launcher_produce_vcproj_user() + + _launcher_create_target_launcher() +endfunction() + +function(create_target_launcher _targetname) + _launcher_system_settings() + _launcher_process_args(${ARGN}) + + set(VCPROJNAME "${CMAKE_CURRENT_BINARY_DIR}/${_targetname}") + _launcher_produce_vcproj_user() + + _launcher_create_target_launcher() +endfunction() + +function(create_generic_launcher _launchername) + _launcher_system_settings() + _launcher_process_args(${ARGN}) + + if(NOT IS_ABSOLUTE _launchername) + set(_launchername + "${CMAKE_CURRENT_BINARY_DIR}/${_launchername}.${_suffix}") + else() + set(_launchername "${_launchername}.${_suffix}") + endif() + if(WIN32) + set(GENERIC_LAUNCHER_COMMAND "${_launchername}" PARENT_SCOPE) + set(GENERIC_LAUNCHER_FAIL_REGULAR_EXPRESSION) + else() + set(GENERIC_LAUNCHER_COMMAND sh "${_launchername}" PARENT_SCOPE) + set(GENERIC_LAUNCHER_FAIL_REGULAR_EXPRESSION + "Program terminated with signal") + endif() + + _launcher_configure_executable("${_launchermoddir}/genericlauncher.${_suffix}.in" + "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/genericlauncher.${_suffix}.in" + "${_launchername}") +endfunction() + +function(guess_runtime_library_dirs _var) + # Start off with the link directories of the calling listfile's directory + get_directory_property(_libdirs LINK_DIRECTORIES) + + # Add additional libraries passed to the function + foreach(_lib ${ARGN}) + get_filename_component(_libdir "${_lib}" PATH) + list(APPEND _libdirs "${_libdir}") + endforeach() + + # Now, build a list of potential dll directories + set(_dlldirs) + foreach(_libdir ${_libdirs}) + # Add the libdir itself + list(APPEND _dlldirs "${_libdir}") + + # Look also in libdir/../bin since the dll might not be with the lib + get_filename_component(_libdir "${_libdir}/../bin" ABSOLUTE) + list(APPEND _dlldirs "${_libdir}") + endforeach() + + # Only keep the valid, unique directories + clean_directory_list(_dlldirs) + + # Return _dlldirs + set(${_var} "${_dlldirs}" PARENT_SCOPE) +endfunction() diff --git a/launcher-templates/genericlauncher.cmd.in b/launcher-templates/genericlauncher.cmd.in new file mode 100644 index 000000000..9a19bbc7a --- /dev/null +++ b/launcher-templates/genericlauncher.cmd.in @@ -0,0 +1,14 @@ +cd @USERFILE_WORKING_DIRECTORY@ +@USERFILE_ENV_COMMANDS@ + +IF NOT [x%1]==[x--debugger] GOTO SkipDebuggingMess + +ECHO Need to ditch the debugger! +SHIFT /1 +%1 %2 %3 %4 %5 %6 %7 %8 %9 +GOTO EOF + +:SkipDebuggingMess +%* + +:EOF \ No newline at end of file diff --git a/launcher-templates/launcher.env.cmd.in b/launcher-templates/launcher.env.cmd.in new file mode 100644 index 000000000..72a24e67e --- /dev/null +++ b/launcher-templates/launcher.env.cmd.in @@ -0,0 +1 @@ +set @_arg@ diff --git a/launcher-templates/perconfig.vcproj.user.in b/launcher-templates/perconfig.vcproj.user.in new file mode 100644 index 000000000..95cacecff --- /dev/null +++ b/launcher-templates/perconfig.vcproj.user.in @@ -0,0 +1,28 @@ + + + diff --git a/launcher-templates/perconfig.vcxproj.user.in b/launcher-templates/perconfig.vcxproj.user.in new file mode 100644 index 000000000..ef0237999 --- /dev/null +++ b/launcher-templates/perconfig.vcxproj.user.in @@ -0,0 +1,7 @@ + + @USERFILE_ENVIRONMENT@ + WindowsLocalDebugger + ${USERFILE_@USERFILE_CONFIGNAME@_COMMAND} + @USERFILE_COMMAND_ARGUMENTS@ + @USERFILE_WORKING_DIRECTORY@ + diff --git a/launcher-templates/targetlauncher.cmd.in b/launcher-templates/targetlauncher.cmd.in new file mode 100644 index 000000000..c5715d679 --- /dev/null +++ b/launcher-templates/targetlauncher.cmd.in @@ -0,0 +1,8 @@ +cd @USERFILE_WORKING_DIRECTORY@ +@USERFILE_ENV_COMMANDS@ +if [%1]==[--debugger] ( + SHIFT +) + +"@USERFILE_COMMAND@" @LAUNCHERSCRIPT_COMMAND_ARGUMENTS@ +pause diff --git a/launcher-templates/vcproj.user.in b/launcher-templates/vcproj.user.in new file mode 100644 index 000000000..117473d70 --- /dev/null +++ b/launcher-templates/vcproj.user.in @@ -0,0 +1,10 @@ + + + +@USERFILE_CONFIGSECTIONS@ + + diff --git a/launcher-templates/vcxproj.user.in b/launcher-templates/vcxproj.user.in new file mode 100644 index 000000000..f3e423835 --- /dev/null +++ b/launcher-templates/vcxproj.user.in @@ -0,0 +1,4 @@ + + +@USERFILE_CONFIGSECTIONS@ + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 464d6db97..7c6820423 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -24,7 +24,7 @@ if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STRE endif( APPLE ) endif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) -option( DYN_FLUIDSYNTH "Dynamically load fluidsynth" ) +option( DYN_FLUIDSYNTH "Dynamically load fluidsynth" ON ) if( CMAKE_SIZEOF_VOID_P MATCHES "8" ) set( X64 64 ) @@ -1087,10 +1087,32 @@ include_directories( . add_dependencies( zdoom revision_check ) -# 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} ) +if( MSVC ) + set_target_properties(zdoom PROPERTIES LINK_FLAGS "/MANIFEST:NO") + add_custom_command(TARGET zdoom POST_BUILD + COMMAND "mt.exe" -manifest \"${CMAKE_CURRENT_SOURCE_DIR}\\win32\\zdoom.exe.manifest\" -outputresource:\"$(TargetDir)$(TargetFileName)\"\;\#2 + COMMENT "Adding manifest..." + ) + + create_default_target_launcher( zdoom WORKING_DIRECTORY ${ZDOOM_OUTPUT_DIR} ) +endif( MSVC ) + +if( ZDOOM_OUTPUT_OLDSTYLE AND NOT NO_GENERATOR_EXPRESSION ) + set_target_properties( zdoom PROPERTIES + RUNTIME_OUTPUT_NAME ${ZDOOM_EXE_NAME} + RUNTIME_OUTPUT_NAME_DEBUG ${ZDOOM_EXE_NAME}d + RUNTIME_OUTPUT_NAME_MINSIZEREL ${ZDOOM_EXE_NAME}msr + RUNTIME_OUTPUT_NAME_RELWITHDEBINFO ${ZDOOM_EXE_NAME}rd + ) + add_custom_command(TARGET zdoom POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different $ ${ZDOOM_OUTPUT_DIR}/$ + COMMENT "Copying to output directory..." ) +else( ZDOOM_OUTPUT_OLDSTYLE AND NOT NO_GENERATOR_EXPRESSION ) + # 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} ) +endif( ZDOOM_OUTPUT_OLDSTYLE AND NOT NO_GENERATOR_EXPRESSION ) 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" ) @@ -1108,14 +1130,6 @@ if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STRE endif( SSE_MATTERS ) endif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) -if( MSVC ) - set_target_properties(zdoom PROPERTIES LINK_FLAGS "/MANIFEST:NO") - add_custom_command(TARGET zdoom POST_BUILD - COMMAND "mt.exe" -manifest \"${CMAKE_CURRENT_SOURCE_DIR}\\win32\\zdoom.exe.manifest\" -outputresource:\"$(TargetDir)$(TargetFileName)\"\;\#2 - COMMENT "Adding manifest..." - ) -endif( MSVC ) - 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/.+") source_group("Audio Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sound/.+")