From 2b17a711e09acb76b1b09380b3b12582fba2c936 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Thu, 24 Sep 2020 15:43:06 +0200
Subject: [PATCH] Provisions for MATLAB R2020b

(cherry picked from commit fa12e5abfc5ea8388b31b20ca1f394b731846d89)
---
 .gitlab-ci.yml                 | 2 +-
 m4/ax_matlab_version.m4        | 5 ++++-
 macOS/build.sh                 | 4 ++--
 matlab/add_path_to_mex_files.m | 4 ++--
 windows/build.sh               | 4 ++--
 windows/dynare.nsi             | 6 +++---
 6 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 60b293871c..b54ccb73c7 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,7 +1,7 @@
 variables:
   GIT_SUBMODULE_STRATEGY: recursive
   TERM: linux
-  MATLAB_VERSION: R2020a
+  MATLAB_VERSION: R2020b
   OLD_MATLAB_VERSION: R2014a
 
 # The next stanza creates the version number used for the source tarball and the
diff --git a/m4/ax_matlab_version.m4 b/m4/ax_matlab_version.m4
index a430f44812..f72bb39c45 100644
--- a/m4/ax_matlab_version.m4
+++ b/m4/ax_matlab_version.m4
@@ -1,4 +1,4 @@
-dnl Copyright © 2009-2019 Dynare Team
+dnl Copyright © 2009-2020 Dynare Team
 dnl
 dnl This file is part of Dynare.
 dnl
@@ -22,6 +22,9 @@ AC_REQUIRE([AX_MATLAB])
 AC_MSG_CHECKING([for MATLAB version])
 if test -n "$MATLAB_VERSION"; then
   case $MATLAB_VERSION in
+    *2020b | *2020B)
+      MATLAB_VERSION="9.9"
+      ;;
     *2020a | *2020A)
       MATLAB_VERSION="9.8"
       ;;
diff --git a/macOS/build.sh b/macOS/build.sh
index a661fd486a..2aa00aa52b 100755
--- a/macOS/build.sh
+++ b/macOS/build.sh
@@ -89,7 +89,7 @@ NAME=dynare-"$VERSION"
 PKGFILES="$ROOTDIR"/macOS/pkg/"$NAME"
 mkdir -p \
       "$PKGFILES"/mex/matlab/maci64-8.3-9.3 \
-      "$PKGFILES"/mex/matlab/maci64-9.4-9.8 \
+      "$PKGFILES"/mex/matlab/maci64-9.4-9.9 \
       "$PKGFILES"/mex/octave \
       "$PKGFILES"/doc/dynare++ \
       "$PKGFILES"/dynare++ \
@@ -146,7 +146,7 @@ CC=$CC CXX=$CXX ./configure \
   --with-slicot="$LIB64"/Slicot/with-underscore \
   --with-matlab=/Applications/MATLAB_R2019b.app MATLAB_VERSION=R2019b
 make -j"$NTHREADS"
-cp -L  "$ROOTDIR"/mex/matlab/*                                       "$PKGFILES"/mex/matlab/maci64-9.4-9.8
+cp -L  "$ROOTDIR"/mex/matlab/*                                       "$PKGFILES"/mex/matlab/maci64-9.4-9.9
 
 
 ##
diff --git a/matlab/add_path_to_mex_files.m b/matlab/add_path_to_mex_files.m
index f91a7b5b9d..bf45ffac65 100644
--- a/matlab/add_path_to_mex_files.m
+++ b/matlab/add_path_to_mex_files.m
@@ -60,7 +60,7 @@ else
                 end
             end
         else
-            tmp = [dynareroot '../mex/matlab/win64-9.4-9.8/'];
+            tmp = [dynareroot '../mex/matlab/win64-9.4-9.9/'];
             if exist(tmp, 'dir')
                 mexpath = tmp;
                 if modifypath
@@ -80,7 +80,7 @@ else
                 end
             end
         else
-            tmp = [dynareroot '../mex/matlab/maci64-9.4-9.8'];
+            tmp = [dynareroot '../mex/matlab/maci64-9.4-9.9'];
             if exist(tmp, 'dir')
                 mexpath = tmp;
                 if modifypath
diff --git a/windows/build.sh b/windows/build.sh
index cc507b1727..0bb3e0e34f 100755
--- a/windows/build.sh
+++ b/windows/build.sh
@@ -122,8 +122,8 @@ build_windows_matlab_mex_64_b ()
 		     PACKAGE_STRING="dynare $VERSION"
     make -j"$NTHREADS" all
     x86_64-w64-mingw32-strip -- **/*.mexw64
-    mkdir -p "$ROOT_DIRECTORY"/../mex/matlab/win64-9.4-9.8
-    mv -- **/*.mexw64 "$ROOT_DIRECTORY"/../mex/matlab/win64-9.4-9.8
+    mkdir -p "$ROOT_DIRECTORY"/../mex/matlab/win64-9.4-9.9
+    mv -- **/*.mexw64 "$ROOT_DIRECTORY"/../mex/matlab/win64-9.4-9.9
 }
 
 # Create Windows DLL binaries for Octave/MinGW (64bit)
diff --git a/windows/dynare.nsi b/windows/dynare.nsi
index 86d1f50942..41226695d0 100644
--- a/windows/dynare.nsi
+++ b/windows/dynare.nsi
@@ -87,9 +87,9 @@ Section "MEX files for MATLAB 64-bit, version 8.3 to 9.3 (R2014a to R2017b)"
  File ..\mex\matlab\win64-8.3-9.3\*.mexw64
 SectionEnd
 
-Section "MEX files for MATLAB 64-bit, version 9.4 to 9.8 (R2018a to R2020a)"
- SetOutPath $INSTDIR\mex\matlab\win64-9.4-9.8
- File ..\mex\matlab\win64-9.4-9.8\*.mexw64
+Section "MEX files for MATLAB 64-bit, version 9.4 to 9.9 (R2018a to R2020b)"
+ SetOutPath $INSTDIR\mex\matlab\win64-9.4-9.9
+ File ..\mex\matlab\win64-9.4-9.9\*.mexw64
 SectionEnd
 
 Section "MinGW compiler for MATLAB 64-bit"
-- 
GitLab