From: mathnerd314 Date: Sun, 11 Sep 2011 20:58:11 +0000 (+0000) Subject: Fix some small errors, change some things around for MSVC compatibility X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=3a2b4a87b8907de548f8bc8d196434fb3e7c43f5;p=supertux.git Fix some small errors, change some things around for MSVC compatibility git-svn-id: http://supertux.lethargik.org/svn/supertux/trunk/supertux@6693 837edb03-e0f3-0310-88ca-d4d4e8b29345 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b8276e74..9d8b81dd7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,7 +91,7 @@ FIND_PACKAGE(OpenAL REQUIRED) INCLUDE_DIRECTORIES(${OPENAL_INCLUDE_DIR}) FIND_PACKAGE(OggVorbis REQUIRED) -INCLUDE_DIRECTORIES(${OGGVORBIS_INCLUDE_DIR}) +INCLUDE_DIRECTORIES(${VORBIS_INCLUDE_DIR}) FIND_PACKAGE(PhysFS REQUIRED) INCLUDE_DIRECTORIES(${PHYSFS_INCLUDE_DIR}) @@ -109,27 +109,28 @@ ENDIF(CURL_FOUND) ## Find revision of WC MARK_AS_ADVANCED(SVNVERSION_EXECUTABLE) FIND_PROGRAM(SVNVERSION_EXECUTABLE svnversion) + IF(SVNVERSION_EXECUTABLE) ADD_CUSTOM_TARGET(svnversion ALL - cmake -E echo "#ifndef VERSION_H" > "${CMAKE_BINARY_DIR}/version.h.tmp" - COMMAND cmake -E echo "#define VERSION_H" >> "${CMAKE_BINARY_DIR}/version.h.tmp" - COMMAND cmake -E echo_append "#define PACKAGE_VERSION \"${SUPERTUX_VERSION} r" >> "${CMAKE_BINARY_DIR}/version.h.tmp" - COMMAND svnversion -n ${CMAKE_CURRENT_SOURCE_DIR} >> "${CMAKE_BINARY_DIR}/version.h.tmp" - COMMAND cmake -E echo "\"" >> "${CMAKE_BINARY_DIR}/version.h.tmp" - COMMAND cmake -E echo "#endif" >> "${CMAKE_BINARY_DIR}/version.h.tmp" - COMMAND cmake -E copy_if_different "${CMAKE_BINARY_DIR}/version.h.tmp" "${CMAKE_BINARY_DIR}/version.h" - COMMAND cmake -E remove "${CMAKE_BINARY_DIR}/version.h.tmp" + ${CMAKE_COMMAND} -E echo "#ifndef VERSION_H" > "${CMAKE_BINARY_DIR}/version.h.tmp" + COMMAND ${CMAKE_COMMAND} -E echo "#define VERSION_H" >> "${CMAKE_BINARY_DIR}/version.h.tmp" + COMMAND ${CMAKE_COMMAND} >> "${CMAKE_BINARY_DIR}/version.h.tmp" -E echo_append "#define PACKAGE_VERSION \"${SUPERTUX_VERSION} r" + COMMAND ${SVNVERSION_EXECUTABLE} -n ${CMAKE_CURRENT_SOURCE_DIR} >> "${CMAKE_BINARY_DIR}/version.h.tmp" + COMMAND ${CMAKE_COMMAND} >> "${CMAKE_BINARY_DIR}/version.h.tmp" -E echo "\"" + COMMAND ${CMAKE_COMMAND} -E echo "#endif" >> "${CMAKE_BINARY_DIR}/version.h.tmp" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_BINARY_DIR}/version.h.tmp" "${CMAKE_BINARY_DIR}/version.h" + COMMAND ${CMAKE_COMMAND} -E remove "${CMAKE_BINARY_DIR}/version.h.tmp" WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" COMMENT "Updating ${CMAKE_BINARY_DIR}/version.h..." VERBATIM) ELSE(SVNVERSION_EXECUTABLE) ADD_CUSTOM_TARGET(svnversion ALL - cmake -E echo "#ifndef VERSION_H" > "${CMAKE_BINARY_DIR}/version.h.tmp" - COMMAND cmake -E echo "#define VERSION_H" >> "${CMAKE_BINARY_DIR}/version.h.tmp" - COMMAND cmake -E echo "#define PACKAGE_VERSION \"${SUPERTUX_VERSION}\"" >> "${CMAKE_BINARY_DIR}/version.h.tmp" - COMMAND cmake -E echo "#endif" >> "${CMAKE_BINARY_DIR}/version.h.tmp" - COMMAND cmake -E copy_if_different "${CMAKE_BINARY_DIR}/version.h.tmp" "${CMAKE_BINARY_DIR}/version.h" - COMMAND cmake -E remove "${CMAKE_BINARY_DIR}/version.h.tmp" + ${CMAKE_COMMAND} -E echo "#ifndef VERSION_H" > "${CMAKE_BINARY_DIR}/version.h.tmp" + COMMAND ${CMAKE_COMMAND} -E echo "#define VERSION_H" >> "${CMAKE_BINARY_DIR}/version.h.tmp" + COMMAND ${CMAKE_COMMAND} >> "${CMAKE_BINARY_DIR}/version.h.tmp" -E echo "#define PACKAGE_VERSION \"${SUPERTUX_VERSION}\"" + COMMAND ${CMAKE_COMMAND} -E echo "#endif" >> "${CMAKE_BINARY_DIR}/version.h.tmp" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_BINARY_DIR}/version.h.tmp" "${CMAKE_BINARY_DIR}/version.h" + COMMAND ${CMAKE_COMMAND} -E remove "${CMAKE_BINARY_DIR}/version.h.tmp" WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMENT "Updating ${CMAKE_BINARY_DIR}/version.h..." VERBATIM) @@ -165,6 +166,13 @@ include_directories (${CMAKE_CURRENT_SOURCE_DIR}/external/findlocale/) include_directories (${CMAKE_CURRENT_SOURCE_DIR}/external/obstack/) include_directories (${CMAKE_CURRENT_SOURCE_DIR}/external/binreloc/) +## MSVC Compatibility headers and definitions + +IF(MSVC) +include_directories (${CMAKE_CURRENT_SOURCE_DIR}/mk/msvc) +ADD_DEFINITIONS(-D_USE_MATH_DEFINES -DNOMINMAX) +ENDIF(MSVC) + ## Build list of sources for supertux binary FILE(GLOB SUPERTUX_SOURCES_C RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} external/obstack/*.c external/findlocale/findlocale.c) @@ -305,7 +313,7 @@ ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") ## On Windows, add an icon IF(WIN32) - SET(SUPERTUX_SOURCES_C ${SUPERTUX_SOURCES_C} ${CMAKE_CURRENT_SOURCE_DIR}/data/images/engine/icons/supertux.rc) +# SET(SUPERTUX_SOURCES_C ${SUPERTUX_SOURCES_C} ${CMAKE_CURRENT_SOURCE_DIR}/data/images/engine/icons/supertux.rc) IF(MINGW) ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/supertux_rc.o