updates to make compilation with vs 2015 work

This commit is contained in:
Tim Felgentreff 2015-11-26 14:12:53 +01:00
parent fdd3fc232f
commit 9e43d695d2
6 changed files with 18 additions and 20 deletions

View file

@ -629,6 +629,11 @@ if(LINUX)
endif() endif()
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 # Find all libraries
option(ENABLE_STATIC "Compile Stratagus as static executable" OFF) option(ENABLE_STATIC "Compile Stratagus as static executable" OFF)
@ -830,7 +835,7 @@ if(WIN32)
endif() endif()
if (WIN32 AND MSVC) 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() endif()
if (WIN32 AND MINGW) if (WIN32 AND MINGW)
@ -934,13 +939,9 @@ endif()
if(ENABLE_MULTIBUILD) if(ENABLE_MULTIBUILD)
if(WIN32 AND MSVC) if(WIN32 AND MSVC)
if(MSVC_VERSION GREATER 1600) # if > VC13 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:MSVCRT /NODEFAULTLIB:LIBCMT")
message("The project must be compiled with VS2013 or older. VS2015 has deprecated many functions that we still use.") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /NODEFAULTLIB:MSVCRT /NODEFAULTLIB:LIBCMT")
set(CMAKE_GENERATOR_TOOLSET "v120" CACHE STRING "Platform Toolset" FORCE) set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /NODEFAULTLIB:MSVCRT /NODEFAULTLIB:LIBCMT")
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_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
message(STATUS "Added parallel build arguments to CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") message(STATUS "Added parallel build arguments to CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
endif() endif()

View file

@ -1,10 +1,8 @@
environment:
VisualStudioVersion: 12.0
shallow_clone: true shallow_clone: true
before_build: before_build:
- mkdir build - mkdir build
- cd build - cd build
- appveyor DownloadFile http://stratagus.sourceforge.net/msvc-libs.zip - appveyor DownloadFile https://github.com/Wargus/stratagus/releases/download/2015-30-11/dependencies.zip
- 7z x msvc-libs.zip - 7z x dependencies.zip
- cmake -G "Visual Studio 12 2013" -DCMAKE_PREFIX_PATH="%cd%\\3rd" .. - cmake -G "Visual Studio 14 2015" -DCMAKE_PREFIX_PATH="%cd%\\dependencies" ..
- cd .. - cd ..

View file

@ -14,7 +14,7 @@
if(MAKENSIS) if(MAKENSIS)
set(MAKENSIS_FOUND true) set(MAKENSIS_FOUND true)
else() else()
find_program(MAKENSIS NAMES makensis) find_program(MAKENSIS NAMES makensis HINTS "C:/Program Files/NSIS" "C:/Program Files (x86)/NSIS")
find_package(SelfPackers) find_package(SelfPackers)
set(MAKENSIS_ADDITIONAL_FLAGS "" CACHE STRING "Additional flags for makensis") set(MAKENSIS_ADDITIONAL_FLAGS "" CACHE STRING "Additional flags for makensis")

View file

@ -19,8 +19,8 @@ include (CheckLibraryExists)
find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h) find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h)
find_path(OGG_INCLUDE_DIR ogg/ogg.h) find_path(OGG_INCLUDE_DIR ogg/ogg.h)
find_library(OGG_LIBRARY NAMES ogg ogg_static) find_library(OGG_LIBRARY NAMES libogg libogg_static ogg ogg_static)
find_library(VORBIS_LIBRARY NAMES vorbis vorbis_static) find_library(VORBIS_LIBRARY NAMES libvorbis libvorbis_static vorbis vorbis_static)
mark_as_advanced(VORBIS_INCLUDE_DIR OGG_INCLUDE_DIR mark_as_advanced(VORBIS_INCLUDE_DIR OGG_INCLUDE_DIR
OGG_LIBRARY VORBIS_LIBRARY) OGG_LIBRARY VORBIS_LIBRARY)

View file

@ -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_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) 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}) set(THEORA_LIBRARY ${THEORA_LIB_LIBRARIES} ${THEORA_OGG_LIBRARIES} ${THEORA_VORBIS_LIBRARIES})

View file

@ -47,7 +47,6 @@
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#define NOUSER #define NOUSER
#define NOMINMAX // do not use min, max as macro
#if _MSC_VER >= 1800 #if _MSC_VER >= 1800
// From VS2013 onwards, std::min/max are only defined if algorithm is included // From VS2013 onwards, std::min/max are only defined if algorithm is included