- Added support for Visual Studio to the CMake project.

SVN r4166 (trunk)
This commit is contained in:
Braden Obrzut 2013-02-25 00:12:21 +00:00
parent e6f66e3c93
commit 01fed92920
4 changed files with 51 additions and 7 deletions

View file

@ -1,4 +1,5 @@
cmake_minimum_required( VERSION 2.4 )
project(ZDoom)
IF( NOT CMAKE_BUILD_TYPE )
SET( CMAKE_BUILD_TYPE Debug CACHE STRING

View file

@ -485,8 +485,10 @@ endif( BACKPATCH )
# Update svnrevision.h
get_target_property( UPDATEREVISION_EXE updaterevision LOCATION )
add_custom_target( revision_check ALL
COMMAND ${CMAKE_BINARY_DIR}/tools/updaterevision/updaterevision . src/svnrevision.h
COMMAND ${UPDATEREVISION_EXE} . src/svnrevision.h
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
DEPENDS updaterevision )
@ -568,14 +570,17 @@ else( NO_ASM )
endif( X64 )
endif( NO_ASM )
get_target_property( LEMON_EXE lemon LOCATION )
get_target_property( RE2C_EXE re2c LOCATION )
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 .
COMMAND ${CMAKE_BINARY_DIR}/tools/lemon/lemon xlat_parser.y
COMMAND ${LEMON_EXE} xlat_parser.y
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS lemon ${CMAKE_CURRENT_SOURCE_DIR}/xlat/xlat_parser.y )
add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sc_man_scanner.h
COMMAND ${CMAKE_BINARY_DIR}/tools/re2c/re2c --no-generation-date -s -o ${CMAKE_CURRENT_BINARY_DIR}/sc_man_scanner.h ${CMAKE_CURRENT_SOURCE_DIR}/sc_man_scanner.re
COMMAND ${RE2C_EXE} --no-generation-date -s -o ${CMAKE_CURRENT_BINARY_DIR}/sc_man_scanner.h ${CMAKE_CURRENT_SOURCE_DIR}/sc_man_scanner.re
DEPENDS re2c ${CMAKE_CURRENT_SOURCE_DIR}/sc_man_scanner.re )
include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
@ -598,7 +603,37 @@ elseif( FLUIDSYNTH_FOUND )
add_definitions( -DHAVE_FLUIDSYNTH )
endif( DYN_FLUIDSYNTH )
# 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
if( WIN32 )
set( EXTRA_HEADER_DIRS win32/*.h )
else( WIN32 )
set( EXTRA_HEADER_DIRS sdl/*.h )
endif( WIN32 )
file( GLOB HEADER_FILES
${EXTRA_HEADER_DIRS}
fragglescript/*.h
g_doom/*.h
g_heretic/*.h
g_hexen/*.h
g_raven/*.h
g_shared/*.h
g_strife/*.h
intermission/*.h
menu/*.h
oplsynth/*.h
r_data/*.h
resourcefiles/*.h
sfmt/*.h
sound/*.h
textures/*.h
thingdef/*.h
xlat/*.h
*.h
)
add_executable( zdoom WIN32
${HEADER_FILES}
autostart.cpp
${ASM_SOURCES}
${SYSTEM_SOURCES}

View file

@ -5,6 +5,13 @@ set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG" )
add_executable( lemon lemon.c )
# Lemon wants lempar.c in its directory
if( MSVC )
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( MSVC )
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( MSVC )

View file

@ -1,8 +1,9 @@
cmake_minimum_required( VERSION 2.4 )
get_target_property(ZIPDIR_EXE zipdir LOCATION)
add_custom_command( OUTPUT ${ZDOOM_OUTPUT_DIR}/zdoom.pk3
COMMAND ${CMAKE_BINARY_DIR}/tools/zipdir/zipdir -udf ${ZDOOM_OUTPUT_DIR}/zdoom.pk3 ${CMAKE_CURRENT_SOURCE_DIR}/static
COMMAND ${ZIPDIR_EXE} -udf ${ZDOOM_OUTPUT_DIR}/zdoom.pk3 ${CMAKE_CURRENT_SOURCE_DIR}/static
DEPENDS zipdir ${CMAKE_CURRENT_SOURCE_DIR}/static )
add_custom_target( pk3 ALL