Skip to content

Commit

Permalink
visual studio 2015 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
vedaldi committed Jan 10, 2018
1 parent 645a9d6 commit aead1c1
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 8 deletions.
25 changes: 19 additions & 6 deletions Makefile.mak
Expand Up @@ -17,6 +17,7 @@
# ARCH: Either win32 or win64 [win64]
# DEBUG: Set to yes to ativate debugging [no]
# MATLABROOT: Path to MATLAB
# MATLABVER: MATLAB version (e.g. 90200 for 9.2.0 - 2017a)
# MSVSVER: Visual Studio version (e.g. 80, 90, 100) [90 for VS 9.0]
# MSVCROOT: Visual C++ location [$(VCInstallDir)].
# WINSDKROOT: Windows SDK location [$(WindowsSdkDir)]
Expand All @@ -43,13 +44,18 @@ WINSDKROOT = C:\Program Files\Microsoft SDKs\Windows\v7.0A

!include make/nmake_helper.mak

MATLABROOT = C:\Program Files\MATLAB\R2017a
MATLABVER = 90200
MEX = "$(MATLABROOT)\bin\mex.bat"

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 32-bit
!if "$(ARCH)" == "win32"
!message === COMPILING FOR 32-BIT

MATLABROOT = C:\Program Files (x86)\MATLAB\R2010b
MEX = "$(MATLABROOT)\bin\mex.bat"
!if $(MATLABVER) <= 80500
MEXOPT = "$(MATLABROOT)\bin\win32\mexopts\msvc$(MSVSVER)opts.bat"
!else
MEXOPT = "$(MATLABROOT)\bin\win32\mexopts\msvc$(MSVSYEAR).xml"
!endif
MEXEXT = mexw32
MEX_FLAGS =

Expand All @@ -64,10 +70,12 @@ LFLAGS = /MACHINE:X86 \
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 64-bit
!elseif "$(ARCH)" == "win64"
!message === COMPILING FOR 64-BIT

MATLABROOT = C:\Program Files\MATLAB\R2010b
MEX = "$(MATLABROOT)\bin\mex.bat"
!if $(MATLABVER) <= 80500
MEXOPT = "$(MATLABROOT)\bin\win64\mexopts\msvc$(MSVSVER)opts.bat"
!else
MEXOPT = "$(MATLABROOT)\bin\win64\mexopts\msvc$(MSVSYEAR).xml"
!endif
MEXEXT = mexw64
MEX_FLAGS = -largeArrayDims

Expand Down Expand Up @@ -340,9 +348,14 @@ MSVCR = Microsoft.VC$(MSVSVER).CRT
# VS <= 2008 needs a manifest too
bincrt = $(bindir)\msvcr$(MSVSVER).dll $(bindir)\$(MSVCR).manifest
mexcrt = $(mexdir)\msvcr$(MSVSVER).dll $(mexdir)\$(MSVCR).manifest
!else
!else if $(MSVSVER) <= 120
bincrt = $(bindir)\msvcr$(MSVSVER).dll
mexcrt = $(mexdir)\msvcr$(MSVSVER).dll
!else
# With Visual Studio 2015 the universal run time does not need to be redistributed?
# https://blogs.msdn.microsoft.com/vcblog/2015/03/03/introducing-the-universal-crt/
bincrt =
mexcrt =
!endif

!ifdef MATLABROOT
Expand Down
2 changes: 1 addition & 1 deletion make/dll.mak
Expand Up @@ -2,7 +2,7 @@
# description: Build VLFeat DLL
# author: Andrea Vedaldi

# Copyright (C) 2013-14 Andrea Vedaldi.
# Copyright (C) 2013-14,18 Andrea Vedaldi.
# Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson.
# All rights reserved.
#
Expand Down
2 changes: 1 addition & 1 deletion make/matlab.mak
Expand Up @@ -2,7 +2,7 @@
# description: Build MATALB toolbox
# author: Andrea Vedaldi

# Copyright (C) 2013-14 Andrea Vedaldi.
# Copyright (C) 2013-14,18 Andrea Vedaldi.
# Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson.
# All rights reserved.
#
Expand Down
40 changes: 40 additions & 0 deletions make/nmake_helper.mak
Expand Up @@ -72,6 +72,33 @@ VL_MSC = 1700
VL_MSVC = 11.0
VL_MSVS = 110
VL_MSC = 1700
!ELSEIF "$(_NMAKE_VER)" == "11.00.60521.0"
VL_MSVC = 11.0
VL_MSVS = 110
VL_MSC = 1700
!ELSEIF "$(_NMAKE_VER)" == "11.00.60610.1"
VL_MSVC = 11.0
VL_MSVS = 110
VL_MSC = 1700
!ELSEIF "$(_NMAKE_VER)" == "12.00.21005.1"
VL_MSVC = 12.0
VL_MSVS = 120
VL_MSC = 1800
!ELSEIF "$(_NMAKE_VER)" == "14.00.22816.0"
VL_MSVC = 14.0
VL_MSVS = 140
VL_MSC = 1900
!ELSEIF "$(_NMAKE_VER)" == "14.00.23026.0"
VL_MSVC = 14.0
VL_MSVS = 140
VL_MSC = 1900
!ELSEIF "$(_NMAKE_VER)" == "14.00.23506.0"
VL_MSVC = 14.0
VL_MSVS = 140
VL_MSC = 1900
!ELSEIF "$(_NMAKE_VER)" == "14.00.24210.0"
VL_MSVC = 14.0
VL_MSC = 1900
!ELSE
VL_MSVC =
VL_MSVS =
Expand All @@ -88,3 +115,16 @@ MSVSVER=$(VL_MSVS)
!MESSAGE *** Using Microsoft Visual C++ version $(MSVSVER)
!MESSAGE ***
!ENDIF

MSVSYEAR =
!IF "$(MSVSVER)" == "90"
MSVSYEAR = 2008
!ELSEIF "$(MSVSVER)" == "100"
MSVSYEAR = 2010
!ELSEIF "$(MSVSVER)" == "110"
MSVSYEAR = 2012
!ELSEIF "$(MSVSVER)" == "120"
MSVSYEAR = 2013
!ELSEIF "$(MSVSVER)" == "140"
MSVSYEAR = 2015
!ENDIF
2 changes: 2 additions & 0 deletions vl/host.h
Expand Up @@ -312,8 +312,10 @@ defined(__DOXYGEN__)
#if defined(VL_COMPILER_MSC) & ! defined(__DOXYGEN__)
# define VL_UNUSED
# define VL_INLINE static __inline
#if _MSC_VER <= 1800
# define snprintf _snprintf
# define isnan _isnan
#endif
# ifdef VL_BUILD_DLL
# ifdef __cplusplus
# define VL_EXPORT extern "C" __declspec(dllexport)
Expand Down

0 comments on commit aead1c1

Please sign in to comment.