fix trouble with debug/release detection on Windows dynamic_link 09/18709/2
Antoine ELIAS [Fri, 25 Nov 2016 10:15:14 +0000 (11:15 +0100)]
Change-Id: Ia573abbaa17e1f449d103ce4ff0a9aa768a39b35

scilab/modules/dynamic_link/macros/windows/dlwCompile.sci
scilab/modules/dynamic_link/macros/windows/dlwGenerateMakefile.sci
scilab/modules/dynamic_link/macros/windows/dlwMake.sci

index e27b048..054ea95 100644 (file)
@@ -60,11 +60,14 @@ function filename = writeBatchFile(cmd)
 
     //update DEBUG_SCILAB_DYNAMIC_LINK to match with Scilab compilation mode
     val = getenv("DEBUG_SCILAB_DYNAMIC_LINK","");
-    debugVal = "NO";
-    if val <> "YES" & val <> "NO" & isDebug() then
-        debugVal = "YES";
+    if val <> "NO" & val <> "YES" then
+        if isDebug() then
+            val = "YES";
+        else
+            val = "NO";
+        end
     end
-
+    
     if win64() then
         if dlwIsExpress() then
             arch = "x86_amd64";
@@ -79,7 +82,7 @@ function filename = writeBatchFile(cmd)
 
     scibuild = [ ...
     "@call """ + path + "\VC\vcvarsall.bat"" " + arch;
-    "set DEBUG_SCILAB_DYNAMIC_LINK=" + debugVal;
+    "set DEBUG_SCILAB_DYNAMIC_LINK=" + val;
     cmd
     ];
 
index 0add43d..a5c01d1 100644 (file)
@@ -185,12 +185,21 @@ function ilib_gen_Make_win32(name, ..
     end
 
     //update DEBUG_SCILAB_DYNAMIC_LINK to map with Scilab compilation mode
-    val = getenv("DEBUG_SCILAB_DYNAMIC_LINK","");
-    if val <> "YES" & val <> "NO" & isDebug() then
+    debugVal = getenv("DEBUG_SCILAB_DYNAMIC_LINK","");
+    val = debugVal;
+    if val <> "NO" & val <> "YES" then
+        if isDebug() then
+            val = "YES";
+        else
+            val = "NO";
+        end
+    end
+
+    if val == "YES" then
         setenv("DEBUG_SCILAB_DYNAMIC_LINK","YES");
         CFLAGS = CFLAGS + " -D_DEBUG";
     else
-        setenv("DEBUG_SCILAB_DYNAMIC_LINK","");
+        setenv("DEBUG_SCILAB_DYNAMIC_LINK","NO");
         CFLAGS = CFLAGS + " -DNDEBUG";
     end
 
@@ -280,7 +289,7 @@ function ilib_gen_Make_win32(name, ..
     end
 
     //restore DEBUG_SCILAB_DYNAMIC_LINK
-    setenv("DEBUG_SCILAB_DYNAMIC_LINK", val);
+    setenv("DEBUG_SCILAB_DYNAMIC_LINK", debugVal);
 
 endfunction
 //=============================================================================
index 065f468..2ac46d5 100644 (file)
@@ -50,9 +50,12 @@ function filename = writeBatchFile(cmd)
 
     //update DEBUG_SCILAB_DYNAMIC_LINK to match with Scilab compilation mode
     val = getenv("DEBUG_SCILAB_DYNAMIC_LINK","");
-    debugVal = "NO";
-    if val <> "YES" & val <> "NO" & isDebug() then
-        debugVal = "YES";
+    if val <> "NO" & val <> "YES" then
+        if isDebug() then
+            val = "YES";
+        else
+            val = "NO";
+        end
     end
 
     if win64() then
@@ -65,7 +68,7 @@ function filename = writeBatchFile(cmd)
 
     scibuild = [ ...
     "@call """ + path + "\VC\vcvarsall.bat"" " + arch;
-    "set DEBUG_SCILAB_DYNAMIC_LINK=" + debugVal;
+    "set DEBUG_SCILAB_DYNAMIC_LINK=" + val;
     cmd
     ];