From 01fed92920fd5dd0dff739b17535cf84c749cc93 Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Mon, 25 Feb 2013 00:12:21 +0000 Subject: [PATCH] - Added support for Visual Studio to the CMake project. SVN r4166 (trunk) --- CMakeLists.txt | 1 + src/CMakeLists.txt | 41 +++++++++++++++++++++++++++++++++++--- tools/lemon/CMakeLists.txt | 7 +++++++ wadsrc/CMakeLists.txt | 9 +++++---- 4 files changed, 51 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c67f73aeea..6e5d9cc400 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,5 @@ cmake_minimum_required( VERSION 2.4 ) +project(ZDoom) IF( NOT CMAKE_BUILD_TYPE ) SET( CMAKE_BUILD_TYPE Debug CACHE STRING diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 056b659377..67993f4e0e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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} diff --git a/tools/lemon/CMakeLists.txt b/tools/lemon/CMakeLists.txt index 0a6b2319cd..91b1445759 100644 --- a/tools/lemon/CMakeLists.txt +++ b/tools/lemon/CMakeLists.txt @@ -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 $ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/lempar.c $ ) +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 ) \ No newline at end of file diff --git a/wadsrc/CMakeLists.txt b/wadsrc/CMakeLists.txt index 19a210abc6..a24d712e1b 100644 --- a/wadsrc/CMakeLists.txt +++ b/wadsrc/CMakeLists.txt @@ -1,9 +1,10 @@ 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 - DEPENDS zipdir ${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 DEPENDS ${ZDOOM_OUTPUT_DIR}/zdoom.pk3 )