From 9e43d695d2ecece328455e8e5df672378798c829 Mon Sep 17 00:00:00 2001 From: Tim Felgentreff Date: Thu, 26 Nov 2015 14:12:53 +0100 Subject: [PATCH] updates to make compilation with vs 2015 work --- CMakeLists.txt | 17 +++++++++-------- appveyor.yml | 8 +++----- cmake/modules/FindMakeNSIS.cmake | 2 +- cmake/modules/FindOggVorbis.cmake | 4 ++-- cmake/modules/FindTheora.cmake | 6 +++--- src/include/stratagus.h | 1 - 6 files changed, 18 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b4a385d9a..7c35874cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -629,6 +629,11 @@ if(LINUX) endif() endif() +if(WIN32 AND MSVC AND NOT CMAKE_PREFIX_PATH) + # use a default + set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../dependencies) +endif() + # Find all libraries option(ENABLE_STATIC "Compile Stratagus as static executable" OFF) @@ -830,7 +835,7 @@ if(WIN32) endif() if (WIN32 AND MSVC) - add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE=1) + add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE=1 -DNOMINMAX) endif() if (WIN32 AND MINGW) @@ -934,13 +939,9 @@ endif() if(ENABLE_MULTIBUILD) if(WIN32 AND MSVC) - if(MSVC_VERSION GREATER 1600) # if > VC13 - message("The project must be compiled with VS2013 or older. VS2015 has deprecated many functions that we still use.") - set(CMAKE_GENERATOR_TOOLSET "v120" CACHE STRING "Platform Toolset" FORCE) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO /NODEFAULTLIB:MSVCRT") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO /NODEFAULTLIB:MSVCRT") - set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO /NODEFAULTLIB:MSVCRT") - endif() + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:MSVCRT /NODEFAULTLIB:LIBCMT") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /NODEFAULTLIB:MSVCRT /NODEFAULTLIB:LIBCMT") + set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /NODEFAULTLIB:MSVCRT /NODEFAULTLIB:LIBCMT") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") message(STATUS "Added parallel build arguments to CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") endif() diff --git a/appveyor.yml b/appveyor.yml index ef0f7cab3..4481641c5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,10 +1,8 @@ -environment: - VisualStudioVersion: 12.0 shallow_clone: true before_build: - mkdir build - cd build - - appveyor DownloadFile http://stratagus.sourceforge.net/msvc-libs.zip - - 7z x msvc-libs.zip - - cmake -G "Visual Studio 12 2013" -DCMAKE_PREFIX_PATH="%cd%\\3rd" .. + - appveyor DownloadFile https://github.com/Wargus/stratagus/releases/download/2015-30-11/dependencies.zip + - 7z x dependencies.zip + - cmake -G "Visual Studio 14 2015" -DCMAKE_PREFIX_PATH="%cd%\\dependencies" .. - cd .. diff --git a/cmake/modules/FindMakeNSIS.cmake b/cmake/modules/FindMakeNSIS.cmake index b96a91141..ffa1e5a72 100644 --- a/cmake/modules/FindMakeNSIS.cmake +++ b/cmake/modules/FindMakeNSIS.cmake @@ -14,7 +14,7 @@ if(MAKENSIS) set(MAKENSIS_FOUND true) else() - find_program(MAKENSIS NAMES makensis) + find_program(MAKENSIS NAMES makensis HINTS "C:/Program Files/NSIS" "C:/Program Files (x86)/NSIS") find_package(SelfPackers) set(MAKENSIS_ADDITIONAL_FLAGS "" CACHE STRING "Additional flags for makensis") diff --git a/cmake/modules/FindOggVorbis.cmake b/cmake/modules/FindOggVorbis.cmake index de8d0c92e..6ce106ba4 100644 --- a/cmake/modules/FindOggVorbis.cmake +++ b/cmake/modules/FindOggVorbis.cmake @@ -19,8 +19,8 @@ include (CheckLibraryExists) find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h) find_path(OGG_INCLUDE_DIR ogg/ogg.h) -find_library(OGG_LIBRARY NAMES ogg ogg_static) -find_library(VORBIS_LIBRARY NAMES vorbis vorbis_static) +find_library(OGG_LIBRARY NAMES libogg libogg_static ogg ogg_static) +find_library(VORBIS_LIBRARY NAMES libvorbis libvorbis_static vorbis vorbis_static) mark_as_advanced(VORBIS_INCLUDE_DIR OGG_INCLUDE_DIR OGG_LIBRARY VORBIS_LIBRARY) diff --git a/cmake/modules/FindTheora.cmake b/cmake/modules/FindTheora.cmake index ac176b799..18eb65dba 100644 --- a/cmake/modules/FindTheora.cmake +++ b/cmake/modules/FindTheora.cmake @@ -13,11 +13,11 @@ endif(THEORA_INCLUDE_DIR AND THEORA_LIB_LIBRARIES AND THEORA_VORBIS_LIBRARIES AN FIND_PATH(THEORA_INCLUDE_DIR theora/theora.h) -FIND_LIBRARY(THEORA_OGG_LIBRARIES NAMES ogg) +FIND_LIBRARY(THEORA_OGG_LIBRARIES NAMES libogg libogg_static ogg ogg_static) -FIND_LIBRARY(THEORA_VORBIS_LIBRARIES NAMES vorbis vorbis_static) +FIND_LIBRARY(THEORA_VORBIS_LIBRARIES NAMES libvorbis libvorbis_static vorbis vorbis_static) -FIND_LIBRARY(THEORA_LIB_LIBRARIES NAMES theora theora_static) +FIND_LIBRARY(THEORA_LIB_LIBRARIES NAMES libtheora libtheora_static theora theora_static) if(THEORA_LIB_LIBRARIES AND THEORA_VORBIS_LIBRARIES AND THEORA_OGG_LIBRARIES AND THEORA_INCLUDE_DIR) set(THEORA_LIBRARY ${THEORA_LIB_LIBRARIES} ${THEORA_OGG_LIBRARIES} ${THEORA_VORBIS_LIBRARIES}) diff --git a/src/include/stratagus.h b/src/include/stratagus.h index 27df7c262..a2dcacafb 100644 --- a/src/include/stratagus.h +++ b/src/include/stratagus.h @@ -47,7 +47,6 @@ #define WIN32_LEAN_AND_MEAN #define NOUSER -#define NOMINMAX // do not use min, max as macro #if _MSC_VER >= 1800 // From VS2013 onwards, std::min/max are only defined if algorithm is included