Dynamic link:
=============
+* Microsoft Visual Studio 2010 Express and Professional support on
+ Windows x86 and x64 platform.
+
+* Microsoft Visual Studio 2008 Express support on Windows x64 platform
+ It requires to install Windows SDK to add x64 component on Visual Studio.
+
+* lcc-win32 support moved as toolbox in ATOMS.
+ It will be easier to maintain with new versions of lcc-win32.
+
+* Intel Fortran 12 (beta) support on Windows x86 and x64 platform.
+
+* 5th argument of 'ilib_compile', 'ilib_for_link', 'ilib_gen_cleaner',
+ 'ilib_gen_Make', 'ilib_mex_build', 'ilib_build' is deprecated.
+ default value of makefile name must be [].
+
* bug 4265 fixed - In the dynamic link functions (ilib_*), when a compiler was
not available, the execution continued.
+* bug 5737 fixed - loader.sce generated by ilib_gen_loader did not detect
+ if it was a x86 dll or a x64 dll used with a scilab x64 or x86,
+ on Windows.
+
Compilation:
============
* 'MSDOS' obsolete see 'getos' (SEP #39).
+* 'with_lcc', 'VCtoLCCLib', 'chooselcccompiler', 'configure_lcc',
+ 'findlcccompiler' have been moved as toolbox in ATOMS
+ See http://atoms.scilab.org/toolboxes/LCC-windows or atomsInstall('LCC-windows')
+ from Scilab.
+
Removed functions (previously declared as obsolete):
====================================================
tbx_builder_gateway_lang('c', sci_gateway_dir);
// LCC does not manage C++
-if ~with_lcc() then
- tbx_builder_gateway_lang('cpp', sci_gateway_dir);
- languages = ['c', 'fortran','cpp'];
-else
+if isdef('with_lcc') & with_lcc() then
languages = ['c', 'fortran'];
+else
+ tbx_builder_gateway_lang('cpp', sci_gateway_dir);
+ languages = ['c', 'fortran','cpp'];
end
tbx_build_gateway_loader(languages, sci_gateway_dir);
// Simple wrapper around ilib_build
function tbx_build_gateway(libname, names, files, gateway_path, libs, ldflags, ..
cflags, fflags, cc, makename, ismex)
- oldpath = pwd();
-
- if exists('gateway_path', 'local') then
- chdir(gateway_path);
- end
-
- if ~exists('libs', 'local') then libs = []; end
- if ~exists('ldflags', 'local') then ldflags = ""; end
- if ~exists('cflags', 'local') then cflags = ""; end
- if ~exists('fflags', 'local') then fflags = ""; end
- if ~exists('cc', 'local') then cc = ""; end
- if ~exists('makename', 'local') then makename = "Makelib"; end
- if ~exists('ismex', 'local') then ismex = %f; end
-
- ilib_build(libname, names, files, libs, makename, ldflags, cflags, ..
- fflags, ismex, cc);
-
- chdir(oldpath);
+ oldpath = pwd();
+
+ if exists('gateway_path', 'local') then
+ chdir(gateway_path);
+ end
+
+ if ~exists('libs', 'local') then libs = []; end
+ if ~exists('ldflags', 'local') then ldflags = ""; end
+ if ~exists('cflags', 'local') then cflags = ""; end
+ if ~exists('fflags', 'local') then fflags = ""; end
+ if ~exists('cc', 'local') then cc = ""; end
+ if ~exists('makename', 'local') then makename = ""; end
+ if ~exists('ismex', 'local') then ismex = %f; end
+
+ ilib_build(libname, names, files, libs, makename, ldflags, cflags, ..
+ fflags, ismex, cc);
+
+ chdir(oldpath);
endfunction
\ No newline at end of file
if ~exists('cc', 'local') then cc = ""; end
if ~exists('libname', 'local') then libname = ""; end
if ~exists('loadername', 'local') then loadername = "loader.sce"; end
- if ~exists('makename', 'local') then makename = "Makelib"; end
+ if ~exists('makename', 'local') then makename = ""; end
ilib_for_link(names, files, libs, flag, makename, loadername, ..
libname, ldflags, cflags, fflags, cc);
;
Source: modules\{#DYNAMIC_LINK}\src\scripts\Makedll.incl; DestDir: {app}\modules\{#DYNAMIC_LINK}\src\scripts; Components: {#COMPN_SCILAB}
Source: modules\{#DYNAMIC_LINK}\src\scripts\TEMPLATE_MAKEFILE.VC; DestDir: {app}\modules\{#DYNAMIC_LINK}\src\scripts; Components: {#COMPN_SCILAB}
-Source: modules\{#DYNAMIC_LINK}\src\scripts\TEMPLATE_MAKEFILE.LCC; DestDir: {app}\modules\{#DYNAMIC_LINK}\src\scripts; Components: {#COMPN_SCILAB}
Source: modules\{#DYNAMIC_LINK}\src\scripts\Makefile.incl.mak; DestDir: {app}\modules\{#DYNAMIC_LINK}\src\scripts; Components: {#COMPN_SCILAB}
;
Source: modules\{#DYNAMIC_LINK}\includes\*.h; DestDir: {app}\modules\{#DYNAMIC_LINK}\includes; Components: {#COMPN_SCILAB}
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) INRIA - Allan CORNET
-//
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution. The terms
-// are also available at
+// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
//Load functions libraries
// =============================================================================
load('SCI/modules/dynamic_link/macros/lib');
-// Configure Environment Variables for Ms Visual C ====================
+// Configure Environment Variables for Microsoft Visual Studio C and
+// Intel Fortran
if getos() == 'Windows' then
- if (~isdef('WSCI')) then
- WSCI = getlongpathname( pathconvert(SCI, %f, %f, 'w') );
- end
- if (findmsvccompiler()<>'unknown') then
+ if findmsvccompiler() <> 'unknown' then
+ // Configure Ms VC environment
configure_msvc();
- clear configure_msvc
- if (findmsifortcompiler()<>'unknown') then
+ clear configure_msvc
+ if findmsifortcompiler() <> 'unknown' then
+ // Configure Intel Fortran environment
configure_msifort();
clear configure_msifort
else
- setenv('USE_F2C','YES');
+ // Use F2C
+ setenv('USE_F2C', 'YES');
end
clear findmsifortcompiler
- else
- if ( findlcccompiler() ) then
- configure_lcc();
- clear configure_lcc
- end
- clear findlcccompiler
end
clear findmsvccompiler
end
// Add demos
// =============================================================================
if WITH_DEMOS then
- pathdemos = pathconvert(SCI+"/modules/dynamic_link/demos/dynamic_link.dem.gateway.sce",%f,%t);
- add_demo(gettext("Dynamic link"),pathdemos);
- clear pathdemos;
+ pathdemos = pathconvert(SCI + "/modules/dynamic_link/demos/dynamic_link.dem.gateway.sce", %f, %t);
+ add_demo(gettext("Dynamic link"), pathdemos);
+ clear pathdemos;
end
-
-clear LCC
+// =============================================================================
// =============================================================================
// Bernard HUGUENEY - DIGITEO - 2010
// =============================================================================
+if getos() <> 'Windows' then
files=['sci_apply.c'];
ilib_build('apply',['apply','sci_apply'],files,[]);
// =============================================================================
apply([1,2],fun_name,1)
ulink();
+end
\ No newline at end of file
#include <stdio.h>
-
+#ifndef _MSC_VER
#include <unistd.h>
+#endif
#include <stdlib.h>
#include "dynamic_link.h"
#include <stdio.h>
-
+#ifndef _MSC_VER
#include <unistd.h>
+#endif
#include <stdlib.h>
</info>
<refnamediv>
<refname>VCtoLCCLib</refname>
- <refpurpose>converts Ms VC libs to LCC-Win32 libs.</refpurpose>
+ <refpurpose>moved as toolbox in ATOMS</refpurpose>
</refnamediv>
- <refsynopsisdiv>
- <title>Calling Sequence</title>
- <synopsis>VCtoLCCLib()</synopsis>
- </refsynopsisdiv>
- <refsection>
- <title>Description</title>
- <para>converts Ms VC libs to LCC-Win32 libs.</para>
- </refsection>
- <refsection>
- <title>Examples</title>
- <programlisting role="example"><![CDATA[
-bOK=chooselcccompiler();
-VCtoLCCLib()
- ]]></programlisting>
- </refsection>
- <refsection>
- <title>Authors</title>
- <para>Allan CORNET</para>
- </refsection>
</refentry>
</info>
<refnamediv>
<refname>chooselcccompiler</refname>
- <refpurpose>choose LCC-Win32 as the default C Compiler.</refpurpose>
+ <refpurpose>moved as toolbox in ATOMS</refpurpose>
</refnamediv>
- <refsynopsisdiv>
- <title>Calling Sequence</title>
- <synopsis>bOK=chooselcccompiler()</synopsis>
- </refsynopsisdiv>
- <refsection>
- <title>Parameters</title>
- <variablelist>
- <varlistentry>
- <term>bOK</term>
- <listitem>
- <para>returns %T if LCC-Win32 is the default C Compiler.</para>
- </listitem>
- </varlistentry>
- </variablelist>
- </refsection>
- <refsection>
- <title>Description</title>
- <para>choose LCC-Win32 as the default C Compiler.</para>
- </refsection>
- <refsection>
- <title>Examples</title>
- <programlisting role="example"><![CDATA[
-bOK=chooselcccompiler()
- ]]></programlisting>
- </refsection>
- <refsection>
- <title>Authors</title>
- <para>Allan CORNET</para>
- </refsection>
</refentry>
</info>
<refnamediv>
<refname>configure_lcc</refname>
- <refpurpose>set environments variables for LCC-Win32 C Compiler.</refpurpose>
+ <refpurpose>moved as toolbox in ATOMS</refpurpose>
</refnamediv>
- <refsynopsisdiv>
- <title>Calling Sequence</title>
- <synopsis>bOK=configure_lcc()</synopsis>
- </refsynopsisdiv>
- <refsection>
- <title>Parameters</title>
- <variablelist>
- <varlistentry>
- <term>bOK</term>
- <listitem>
- <para>returns %T if environments variables for LCC-Win32 C Compiler are OK. </para>
- </listitem>
- </varlistentry>
- </variablelist>
- </refsection>
- <refsection>
- <title>Description</title>
- <para>set environments variables for LCC-Win32 C Compiler.</para>
- </refsection>
- <refsection>
- <title>Examples</title>
- <programlisting role="example"><![CDATA[
-bOK=configure_lcc()
- ]]></programlisting>
- </refsection>
- <refsection>
- <title>Authors</title>
- <para>Allan CORNET</para>
- </refsection>
</refentry>
</info>
<refnamediv>
<refname>findlcccompiler</refname>
- <refpurpose>detects LCC-Win32 C Compiler</refpurpose>
+ <refpurpose>moved as toolbox in ATOMSr</refpurpose>
</refnamediv>
- <refsynopsisdiv>
- <title>Calling Sequence</title>
- <synopsis>ret=findlcccompiler()</synopsis>
- </refsynopsisdiv>
- <refsection>
- <title>Parameters</title>
- <variablelist>
- <varlistentry>
- <term>ret</term>
- <listitem>
- <para>returns %T or %F</para>
- </listitem>
- </varlistentry>
- </variablelist>
- </refsection>
- <refsection>
- <title>Description</title>
- <para>detects LCC-Win32 C Compiler.</para>
- </refsection>
- <refsection>
- <title>Examples</title>
- <programlisting role="example"><![CDATA[
-ret=findlcccompiler()
- ]]></programlisting>
- </refsection>
- <refsection>
- <title>Authors</title>
- <para>Allan CORNET</para>
- </refsection>
</refentry>
<refsynopsisdiv>
<title>Calling Sequence</title>
- <synopsis>ifortv=findmsifortcompiler()</synopsis>
+ <synopsis>ifortv = findmsifortcompiler()</synopsis>
</refsynopsisdiv>
<refsection>
<varlistentry>
<term>ifortv</term>
- <listitem>
- <para>returns 'ifort90','ifort10','ifort11','unknown'</para>
- </listitem>
+ <informaltable border="1">
+ <tr>
+ <td>string</td>
+ <td>Intel Fortran version</td>
+ </tr>
+ <tr>
+ <td>ifort90</td>
+ <td>Intel Fortran 9.x</td>
+ </tr>
+ <tr>
+ <td>ifort10</td>
+ <td>Intel Fortran 10.x</td>
+ </tr>
+ <tr>
+ <td>ifort11</td>
+ <td>Intel Fortran 11.x</td>
+ </tr>
+ <tr>
+ <td>ifort12</td>
+ <td>Intel Fortran 12.x (beta support)</td>
+ </tr>
+
+ <tr>
+ <td>unknown</td>
+ <td>not detected or unknown version.</td>
+ </tr>
+ </informaltable>
</varlistentry>
</variablelist>
</refsection>
</refnamediv>
<refsynopsisdiv>
<title>Calling Sequence</title>
- <synopsis>msvc=findmsvccompiler()</synopsis>
+ <synopsis>msvc = findmsvccompiler()</synopsis>
</refsynopsisdiv>
<refsection>
<title>Parameters</title>
<varlistentry>
<term>msvc</term>
<listitem>
- <para>returns 'msvc70','msvc71','msvc80express','msvc80std,'msvc80pro','msvc90express','msvc90std,'msvc90pro','unknown'</para>
+ <para>returns a string to identify Visual studio version.</para>
+ <informaltable border="1">
+ <tr>
+ <td>string</td>
+ <td>Visual Studio version</td>
+ </tr>
+ <tr>
+ <td>msvc70</td>
+ <td>Microsoft Visual Studio 2002 Professional or above.</td>
+ </tr>
+ <tr>
+ <td>msvc71</td>
+ <td>Microsoft Visual Studio 2003 Professional or above.</td>
+ </tr>
+ <tr>
+ <td>msvc80express</td>
+ <td>Microsoft Visual Studio 2005 Express Edition.</td>
+ </tr>
+ <tr>
+ <td>msvc80std</td>
+ <td>Microsoft Visual Studio 2005 Standard Edition.</td>
+ </tr>
+ <tr>
+ <td>msvc80pro</td>
+ <td>Microsoft Visual Studio 2005 Professional or above.</td>
+ </tr>
+ <tr>
+ <td>msvc90express</td>
+ <td>Microsoft Visual Studio 2008 Express Edition.</td>
+ </tr>
+ <tr>
+ <td>msvc90std</td>
+ <td>Microsoft Visual Studio 2008 Standard Edition.</td>
+ </tr>
+ <tr>
+ <td>msvc90pro</td>
+ <td>Microsoft Visual Studio 2008 Professional or above.</td>
+ </tr>
+ <tr>
+ <td>msvc100express</td>
+ <td>Microsoft Visual Studio 2010 Express Edition</td>
+ </tr>
+ <tr>
+ <td>msvc100pro</td>
+ <td>Microsoft Visual Studio 2010 Professional or above.</td>
+ </tr>
+ <tr>
+ <td>unknown</td>
+ <td>not detected or unknown version.</td>
+ </tr>
+ </informaltable>
</listitem>
</varlistentry>
</variablelist>
<refsection>
<title>Examples</title>
<programlisting role="example"><![CDATA[
-msvc=findmsvccompiler()
+msvc = findmsvccompiler()
]]></programlisting>
</refsection>
<refsection>
</info>
<refnamediv>
<refname>with_lcc</refname>
- <refpurpose>returns if LCC-Win32 is the default C Compiler.</refpurpose>
+ <refpurpose>moved as toolbox in ATOMS</refpurpose>
</refnamediv>
- <refsynopsisdiv>
- <title>Calling Sequence</title>
- <synopsis>bOK=with_lcc()</synopsis>
- </refsynopsisdiv>
- <refsection>
- <title>Parameters</title>
- <variablelist>
- <varlistentry>
- <term>bOK</term>
- <listitem>
- <para>returns %T if LCC-Win32 is the default C Compiler.</para>
- </listitem>
- </varlistentry>
- </variablelist>
- </refsection>
- <refsection>
- <title>Description</title>
- <para>checks if LCC-Win32 is the default C Compiler.</para>
- </refsection>
- <refsection>
- <title>Examples</title>
- <programlisting role="example"><![CDATA[
-bOK=with_lcc()
- ]]></programlisting>
- </refsection>
- <refsection>
- <title>Authors</title>
- <para>Allan CORNET</para>
- </refsection>
-</refentry>
+ </refentry>
+
-//==========================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) INRIA - Allan CORNET
-//
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution. The terms
-// are also available at
+// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-//==========================================
-function [res]=G_make(files,objects_or_dll)
+//=============================================================================
+function res = G_make(files, objects_or_dll)
if ~haveacompiler() then
error(msprintf(gettext('%s: A Fortran or C compiler is required.\n'),'G_make'))
end
-
+
[lhs,rhs] = argn(0);
if rhs <> 2 then
error(msprintf(gettext("%s: Wrong number of input argument(s).\n"),"G_make"));
end
msg = '';
-
- if getos() == 'Windows' then // WINDOWS
- if typeof(objects_or_dll)<>'string' then
- error(sprintf(gettext('%s: Wrong type for input argument #%d: String expected.'),'G_make',2));
- return;
- end
-
- OBJ = '';
- [ptmp,ftmp,fext] = fileparts(objects_or_dll);
- OBJ = ptmp + ftmp;
-
- if with_lcc() == %T then
- if ilib_verbose() > 1 then
- msg = unix_g('make -f Makefile.lcc '+OBJ);
- else
- host('make -f Makefile.lcc '+OBJ);
- end
- else
- // scilab uses Visual Studio C++
- if ilib_verbose() > 1 then
- msg = unix_g('nmake /Y /nologo /f Makefile.mak '+OBJ);
- else
- host('nmake /Y /nologo /f Makefile.mak '+OBJ);
- end
-
+ if getos() == 'Windows' then // WINDOWS
+ // Load dynamic_link Internal lib if it's not already loaded
+ if ~ exists("dynamic_linkwindowslib") then
+ load("SCI/modules/dynamic_link/macros/windows/lib");
end
-
- res = [OBJ];
-
+ res = dlwMake(files, objects_or_dll);
else // LINUX
-
+
mk = [];
- for x = files(:)', if strindex(x,'-l')==[], mk=mk+' '+x ; end ;end
-
+ for x = files(:)', if strindex(x,'-l')==[], mk=mk+' '+x ; end ;end
+
if ilib_verbose() > 1 then
msg = unix_g('make '+ mk);
else
host('make '+ mk);
end
-
+
res = files ;
-
- end
-
+
+ end
+
if ilib_verbose() > 1 then
disp(msg);
end
-
+
endfunction
-//==========================================
+//=============================================================================
-//==========================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) INRIA - Allan CORNET
-// Copyright (C) DIGITEO - 2009 - Allan CORNET
-//
+// Copyright (C) DIGITEO - 2009-2010 - Allan CORNET
+//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution. The terms
-// are also available at
+// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-//==========================================
-// Export Libraries of Scilab for LCC compiler
-//==========================================
+//=============================================================================
function bOK = VCtoLCCLib()
- // Bug 5433
- // VCtoLCCLib called in dynamic_link.start
- // We need to be sure that '%c_a_c' is already loaded
- bCleanVar = %f;
- if ~isdef('%c_a_c') then
- ierr = exec(SCI + '/modules/overloading/macros/%c_a_c.sci','errcatch');
- if ierr == 0 then
- bCleanVar = %t;
- end
- end
-
- // LCC-Win32 only on Windows
- if (findlcccompiler() == %T) then
- bOK = [];
- DirCur = pwd();
-
- bOK = [bOK , ExportAtlasLibrary('blasplus', WSCI+'\bin')];
-
- if with_module('scicos') then
- bOK = [bOK , Exportalibrary('scicos', WSCI+'\bin',[])];
- bOK = [bOK , Exportalibrary('scicos_f', WSCI+'\bin',[])];
- bOK = [bOK , Exportalibrary('scicos_blocks', WSCI+'\bin',[])];
- bOK = [bOK , Exportalibrary('scicos_blocks_f', WSCI+'\bin',[])];
- end
-
- DATAS_LIBSCILAB = ['LaunchScilabLock', ..
- 'LaunchScilab', ..
- 'adre_', ..
- 'basbrk_', ..
- 'basetype_', ..
- 'cha1_', ..
- 'com_', ..
- 'dcoeff_', ..
- 'errgst_', ..
- 'ierode_', ..
- 'intersci_', ..
- 'iop_', ..
- 'ls0001_', ..
- 'lsa001_', ..
- 'lsr001_', ..
- 'recu_', ..
- 'scigsch_', ..
- 'scisch_', ..
- 'scizgsch_', ..
- 'stack_', ..
- 'vstk_'];
- bOK = [bOK , Exportalibrary('LibScilab', WSCI+'\bin',DATAS_LIBSCILAB)];
-
- bOK = [bOK , Exportalibrary('MALLOC', WSCI+'\bin',[])];
- bOK = [bOK , Exportalibrary('libf2c', WSCI+'\bin',[])];
- bOK = [bOK , Exportalibrary('lapack', WSCI+'\bin',[])];
- bOK = [bOK , Exportalibrary('intersci', WSCI+'\bin',[])];
- bOK = [bOK , Exportalibrary('output_stream', WSCI+'\bin',[])];
- bOK = [bOK , Exportalibrary('dynamic_link', WSCI+'\bin',[])];
- bOK = [bOK , Exportalibrary('integer', WSCI+'\bin',[])];
- bOK = [bOK , Exportalibrary('optimization_f', WSCI+'\bin',[])];
- bOK = [bOK , Exportalibrary('libjvm', WSCI+'\bin',[])];
- bOK = [bOK , Exportalibrary('scilocalization', WSCI+'\bin',[])];
- bOK = [bOK , Exportalibrary('libintl', WSCI+'\bin',[])];
- bOK = [bOK , Exportalibrary('linpack_f', WSCI+'\bin',[])];
- bOK = [bOK , Exportalibrary('call_scilab', WSCI+'\bin',[])];
- bOK = [bOK , Exportalibrary('time', WSCI+'\bin',[])];
- bOK = [bOK , Exportalibrary('api_scilab', WSCI+'\bin',[])];
- bOK = [bOK , Exportalibrary('hashtable', WSCI+'\bin',[])];
- bOK = [bOK , Exportalibrary('scilab_windows', WSCI+'\bin',[])];
-
- if bCleanVar == %t then
- clear %c_a_c;
- end
-
- chdir(DirCur);
-
- if and(bOK == %T) then
- bOK = %t;
- end
-
- else
- bOK = %f;
- end
-
-endfunction
-//==========================================
-function bOK = ExportAtlasLibrary(libraryname, pathlib)
-
- destPath = SCIHOME + filesep() + 'lcclib';
- mkdir(destPath);
- if chdir(pathlib) == %f then
- bOK = %f;
- return
- end
-
- if ( ilib_verbose() <> 0 ) then
- mprintf('\nExports from '+libraryname+'.dll\n');
- end
- ierr = unix('pedump /exp '+libraryname+'.dll >'+TMPDIR+filesep()+libraryname+'.lcc');
- if ierr <> 0 then
- bOK=%F;
- return;
- end
-
- if ( ilib_verbose() <> 0 ) then
- mprintf('Converting Library');
- end
-
- fw = mopen(TMPDIR+filesep()+libraryname+'.exp',"wt");
- fr = mopen(TMPDIR+filesep()+libraryname+'.lcc',"rt");
-
- if (meof(fr) == 0) then
- line = mfscanf(1,fr,"%s");
- mfprintf(fw,"blasplus.dll\n");
- end
-
- i=1;
- while ( meof(fr) == 0)
- line = mfscanf(1,fr,"%s");
- if (line ~= []) then
- mfprintf(fw,"_%s_ %s @%d\n",line,line,i);
- i=i+1;
- end
- end
-
- mclose(fw);
- mclose(fr);
-
- if ( ilib_verbose() <> 0 ) then
- mprintf('\n');
- mprintf(gettext('Build %s.lib (Please waiting).\n'),libraryname);
- end
- command = 'buildLib ""'+TMPDIR+filesep()+libraryname+'.exp""'+' ""'+destPath+filesep()+libraryname+'.lib""';
- ierr = unix(command);
- if ierr <> 0 then
- bOK=%F;
- return;
- end
-
- if fileinfo(destPath+filesep()+libraryname+'.lib') <> [] then
- bOK=%T;
- else
- bOK=%F;
- end
-endfunction
-//==========================================
-function bOK = Exportalibrary(libraryname, pathlib,DATAS)
- destPath = SCIHOME + filesep() + 'lcclib';
- mkdir(destPath);
-
- if chdir(pathlib) == %f then
- bOK = %f;
- return
- end
-
- if ( ilib_verbose() <> 0 ) then
- mprintf('\nExports from '+libraryname+'.dll\n');
- end
- ierr = unix('pedump /exp '+libraryname+'.dll >'+TMPDIR+filesep()+libraryname+'.lcc');
- if ierr <> 0 then
- bOK=%F;
- return;
- end
-
- if ( ilib_verbose() <> 0 ) then
- mprintf('Converting Library');
- end
-
- fr = mopen(TMPDIR+filesep()+libraryname+'.lcc',"rt");
- LCC = mgetl(fr);
- mclose(fr);
-
- LCC = strsubst(LCC,'/\.$/','','r');
-
- LCC_LINE1 = LCC(1);
-
- LCC = '_' + LCC + ' ' + LCC;
- LCC(1) = LCC_LINE1;
-
- if DATAS <> [] then
- index_datas = grep(LCC,DATAS);
- for i = index_datas
- LCC(i) = LCC(i) + ' DATA';
- end
- end
-
- fw = mopen(TMPDIR+filesep()+libraryname+'.exp',"wt");
- mputl(LCC,fw);
- mclose(fw);
-
- if ( ilib_verbose() <> 0 ) then
- mprintf('\n');
- mprintf(gettext('Build %s.lib (Please waiting).\n'),libraryname);
- end
- command = 'buildLib ""'+TMPDIR+filesep()+libraryname+'.exp""'+' ""'+destPath+filesep()+libraryname+'.lib""';
- ierr = unix(command);
- if ierr <> 0 then
- bOK=%F;
- return;
- end
-
- if fileinfo(destPath+filesep()+libraryname+'.lib') <> [] then
- bOK=%T;
- else
- bOK=%F;
- end
-
+ warnobsolete(_('LCC in Atoms: atomsInstall(""LCC-windows"")'), '5.3.1');
+ bOK = %F;
endfunction
-//==========================================
+//=============================================================================
-//------------------------------------
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) INRIA - Allan CORNET
-//
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution. The terms
-// are also available at
+// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-//------------------------------------
+//=============================================================================
if (isdef('genlib') == %f) then
exec(SCI+'/modules/functions/scripts/buildmacros/loadgenlib.sce');
end
-//------------------------------------
+//=============================================================================
genlib('dynamic_linklib','SCI/modules/dynamic_link/macros',%f,%t);
-//------------------------------------
+//=============================================================================
+if getos() == 'Windows' then
+ genlib('dynamic_linkwindowslib','SCI/modules/dynamic_link/macros/windows',%f,%t);
+end
+//=============================================================================
-//==========================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) INRIA - Allan CORNET
-//
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution. The terms
-// are also available at
+// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-
-//==========================================
-// force to use LCC-Win32 compiler
-//==========================================
-function res = chooselcccompiler()
-
- res = findlcccompiler();
- if (res) then
- global LCC;
- LCC=res;
- clear LCC;
- configure_lcc();
- end
-
+//=============================================================================
+function bOK = chooselcccompiler()
+ warnobsolete(_('LCC in Atoms: atomsInstall(""LCC-windows"")'), '5.3.1');
+ bOK = %F;
endfunction
-//==========================================
+//=============================================================================
+
-//==========================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) INRIA - Allan CORNET
-//
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution. The terms
-// are also available at
+// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-//==========================================
+//=============================================================================
function bOK = configure_lcc()
+ warnobsolete(_('LCC in Atoms: atomsInstall(""LCC-windows"")'), '5.3.1');
bOK = %F;
-
- if getos() == 'Windows' then
-
- try
- lccincludepath = winqueryreg('HKEY_CURRENT_USER','Software\lcc\compiler','includepath');
- catch
- return;
- end
-
- try
- lcclibpath = winqueryreg('HKEY_CURRENT_USER','Software\lcc\lcclnk','libpath');
- catch
- return;
- end
-
- index = strindex(lccincludepath,filesep());
- szindex = size(index);
- lccbasepath = part(lccincludepath,[1:index(szindex(2))]);
- lccbinpath = lccbasepath + 'bin';
- lccexe = lccbinpath + filesep() + 'lcc.exe';
-
- if ( fileinfo(lccexe) <> [] ) then
- PATH = getenv('PATH');
- NEWPATH = lccbinpath + pathsep() + ..
- lccincludepath + pathsep() + ..
- lcclibpath + pathsep() + ..
- PATH;
- err = setenv('PATH',NEWPATH);
- if (err == %F) then bOK = %F,return,end
-
- LCCLIB_DIR = SCIHOME+'\lcclib';
-
- if ( (fileinfo(LCCLIB_DIR) == []) | ( findfiles(LCCLIB_DIR,'*.lib') == []) ) then
- if ( ilib_verbose() <> 0 ) then
- mprintf('\n');
- mprintf(gettext('%s: Converts libraries to use LCC-Win32.\n'),'configure_lcc')
- end
- bOK = VCtoLCCLib();
- else
- bOK = %T;
- end
-
- else
- bOK=%F;
- end
- end
-
endfunction
-//==========================================
+//=============================================================================
-//==========================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) DIGITEO - Allan CORNET
-//
+//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution. The terms
-// are also available at
+// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-//==========================================
+//=============================================================================
function bOK = configure_msifort()
-//==========================================
+//=============================================================================
// functions defined only in configure_ifort
-//==========================================
+//=============================================================================
function ifpath = getIFpath(ifversion)
select ifversion ,
case 'ifort9' then
- ifpath = getenv('IFORT_COMPILER9','');
+ ifpath = getenv('IFORT_COMPILER9', '');
case 'ifort10' then
- ifpath = getenv('IFORT_COMPILER10','');
+ ifpath = getenv('IFORT_COMPILER10', '');
case 'ifort11' then
- ifpath = getenv('IFORT_COMPILER11','');
- else
+ ifpath = getenv('IFORT_COMPILER11', '');
+ case 'ifort12' then
+ ifpath = getenv('IFORT_COMPILER12', '');
+ else
ifpath = '';
end
endfunction
-//==========================================
-function bOK = set_commons_msifort11(ifpath,machinepath)
- // intel fortran directories changed with version 11
+//=============================================================================
+function bOK = set_commons_ifort11and12(ifpath, machinepath)
+ // intel fortran directories changed with version 11 and 12
bOK = %F;
- ENV_PATH = getenv('PATH','');
+ ENV_PATH = getenv('PATH', '');
// example set PATH=%IFORT_COMPILER11%\Bin\intel64;
PATH_TO_ADD = ifpath + 'bin' + filesep() + machinepath;
if isdir(PATH_TO_ADD) then
ENV_PATH = PATH_TO_ADD + pathsep() + ENV_PATH;
- err = setenv('PATH',ENV_PATH);
+ err = setenv('PATH', ENV_PATH);
if (err == %F) then bOK = %F,return,end
bOK = %T;
else
end
// example set INCLUDE=%IFORT_COMPILER11%\include\intel64;
- ENV_INCLUDE = getenv('INCLUDE','');
+ ENV_INCLUDE = getenv('INCLUDE', '');
PATH_TO_ADD = ifpath + 'include' + filesep() + machinepath;
if isdir(PATH_TO_ADD) then
ENV_INCLUDE = PATH_TO_ADD + pathsep() + ENV_INCLUDE;
- err = setenv('INCLUDE',ENV_INCLUDE);
+ err = setenv('INCLUDE', ENV_INCLUDE);
if (err == %F) then bOK = %F,return,end
bOK = %T;
else
end
// example set LIB=%IFORT_COMPILER10%\lib\intel64;
- ENV_LIB = getenv('LIB','');
+ ENV_LIB = getenv('LIB', '');
PATH_TO_ADD = ifpath + 'lib' + filesep() + machinepath;
if isdir(PATH_TO_ADD) then
ENV_LIB = PATH_TO_ADD + pathsep() + ENV_LIB;
- err = setenv('LIB',ENV_LIB);
+ err = setenv('LIB', ENV_LIB);
if (err == %F) then bOK = %F,return,end
bOK = %T;
else
bOK = %F;
return;
end
-
+
endfunction
-//==========================================
+//=============================================================================
function bOK = set_commons_msi9and10(ifpath,machinepath)
bOK = %F;
-
+
// example set PATH=%IFORT_COMPILER10%\EM64T\Bin;
- ENV_PATH = getenv('PATH','');
+ ENV_PATH = getenv('PATH', '');
PATH_TO_ADD = ifpath + machinepath + filesep() + 'bin';
if isdir(PATH_TO_ADD) then
ENV_PATH = PATH_TO_ADD + pathsep() + ENV_PATH;
- err = setenv('PATH',ENV_PATH);
+ err = setenv('PATH', ENV_PATH);
if (err == %F) then bOK = %F,return,end
bOK = %T;
else
bOK = %F;
return;
end
-
+
// example set INCLUDE=%IFORT_COMPILER10%\EM64T\Include;
- ENV_INCLUDE = getenv('INCLUDE','');
+ ENV_INCLUDE = getenv('INCLUDE', '');
PATH_TO_ADD = ifpath + machinepath + filesep() + 'Include';
if isdir(PATH_TO_ADD) then
ENV_INCLUDE = PATH_TO_ADD + pathsep() + ENV_INCLUDE;
- err = setenv('INCLUDE',ENV_INCLUDE);
+ err = setenv('INCLUDE', ENV_INCLUDE);
if (err == %F) then bOK = %F,return,end
bOK = %T;
else
bOK = %F;
return;
end
-
+
// example set LIB=%IFORT_COMPILER10%\EM64T\Lib;
- ENV_LIB = getenv('LIB','');
+ ENV_LIB = getenv('LIB', '');
PATH_TO_ADD = ifpath + machinepath + filesep() + 'Lib';
if isdir(PATH_TO_ADD) then
ENV_LIB = PATH_TO_ADD + pathsep() + ENV_LIB;
- err = setenv('LIB',ENV_LIB);
+ err = setenv('LIB', ENV_LIB);
if (err == %F) then bOK = %F,return,end
bOK = %T;
else
bOK = %F;
return;
end
-
+
endfunction
-//==========================================
+//=============================================================================
bOK = %F;
if getos() == 'Windows' then
ifortcompiler = findmsifortcompiler();
if ifortcompiler <> 'unknown' then
if_path = getIFpath(ifortcompiler);
-
+
if win64() & detectmsifort64tools() then
- if ifortcompiler == 'ifort11' then
- set_commons_msifort11(if_path,'intel64');
+ if (ifortcompiler == 'ifort11') | (ifortcompiler == 'ifort12') then
+ set_commons_ifort11and12(if_path, 'intel64');
else
- set_commons_msi9and10(if_path,'EM64T');
+ set_commons_msi9and10(if_path, 'EM64T');
end
else
- if ifortcompiler == 'ifort11' then
- set_commons_msifort11(if_path,'ia32');
+ if (ifortcompiler == 'ifort11') | (ifortcompiler == 'ifort12') then
+ set_commons_ifort11and12(if_path,'ia32');
else
set_commons_msi9and10(if_path,'IA32');;
end
end
-
end
end
endfunction
+//=============================================================================
-//==========================================
-//==========================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) INRIA - Allan CORNET
-// Copyright (C) DIGITEO - 2009 - Allan CORNET
-//
+// Copyright (C) DIGITEO - 2009-2010 - Allan CORNET
+//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution. The terms
-// are also available at
+// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-//==========================================
+//=============================================================================
function bOK = configure_msvc()
-//==========================================
-// functions defined only in configure_msvc
-//==========================================
-function bOK = set_msvc100express()
bOK = %F;
- try
- MSVSDir = winqueryreg('HKEY_LOCAL_MACHINE','Software\Microsoft\VCExpress\10.0\Setup\VS','ProductDir');
- catch
- MSVSDir = '';
+ if getos() <> 'Windows' then
+ return
end
-
- DevEnvDir = MSVSDir + 'Common7\IDE\';
- err = setenv('DevEnvDir', DevEnvDir);
- if (err == %F) then bOK = %F,return,end
-
- VCINSTALLDIR = MSVSDir + 'VC\';
- err = setenv('VCINSTALLDIR', VCINSTALLDIR);
- if (err == %F) then bOK = %F,return,end
-
- VS100COMNTOOLS = MSVSDir + 'Common7\Tools\'
- err = setenv('VS100COMNTOOLS', VS100COMNTOOLS);
- if (err == %F) then bOK = %F,return,end
-
- VSINSTALLDIR = MSVSDir;
- err = setenv('VSINSTALLDIR', VSINSTALLDIR);
- if (err == %F) then bOK = %F,return,end
-
- SDK = get_ms_SDK();
- if SDK <> '' then
- err = setenv('WindowsSdkDir',SDK);
- if (err == %F) then bOK = %F,return,end
- end
-
- PATH = getenv('PATH','');
- PATH_ADD_VC_1 = MSVSDir + 'Common7\IDE\';
- PATH_ADD_VC_2 = MSVSDir + 'VC\BIN';
- PATH_ADD_VC_3 = MSVSDir + 'Common7\Tools';
- PATH_ADD_VC_4 = MSVSDir + 'VC\VCPackages';
- PATH_ADD_VC_5 = SDK + 'bin';
-
- PATH = PATH_ADD_VC_1 + ';' + PATH_ADD_VC_2 + ';' + ..
- PATH_ADD_VC_3 + ';' + PATH_ADD_VC_4 + ';' + ..
- PATH_ADD_VC_5 + PATH;
- err = setenv('PATH', PATH);
- if (err == %F) then bOK = %F,return,end
-
- INCLUDE_ADD_VC_1 = MSVSDir + 'VC\INCLUDE';
- INCLUDE_ADD_VC_2 = SDK + 'include';
-
- INCLUDE = getenv('INCLUDE','');
- INCLUDE = INCLUDE_ADD_VC_1 + ';' + INCLUDE_ADD_VC_2 + ';' + INCLUDE;
- err = setenv('INCLUDE', INCLUDE);
- if (err == %F) then bOK = %F,return,end
-
- LIB_ADD_VC_1 = MSVSDir + 'VC\LIB';
- LIB_ADD_VC_2 = SDK + 'lib';
- LIB = getenv('LIB','');
- LIB = LIB_ADD_VC_1 + ';' + LIB_ADD_VC_2 + ';' + LIB;
- err = setenv('LIB', LIB);
- if (err == %F) then bOK = %F,return,end
-
- LIB_ADD_VC_1 = MSVSDir + 'VC\LIB';
- LIBPATH = getenv('LIBPATH','');
- LIBPATH = LIB_ADD_VC_1 + ';' + LIBPATH;
- err = setenv('LIBPATH', LIBPATH);
- if (err == %F) then bOK = %F,return,end
-
-endfunction
-//==========================================
-function bOK = set_msvc90pro()
- bOK = %F;
- try
- MSVSDir = winqueryreg('HKEY_LOCAL_MACHINE','Software\Microsoft\VisualStudio\9.0\Setup\VS\Pro','ProductDir');
- catch
- MSVSDir = '';
- end
- bOK = commons_msvc90(MSVSDir);
-endfunction
-//==========================================
-function bOK = set_msvc90std()
- bOK = %F;
- try
- MSVSDir = winqueryreg('HKEY_LOCAL_MACHINE','Software\Microsoft\VisualStudio\9.0\Setup\VS\Std','ProductDir');
- catch
- MSVSDir = '';
- end
- bOK = commons_msvc90(MSVSDir);
-endfunction
-//==========================================
-function bOK = set_msvc90express()
- bOK = %F;
- try
- MSVSDir = winqueryreg('HKEY_LOCAL_MACHINE','Software\Microsoft\VCExpress\9.0\Setup\VS','ProductDir');
- catch
- return;
- end
- if ( part(MSVSDir,length(MSVSDir)) == filesep() ) then MSVSDir = part(MSVSDir,1:length(MSVSDir)-1);end;
-
- err = setenv('VSINSTALLDIR',MSVSDir);
- if (err == %F) then bOK = %F,return,end
-
- MSVCDir = MSVSDir + filesep() + 'VC';
- err = setenv('VCINSTALLDIR',MSVCDir);
- if (err == %F) then bOK = %F,return,end
-
- DevEnvDir = MSVSDir + filesep() +'Common7\IDE';
- err = setenv('DevEnvDir',DevEnvDir);
- if (err == %F) then bOK = %F,return,end
-
- PATH = getenv('PATH','ndef');
- if (PATH == 'ndef') then bOK = %F,return,end
-
- err = setenv('PATH',DevEnvDir + ';' + ..
- MSVCDir + filesep() + 'bin' + pathsep() + ..
- MSVSDir + filesep() + 'Common7\Tools' + pathsep() + ..
- MSVSDir + filesep() + 'SDK\v2.0\bin' + pathsep() + ..
- MSVCDir + filesep() + 'VCPackages' + pathsep() + ..
- PATH + pathsep() );
- if (err == %F) then bOK = %F,return,end
-
- WINDOWSSDK = get_ms_SDK();
-
- if WINDOWSSDK <> '' then
- INCLUDE = getenv('INCLUDE','');
- INCLUDE = MSVCDir + filesep() + 'INCLUDE' + pathsep() + ..
- WINDOWSSDK + 'INCLUDE' + pathsep();
- err = setenv('INCLUDE',INCLUDE);
- if (err == %F) then bOK = %F,return,end
-
- LIB = getenv('LIB','');
- LIB = MSVCDir + filesep() + 'LIB' + pathsep() + ..
- MSVSDir + filesep() + 'SDK\v2.0\lib' + pathsep() + ..
- WINDOWSSDK + 'Lib' + pathsep() + ..
- LIB;
- err = setenv('LIB',LIB);
- if (err == %F) then bOK = %F,return,end
- bOK = %T;
+ // Load dynamic_link Internal lib if it's not already loaded
+ if ~ exists("dynamic_linkwindowslib") then
+ load("SCI/modules/dynamic_link/macros/windows/lib");
end
-endfunction
-//==========================================
-function bOK = set_msvc80pro()
- bOK = %F;
- try
- MSVSDir = winqueryreg('HKEY_LOCAL_MACHINE','Software\Microsoft\VisualStudio\8.0\Setup\VS\Pro','ProductDir');
- catch
- MSVSDir = '';
- end
- bOK = commons_msvc80(MSVSDir);
-endfunction
-//==========================================
-function bOK = set_msvc80std()
- bOK = %F;
- try
- MSVSDir = winqueryreg('HKEY_LOCAL_MACHINE','Software\Microsoft\VisualStudio\8.0\Setup\VS\Std','ProductDir');
- catch
- MSVSDir = '';
- end
- bOK = commons_msvc80(MSVSDir);
-endfunction
-//==========================================
-function bOK = set_msvc80express()
- bOK = %F;
- try
- MSVSDir = winqueryreg('HKEY_LOCAL_MACHINE','Software\Microsoft\VCExpress\8.0\Setup\VS','ProductDir');
- catch
- return;
- end
- if ( part(MSVSDir,length(MSVSDir)) == filesep() ) then MSVSDir = part(MSVSDir,1:length(MSVSDir)-1);end;
-
- err = setenv('VSINSTALLDIR',MSVSDir);
- if (err == %F) then bOK = %F,return,end
-
- MSVCDir = MSVSDir + filesep() + 'VC';
- err = setenv('VCINSTALLDIR',MSVCDir);
- if (err == %F) then bOK = %F,return,end
-
- DevEnvDir = MSVSDir + filesep() +'Common7\IDE';
- err = setenv('DevEnvDir',DevEnvDir);
- if (err == %F) then bOK = %F,return,end
-
- PATH = getenv('PATH','ndef');
- if (PATH == 'ndef') then bOK = %F,return,end
-
- err = setenv('PATH',DevEnvDir + pathsep() + ..
- MSVCDir + filesep() + 'bin' + pathsep() + ..
- MSVSDir + filesep() + 'Common7\Tools' + pathsep() + ..
- MSVSDir + filesep() + 'SDK\v2.0\bin' + pathsep() + ..
- MSVCDir + filesep() + 'VCPackages' + pathsep() + ..
- PATH + pathsep() );
- if (err == %F) then bOK=%F,return,end
-
- WINDOWSSDK = get_ms_SDK();
-
- if WINDOWSSDK <> '' then
- INCLUDE = getenv('INCLUDE','');
- INCLUDE = MSVCDir + filesep() + 'INCLUDE' + pathsep() + ..
- WINDOWSSDK + 'INCLUDE' + pathsep();
- err = setenv('INCLUDE',INCLUDE);
- if (err == %F) then bOK = %F,return,end
-
- LIB = getenv('LIB','');
- LIB = MSVCDir + filesep() + 'LIB' + pathsep() + ..
- MSVSDir + filesep() + 'SDK\v2.0\lib' + pathsep() + ..
- WINDOWSSDK + 'Lib' + pathsep() + ..
- LIB;
- err = setenv('LIB',LIB);
- if (err == %F) then bOK = %F,return,end
- bOK = %T;
- end
-
-endfunction
-//==========================================
-function bOK = set_msvc71()
- bOK = %F;
- try
- MSVCDir = winqueryreg('HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\VisualStudio\7.1\Setup\VC','ProductDir');
- catch
- return;
- end
- if ( part(MSVCDir,length(MSVCDir)) == filesep() ) then MSVCDir = part(MSVCDir,1:length(MSVCDir)-1),end;
-
- err = setenv('MSVCDir',MSVCDir);
- if (err == %F) then bOK = %F,return,end
-
- err=setenv('DevEnvDir',MSVCDir + filesep() + '..\Common7\Tools');
- if (err == %F) then bOK = %F,return,end
-
- PATH = getenv('PATH','ndef');
- if (PATH =='ndef') then bOK = %F,return,end
-
- DevEnvDir = getenv('DevEnvDir','ndef');
- if (DevEnvDir =='ndef') then bOK = %F,return,end
-
- err = setenv('PATH',MSVCDir + filesep() + 'BIN' + pathsep() + ..
- DevEnvDir + pathsep() + ..
- DevEnvDir + filesep() + 'bin' + pathsep() + ..
- MSVCDir + filesep() + '..\Common7\IDE' + pathsep() + ..
- PATH + pathsep() );
- if (err == %F) then bOK = %F,return,end
-
- INCLUDE = getenv('INCLUDE','');
-
- err = setenv('INCLUDE',MSVCDir + filesep() + 'ATLMFC\INCLUDE' + pathsep() + ..
- MSVCDir + filesep() + 'INCLUDE' + pathsep() + ..
- MSVCDir + filesep() + 'PlatformSDK\include' + pathsep() + ..
- INCLUDE);
- if (err == %F) then bOK = %F,return,end
-
- LIB = getenv('LIB','ndef');
-
- err = setenv('LIB',MSVCDir + filesep() + 'ATLMFC\LIB' + pathsep() + ..
- MSVCDir + filesep() + 'LIB' + pathsep() + ..
- MSVCDir + filesep() + 'PlatformSDK\lib' + pathsep() + ..
- LIB);
- if (err == %F) then bOK = %F,return,end
-
- bOK=%T;
-endfunction
-//==========================================
-function bOK = set_msvc70()
- bOK = %F;
- try
- MSVCDir = winqueryreg('HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\VisualStudio\7.0\Setup\VC','ProductDir');
- catch
- return;
- end
- if ( part(MSVCDir,length(MSVCDir)) == filesep() ) then MSVCDir = part(MSVCDir,1:length(MSVCDir)-1),end;
-
- err = setenv('MSVCDir',MSVCDir);
- if (err == %F) then bOK = %F,return,end
-
- err = setenv('DevEnvDir',MSVCDir + filesep() + '..\Common7\Tools');
- if (err == %F) then bOK = %F,return,end
-
- DevEnvDir = getenv('DevEnvDir','ndef');
- if (DevEnvDir =='ndef') then bOK = %F,return,end
-
- PATH=getenv('PATH','ndef');
- if (PATH =='ndef') then bOK = %F,return,end
-
- err = setenv('PATH',MSVCDir + filesep() + 'BIN;' + ..
- DevEnvDir + pathsep() + ..
- DevEnvDir + filesep() + 'bin' + pathsep() + ..
- MSVCDir + filesep() + '..\Common7\IDE' + pathsep() + ..
- PATH + pathsep() );
- if (err == %F) then bOK=%F,return,end
-
- INCLUDE = getenv('INCLUDE','');
-
- err = setenv('INCLUDE',MSVCDir + filesep() + 'ATLMFC\INCLUDE' + pathsep() + ..
- MSVCDir + filesep() + 'INCLUDE' + pathsep() +..
- MSVCDir + filesep() + 'PlatformSDK\include' + pathsep() + ..
- INCLUDE);
- if (err == %F) then bOK=%F,return,end
-
- LIB = getenv('LIB','');
-
- err = setenv('LIB',MSVCDir + filesep() + 'ATLMFC\LIB' + pathsep() + ..
- MSVCDir + filesep() + 'LIB'+ pathsep() +..
- MSVCDir + filesep() + 'PlatformSDK\lib' + pathsep() + ..
- LIB);
- if (err == %F) then bOK = %F,return,end
-
- bOK = %T;
-
-endfunction
-//==========================================
-function SDKpath = get_ms_SDK()
- // We always use last version of MS SDK
- try
- // Vista SDK
- SDKpath = winqueryreg('HKEY_LOCAL_MACHINE', ..
- 'Software\Microsoft\Microsoft SDKs\Windows', ..
- 'CurrentInstallFolder');
- return;
- catch
- try
- // Windows 2003 R2 SDK
- SDKpath = winqueryreg('HKEY_LOCAL_MACHINE', ..
- 'Software\Microsoft\MicrosoftSDK\InstalledSDKs\D2FF9F89-8AA2-4373-8A31-C838BF4DBBE1', ..
- 'Install Dir');
- return;
- catch
- try
- // Windows 2003 SDK
- SDKpath = winqueryreg('HKEY_LOCAL_MACHINE', ..
- 'Software\Microsoft\MicrosoftSDK\InstalledSDKs\8F9E5EF3-A9A5-491B-A889-C58EFFECE8B3', ..
- 'Install Dir');
- return;
- catch
- SDKpath = '';
- end
- end
- end
-endfunction
-//==========================================
-function bOK = commons_msvc80(MS_VS_DIRECTORY)
- bOK = %F;
- if (MS_VS_DIRECTORY <> '') then
- if ( part(MS_VS_DIRECTORY,length(MS_VS_DIRECTORY)) == filesep() ) then
- MSVSDir = part(MS_VS_DIRECTORY,1:length(MS_VS_DIRECTORY)-1);
- end;
-
- err = setenv('VSINSTALLDIR',MSVSDir);
- if (err == %F) then bOK = %F,return,end
-
- MSVCDir = MSVSDir + filesep() + 'VC';
- err = setenv('VCINSTALLDIR',MSVCDir);
- if (err == %F) then bOK = %F,return,end
-
- DevEnvDir = MSVSDir + filesep() + 'Common7\IDE';
- err = setenv('DevEnvDir',DevEnvDir);
- if (err == %F) then bOK = %F,return,end
-
- PATH = getenv('PATH','ndef');
- if (PATH == 'ndef') then bOK = %F,return,end
-
- err=setenv('PATH',DevEnvDir + pathsep() + ..
- MSVCDir + filesep() + 'bin' + pathsep() + ..
- MSVSDir + filesep() + 'Common7\Tools'+ pathsep() + ..
- MSVSDir + filesep() + 'SDK\v2.0\bin' + pathsep() + ..
- MSVCDir + filesep() + 'VCPackages' + pathsep() + ..
- PATH + pathsep() );
- if (err == %F) then bOK=%F,return,end
-
- INCLUDE = getenv('INCLUDE','');
- INCLUDE = MSVCDir + filesep() + 'INCLUDE' + pathsep() + ..
- MSVCDir + filesep() + 'PlatformSDK\include' + pathsep() + ..
- MSVSDir + filesep() + 'SDK\v2.0\include' + pathsep() + ..
- INCLUDE;
-
- err = setenv('INCLUDE',INCLUDE);
- if (err == %F) then bOK = %F,return,end
-
- LIB = getenv('LIB','');
- LIB = MSVCDir + filesep() + 'LIB' + pathsep() + ..
- MSVSDir + filesep() + 'SDK\v2.0\lib' + pathsep() + ..
- MSVSDir + filesep() + 'VC\PlatformSDK\lib' + pathsep() + ..
- LIB;
- err = setenv('LIB',LIB);
- if (err == %F) then bOK = %F,return,end
-
- bOK = %T;
- end
-endfunction
-//==========================================
-function bOK = commons_msvc90(MS_VS_DIRECTORY)
- bOK = %F;
- if (MS_VS_DIRECTORY <> '') then
- if ( part(MS_VS_DIRECTORY,length(MS_VS_DIRECTORY)) == filesep() ) then
- MSVSDir = part(MS_VS_DIRECTORY,1:length(MS_VS_DIRECTORY)-1);
- end;
-
- err = setenv('VSINSTALLDIR',MSVSDir);
- if (err == %F) then bOK = %F,return,end
-
- SDK = get_ms_SDK();
- if SDK <> '' then
- err = setenv('WindowsSdkDir',SDK);
- if (err == %F) then bOK = %F,return,end
- end
-
- MSVCDir = MSVSDir + filesep() + 'VC';
- err = setenv('VCINSTALLDIR',MSVCDir);
- if (err == %F) then bOK = %F,return,end
-
- DevEnvDir = MSVSDir + filesep() + 'Common7\IDE';
- err = setenv('DevEnvDir',DevEnvDir);
- if (err == %F) then bOK = %F,return,end
-
- PATH = getenv('PATH','ndef');
- if (PATH == 'ndef') then bOK = %F,return,end
-
- err=setenv('PATH',DevEnvDir + pathsep() + ..
- MSVCDir + filesep() + 'bin' + pathsep() + ..
- MSVSDir + filesep() + 'Common7\Tools'+ pathsep() + ..
- MSVCDir + filesep() + 'VCPackages' + pathsep() + ..
- PATH + pathsep() );
- if (err == %F) then bOK=%F,return,end
-
- INCLUDE = getenv('INCLUDE','');
- INCLUDE = MSVCDir + filesep() + 'INCLUDE' + pathsep() + ..
- SDK + 'INCLUDE' + pathsep() + ..
- INCLUDE;
-
-
- err = setenv('INCLUDE',INCLUDE);
- if (err == %F) then bOK = %F,return,end
-
- LIB = getenv('LIB','');
- LIB = MSVCDir + filesep() + 'LIB' + pathsep() + ..
- SDK + filesep() + 'lib' + pathsep() + ..
- LIB;
- err = setenv('LIB',LIB);
- if (err == %F) then bOK = %F,return,end
-
- bOK = %T;
- end
-endfunction
-//==========================================
-function bOK = commons_msvc100(MS_VS_DIRECTORY)
-endfunction
-//==========================================
-function bOK = set_msvc100express_x64()
- bOK = %F;
- try
- MSVSDir = winqueryreg('HKEY_LOCAL_MACHINE', ..
- 'Software\Microsoft\VCExpress\10.0\Setup\VS', ..
- 'ProductDir');
- catch
- return;
- end
- bOK = commons_msvc100_x64(MSVSDir);
-endfunction
-//==========================================
-function bOK = set_msvc90pro_x64()
- bOK = %F;
- try
- MSVSDir = winqueryreg('HKEY_LOCAL_MACHINE', ..
- 'Software\Microsoft\VisualStudio\9.0\Setup\VS\Pro', ..
- 'ProductDir');
- catch
- MSVSDir = '';
- end
- bOK = commons_msvc90_x64(MSVSDir);
-endfunction
-//==========================================
-function bOK = set_msvc90std_x64()
- bOK = %F;
- try
- MSVSDir = winqueryreg('HKEY_LOCAL_MACHINE', ..
- 'Software\Microsoft\VisualStudio\9.0\Setup\VS\Std', ..
- 'ProductDir');
- catch
- MSVSDir = '';
- end
- bOK = commons_msvc90_x64(MSVSDir);
-endfunction
-//==========================================
-function bOK = set_msvc90express_x64()
- bOK = %F;
- try
- MSVSDir = winqueryreg('HKEY_LOCAL_MACHINE', ..
- 'Software\Microsoft\VCExpress\9.0\Setup\VS', ..
- 'ProductDir');
- catch
- return;
- end
- bOK = commons_msvc90_x64(MSVSDir);
-endfunction
-//==========================================
-function bOK = commons_msvc90_x64(MS_VS_DIRECTORY)
- bOK = %F;
- if (MS_VS_DIRECTORY <> '') then
- if ( part(MS_VS_DIRECTORY,length(MS_VS_DIRECTORY)) == filesep() ) then
- MSVSDir = part(MS_VS_DIRECTORY,1:length(MS_VS_DIRECTORY)-1);
- end;
-
- err = setenv('VSINSTALLDIR',MSVSDir);
- if (err == %F) then bOK = %F,return,end
-
- err = setenv('VCINSTALLDIR',MSVSDir+'\VC');
- if (err == %F) then bOK = %F,return,end
-
- err = setenv('VS90COMNTOOLS',MSVSDir+'\Common7\Tools\');
- if (err == %F) then bOK = %F,return,end
-
-
- SDK = get_ms_SDK();
- if SDK <> '' then
- err = setenv('WindowsSdkDir',SDK);
- if (err == %F) then bOK = %F,return,end
+ msvc = findmsvccompiler();
+ if win64() & detectmsvc64tools() then
+ bOK = dlwConfigureVcx64();
+ else
+ bOK = dlwConfigureVcx86();
+ if ~bOK then
+ warning(msprintf(gettext('Microsoft Visual Studio C x86 Compiler not found.')));
end
-
- INCLUDE = getenv('INCLUDE','');
- INCLUDE = MSVSDir + '\VC\ATLMFC\INCLUDE' + pathsep() + ..
- MSVSDir + '\VC\INCLUDE' + pathsep() + ..
- SDK + '\include' + pathsep() + INCLUDE;
-
- err = setenv('INCLUDE',INCLUDE);
- if (err == %F) then bOK = %F,return,end
-
- LIB = getenv('LIB','');
- LIB = MSVSDir + '\VC\ATLMFC\LIB\amd64' + pathsep() + ..
- MSVSDir + '\VC\LIB\amd64' + pathsep() + ..
- SDK + '\lib\x64' + pathsep() + LIB;
-
- err = setenv('LIB',LIB);
- if (err == %F) then bOK = %F,return,end
-
- LIBPATH = getenv('LIBPATH','');
- LIBPATH = MSVSDir + 'VC\ATLMFC\LIB\amd64' + pathsep() + ..
- MSVSDir + 'VC\LIB\amd64' + pathsep() + LIBPATH;
-
- err = setenv('LIBPATH',LIBPATH);
- if (err == %F) then bOK = %F,return,end
-
- LIB = getenv('LIB','');
- LIB = MSVSDir + '\VC\ATLMFC\LIB\amd64' + pathsep() + ..
- MSVSDir + '\VC\LIB\amd64' + pathsep() + ..
- SDK + '\lib\x64' + pathsep() + LIB;
-
- err = setenv('LIB',LIB);
- if (err == %F) then bOK = %F,return,end
-
- PATH = getenv('PATH','');
- PATH = MSVSDir + '\VC\BIN\amd64' + pathsep() + ..
- MSVSDir + '\VC\VCPackages' + pathsep() + ..
- MSVSDir + '\Common7\IDE' + pathsep() + ..
- MSVSDir + '\Common7\Tools' + pathsep() + ..
- MSVSDir + '\Common7\Tools\bin' + pathsep() + ..
- SDK + '\bin\x64' + pathsep() + ..
- SDK + '\bin\win64\x64' + pathsep() + ..
- SDK + '\bin' + pathsep() + PATH;
-
- err = setenv('PATH',PATH);
- if (err == %F) then bOK = %F,return,end
-
end
-endfunction
-//==========================================
-
- if getos() == 'Windows' then
- msvc = findmsvccompiler();
- bOK = %F;
-
- if win64() & detectmsvc64tools() then
- select msvc,
-
- // Microsoft Visual 2010 Express
- // not yet tested
-// case 'msvc100express' then
-// bOK = set_msvc100express_x64();
-
- // Microsoft Visual 2008 Studio Professional
- case 'msvc90pro' then
- bOK = set_msvc90pro_x64();
-
- // Microsoft Visual 2008 Studio Standard
- case 'msvc90std' then
- bOK = set_msvc90std_x64();
-
- // Microsoft Visual 2008 Express
- case 'msvc90express' then
- bOK = set_msvc90express_x64();
- else
- bOK = %F;
- end
- else
- select msvc,
-
- // Microsoft Visual 2010 Express
- case 'msvc100express' then
- bOK = set_msvc100express();
-
- // Microsoft Visual 2008 Studio Professional
- case 'msvc90pro' then
- bOK = set_msvc90pro();
-
- // Microsoft Visual 2008 Studio Standard
- case 'msvc90std' then
- bOK = set_msvc90std();
-
- // Microsoft Visual 2008 Express
- case 'msvc90express' then
- bOK = set_msvc90express();
- // Microsoft Visual 2005 Studio Professional
- case 'msvc80pro' then
- bOK = set_msvc80pro();
-
- // Microsoft Visual 2005 Studio Standard
- case 'msvc80std' then
- bOK = set_msvc80std();
-
- // Microsoft Visual 2005 Express
- case 'msvc80express' then
- bOK = set_msvc80express();
-
- // Microsoft Visual Studio .NET 2003
- case 'msvc71' then
- bOK = set_msvc71();
-
- // Microsoft Visual Studio .NET 2002
- case 'msvc70' then
- bOK = set_msvc70();
-
- else
- warning(msprintf(gettext('Microsoft Visual Studio C Compiler not found.')));
- bOK = %F;
- end
- end
- else
- bOK = %F;
- end
endfunction
-//==========================================
-
+//=============================================================================
-//==========================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) DIGITEO - Allan CORNET
-//
+//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution. The terms
-// are also available at
+// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-//==========================================
-
+//=============================================================================
function bOK = detectmsifort64tools()
bOK = %F;
if getos() == 'Windows' & win64() then
- IFORTPATH = '';
+ IFORTPATH = '';
ifortcomp = findmsifortcompiler();
if ifortcomp <> 'unknown' then
select ifortcomp,
-
- case 'ifort11' then
+ case 'ifort12' then
+ IFORTPATH = getenv('IFORT_COMPILER12','');
+
+ case 'ifort11' then
IFORTPATH = getenv('IFORT_COMPILER11','');
-
- case 'ifort10' then
+
+ case 'ifort10' then
IFORTPATH = getenv('IFORT_COMPILER10','');
-
- case 'ifort9' then
+
+ case 'ifort9' then
IFORTPATH = getenv('IFORT_COMPILER9','');
-
+
else
show = displayWarningmsifort();
if show then
- TXT = gettext('Intel Fortran Comiler 9, 10 or 11 Compiler not found.');
+ TXT = gettext('Intel Fortran Comiler 9, 10, 11 or 12 Compiler not found.');
warning(TXT);
clear TXT;
disableWarningmsifort();
return
end
end
-
- if (ifortcomp == 'ifort11') then
+
+ if (ifortcomp == 'ifort11') | (ifortcomp == 'ifort12') then
IFORTSPATHEMT64 = IFORTPATH + 'lib\intel64';
else
IFORTSPATHEMT64 = IFORTPATH + 'em64t';
end
-
+
if isdir(IFORTSPATHEMT64) then
bOK = %T;
end
end
-
+
endfunction
-//==========================================
+//=============================================================================
function show = displayWarningmsifort()
settings_filename = '/.settings_warning_msif';
settings_file = pathconvert(SCIHOME+settings_filename,%f,%t);
w = fileinfo(settings_file);
show = %t;
- if w <> [] then
- show = grep(mgetl(settings_file),'displayWarningIFx64=no')==[]
- end
+ if isfile(settings_file) then
+ show = grep(mgetl(settings_file),'displayWarningIFx64=no')==[]
+ end
endfunction
-//==========================================
+//=============================================================================
function disableWarningmsifort()
settings_filename = '/.settings_warning_msif';
settings_file = pathconvert(SCIHOME+settings_filename,%f,%t);
mputl('displayWarningIFx64=no',settings_file);
endfunction
-//==========================================
+//=============================================================================
-//==========================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) INRIA - Allan CORNET
-//
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution. The terms
-// are also available at
+// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-//==========================================
-
+//=============================================================================
function bOK = detectmsvc64tools()
- bOK = %F;
- if getos() == 'Windows' & win64() then
- compiler = findmsvccompiler();
- if ( (compiler == 'msvc90pro') | ..
- (compiler == 'msvc90std') | ..
- (compiler == 'msvc90express') ) then
- select compiler,
- // Microsoft Visual 2008 Studio Professional
- case 'msvc90pro' then
- MSVSPATH = winqueryreg('HKEY_LOCAL_MACHINE', ..
- 'Software\Microsoft\VisualStudio\9.0\Setup\VS\Pro', ..
- 'ProductDir');
-
- // Microsoft Visual 2008 Studio Standard
- case 'msvc90std' then
- MSVSPATH = winqueryreg('HKEY_LOCAL_MACHINE', ..
- 'Software\Microsoft\VisualStudio\9.0\Setup\VS\Std', ..
- 'ProductDir');
-
- // Microsoft Visual 2008 Express
- case 'msvc90express' then
- MSVSPATH = winqueryreg('HKEY_LOCAL_MACHINE', ..
- 'Software\Microsoft\VCExpress\9.0\Setup\VS', ..
- 'ProductDir');
- else
- show = displayWarningMsVC();
- if show then
- TXT = gettext('Microsoft Visual Studio C 2008 Compiler not found.');
- warning(TXT);
- clear TXT;
- disableWarningMsVC();
- end
- bOK = %F;
- return
- end
-
- MSVCBIN64PATH = MSVSPATH + 'VC\bin\amd64';
- if fileinfo(MSVCBIN64PATH) <> [] then
- bOK = %T;
- else
- show = displayWarningMsVC();
- if show then
- TXT = gettext('Microsoft Visual Studio C 2008 x64 Compiler not installed.');
- warning(TXT);
- clear TXT;
- disableWarningMsVC();
- end
- bOK = %F;
- end
-
- end
- end
-
-endfunction
-//==========================================
-function show = displayWarningMsVC()
- settings_filename = '/.settings_warning_msvc';
- settings_file = pathconvert(SCIHOME+settings_filename,%f,%t);
- w = fileinfo(settings_file);
- show = %t;
- if w <> [] then
- show = grep(mgetl(settings_file),'displayWarningMSVCx64=no')==[]
- end
-endfunction
-//==========================================
-function disableWarningMsVC()
- settings_filename = '/.settings_warning_msvc';
- settings_file = pathconvert(SCIHOME+settings_filename,%f,%t);
- mputl('displayWarningMSVCx64=no',settings_file);
+ bOK = %F;
+ if getos() <> 'Windows' then
+ return
+ end
+
+ //=============================================================================
+ // internal functions
+ //=============================================================================
+ function show = displayWarningMsVC()
+ settings_filename = '/.settings_warning_msvc';
+ settings_file = pathconvert(SCIHOME + settings_filename, %f, %t);
+ w = fileinfo(settings_file);
+ show = %t;
+ if isfile(settings_file) then
+ show = grep(mgetl(settings_file), 'displayWarningMSVCx64=no') == [];
+ end
+ endfunction
+ //=============================================================================
+ function disableWarningMsVC()
+ settings_filename = '/.settings_warning_msvc';
+ settings_file = pathconvert(SCIHOME + settings_filename, %f, %t);
+ mputl('displayWarningMSVCx64=no', settings_file);
+ endfunction
+ //=============================================================================
+
+
+ // Load dynamic_link Internal lib if it's not already loaded
+ if ~ exists("dynamic_linkwindowslib") then
+ load("SCI/modules/dynamic_link/macros/windows/lib");
+ end
+
+ if win64() then
+ compiler = findmsvccompiler();
+ supported_compiler = ['msvc100pro', ..
+ 'msvc100express', ..
+ 'msvc90pro', ..
+ 'msvc90std', ..
+ 'msvc90express'];
+
+ if (find(supported_compiler == compiler) <> []) then
+ MSVCBIN64PATH = dlwGet64BitPath() + filesep() + 'VC\bin\amd64';
+ if isdir(MSVCBIN64PATH) then
+ bOK = %T;
+ else
+ show = displayWarningMsVC();
+ if show then
+ TXT = gettext('Microsoft Visual Studio C 2008 or more x64 Compiler not installed.');
+ warning(TXT);
+ clear TXT;
+ disableWarningMsVC();
+ end
+ bOK = %F;
+ end
+ else
+ show = displayWarningMsVC();
+ if show then
+ TXT = gettext('Microsoft Visual Studio C 2008 or more Compiler not found.');
+ warning(TXT);
+ clear TXT;
+ disableWarningMsVC();
+ end
+ bOK = %F;
+ end
+ end
+
endfunction
-//==========================================
+//=============================================================================
-//==========================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) DIGITEO - Allan CORNET
-//
+//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution. The terms
-// are also available at
+// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-//==========================================
+//=============================================================================
+function dllinfolist = dllinfo(dllname, options)
-function dllinfolist = dllinfo(dllname,options)
+ dllinfolist = list();
+ if getos() <> 'Windows' then
+ warning(msprintf(gettext("%s: This feature has been implemented for Windows.\n"),'dllinfo'));
+ else
+ // Load dynamic_link Internal lib if it's not already loaded
+ if ~ exists("dynamic_linkwindowslib") then
+ load("SCI/modules/dynamic_link/macros/windows/lib");
+ end
-//==========================================
-function symbolslist = dllinfoimports(dllname)
- symbolslist = list();
- [result,bOK] = dos('dumpbin /IMPORTS ""' + dllname +'""');
- if bOK == %T then
- result(5) = '';
- indicedotdll=grep(result,'.dll');
-
- if (indicedotdll <> []) then
- dlllist = result(indicedotdll);
-
- symbolslist = list();
+ [lhs,rhs] = argn(0);
- for i = 1:size(dlllist,'*')-1
- symbolsdll = [];
- symbolsdllstr = result(indicedotdll(i)+6:indicedotdll(i+1)-2);
- for j = 1: size(symbolsdllstr,'*')
- tok = tokens(symbolsdllstr(j),' ');
- if size(tok,'*') >=2 then
- symbolsdll(j) = tok(2);
- end
- end
- symbolslist(i)= list(dlllist(i),symbolsdll);
- end
-
- symbolsdllstr = result(indicedotdll(size(dlllist,'*'))+6:grep(result,'.data')-4);
- for j = 1: size(symbolsdllstr,'*')
- symbolsdll = [];
- tok = tokens(symbolsdllstr(j),' ');
- if size(tok,'*') >=2 then
- symbolsdll(j) = tok(2);
- end
- end
- symbolslist(size(dlllist,'*'))= list(dlllist(size(dlllist,'*')),symbolsdll);
+ if rhs == 1 then
+ options = 'exports';
end
- end
-endfunction
-//==========================================
-function symbolslist = dllinfoexports(dllname)
- symbolslist = list();
- symbolsdll = [];
- [result,bOK] = dos('dumpbin /EXPORTS ""' + dllname +'""');
- if bOK == %T then
- if size(result,'*') > 20 then
- indicenumberfunctstr = 15;
- numberfunctstr = result(indicenumberfunctstr);
- numberfunct = sscanf(numberfunctstr,'%d');
-
- indicefirstsymbolstr = 20;
- firstsymbolstr = result(indicefirstsymbolstr);
- for i = 0:numberfunct
- tok = tokens(result(indicefirstsymbolstr + i),' ');
- if size(tok,'*') >=4 then
- symbolsdll = [symbolsdll;tok(4)];
- end
- end
- [pat,nam,ext] = fileparts(dllname);
- symbolslist = list(nam+ext,symbolsdll);
+ if type(dllname) <> 10 | size(dllname, "*") <> 1 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"),'dllinfo',1));
end
- end
-endfunction
-//==========================================
-function dllinfolist = dllinfomachine(dllname)
- dllinfolist = list();
- machine = '';
- [result,bOK] = dos('dumpbin /HEADERS ""' + dllname +'""');
- if bOK == %T then
- if size(result,'*') > 20 then
- indiceinfomachine = 12;
- infomachinestr = result(indiceinfomachine);
- tok = tokens(infomachinestr,' ');
- if size(tok,'*') == 3 then
- machine = strsubst(tok(3),')','');
- machine = strsubst(machine,'(','');
- end
- [pat,nam,ext] = fileparts(dllname);
- dllinfolist = list(nam+ext,machine);
+ if fileinfo(dllname) == [] then
+ error(msprintf(gettext("%s: The file %s does not exist.\n"),'dllinfo',dllname));
end
- end
-endfunction
-//==========================================
-
- [lhs,rhs]=argn(0);
-
- if rhs == 1 then
- options = 'exports';
- end
-
- if type(dllname) <> 10 | size(dllname) <> 1 then
- error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"),'dllinfo',1));
- end
-
- if fileinfo(dllname) == [] then
- error(msprintf(gettext("%s: The file %s does not exist.\n"),'dllinfo',dllname));
- end
-
- fext = fileext(dllname);
- if ~(strcmpi(fext,'.exe') == 0 | strcmpi(fext,'.dll')== 0) then
- error(msprintf(gettext("%s: Cannot open file %s.\n"),'dllinfo',dllname));
- end
- if type(options) <> 10 | size(options) <> 1 then
- error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"),'dllinfo',2));
- end
+ fext = fileext(dllname);
+ if ~(strcmpi(fext,'.exe') == 0 | strcmpi(fext,'.dll')== 0) then
+ error(msprintf(gettext("%s: Cannot open file %s.\n"),'dllinfo',dllname));
+ end
- if ~(strcmpi(options,'imports')== 0 | strcmpi(options,'exports')== 0 | strcmpi(options,'machine')== 0) then
- error(msprintf(gettext("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"),'dllinfo',2,'''imports'',''exports'',''machine'''));
- end
-
- dllinfolist = list();
-
- if getos() == 'Windows' then
- if findmsvccompiler() <> 'unknown' then
- if strcmpi(options,'imports')== 0 then
- dllinfolist = dllinfoimports(dllname);
- end
+ if type(options) <> 10 | size(options) <> 1 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"),'dllinfo',2));
+ end
- if strcmpi(options,'exports')== 0 then
- dllinfolist = dllinfoexports(dllname);
- end
-
- if strcmpi(options,'machine')== 0 then
- dllinfolist = dllinfomachine(dllname);
- end
-
- else
- warning(msprintf(gettext("%s: This feature required Microsoft visual studio C compiler.\n"),'dllinfo'));
+ if ~(strcmpi(options,'imports')== 0 | strcmpi(options,'exports')== 0 | strcmpi(options,'machine')== 0) then
+ error(msprintf(gettext("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"),'dllinfo',2,'''imports'',''exports'',''machine'''));
end
- else
- warning(msprintf(gettext("%s: This feature has been implemented for Windows.\n"),'dllinfo'));
+
+ dllinfolist = dlwDllInfo(dllname, options);
end
endfunction
-//==========================================
+//=============================================================================
-//==========================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) INRIA - Allan CORNET
-//
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution. The terms
-// are also available at
+// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-// Detect LCC-Win32 compiler
-//==========================================
+//=============================================================================
function res = findlcccompiler()
res = %F;
- if getos() == 'Windows' then
- try
- lccincludepath = winqueryreg('HKEY_CURRENT_USER', ..
- 'Software\lcc\compiler', ..
- 'includepath');
-
- catch
- // remove last error on 'winqueryreg' fails
- lasterror();
- return;
- end
-
- try
- winqueryreg('HKEY_CURRENT_USER', ..
- 'Software\lcc\lcclnk', ..
- 'libpath');
- index = strindex(lccincludepath,filesep());
- szindex = size(index);
- lccbasepath = part(lccincludepath,[1:index(szindex(2))]);
- lccbinpath = lccbasepath + 'bin';
- lccexe = lccbinpath + filesep() + 'lcc.exe';
- if ( fileinfo(lccexe) <> [] ) then
- res = %T;
- end
- catch
- // remove last error on 'winqueryreg' fails
- lasterror();
- return;
- end
- end
+ warnobsolete(_('LCC in Atoms: atomsInstall(""LCC-windows"")'), '5.3.1');
endfunction
-//==========================================
+//=============================================================================
-//==========================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) DIGITEO - Allan CORNET
-//
+// Copyright (C) DIGITEO - 200X-2010 - Allan CORNET
+//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution. The terms
-// are also available at
+// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-//==========================================
+//=============================================================================
function ifortCompiler = findmsifortcompiler()
- ifortCompiler='unknown'; // unknown
+ ifortCompiler = 'unknown'; // unknown
if getos() == 'Windows' then
+ if getenv('IFORT_COMPILER12','NOK') <> 'NOK' then
+ ifortCompiler = 'ifort12';
+ return
+ end
+
if getenv('IFORT_COMPILER11','NOK') <> 'NOK' then
- ifortCompiler='ifort11';
- else
- if getenv('IFORT_COMPILER10','NOK') <> 'NOK' then
- ifortCompiler='ifort10';
- else
- if getenv('IFORT_COMPILER9','NOK') <> 'NOK' then
- ifortCompiler='ifort9';
- end
- end
+ ifortCompiler = 'ifort11';
+ return
+ end
+
+ if getenv('IFORT_COMPILER10','NOK') <> 'NOK' then
+ ifortCompiler = 'ifort10';
+ return
+ end
+
+ if getenv('IFORT_COMPILER9','NOK') <> 'NOK' then
+ ifortCompiler = 'ifort9';
+ return
end
else // NOT Windows
ifortCompiler = 'unknown'; // unknown
end
endfunction
-//==========================================
+//=============================================================================
+
-
\ No newline at end of file
-//==========================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) INRIA - Allan CORNET
-// Copyright (C) DIGITEO - 2009 - Allan CORNET
-//
+// Copyright (C) DIGITEO - 2009-2010 - Allan CORNET
+//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution. The terms
-// are also available at
+// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-//==========================================
+//=============================================================================
function MSCompiler = findmsvccompiler()
+ MSCompiler = 'unknown'; // unknown
-
-//==========================================
-// functions defined only in findmsvccompiler
-//==========================================
-function bOK = is_msvc100express()
- try
- MSVS100EXPRESS = winqueryreg('HKEY_LOCAL_MACHINE', ..
- 'Software\Microsoft\VCExpress\10.0\Setup\VS', ..
- 'ProductDir');
- bOK = findWindowsSDK();
- catch
- bOK = %F;
- // remove last error on 'winqueryreg' fails
- lasterror();
- end
-endfunction
-//==========================================
-function bOK = is_msvc90pro()
- try
- MSVS90Pro = winqueryreg('HKEY_LOCAL_MACHINE', ..
- 'Software\Microsoft\VisualStudio\9.0\Setup\VS\Pro', ..
- 'ProductDir');
- bOK = %T;
- catch
- bOK = %F;
- // remove last error on 'winqueryreg' fails
- lasterror();
- end
-endfunction
-//==========================================
-function bOK = is_msvc90std()
- try
- MSVS90std = winqueryreg('HKEY_LOCAL_MACHINE', ..
- 'Software\Microsoft\VisualStudio\9.0\Setup\VS\Std', ..
- 'ProductDir');
- bOK = %T;
- catch
- bOK = %F;
- // remove last error on 'winqueryreg' fails
- lasterror();
- end
-endfunction
-//==========================================
-function bOK = is_msvc90express()
- try
- MSVS90EXPRESS = winqueryreg('HKEY_LOCAL_MACHINE', ..
- 'Software\Microsoft\VCExpress\9.0\Setup\VS', ..
- 'ProductDir');
- bOK = findWindowsSDK();
- catch
- bOK = %F;
- // remove last error on 'winqueryreg' fails
- lasterror();
- end
-endfunction
-//==========================================
-function bOK = is_msvc80pro()
- try
- MSVS80Pro = winqueryreg('HKEY_LOCAL_MACHINE', ..
- 'Software\Microsoft\VisualStudio\8.0\Setup\VS\Pro', ..
- 'ProductDir');
- bOK = %T;
- catch
- bOK = %F;
- // remove last error on 'winqueryreg' fails
- lasterror();
- end
-endfunction
-//==========================================
-function bOK = is_msvc80std()
- try
- MSVS80std = winqueryreg('HKEY_LOCAL_MACHINE', ..
- 'Software\Microsoft\VisualStudio\8.0\Setup\VS\Std', ..
- 'ProductDir');
- bOK = %T;
- catch
- bOK = %F;
- // remove last error on 'winqueryreg' fails
- lasterror();
- end
-endfunction
-//==========================================
-function bOK = is_msvc80express()
- try
- MSVS80EXPRESS = winqueryreg('HKEY_LOCAL_MACHINE', ..
- 'Software\Microsoft\VCExpress\8.0\Setup\VS', ..
- 'ProductDir');
- bOK = findWindowsSDK();
- catch
- bOK = %F;
- // remove last error on 'winqueryreg' fails
- lasterror();
- end
-endfunction
-//==========================================
-function bOK = is_msvc71()
- try
- MSVS71 = winqueryreg('HKEY_LOCAL_MACHINE', ..
- 'SOFTWARE\Microsoft\VisualStudio\7.1\Setup\VC', ..
- 'ProductDir');
- bOK = %T;
- catch
- bOK = %F;
- // remove last error on 'winqueryreg' fails
- lasterror();
- end
-endfunction
-//==========================================
-function bOK = is_msvc70()
- try
- MSVS70 = winqueryreg('HKEY_LOCAL_MACHINE', ..
- 'SOFTWARE\Microsoft\VisualStudio\7.0\Setup\VC', ..
- 'ProductDir');
- bOK = %T;
- catch
- bOK = %F;
- // remove last error on 'winqueryreg' fails
- lasterror();
- end
-endfunction
-//==========================================
-function bOK = findWindowsSDK()
- try
- W2003R2SDK = winqueryreg('HKEY_LOCAL_MACHINE', ..
- 'Software\Microsoft\MicrosoftSDK\InstalledSDKs\D2FF9F89-8AA2-4373-8A31-C838BF4DBBE1', ..
- 'Install Dir');
- findSDK1 = %T;
- catch
- findSDK1 = %F;
- // remove last error on 'winqueryreg' fails
- lasterror();
- end
-
- try
- W2003SDK = winqueryreg('HKEY_LOCAL_MACHINE', ..
- 'Software\Microsoft\MicrosoftSDK\InstalledSDKs\8F9E5EF3-A9A5-491B-A889-C58EFFECE8B3', ..
- 'Install Dir');
- findSDK2 = %T;
- catch
- findSDK2 = %F;
- // remove last error on 'winqueryreg' fails
- lasterror();
- end
-
- try
- VISTASDK = winqueryreg('HKEY_LOCAL_MACHINE', ..
- 'Software\Microsoft\Microsoft SDKs\Windows', ..
- 'CurrentInstallFolder');
- findSDK3 = %T;
- catch
- findSDK3 = %F;
- // remove last error on 'winqueryreg' fails
- lasterror();
- end
-
- if ( findSDK1 | findSDK2 | findSDK3 ) then
- bOK = %T;
- else
- TXT = _('Microsoft Visual C++ 2005/2008 Express Edition has been detected,') + char(10) + ..
- _('but not Microsoft Platform SDK for Windows Server 2003 R2 or more.') + char(10) + ..
- _('Please install this SDK if you want to use dynamic link with scilab.');
- warning(TXT);
- bOK = %F;
- end
-
-endfunction
-//==========================================
-
-
- MSCompiler='unknown'; // unknown
-
if getos() == 'Windows' then
- if is_msvc100express() then
- MSCompiler = 'msvc100express'; // Microsoft Visual 2010 Express
- return;
- end
-
- if is_msvc90pro() then
- MSCompiler = 'msvc90pro'; // Microsoft Visual 2008 Studio Professional
- return;
- end
-
- if is_msvc90std() then
- MSCompiler = 'msvc90std'; // Microsoft Visual 2008 Studio Standard
- return;
- end
-
- if is_msvc90express() then
- MSCompiler = 'msvc90express'; // Microsoft Visual 2008 Express
- return;
- end
-
- if is_msvc80pro() then
- MSCompiler = 'msvc80pro'; // Microsoft Visual 2005 Studio Professional
- return;
+ // Load dynamic_link Internal lib if it's not already loaded
+ if ~ exists("dynamic_linkwindowslib") then
+ load("SCI/modules/dynamic_link/macros/windows/lib");
end
- if is_msvc80std() then
- MSCompiler = 'msvc80std'; // Microsoft Visual 2005 Studio Standard
- return;
- end
-
- if is_msvc80express() then
- MSCompiler = 'msvc80express'; // Microsoft Visual 2005 Express
- return;
- end
-
- if is_msvc71() then
- MSCompiler = 'msvc71'; // Microsoft Visual Studio .NET 2003
- return;
- end
-
- if is_msvc70() then
- MSCompiler = 'msvc70'; // Microsoft Visual Studio .NET 2002
- return;
- end
-
+ MSCompiler = dlwFindMsVcCompiler();
+
else // NOT WINDOWS
MSCompiler = 'unknown'; // unknown
end
+
endfunction
-//==========================================
+//=============================================================================
-
\ No newline at end of file
// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-
+//=============================================================================
function cmd = gencompilationflags_unix(ldflags, cflags, fflags, cc, flagsType)
-
- // This function is restricted to Linux/Unix user only
- if getos() == 'Windows' then
- error(msprintf(gettext("%s: Feature not available under Microsoft Windows.\n"),'gencompilationflags_unix'));
- return;
- end
-
- [lhs,rhs] = argn(0);
- if rhs <> 5 then
- error(msprintf(gettext("%s: Wrong number of input arguments: %d expected.\n"),"gencompilationflags_unix",5));
- return
- end
-
- cmd=''
-
- // CFLAGS
- if cflags <> '' then
- cmd = cmd +" CFLAGS="""+cflags+""""
- end
-
- // CXXFLAGS ... use the same as C
- if cflags <> '' then
- cmd = cmd +" CXXFLAGS="""+cflags+""""
- end
-
- // LDFLAGS
- // Do not set the LDFLAGS See bug #4787
- if ldflags <> '' & flagsType <> "configure" then
- cmd = cmd +" LDFLAGS="""+ldflags+""""
- end
-
- // FFLAGS
- if fflags <> '' then
- cmd = cmd +" FFLAGS="""+fflags+""""
- end
-
- // CC
- if cc <> '' then
- cmd = cmd +" CC="""+cc+""""
- end
-
+
+ // This function is restricted to Linux/Unix user only
+ if getos() == 'Windows' then
+ error(msprintf(gettext("%s: Feature not available under Microsoft Windows.\n"),'gencompilationflags_unix'));
+ return;
+ end
+
+ [lhs,rhs] = argn(0);
+ if rhs <> 5 then
+ error(msprintf(gettext("%s: Wrong number of input arguments: %d expected.\n"),"gencompilationflags_unix",5));
+ return
+ end
+
+ cmd=''
+
+ // CFLAGS
+ if cflags <> '' then
+ cmd = cmd +" CFLAGS="""+cflags+""""
+ end
+
+ // CXXFLAGS ... use the same as C
+ if cflags <> '' then
+ cmd = cmd +" CXXFLAGS="""+cflags+""""
+ end
+
+ // LDFLAGS
+ // Do not set the LDFLAGS See bug #4787
+ if ldflags <> '' & flagsType <> "configure" then
+ cmd = cmd +" LDFLAGS="""+ldflags+""""
+ end
+
+ // FFLAGS
+ if fflags <> '' then
+ cmd = cmd +" FFLAGS="""+fflags+""""
+ end
+
+ // CC
+ if cc <> '' then
+ cmd = cmd +" CC="""+cc+""""
+ end
+
endfunction
+//=============================================================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) INRIA - Allan CORNET , Sylvestre LEDRU
-//
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution. The terms
-// are also available at
+// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-//==========================================
+//=============================================================================
function bOK = haveacompiler()
if getos() == 'Windows' then
- bOK = %F;
- msvc = findmsvccompiler();
- if ( msvc == 'unknown' ) then
- if ~win64() & findlcccompiler() then
- bOK = %T;
- else
- bOK = %F;
- end
- else
- if win64() then
- if detectmsvc64tools() then
- bOK = %T;
- else
- bOK = %F;
- end
- else
- bOK = %T;
- end
+ // Load dynamic_link Internal lib if it's not already loaded
+ if ~ exists("dynamic_linkwindowslib") then
+ load("SCI/modules/dynamic_link/macros/windows/lib");
end
+ bOK = dlwHaveCompiler();
else
- // Very hard to detect under Linux/Unix since there are plenty of
- // compiler... Then, we return all the time TRUE
- // The actual detection is done by the dedicated ./configure
+ // Very hard to detect under Linux/Unix since there are plenty of
+ // compiler... Then, we return all the time TRUE
+ // The actual detection is done by the dedicated ./configure
bOK = %T;
end
endfunction
-//==========================================
+//=============================================================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) ENPC/INRIA
-// Copyright (C) DIGITEO - 2009 - Allan CORNET
-//
+// Copyright (C) DIGITEO - 2009-2010 - Allan CORNET
+//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution. The terms
-// are also available at
+// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-//==========================================
-function ilib_build(ilib_name,table,files,libs,makename,ldflags,cflags,fflags,ismex,cc)
+//=============================================================================
+function ilib_build(ilib_name, ..
+ table, ..
+ files, ..
+ libs, ..
+ makename, ..
+ ldflags, ..
+ cflags, ..
+ fflags, ..
+ ismex, ..
+ cc)
if ~haveacompiler() then
- error(msprintf(gettext("%s: A Fortran or C compiler is required.\n"),'ilib_build'));
+ error(msprintf(gettext("%s: A Fortran or C compiler is required.\n"), 'ilib_build'));
return;
end
-
+
[lhs,rhs] = argn(0);
if rhs < 4 then
- error(msprintf(gettext("%s: Wrong number of input argument(s).\n"),"ilib_build"));
+ error(msprintf(gettext("%s: Wrong number of input argument(s).\n"), "ilib_build"));
return
end
if type(ilib_name) <> 10 then
- error(999,msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"),'ilib_build',1));
+ error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), 'ilib_build', 1));
end
-
+
if size(ilib_name,'*') <> 1 then
- error(999,msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"),'ilib_build',1));
- end
+ error(999, msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"), 'ilib_build', 1));
+ end
if type(table) <> 10 then
- error(999,msprintf(_("%s: Wrong type for input argument #%d: A matrix of strings expected.\n"),'ilib_build',2));
+ error(999,msprintf(_("%s: Wrong type for input argument #%d: A matrix of strings expected.\n"), 'ilib_build', 2));
end
-
+
if size(table,'*') > 999 * 2 then
- error(999,msprintf(_("%s: Wrong size for input argument #%d: A matrix of strings < 999 expected.\n"),'ilib_build',2));
- end
-
- if getos() <> 'Windows' & strncpy(ilib_name,3) <> "lib" then
- // We add a leading lib under Linux/Unix because it is the way
- ilib_name="lib" + ilib_name;
- end
-
- if rhs <= 4 then makename = 'Makelib';end
- if rhs <= 5 then ldflags = ''; end
- if rhs <= 6 then cflags = ''; end
- if rhs <= 7 then fflags = ''; end
- if rhs <= 8 then ismex = %f; end
- if rhs <= 9 then cc = ''; end
-
+ error(999,msprintf(_("%s: Wrong size for input argument #%d: A matrix of strings < 999 expected.\n"), 'ilib_build', 2));
+ end
+
+ if getos() <> 'Windows' & strncpy(ilib_name, 3) <> "lib" then
+ // We add a leading lib under Linux/Unix because it is the way
+ ilib_name = "lib" + ilib_name;
+ end
+
+ if rhs > 4 then
+ if (makename <> [] & makename <> '') then
+ warning(msprintf(_("%s: Wrong value for input argument #%d: '''' or ''[]'' expected.\n"), 'ilib_build', 5));
+ end
+ end
+
+ if rhs <= 5 then ldflags = ''; end
+ if rhs <= 6 then cflags = ''; end
+ if rhs <= 7 then fflags = ''; end
+ if rhs <= 8 then ismex = %f; end
+ if rhs <= 9 then cc = ''; end
+
if getos() == 'Windows' then
- if isdef('makename') then
- if (makename == []) | (makename == '') then
- makename = 'makelib';
+ if ~isdef('makename') | (makename == '') | (makename == []) then
+ // Load dynamic_link Internal lib if it's not already loaded
+ if ~exists("dynamic_linkwindowslib") then
+ load("SCI/modules/dynamic_link/macros/windows/lib");
end
+ makename = dlwGetDefltMakefileName();
end
+ else
+ makename = 'Makefile';
end
-
+
// check if library is not already loaded
if or(link() == ilib_name) then
- error(999,msprintf(_('%s: ''%s'' already loaded in scilab.'),'ilib_build',ilib_name) + ..
+ error(999, msprintf(_('%s: ''%s'' already loaded in scilab.'),'ilib_build',ilib_name) + ..
ascii(10) + _('You need to unload this library before.'));
end
-
+
// generate the gateway file
if ( ilib_verbose() <> 0 ) then
mprintf(_(" Generate a gateway file\n"));
end
-
-
- file_gw_name = ilib_gen_gateway(ilib_name,table);
-
+
+ file_gw_name = ilib_gen_gateway(ilib_name, table);
+
// generate a loader file
if ( ilib_verbose() <> 0 ) then
mprintf(_(" Generate a loader file\n"));
else
ilib_gen_loader(ilib_name,table);
end
-
+
// generate a Makefile
if ( ilib_verbose() <> 0 ) then
- if getos() == 'Windows'
- mprintf(_(" Generate a Makefile: %s\n"),'Makelib');
- else
- mprintf(_(" Generate a Makefile\n"));
- end
+ if getos() == 'Windows'
+ mprintf(_(" Generate a Makefile: %s\n"), makename);
+ else
+ mprintf(_(" Generate a Makefile\n"));
+ end
end
-
+
if getos() <> 'Windows' then // Needs to copy the libfoo.c which contains important stuff
files = files(:)';
- files = [files,ilib_name + '.c'];
+ files = [files, ilib_name + '.c'];
end
- ilib_gen_Make(ilib_name,table,files,libs,makename,%t,ldflags,cflags,fflags,cc);
-
+ ilib_gen_Make(ilib_name, table, files, libs, makename, %t, ldflags, cflags, fflags, cc);
+
// we call make
if ( ilib_verbose() <> 0 ) then
mprintf(_(" Running the makefile\n"));
end
-
- libn = ilib_compile(ilib_name,makename,files);
-
+
+ libn = ilib_compile(ilib_name, makename, files);
+
if ( ilib_verbose() <> 0 ) then
mprintf(_(" Generate a cleaner file\n"));
end
- ilib_gen_cleaner(makename,'loader.sce',[libn;file_gw_name]);
-
+ ilib_gen_cleaner(makename, 'loader.sce', [libn; file_gw_name]);
+
endfunction
-//==========================================
+//=============================================================================
+
// Copyright (C) INRIA
// Copyright (C) ENPC
// Copyright (C) DIGITEO - 2009
-//
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution. The terms
-// are also available at
+// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-function libn = ilib_compile(lib_name,makename,files, ..
- ldflags, ..
- cflags, ..
- fflags, ..
- cc)
+//=============================================================================
+function libn = ilib_compile(lib_name, ..
+ makename, ..
+ files, ..
+ ldflags, ..
+ cflags, ..
+ fflags, ..
+ cc)
[lhs,rhs] = argn(0);
if rhs < 2 then
error(msprintf(gettext("%s: Wrong number of input argument(s).\n"),"ilib_compile"));
return
end
-
- libn=""; //** init variable
+
+ libn=""; //** init variable
if ~haveacompiler() then
- error(_("A Fortran or C compiler is required."))
- return;
+ error(_("A Fortran or C compiler is required."))
+ return;
end
[lhs,rhs]=argn(0);
-
- if rhs < 3 then files = []; end
-
+
+ if rhs < 3 then files = []; end
+
if typeof(lib_name)<>'string' then
error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"),"ilib_compile",1));
return ;
end
-
+
oldpath = pwd();
files = files(:)';
-
+
managed_ext = ['.obj','.o'];
for i=1:size(files,'*') // compatibility scilab 4.x
[path_f, file_f, ext_f] = fileparts(files(i));
files1(i) = path_f + file_f + ext_f;
end
end
-
- [make_command,lib_name_make,lib_name,path,makename,files]= ...
- ilib_compile_get_names(lib_name,makename,files);
-
- if path<> ''; chdir(path); end
-
-
- // first try to build each file step by step
+
+ [make_command, lib_name_make, lib_name, path, makename, files]= ...
+ ilib_compile_get_names(lib_name, makename, files);
+
+ if isdir(path) then
+ chdir(path);
+ end
+
if getos() == 'Windows' then
//** ----------- Windows section -----------------
msgs_make = '';
nf = size(files,'*');
-
+
for i=1:nf
if ( ilib_verbose() <> 0 ) then
mprintf(_(" Compilation of ") + string(files1(i)) +'\n');
end
end
-
- // then the shared library
+
+ // then the shared library
if ( ilib_verbose() <> 0 ) then
mprintf(_(" Building shared library (be patient)\n"));
end
-
- // TO DO : Check if it is always needed ...
+
if ilib_verbose() > 1 then
- msg = unix_g(make_command + makename + ' all');
+ msg = unix_g(make_command + makename + ' all');
disp(msg);
else
- unix_s(make_command + makename + ' all');
+ unix_s(make_command + makename + ' all');
end
-
+
else
- //** ---------- Linux/MacOS/Unix section ---------------------
-
- ScilabTreeFound=%f;
+ //** ---------- Linux/MacOS/Unix section ---------------------
+
+ ScilabTreeFound=%f;
// Source tree version
- // Headers are dispatched in the source tree
- if isdir(SCI+"/modules/core/includes/") then
- defaultModulesCHeader=[ "core", "mexlib","api_scilab","output_stream","localization", "operations" ];
- defaultModulesFHeader=[ "core" ];
- ScilabTreeFound=%t
-
- for x = defaultModulesCHeader(:)'
- cflags=" -I"+SCI+"/modules/"+x+"/includes/ "+cflags;
- end
- cflags=" -I"+SCI+"/libs/MALLOC/includes/ " + cflags;
-
- for x = defaultModulesFHeader(:)'
- fflags=" -I"+SCI+"/modules/"+x+"/includes/ " + fflags;
+ // Headers are dispatched in the source tree
+ if isdir(SCI+"/modules/core/includes/") then
+ defaultModulesCHeader=[ "core", "mexlib","api_scilab","output_stream","localization" ];
+ defaultModulesFHeader=[ "core" ];
+ ScilabTreeFound=%t
+
+ for x = defaultModulesCHeader(:)'
+ cflags=" -I"+SCI+"/modules/"+x+"/includes/ "+cflags;
+ end
+ cflags=" -I"+SCI+"/libs/MALLOC/includes/ " + cflags;
+
+ for x = defaultModulesFHeader(:)'
+ fflags=" -I"+SCI+"/modules/"+x+"/includes/ " + fflags;
end
- end
-
- // Binary version
- if isdir(SCI+"/../../include/scilab/") & ~ScilabTreeFound then
- cflags="-I"+SCI+"/../../include/scilab/ " + cflags
- fflags="-I"+SCI+"/../../include/scilab/ " + fflags
- ScilabTreeFound=%t
- end
-
- // System version (ie: /usr/include/scilab/)
- if isdir("/usr/include/scilab/") & ~ScilabTreeFound then
- cflags="-I/usr/include/scilab/ "+cflags
- fflags="-I/usr/include/scilab/ "+fflags
- ScilabTreeFound=%t
- end
-
- if ( ilib_verbose() <> 0 & ScilabTreeFound <> %t) then
- mprintf(gettext("%s: Warning: Scilab has not been able to find where the Scilab sources are. Please submit a bug report on http://bugzilla.scilab.org/\n"),"ilib_compile");
- end
-
- oldPath = pwd();
-
- // Switch back to the TMPDIR where the mandatory files are
- chdir(TMPDIR);
- cmd = "make "
-
- cmd = cmd + gencompilationflags_unix(ldflags, cflags, fflags, cc, "build")
+ end
+
+ // Binary version
+ if isdir(SCI+"/../../include/scilab/") & ~ScilabTreeFound then
+ cflags="-I"+SCI+"/../../include/scilab/ " + cflags
+ fflags="-I"+SCI+"/../../include/scilab/ " + fflags
+ ScilabTreeFound=%t
+ end
+
+ // System version (ie: /usr/include/scilab/)
+ if isdir("/usr/include/scilab/") & ~ScilabTreeFound then
+ cflags="-I/usr/include/scilab/ "+cflags
+ fflags="-I/usr/include/scilab/ "+fflags
+ ScilabTreeFound=%t
+ end
+
+ if ( ilib_verbose() <> 0 & ScilabTreeFound <> %t) then
+ mprintf(gettext("%s: Warning: Scilab has not been able to find where the Scilab sources are. Please submit a bug report on http://bugzilla.scilab.org/\n"),"ilib_compile");
+ end
+
+ oldPath = pwd();
+
+ // Switch back to the TMPDIR where the mandatory files are
+ chdir(TMPDIR);
+ cmd = "make "
+
+ cmd = cmd + gencompilationflags_unix(ldflags, cflags, fflags, cc, "build")
//** BEWARE : this function can cause errors if used with "old style" Makefile inside a Scilab 5
- //** environment where the Makefile are created from a "./configure"
- [msg, ierr, stderr] = unix_g(cmd) ;
-
- if ( ilib_verbose() == 2 ) then
- mprintf(gettext("%s: Build command: %s\n"),"ilib_compile",cmd);
- mprintf(gettext("Output: %s\n"),msg);
- mprintf(gettext("stderr: %s\n"),stderr);
- end
- if ierr <> 0 then
- mprintf(gettext("%s: An error occurred during the compilation:\n"),"ilib_compile");
- lines(0);
- disp(stderr);
- mprintf("\n");
- mprintf(gettext("%s: The command was:\n"),"ilib_compile");
- mprintf(cmd);
- mprintf("\n");
- chdir(oldPath); // Go back to the working dir
- return ;
- end
- if stderr <> "" then
- if ( ilib_verbose() <> 0 ) then
- mprintf(gettext("%s: Warning: No error code returned by the compilation but the error output is not empty:\n"),"ilib_compile");
- mprintf(stderr);
- end
- return ;
- end
-
- // Copy the produce lib to the working path
- copyfile(".libs/" + lib_name, oldPath);
- end
-
- libn = path + lib_name_make ;
- chdir(oldpath);
-
-endfunction
-//==========================================
+ //** environment where the Makefile are created from a "./configure"
+ [msg, ierr, stderr] = unix_g(cmd) ;
-//==========================================
-// function only defined in ilib_compile
-//==========================================
-function [make_command,lib_name_make,lib_name,path,makename,files] = ilib_compile_get_names(lib_name,makename,files)
-
- managed_ext = ['.obj','.o'];
- for i=1:size(files,'*') // compatibility scilab 4.x
- [path_f, file_f, ext_f] = fileparts(files(i));
- if or(managed_ext == ext_f) then
- files(i) = path_f + file_f;
- else
- files(i) = path_f + file_f + ext_f;
+ if ( ilib_verbose() == 2 ) then
+ mprintf(gettext("%s: Build command: %s\n"),"ilib_compile",cmd);
+ mprintf(gettext("Output: %s\n"),msg);
+ mprintf(gettext("stderr: %s\n"),stderr);
end
- end
- k = strindex(makename,['/','\']);
-
- if k~=[] then
- path = part(makename,1:k($));
- makename = part(makename,k($)+1:length(makename));
- else
- path='';
- end
-
- lib_name = lib_name+getdynlibext();
- lib_name_make = lib_name;
-
- if getos() == 'Windows' then // WINDOWS
- FILES = [];
- for x = files(:)'
- [ptmp,ftmp,fext] = fileparts(x);
- FILES = [FILES,ptmp+ftmp];
+ if ierr <> 0 then
+ mprintf(gettext("%s: An error occurred during the compilation:\n"),"ilib_compile");
+ lines(0);
+ disp(stderr);
+ mprintf("\n");
+ mprintf(gettext("%s: The command was:\n"),"ilib_compile");
+ mprintf(cmd);
+ mprintf("\n");
+ chdir(oldPath); // Go back to the working dir
+ return ;
end
- // Visual Studio C++
- if ( findmsvccompiler() <> 'unknown' ) then
- makename = makename + '.mak' ;
- make_command = 'nmake /Y /nologo /f '
- else
- // LCC-WIN32
- if findlcccompiler() then
- makename = makename + '.lcc' ;
- make_command = 'make -f ';
+ if stderr <> "" then
+ if ( ilib_verbose() <> 0 ) then
+ mprintf(gettext("%s: Warning: No error code returned by the compilation but the error output is not empty:\n"),"ilib_compile");
+ mprintf(stderr);
+ end
+ return ;
+ end
+
+ // Copy the produce lib to the working path
+ copyfile(".libs/" + lib_name, oldPath);
+ end
+
+ libn = path + lib_name_make ;
+ chdir(oldpath);
+
+endfunction
+//=============================================================================
+// function only defined in ilib_compile
+//=============================================================================
+function [make_command,lib_name_make,lib_name,path,makename,files] = ..
+ ilib_compile_get_names(lib_name, makename, files)
+
+ if getos() <> 'Windows' then
+ managed_ext = '.o';
+ for i=1:size(files,'*') // compatibility scilab 4.x
+ [path_f, file_f, ext_f] = fileparts(files(i));
+ if or(managed_ext == ext_f) then
+ files(i) = path_f + file_f;
else
- // TO DO : Add another compiler here
+ files(i) = path_f + file_f + ext_f;
end
-
end
- if FILES<>[] then
- files = FILES + '.obj' ;
+
+ k = strindex(makename,['/','\']);
+
+ if k~=[] then
+ path = part(makename,1:k($));
+ makename = part(makename,k($)+1:length(makename));
+ else
+ path = '';
end
- else // LINUX
-
- make_command = 'make ';
-
- if files <> [] then
+
+ lib_name = lib_name + getdynlibext();
+ lib_name_make = lib_name;
+
+ make_command = 'make ';
+ if files <> [] then
files = files + '.o';
end
-
+
+ else // Windows
+ // Load dynamic_link Internal lib if it's not already loaded
+ if ~ exists("dynamic_linkwindowslib") then
+ load("SCI/modules/dynamic_link/macros/windows/lib");
+ end
+
+ [make_command, lib_name_make, lib_name, path, makename, files] = ..
+ dlwGetParamsIlibCompil(lib_name, makename, files);
end
-
-endfunction
-//==========================================
+endfunction
+//=============================================================================
+
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) INRIA/ENPC
-// Copyright (C) DIGITEO - 2009 - Allan CORNET
-//
+// Copyright (C) DIGITEO - 2009-2010 - Allan CORNET
+//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution. The terms
-// are also available at
+// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-//==========================================
-// Generate a shared library which can be used by link command.
+//=============================================================================
+// Generate a shared library which can be used by link command.
function libn = ilib_for_link(names, ..
files, ..
libs, ..
cflags, ..
fflags, ..
cc)
-
- [lhs,rhs] = argn(0);
+ [lhs, rhs] = argn(0);
if rhs < 4 then
error(msprintf(gettext("%s: Wrong number of input argument(s).\n"),"ilib_for_link"));
return
end
-
- if rhs <= 4 then makename = "Makelib";end
+
+ if rhs > 4 then
+ if (makename <> [] & makename <> '') then
+ warning(msprintf(_("%s: Wrong value for input argument #%d: '''' or ''[]'' expected.\n"), 'ilib_for_link', 5));
+ end
+ end
if rhs <= 5 then loadername = "loader.sce";end
if rhs <= 6 then libname = ""; end
- if rhs <= 7 then ldflags = ""; end
- if rhs <= 8 then cflags = ""; end
- if rhs <= 9 then fflags = ""; end
- if rhs <= 10 then cc = ""; end
-
+ if rhs <= 7 then ldflags = ""; end
+ if rhs <= 8 then cflags = ""; end
+ if rhs <= 9 then fflags = ""; end
+ if rhs <= 10 then cc = ""; end
+
if getos() == 'Windows' then
- if isdef('makename') then
- if (makename == []) | (makename == '') then
- makename = 'makelib';
+ if ~isdef('makename') | (makename == []) | (makename == '') then
+ // Load dynamic_link Internal lib if it's not already loaded
+ if ~ exists("dynamic_linkwindowslib") then
+ load("SCI/modules/dynamic_link/macros/windows/lib");
end
+ makename = dlwGetDefltMakefileName();
end
+ else
+ makename = 'Makefile';
end
-
+
// generate a loader file
if ( ilib_verbose() <> 0 ) then
mprintf(gettext(" Generate a loader file\n"));
end
-
- ilib_gen_loader(names,flag,loadername,libs,libname);
-
+
+ tables = [];
+
+ // we manage .f90 as .f on windows
+ if getos() == 'Windows' then
+ if findmsifortcompiler() <> "unknown" then
+ if flag == "f90" then
+ flag = "f";
+ end
+ else
+ if flag == "f90" then
+ error(999, _("F2C cannot build fortran 90"));
+ end
+ end
+ end
+
+ ilib_gen_loader(names, tables, libs, libname, flag, loadername);
+
// bug 4515 - unlink previous function with same name
n = size(names,'*');
for i = 1:n
- execstr("[bOK,ilib] = c_link(''" + names(i) + "'');if (bOK) then ulink(ilib),end");
+ execstr("[bOK, ilib] = c_link(''" + names(i) + "'');if bOK then ulink(ilib), end");
end
-
+
// generate a Makefile
if ( ilib_verbose() <> 0 ) then
mprintf(gettext(" Generate a Makefile\n"));
end
- ilib_link_gen_Make(names, ..
- files, ..
- libs, ..
- makename, ..
- libname, ..
- ldflags, ..
- cflags, ..
- fflags, ..
- cc, ..
- flag);
-
+ generateMakefile(names, ..
+ files, ..
+ libs, ..
+ makename, ..
+ libname, ..
+ ldflags, ..
+ cflags, ..
+ fflags, ..
+ cc, ..
+ flag);
+
// we call make
if ( ilib_verbose() <> 0 ) then
mprintf(gettext(" Running the Makefile\n"));
end
- if (libname == "") then libname = names(1);end
+
+ if (libname == "") then
+ libname = names(1);
+ end
libn = ilib_compile('lib' + libname, makename, files);
-
+
if ( ilib_verbose() <> 0 ) then
mprintf(_(" Generate a cleaner file\n"));
end
- ilib_gen_cleaner(makename,loadername,libn);
-
+ ilib_gen_cleaner(makename, loadername, libn);
+
endfunction
-//==========================================
-function ilib_link_gen_Make(names, ..
+//=============================================================================
+function generateMakefile(names, ..
files, ..
libs, ..
makename, ..
cc, ..
flag)
- // generate a Makefile for gateway
- [lhs,rhs] = argn(0);
- if rhs <= 2 then libs = [];end
- if rhs <= 3 then makename = 'Makelib';end
- if rhs <= 4 then libname = "";end
- if rhs <= 5 then ldflags = ""; end
- if rhs <= 6 then cflags = ""; end
- if rhs <= 7 then fflags = ""; end
- if rhs <= 8 then cc = ""; end
- if rhs <= 9 then flag = "c"; end
-
- if getos() == 'Windows' then // Windows
- // Visual Studio C++
- if ( findmsvccompiler() <> 'unknown' ) then
- Makename = makename+'.mak';
- ilib_link_gen_Make_msvc(names, ..
- files, ..
- libs, ..
- Makename, ..
- libname, ..
- ldflags, ..
- cflags, ..
- fflags, ..
- cc);
- else
- // LCC-WIN32
- if findlcccompiler() then
- Makename = makename+'.lcc';
- ilib_link_gen_Make_lcc(names, ..
- files, ..
- libs, ..
- Makename, ..
- libname, ..
- ldflags, ..
- cflags, ..
- fflags, ..
- cc);
- else
- // TO DO : Add another compiler here
- end
- end
-
- else // LINUX
- Makename = makename;
-
- ilib_gen_Make_unix(names, ..
- files, ..
- libs, ..
- libname, ..
- ldflags, ..
- cflags, ..
- fflags, ..
- cc);
- end
-
-endfunction
-//==========================================
-function ilib_link_gen_Make_msvc(names, ..
- files, ..
- libs, ..
- Makename, ..
- libname, ..
- ldflags, ..
- cflags, ..
- fflags, ..
- cc)
-
- managed_ext = ['.cxx', '.cpp', '.c', '.f90', '.f'];
- obj_ext = ['.o', '.obj', ''];
- SCIDIR = SCI;
- SCIDIR1 = pathconvert(SCI,%f,%f,'w');
- LIBRARY = '';
- FILES_SRC = '';
- OBJS = '';
- OBJS_WITH_PATH = '';
- FORTRAN_RUNTIME = '';
- OTHERLIBS = '';
- CC = cc;
- CFLAGS = cflags;
- MEXCFLAGS = '';
- FFLAGS = fflags;
- MEXFFLAGS = '';
- LDFLAGS = ldflags;
-
- FILES_SRC_MATRIX = [];
-
- [path_Make, file_Make, ext_Make] = fileparts(Makename);
-
- for i=1:size(files,'*')
- [path_f, file_f, ext_f] = fileparts(files(i));
-
- if or(obj_ext == ext_f) then
- FILENAME = [];
- FILE_FOUNDED = %f;
- for y = managed_ext(:)'
- if (FILE_FOUNDED == %f) then
- if (fileinfo(path_f + file_f + y) <> []) | (fileinfo(path_Make + file_f + y) <> []) then
- FILENAME = path_f + file_f + y;
- FILE_FOUNDED = %t;
- end
- end
- end
- else
- FILENAME = files(i);
- end
- FILES_SRC_MATRIX = [FILES_SRC_MATRIX , FILENAME];
- end
-
- FILES_SRC = strcat(FILES_SRC_MATRIX,' ');
-
- OBJ_DEST_PATH = '';
- if (getenv("DEBUG_SCILAB_DYNAMIC_LINK","NO") == "NO") then
- OBJ_DEST_PATH = "Release/";
- else
- OBJ_DEST_PATH = "Debug/";
- end
-
- OBJS_MATRIX = [];
- OBJS_WITH_PATH_MATRIX = [];
-
- for y = 1:size(FILES_SRC_MATRIX,'*')
- [path_f, file_f, ext_f] = fileparts(FILES_SRC_MATRIX(y));
- OBJS_MATRIX = [OBJS_MATRIX, path_f + file_f + '.obj'];
- OBJS_WITH_PATH_MATRIX = [OBJS_WITH_PATH_MATRIX, OBJ_DEST_PATH + path_f + file_f + '.obj'];
- end
-
- if ( or(fileext(FILES_SRC_MATRIX) == '.f90') | or(fileext(FILES_SRC_MATRIX) == '.f') ) then
- if findmsifortcompiler() <> 'unknown' then
- if (getenv("DEBUG_SCILAB_DYNAMIC_LINK","NO") == "NO") then
- FORTRAN_RUNTIME = 'libifcoremd.lib libmmd.lib';
- else
- FORTRAN_RUNTIME = 'libifcoremdd.lib libmmdd.lib';
- end
- end
- end
-
- OBJS = strcat(OBJS_MATRIX, ' ');
- OBJS_WITH_PATH = strcat(OBJS_WITH_PATH_MATRIX, ' ');
-
- if (libname == '') then
- LIBRARY = 'lib' + names(1);
+ if getos() <> 'Windows' then
+ Makename = makename;
+ ilib_gen_Make_unix(names, ..
+ files, ..
+ libs, ..
+ libname, ..
+ ldflags, ..
+ cflags, ..
+ fflags, ..
+ cc);
else
- LIBRARY = 'lib' + libname;
- end
-
- if (libs <> []) then
- for x = libs(:)'
- if x <> '' then
- OTHERLIBS = OTHERLIBS + ' ' + x + '.lib';
- end
+ if ~ exists("dynamic_linkwindowslib") then
+ load("SCI/modules/dynamic_link/macros/windows/lib");
end
- end
- try
- MAKEFILE_VC = mgetl(SCI+'/modules/dynamic_link/src/scripts/TEMPLATE_MAKEFILE.VC');
- catch
- MAKEFILE_VC = '';
- end
-
- MAKEFILE_VC = strsubst(MAKEFILE_VC, "__SCI__", SCIDIR);
- MAKEFILE_VC = strsubst(MAKEFILE_VC, "__SCIDIR1__", SCIDIR1);
- MAKEFILE_VC = strsubst(MAKEFILE_VC, "__LIBNAME__", LIBRARY);
- MAKEFILE_VC = strsubst(MAKEFILE_VC, "__FILES_SRC__", FILES_SRC);
- MAKEFILE_VC = strsubst(MAKEFILE_VC, "__OBJS__", OBJS);
- MAKEFILE_VC = strsubst(MAKEFILE_VC, "__OBJS_WITH_PATH__", OBJS_WITH_PATH);
- MAKEFILE_VC = strsubst(MAKEFILE_VC, "__FORTRAN_RUNTIME__", FORTRAN_RUNTIME);
- MAKEFILE_VC = strsubst(MAKEFILE_VC, "__OTHERSLIBS__", OTHERLIBS);
-
- if CC <> '' then
- MAKEFILE_VC = strsubst(MAKEFILE_VC, "__CC__",CC);
- else
- MAKEFILE_VC = strsubst(MAKEFILE_VC, "CC = __CC__","#CC = ");
- end
-
- MAKEFILE_VC = strsubst(MAKEFILE_VC, "__CFLAGS__", CFLAGS);
- MAKEFILE_VC = strsubst(MAKEFILE_VC, "__MEXCFLAGS__", MEXCFLAGS);
- MAKEFILE_VC = strsubst(MAKEFILE_VC, "__FFLAGS__", FFLAGS);
- MAKEFILE_VC = strsubst(MAKEFILE_VC, "__MEXFFLAGS__", MEXFFLAGS);
- MAKEFILE_VC = strsubst(MAKEFILE_VC, "__LDFLAGS__", LDFLAGS);
-
- if ( MAKEFILE_VC <> '') then
- fd = mopen(Makename, "wt");
- mputl(MAKEFILE_VC, fd);
- mclose(fd);
- if ilib_verbose() > 1 then
- disp(MAKEFILE_VC);
+ if strncpy(names,3) <> 'lib' then
+ names = 'lib' + names;
end
- else
- // TEMPLATE_MAKEFILE.VC not found
- warning(SCI+'/modules/dynamic_link/src/scripts/TEMPLATE_MAKEFILE.VC'+ _('not found.') );
- end
-endfunction
-//==========================================
-function ilib_link_gen_Make_lcc(names, ..
- files, ..
- libs, ..
- Makename, ..
- libname, ..
- ldflags, ..
- cflags, ..
- fflags, ..
- cc)
-
- managed_ext = ['.c', '.f'];
- obj_ext = ['.o', '.obj', ''];
-
- CFLAGS = cflags;
- MEXCFLAGS = '';
- FFLAGS = fflags;
- MEXFFLAGS = '';
- LDFLAGS = ldflags;
- SCIDIR = SCI;
- SCIDIR1 = pathconvert(SCI,%f,%f,'w');
- LCCLIBDIR = SCIHOME + filesep() + 'lcclib';
- LIBRARY = '';
- FILES_SRC = '';
- OBJS = '';
- OTHERLIBS = '';
-
- FILES_SRC_MATRIX = [];
-
- [path_Make, file_Make, ext_Make] = fileparts(Makename);
-
- for i=1:size(files,'*')
- [path_f, file_f, ext_f] = fileparts(files(i));
-
- if or(obj_ext == ext_f) then
- FILENAME = [];
- FILE_FOUNDED = %f;
- for y = managed_ext(:)'
- if (FILE_FOUNDED == %f) then
- if (fileinfo(path_f + file_f + y) <> []) | (fileinfo(path_Make + file_f + y) <> []) then
- FILENAME = path_f + file_f + y;
- FILE_FOUNDED = %t;
- end
- end
- end
- else
- FILENAME = files(i);
- end
- FILES_SRC_MATRIX = [FILES_SRC_MATRIX , FILENAME];
- end
-
- FILES_SRC = strcat(FILES_SRC_MATRIX,' ');
+ names = names(1);
- OBJS_MATRIX = [];
-
- for y = 1:size(FILES_SRC_MATRIX,'*')
- [path_f, file_f, ext_f] = fileparts(FILES_SRC_MATRIX(y));
- OBJS_MATRIX = [OBJS_MATRIX, path_f + file_f + '.obj'];
- end
-
- OBJS = strcat(OBJS_MATRIX, ' ');
-
- if (libname == '') then
- LIBRARY = 'lib' + names(1);
- else
- LIBRARY = 'lib' + libname;
+ Makename = dlwGenerateMakefile(names, ..
+ [], ..
+ files, ..
+ libs, ..
+ makename, ..
+ %f, ..
+ ldflags, ..
+ cflags, ..
+ fflags, ..
+ cc);
end
-
- if (libs <> []) then
- for x = libs(:)'
- if x <> '' then
- OTHERLIBS = OTHERLIBS + ' ' + x + '.lib';
- end
- end
- end
- OTHERLIBS = strsubst(OTHERLIBS,'/',filesep());
-
- ierr = execstr("MAKEFILE_LCC = mgetl(SCI+''/modules/dynamic_link/src/scripts/TEMPLATE_MAKEFILE.LCC'');", "errcatch");
- if ierr <> 0 then
- MAKEFILE_LCC = '';
- warning(SCI+'/modules/dynamic_link/src/scripts/TEMPLATE_MAKEFILE.LCC'+ ' ' + _('not found.') );
- else
- MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__LDFLAGS__" , LDFLAGS);
- MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__SCI__" , SCIDIR);
- MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__SCIDIR1__" , SCIDIR1);
- MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__LCCLIBDIR__" , LCCLIBDIR);
- MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__LIBRARY__" , LIBRARY);
- MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__FILES_SRC__" , FILES_SRC);
- MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__OTHERSLIBS__" , OTHERLIBS);
- MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__CFLAGS__" , CFLAGS);
- MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__MEXCFLAGS__" , MEXCFLAGS);
- MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__FFLAGS__" , FFLAGS);
- MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__MEXFFLAGS__" , MEXFFLAGS);
- MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__OBJS__" , OBJS);
- fd = mopen(Makename, "wt");
- mputl(MAKEFILE_LCC, fd);
- mclose(fd);
- if ilib_verbose() > 1 then
- disp(mgetl(Makename));
- end
-
- end
-
endfunction
-//==========================================
+//=============================================================================
+
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) ENPC
-// Copyright (C) DIGITEO - 2009 - Allan CORNET
-//
+// Copyright (C) DIGITEO - 2009-2010 - Allan CORNET
+//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution. The terms
-// are also available at
+// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-function Makename=ilib_gen_Make(name,tables,files,libs,makename,with_gateway,ldflags,cflags,fflags,cc)
-//------------------------------------
-// generate a Makefile for gateway
+//=============================================================================
+function Makename = ilib_gen_Make(name, ..
+ tables, ..
+ files, ..
+ libs, ..
+ makename, ..
+ with_gateway, ..
+ ldflags, ..
+ cflags, ..
+ fflags, ..
+ cc)
[lhs,rhs] = argn(0);
if rhs < 4 then
error(msprintf(gettext("%s: Wrong number of input argument(s).\n"), "ilib_gen_Make"));
return
end
-
- if argn(2)<6 then with_gateway=%t,ldflags='',cflags='',fflags='', cc='';end
- for i=1:size(files,'*') // compatibility scilab 4.x
- [path_f, file_f, ext_f] = fileparts(files(i));
- if or(ext_f == ['.o','.obj']) then
- files(i) = path_f + file_f;
- else
- files(i) = path_f + file_f + ext_f;
- end
- end
-
- // change table if necessary
- if typeof(tables)<>'list' then
- tables= list(tables)
- end
- L=length(tables);
- for it = 1:L
- table = tables(it);
- [mt,nt]=size(table);
-
- if nt==2 then
- col= "csci"; // @TODO what is csci
- table = [table, col(ones(mt,1))];
- nt=3;
- end
-
- if nt<>3 then
- error(msprintf(gettext("%s: Wrong size for input argument #%d.\n"),"ilib_gen_Make",2));
- end
-
- tables(it)=table;
- end
-
-
- if with_lcc() == %T then
- if isdef('makename') then
- if (makename == []) | (makename == '') then
- makename = 'makelib';
- end
- end
- Makename = makename + '.lcc';
- ilib_gen_Make_lcc(name,tables,files,libs,Makename,with_gateway,ldflags,cflags,fflags)
- else
- if getos() == 'Windows' then
- if isdef('makename') then
- if (makename == []) | (makename == '') then
- makename = 'makelib';
- end
- end
- Makename = makename + '.mak';
- ilib_gen_Make_win32(name,tables,files,libs,Makename,with_gateway,ldflags,cflags,fflags)
- else
- Makename = makename;
- ilib_gen_Make_unix(name,files,libs,name,ldflags,cflags,fflags,cc,tables)
- end
- end
-endfunction
-
-
-function ilib_gen_Make_win32(name,table,files,libs,Makename,with_gateway,ldflags,cflags,fflags)
-
- managed_ext = ['.cxx', '.cpp', '.c', '.f90', '.f'];
- obj_ext = ['.o', '.obj', ''];
-
- SCIDIR = SCI;
- SCIDIR1 = pathconvert(SCI,%f,%f,'w');
- LIBRARY = name;
- FILES_SRC = '';
- OBJS = '';
- OBJS_WITH_PATH = '';
- FORTRAN_RUNTIME = '';
- OTHERLIBS = '';
- CC = '';
- CFLAGS = cflags;
- MEXCFLAGS = '';
- FFLAGS = fflags;
- MEXFFLAGS = '';
- LDFLAGS = ldflags;
-
- FILES_SRC_MATRIX = [];
-
- [path_Make, file_Make, ext_Make] = fileparts(Makename);
-
- for i=1:size(files,'*')
- [path_f, file_f, ext_f] = fileparts(files(i));
-
- if or(obj_ext == ext_f) then
- FILENAME = [];
- FILE_FOUNDED = %f;
- for y = managed_ext(:)'
- if (FILE_FOUNDED == %f) then
- if (fileinfo(path_f + file_f + y) <> []) | (fileinfo(path_Make + file_f + y) <> []) then
- FILENAME = path_f + file_f + y;
- FILE_FOUNDED = %t;
- end
- end
- end
- else
- FILENAME = files(i);
- end
- FILES_SRC_MATRIX = [FILES_SRC_MATRIX , FILENAME];
- end
-
- if typeof(tables) <> 'list' then
- tables = list(tables);
- end
- L = length(tables);
-
- if with_gateway then
- if L == 1 then
- FILES_SRC_MATRIX = [FILES_SRC_MATRIX , name + '.c'];
- else
- for i=1:L
- FILES_SRC_MATRIX = [FILES_SRC_MATRIX , name + string(i) + '.c'];
- end
- end
- end
- for it=1:L
- table = tables(it);
- [mt,nt] = size(table);
-
- for i=1:mt
- if table(i,3)=='cmex' | table(i,3)=='fmex' | table(i,3)=='Fmex' then
- MEXCFLAGS = "-Dmexfunction_=mex" + table(i,2) + "_ -DmexFunction=mex_" + table(i,2);
- MEXFFLAGS = "-Dmexfunction=mex" + table(i,2);
- if table(i,3)=='cmex' then
- filenameMex = table(i,2) + '.c';
- else
- filenameMex = table(i,2) + '.f';
- end
- if grep(FILES_SRC_MATRIX,filenameMex) == [] then
- FILES_SRC_MATRIX = [FILES_SRC_MATRIX , filenameMex];
- end
- end
- end
- end
-
-
- FILES_SRC = strcat(FILES_SRC_MATRIX,' ');
-
-
- OBJ_DEST_PATH = '';
- if (getenv("DEBUG_SCILAB_DYNAMIC_LINK","NO") == "NO") then
- OBJ_DEST_PATH = "Release/";
- else
- OBJ_DEST_PATH = "Debug/";
+ if argn(2) < 6 then
+ with_gateway = %t
+ ldflags = '';
+ cflags = '';
+ fflags = '';
+ cc = '';
end
-
- OBJS_MATRIX = [];
- OBJS_WITH_PATH_MATRIX = [];
-
- for y = 1:size(FILES_SRC_MATRIX,'*')
- [path_f, file_f, ext_f] = fileparts(FILES_SRC_MATRIX(y));
- OBJS_MATRIX = [OBJS_MATRIX, path_f + file_f + '.obj'];
- OBJS_WITH_PATH_MATRIX = [OBJS_WITH_PATH_MATRIX, OBJ_DEST_PATH + path_f + file_f + '.obj'];
- end
-
- OBJS = strcat(OBJS_MATRIX, ' ');
- OBJS_WITH_PATH = strcat(OBJS_WITH_PATH_MATRIX, ' ');
- if ( or(fileext(FILES_SRC_MATRIX) == '.f90') | or(fileext(FILES_SRC_MATRIX) == '.f') ) then
- if findmsifortcompiler() <> 'unknown' then
- if (getenv("DEBUG_SCILAB_DYNAMIC_LINK","NO") == "NO") then
- FORTRAN_RUNTIME = 'libifcoremd.lib libmmd.lib';
+ if getos() <> 'Windows' then
+ for i=1:size(files,'*') // compatibility scilab 4.x
+ [path_f, file_f, ext_f] = fileparts(files(i));
+ if or(ext_f == ['.o','.obj']) then
+ files(i) = path_f + file_f;
else
- FORTRAN_RUNTIME = 'libifcoremdd.lib libmmdd.lib';
+ files(i) = path_f + file_f + ext_f;
end
end
- end
-
- for x=libs(:)'
- if OTHERLIBS <> '' then
- OTHERLIBS = OTHERLIBS + ' ' + x + '.lib';
- else
- OTHERLIBS = x + '.lib';
- end
- end
-
- try
- MAKEFILE_VC = mgetl(SCI+'/modules/dynamic_link/src/scripts/TEMPLATE_MAKEFILE.VC');
- catch
- MAKEFILE_VC = '';
- end
-
- MAKEFILE_VC = strsubst(MAKEFILE_VC, "__SCI__", SCIDIR);
- MAKEFILE_VC = strsubst(MAKEFILE_VC, "__SCIDIR1__", SCIDIR1);
- MAKEFILE_VC = strsubst(MAKEFILE_VC, "__LIBNAME__", LIBRARY);
- MAKEFILE_VC = strsubst(MAKEFILE_VC, "__FILES_SRC__", FILES_SRC);
- MAKEFILE_VC = strsubst(MAKEFILE_VC, "__OBJS__", OBJS);
- MAKEFILE_VC = strsubst(MAKEFILE_VC, "__OBJS_WITH_PATH__", OBJS_WITH_PATH);
- MAKEFILE_VC = strsubst(MAKEFILE_VC, "__FORTRAN_RUNTIME__", FORTRAN_RUNTIME);
- MAKEFILE_VC = strsubst(MAKEFILE_VC, "__OTHERSLIBS__", OTHERLIBS);
-
- if CC <> '' then
- MAKEFILE_VC = strsubst(MAKEFILE_VC, "__CC__",CC);
- else
- MAKEFILE_VC = strsubst(MAKEFILE_VC, "CC = __CC__","#CC = ");
- end
-
- MAKEFILE_VC = strsubst(MAKEFILE_VC, "__CFLAGS__", CFLAGS);
- MAKEFILE_VC = strsubst(MAKEFILE_VC, "__MEXCFLAGS__", MEXCFLAGS);
- MAKEFILE_VC = strsubst(MAKEFILE_VC, "__FFLAGS__", FFLAGS);
- MAKEFILE_VC = strsubst(MAKEFILE_VC, "__MEXFFLAGS__", MEXFFLAGS);
- MAKEFILE_VC = strsubst(MAKEFILE_VC, "__LDFLAGS__", LDFLAGS);
- if ( MAKEFILE_VC <> '') then
- fd = mopen(Makename, "wt");
- mputl(MAKEFILE_VC, fd);
- mclose(fd);
-
- if ilib_verbose() > 1 then
- disp(MAKEFILE_VC);
+ // change table if necessary
+ if typeof(tables)<>'list' then
+ tables= list(tables)
end
-
- else
- // TEMPLATE_MAKEFILE.VC not found
- warning(SCI+'/modules/dynamic_link/src/scripts/TEMPLATE_MAKEFILE.VC'+ _('not found.') );
- end
-endfunction
-//---------------------------------------------------------------------------------------
-
-function ilib_gen_Make_lcc(name,table,files,libs,Makename,with_gateway,ldflags,cflags,fflags)
- managed_ext = ['.c', '.f'];
- obj_ext = ['.o', '.obj', ''];
-
- CFLAGS = cflags;
- MEXCFLAGS = '';
- FFLAGS = fflags;
- MEXFFLAGS = '';
- LDFLAGS = ldflags;
- SCIDIR = SCI;
- SCIDIR1 = pathconvert(SCI,%f,%f,'w');
- LCCLIBDIR = SCIHOME + filesep() + 'lcclib';
- LIBRARY = name;
- FILES_SRC = '';
- OBJS = '';
- OTHERLIBS = '';
-
-
- FILES_SRC_MATRIX = [];
-
- [path_Make, file_Make, ext_Make] = fileparts(Makename);
-
- for i=1:size(files,'*')
- [path_f, file_f, ext_f] = fileparts(files(i));
-
- if or(obj_ext == ext_f) then
- FILENAME = [];
- FILE_FOUNDED = %f;
- for y = managed_ext(:)'
- if (FILE_FOUNDED == %f) then
- if (fileinfo(path_f + file_f + y) <> []) | (fileinfo(path_Make + file_f + y) <> []) then
- FILENAME = path_f + file_f + y;
- FILE_FOUNDED = %t;
- end
- end
+ L = length(tables);
+ for it = 1:L
+ table = tables(it);
+ [mt, nt] = size(table);
+
+ if nt == 2 then
+ col = "csci";
+ table = [table, col(ones(mt,1))];
+ nt = 3;
end
- else
- FILENAME = files(i);
- end
- FILES_SRC_MATRIX = [FILES_SRC_MATRIX , FILENAME];
- end
- if typeof(tables) <> 'list' then
- tables = list(tables);
- end
- L = length(tables);
-
- if with_gateway then
- if L == 1 then
- FILES_SRC_MATRIX = [FILES_SRC_MATRIX , name + '.c'];
- else
- for i=1:L
- FILES_SRC_MATRIX = [FILES_SRC_MATRIX , name + string(i) + '.c'];
- end
- end
- end
-
- for it=1:L
- table = tables(it);
- [mt,nt] = size(table);
-
- for i=1:mt ;
- // mex files to be added
- if table(i,3)=='cmex' | table(i,3)=='fmex' | table(i,3)=='Fmex'
- FILES_SRC_MATRIX = [FILES_SRC_MATRIX , table(i,2)];
+ if nt <> 3 then
+ error(msprintf(gettext("%s: Wrong size for input argument #%d.\n"), "ilib_gen_Make", 2));
end
- end
- end
-
- FILES_SRC = strcat(FILES_SRC_MATRIX,' ');
-
- if table(i,3)=='cmex' | table(i,3)=='fmex' | table(i,3)=='Fmex' then
- MEXCFLAGS = "-Dmexfunction_=mex$*_ -DmexFunction=mex_$*";
- MEXFFLAGS = "-Dmexfunction=mex$*";
- end
- OBJS_MATRIX = [];
-
- for y = 1:size(FILES_SRC_MATRIX,'*')
- [path_f, file_f, ext_f] = fileparts(FILES_SRC_MATRIX(y));
- OBJS_MATRIX = [OBJS_MATRIX, path_f + file_f + '.obj'];
- end
-
- OBJS = strcat(OBJS_MATRIX, ' ');
-
- for x=libs(:)'
- if OTHERLIBS <> '' then
- OTHERLIBS = OTHERLIBS + ' ' + x + '.lib';
- else
- OTHERLIBS = x + '.lib';
- end
- end
- OTHERLIBS = strsubst(OTHERLIBS,'/',filesep());
+ tables(it) = table;
+ end
- ierr = execstr("MAKEFILE_LCC = mgetl(SCI+''/modules/dynamic_link/src/scripts/TEMPLATE_MAKEFILE.LCC'');", "errcatch");
- if ierr <> 0 then
- MAKEFILE_LCC = '';
- warning(SCI+'/modules/dynamic_link/src/scripts/TEMPLATE_MAKEFILE.LCC'+ ' ' + _('not found.') );
+ Makename = makename;
+ ilib_gen_Make_unix(name, files, libs, name, ldflags, cflags, fflags, cc, tables)
else
- MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__LDFLAGS__" , LDFLAGS);
- MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__SCI__" , SCIDIR);
- MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__SCIDIR1__" , SCIDIR1);
- MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__LCCLIBDIR__" , LCCLIBDIR);
- MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__LIBRARY__" , LIBRARY);
- MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__FILES_SRC__" , FILES_SRC);
- MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__OTHERSLIBS__" , OTHERLIBS);
- MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__CFLAGS__" , CFLAGS);
- MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__MEXCFLAGS__" , MEXCFLAGS);
- MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__FFLAGS__" , FFLAGS);
- MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__MEXFFLAGS__" , MEXFFLAGS);
- MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__OBJS__" , OBJS);
-
- fd = mopen(Makename, "wt");
- mputl(MAKEFILE_LCC, fd);
- mclose(fd);
- if ilib_verbose() > 1 then
- disp(mgetl(Makename));
+ //
+ // Windows
+ //
+ // Load dynamic_link Internal lib if it's not already loaded
+ if ~ exists("dynamic_linkwindowslib") then
+ load("SCI/modules/dynamic_link/macros/windows/lib");
end
-
+ Makename = dlwGenerateMakefile(name, ..
+ tables, ..
+ files, ..
+ libs, ..
+ makename, ..
+ with_gateway, ..
+ ldflags, ..
+ cflags, ..
+ fflags, ..
+ cc);
end
-
endfunction
-//---------------------------------------------------------------------------------------
+//=============================================================================
// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-//==========================================
+//=============================================================================
// Generate a Makefile which can be used by ilib_*
-//==========================================
+//=============================================================================
function ilib_gen_Make_unix(names, ..
- files, ..
- libs, ..
- libname, ..
- ldflags, ..
- cflags, ..
- fflags, ..
- cc, ..
- tables ..
- )
-
- if libname == "" then libname = names(1);end
-
- if ( strncpy(libname,3) == "lib") then
- l = strsplit(libname,3);
- libname = l(2);
- clear l;
- end
-
- if isdef('tables') then
-
- /// Check tables ... the second element should be the file name
- if typeof(tables)<>'list' then
- tables=list(tables)
- end
- L=length(tables);
-
- // for each element in tables
- for it=1:L
- table = tables(it)
- [mt,nt]=size(table);
- for i=1:mt ;
- // mex files to be added to the build process
- if table(i,3)=='cmex' | table(i,3)=='fmex' | table(i,3)=='Fmex' then
- if isempty(find(basename(files)==table(i,2))) then // If not already in the array
- files=[files, table(i,2)] // add it to the file list
- end
- end
- end
- end
-
- end // isdef('tables')
-
-
- originPath = pwd();
- linkBuildDir = TMPDIR;
- commandpath = SCI+"/modules/dynamic_link/src/scripts";
- [fd,ierr] = mopen(commandpath+"/write.test","w+");
-
- if (ierr<>0) then
- writePerm=%F
- else
- writePerm=%T
- mclose(fd)
- mdelete(commandpath+"/write.test");
- end
-
- if (writePerm == %T & ( fileinfo(commandpath+"/Makefile.orig") == [] | fileinfo(commandpath+"/libtool") == [] )) then
- // We have write permission on the scilab tree, then generate the stuff into the directory in order to avoid the configure each time.
- generateConfigure(commandpath);
- end
-
-
- // Copy files => linkBuildDir
- chdir(linkBuildDir);
-
- if ( ilib_verbose() <> 0 ) then
- mprintf(gettext(" %s: Copy compilation files (Makefile*, libtool...) to TMPDIR\n"),"ilib_gen_Make");
- end
-
- // List of the files mandatory to generate a lib with the detection of the env
- mandatoryFiles = ["compilerDetection.sh", ..
- "configure.ac", ..
- "configure", ..
- "Makefile.am", ..
- "Makefile.in", ..
- "config.sub", ..
- "libtool", ..
- "config.guess", ..
- "config.status", ..
- "depcomp", ..
- "install-sh", ..
- "ltmain.sh", ..
- "missing", ..
- "aclocal.m4"];
-
- // Copy files to the working tmpdir
- for x = mandatoryFiles(:)' ;
- fullPath=commandpath+"/"+x;
- if (fileinfo(fullPath)<>[]) then
- [status,msg]=copyfile(fullPath,linkBuildDir);
- if (status <> 1)
- error(msprintf(gettext("%s: An error occurred: %s\n"), "ilib_gen_Make",msg));
- end
- end
- end
-
- filelist = "";
-
- for x = files(:)' ;
- // Pre added file in the list ... don't really know why
-
- if (x <> "csci") then
- // Old way: to compile a fun.c file, the user had to provide fun.o
- filename = strsubst(x,'.o','');
-
- chdir(originPath); // Switch back to the source dir in order to have only the filename
- filesMatching = ls(filename+".*");
-
- // Two cases here:
- // * The user provided the real filename. Then, take if straight
- // * The user provided a file ending by .o (example: myfile.o)
- // We stripped the ending .o and looked for all files
- if filesMatching == [] | fileinfo(x) <> [] then
-
- pathFrom=fileparts(x); // Retrieve the path of the file
- if length(pathFrom) == 0 then // Empty => it should be PWD
- pathFrom=pwd();
- end
-
- if pathFrom <> linkBuildDir then
- if ( ilib_verbose() <> 0 ) then
- mprintf(gettext(" %s: Copy %s to TMPDIR\n"),"ilib_gen_Make",x);
- end
- copyfile(x, linkBuildDir);
- else
- if ( ilib_verbose() <> 0 ) then
- mprintf(gettext(" %s: Did not copy %s: Source and target directories are the same (%s).\n"),"ilib_gen_Make",x,pathFrom);
- end
- end
-
- filelist = filelist + " " + x ;
-
- else
-
- // Or copy the file matching to what we were looking for
- // (this stuff could lead to bug if you have fun.c fun.f
- // or fun.cxx but it was already the case before ...
-
- // Not that we don't want to copy working files
- ignoredFileExtension=[".lo",".la",".lai"]
- for f=filesMatching(:)'
-
- if strindex(f,ignoredFileExtension) == [] then
- if ( ilib_verbose() <> 0 ) then
- mprintf(gettext(" %s: Copy %s to TMPDIR\n"),"ilib_gen_Make",f);
- end
-
- copyfile(f, linkBuildDir);
- filelist = filelist + " " + f;
- else
- if ( ilib_verbose() <> 0 ) then
- mprintf(gettext(" %s: File %s ignored.\n"),"ilib_gen_Make",f);
- end
- end
- end
- end
- chdir(linkBuildDir);
- end
- end
-
- if ldflags <> '' | cflags <> '' | fflags <> '' | cc <> '' | fileinfo(commandpath+"/Makefile.orig") == [] | fileinfo(commandpath+"/libtool") == [] then
- // Makefile.orig doesn't exists or may be invalid regarding the flags
- // run the ./configure with the flags
-
- if ( ilib_verbose() == 2 ) then
- mprintf(gettext(" %s: Need to run the compiler detection (configure).\n"),"ilib_gen_Make");
- end
-
- mdelete(linkBuildDir+"/Makefile.orig");
- generateConfigure(linkBuildDir, ldflags, cflags, fflags, cc)
- else
- // Reuse existing Makefile.orig because compilation flags are all empty
- [status,msg]=copyfile(commandpath+"/Makefile.orig",linkBuildDir);
-
- if ( ilib_verbose() == 2 ) then
- mprintf(gettext(" %s: Use the previous detection of compiler.\n"),"ilib_gen_Make");
- end
-
- if (status <> 1)
- error(msprintf(gettext("%s: An error occurred: %s\n"), "ilib_gen_Make",msg));
- end
-
- // We just copied the configure script, so its modification time is "now".
- // But Makefile timestamp is also "now", since we just created it. Since
- // Makefile depends on configure, "make" re-run the configure script, and
- // hence rebuild Makefile from Makefile.in, overwriting the result of
- // scicompile.sh. We want to avoid this, so we have to force Makefile's
- // timestamp to one second later.
- // (just try "touch configure Makefile; make" on any autoconf project)
- sleep(1000);
- unix_g("touch Makefile");
- end
-
- // Alter the Makefile in order to compile the right files
- if ( ilib_verbose() <> 0 ) then
- mprintf(gettext(" %s: Modification of the Makefile in TMPDIR.\n"),"ilib_gen_Make");
- end
-
- cmd=commandpath + "/scicompile.sh " + libname + " " + filelist
-
- [msg,ierr, stderr] = unix_g(cmd);
-
- if ( ilib_verbose() == 2 ) then
- mprintf(gettext(" %s: Substitute the reference by the actual file.\n"),"ilib_gen_Make");
- mprintf(gettext(" Command: %s\n"),cmd);
- if (length(msg)) then
- mprintf(gettext("Output: %s\n"),msg);
- end
- mprintf(gettext("stderr: %s\n"),stderr);
- end
-
- if ierr <> 0 then
- if ( ilib_verbose() <> 0 ) then
- mprintf(gettext("%s: Error while modifying the reference Makefile:\n"),"ilib_gen_Make")
- mprintf(msg + " " + stderr);
- end
- return;
- end
-
- chdir(originPath);
-
+ files, ..
+ libs, ..
+ libname, ..
+ ldflags, ..
+ cflags, ..
+ fflags, ..
+ cc, ..
+ tables ..
+ )
+
+ if getos() == 'Windows' then
+ return
+ end
+
+ if libname == "" then libname = names(1);end
+
+ if ( strncpy(libname,3) == "lib") then
+ l = strsplit(libname,3);
+ libname = l(2);
+ clear l;
+ end
+
+ if isdef('tables') then
+
+ /// Check tables ... the second element should be the file name
+ if typeof(tables)<>'list' then
+ tables=list(tables)
+ end
+ L=length(tables);
+
+ // for each element in tables
+ for it=1:L
+ table = tables(it)
+ [mt,nt]=size(table);
+ for i=1:mt ;
+ // mex files to be added to the build process
+ if table(i,3)=='cmex' | table(i,3)=='fmex' | table(i,3)=='Fmex' then
+ if isempty(find(basename(files)==table(i,2))) then // If not already in the array
+ files=[files, table(i,2)] // add it to the file list
+ end
+ end
+ end
+ end
+
+ end // isdef('tables')
+
+
+ originPath = pwd();
+ linkBuildDir = TMPDIR;
+ commandpath = SCI+"/modules/dynamic_link/src/scripts";
+ [fd,ierr] = mopen(commandpath+"/write.test","w+");
+
+ if (ierr<>0) then
+ writePerm=%F
+ else
+ writePerm=%T
+ mclose(fd)
+ mdelete(commandpath+"/write.test");
+ end
+
+ if (writePerm == %T & ( fileinfo(commandpath+"/Makefile.orig") == [] | fileinfo(commandpath+"/libtool") == [] )) then
+ // We have write permission on the scilab tree, then generate the stuff into the directory in order to avoid the configure each time.
+ generateConfigure(commandpath);
+ end
+
+
+ // Copy files => linkBuildDir
+ chdir(linkBuildDir);
+
+ if ( ilib_verbose() <> 0 ) then
+ mprintf(gettext(" %s: Copy compilation files (Makefile*, libtool...) to TMPDIR\n"),"ilib_gen_Make");
+ end
+
+ // List of the files mandatory to generate a lib with the detection of the env
+ mandatoryFiles = ["compilerDetection.sh", ..
+ "configure.ac", ..
+ "configure", ..
+ "Makefile.am", ..
+ "Makefile.in", ..
+ "config.sub", ..
+ "libtool", ..
+ "config.guess", ..
+ "config.status", ..
+ "depcomp", ..
+ "install-sh", ..
+ "ltmain.sh", ..
+ "missing", ..
+ "aclocal.m4"];
+
+ // Copy files to the working tmpdir
+ for x = mandatoryFiles(:)' ;
+ fullPath=commandpath+"/"+x;
+ if (fileinfo(fullPath)<>[]) then
+ [status,msg]=copyfile(fullPath,linkBuildDir);
+ if (status <> 1)
+ error(msprintf(gettext("%s: An error occurred: %s\n"), "ilib_gen_Make",msg));
+ end
+ end
+ end
+
+ filelist = "";
+
+ for x = files(:)' ;
+ // Pre added file in the list ... don't really know why
+
+ if (x <> "csci") then
+ // Old way: to compile a fun.c file, the user had to provide fun.o
+ filename = strsubst(x,'.o','');
+
+ chdir(originPath); // Switch back to the source dir in order to have only the filename
+ filesMatching = ls(filename+".*");
+
+ // Two cases here:
+ // * The user provided the real filename. Then, take if straight
+ // * The user provided a file ending by .o (example: myfile.o)
+ // We stripped the ending .o and looked for all files
+ if filesMatching == [] | fileinfo(x) <> [] then
+
+ pathFrom=fileparts(x); // Retrieve the path of the file
+ if length(pathFrom) == 0 then // Empty => it should be PWD
+ pathFrom=pwd();
+ end
+
+ if pathFrom <> linkBuildDir then
+ if ( ilib_verbose() <> 0 ) then
+ mprintf(gettext(" %s: Copy %s to TMPDIR\n"),"ilib_gen_Make",x);
+ end
+ copyfile(x, linkBuildDir);
+ else
+ if ( ilib_verbose() <> 0 ) then
+ mprintf(gettext(" %s: Did not copy %s: Source and target directories are the same (%s).\n"),"ilib_gen_Make",x,pathFrom);
+ end
+ end
+
+ filelist = filelist + " " + x ;
+
+ else
+
+ // Or copy the file matching to what we were looking for
+ // (this stuff could lead to bug if you have fun.c fun.f
+ // or fun.cxx but it was already the case before ...
+
+ // Not that we don't want to copy working files
+ ignoredFileExtension=[".lo",".la",".lai"]
+ for f=filesMatching(:)'
+
+ if strindex(f,ignoredFileExtension) == [] then
+ if ( ilib_verbose() <> 0 ) then
+ mprintf(gettext(" %s: Copy %s to TMPDIR\n"),"ilib_gen_Make",f);
+ end
+
+ copyfile(f, linkBuildDir);
+ filelist = filelist + " " + f;
+ else
+ if ( ilib_verbose() <> 0 ) then
+ mprintf(gettext(" %s: File %s ignored.\n"),"ilib_gen_Make",f);
+ end
+ end
+ end
+ end
+ chdir(linkBuildDir);
+ end
+ end
+
+ if ldflags <> '' | cflags <> '' | fflags <> '' | cc <> '' | fileinfo(commandpath+"/Makefile.orig") == [] | fileinfo(commandpath+"/libtool") == [] then
+ // Makefile.orig doesn't exists or may be invalid regarding the flags
+ // run the ./configure with the flags
+
+ if ( ilib_verbose() == 2 ) then
+ mprintf(gettext(" %s: Need to run the compiler detection (configure).\n"),"ilib_gen_Make");
+ end
+
+ mdelete(linkBuildDir+"/Makefile.orig");
+ generateConfigure(linkBuildDir, ldflags, cflags, fflags, cc)
+ else
+ // Reuse existing Makefile.orig because compilation flags are all empty
+ [status,msg]=copyfile(commandpath+"/Makefile.orig",linkBuildDir);
+
+ if ( ilib_verbose() == 2 ) then
+ mprintf(gettext(" %s: Use the previous detection of compiler.\n"),"ilib_gen_Make");
+ end
+
+ if (status <> 1)
+ error(msprintf(gettext("%s: An error occurred: %s\n"), "ilib_gen_Make",msg));
+ end
+
+ // We just copied the configure script, so its modification time is "now".
+ // But Makefile timestamp is also "now", since we just created it. Since
+ // Makefile depends on configure, "make" re-run the configure script, and
+ // hence rebuild Makefile from Makefile.in, overwriting the result of
+ // scicompile.sh. We want to avoid this, so we have to force Makefile's
+ // timestamp to one second later.
+ // (just try "touch configure Makefile; make" on any autoconf project)
+ sleep(1000);
+ unix_g("touch Makefile");
+ end
+
+ // Alter the Makefile in order to compile the right files
+ if ( ilib_verbose() <> 0 ) then
+ mprintf(gettext(" %s: Modification of the Makefile in TMPDIR.\n"),"ilib_gen_Make");
+ end
+
+ cmd=commandpath + "/scicompile.sh " + libname + " " + filelist
+
+ [msg,ierr, stderr] = unix_g(cmd);
+
+ if ( ilib_verbose() == 2 ) then
+ mprintf(gettext(" %s: Substitute the reference by the actual file.\n"),"ilib_gen_Make");
+ mprintf(gettext(" Command: %s\n"),cmd);
+ if (length(msg)) then
+ mprintf(gettext("Output: %s\n"),msg);
+ end
+ mprintf(gettext("stderr: %s\n"),stderr);
+ end
+
+ if ierr <> 0 then
+ if ( ilib_verbose() <> 0 ) then
+ mprintf(gettext("%s: Error while modifying the reference Makefile:\n"),"ilib_gen_Make")
+ mprintf(msg + " " + stderr);
+ end
+ return;
+ end
+
+ chdir(originPath);
+
endfunction
function generateConfigure(workingPath, ..
- ldflags, ..
- cflags, ..
- fflags, ..
- cc)
-
- // We launch ./configure in order to produce a "generic" Makefile
- // for this computer
-
- if ( ilib_verbose() <> 0 ) then
- mprintf(gettext(" %s: configure : Generate Makefile.\n"),"ilib_gen_Make");
- end
- cmd = gencompilationflags_unix(ldflags, cflags, fflags, cc, "configure")
- cmd = workingPath+"/compilerDetection.sh "+cmd
-
- [msg,ierr,stderr] = unix_g(cmd);
-
- if ( ilib_verbose() == 2 ) then
- mprintf(gettext(" %s: Command: %s\n"),"ilib_gen_Make",cmd);
- mprintf(gettext(" Output: %s\n"),msg);
- mprintf(gettext(" stderr: %s\n"),stderr);
- end
-
- if ierr <> 0 then
- if ( ilib_verbose() <> 0 ) then
- mprintf(msg + " " + stderr);
- end
- error(msprintf(gettext("%s: An error occurred during the detection of the compiler(s). Set ilib_verbose(2) for more information.\n"), "ilib_gen_Make"));
- return;
- end
+ ldflags, ..
+ cflags, ..
+ fflags, ..
+ cc)
+
+ // We launch ./configure in order to produce a "generic" Makefile
+ // for this computer
+
+ if ( ilib_verbose() <> 0 ) then
+ mprintf(gettext(" %s: configure : Generate Makefile.\n"),"ilib_gen_Make");
+ end
+ cmd = gencompilationflags_unix(ldflags, cflags, fflags, cc, "configure")
+ cmd = workingPath+"/compilerDetection.sh "+cmd
+
+ [msg,ierr,stderr] = unix_g(cmd);
+
+ if ( ilib_verbose() == 2 ) then
+ mprintf(gettext(" %s: Command: %s\n"),"ilib_gen_Make",cmd);
+ mprintf(gettext(" Output: %s\n"),msg);
+ mprintf(gettext(" stderr: %s\n"),stderr);
+ end
+
+ if ierr <> 0 then
+ if ( ilib_verbose() <> 0 ) then
+ mprintf(msg + " " + stderr);
+ end
+ error(msprintf(gettext("%s: An error occurred during the detection of the compiler(s). Set ilib_verbose(2) for more information.\n"), "ilib_gen_Make"));
+ return;
+ end
endfunction
+//=============================================================================
\ No newline at end of file
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) DIGITEO - 2009 - Allan CORNET
-//
+// Copyright (C) DIGITEO - 2009-2010 - Allan CORNET
+//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution. The terms
-// are also available at
+// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-//==========================================
+//=============================================================================
function ilib_gen_cleaner(makename,loadername,files)
[lhs,rhs] = argn(0);
if (rhs < 2) then
loadername = 'loader.sce';
end
-
+
if (rhs < 3) then
files = [];
end
mfprintf(fd," mdelete(''%s'');\n",loadername);
mfprintf(fd,"end\n");
mfprintf(fd,"// ------------------------------------------------------\n");
-
+
if getos() == 'Windows' then
- make_command = get_make_command(makename);
+ make_command = get_make_command(makename);
mfprintf(fd,"if fileinfo(''%s%s'') <> [] then\n",makename,get_makefile_ext());
- mfprintf(fd," unix_s(''%s'');\n",make_command);
+ mfprintf(fd," unix_s(''%s'');\n",make_command);
mfprintf(fd," mdelete(''%s%s'');\n",makename,get_makefile_ext());
mfprintf(fd,"end\n");
mfprintf(fd,"// ------------------------------------------------------\n");
- end
+ end
- if files <> [] then
+ if files <> [] then
for i = 1:size(files,'*')
if ( files(i) <> '' ) then
mfprintf(fd,"if fileinfo(''%s'') <> [] then\n", files(i));
end
mfprintf(fd,"chdir(curdir);\n");
- mfprintf(fd,"// ------------------------------------------------------\n");
+ mfprintf(fd,"// ------------------------------------------------------\n");
mclose(fd);
if ilib_verbose() > 1 then
disp(mgetl('cleaner.sce'));
end
endfunction
-//==========================================
+//=============================================================================
function cmd = get_make_command(makename)
if getos() == 'Windows' then // WINDOWS
- // Visual Studio C++
- if ( findmsvccompiler() <> 'unknown' ) then
- cmd = 'nmake /Y /nologo /f ' + makename + '.mak' + ' clean';
- else
- // LCC-WIN32
- if findlcccompiler() then
- cmd = 'make -f ' + makename + '.lcc' + ' clean';
- else
- // TO DO : Add another compiler here
- end
+ // Load dynamic_link Internal lib if it's not already loaded
+ if ~ exists("dynamic_linkwindowslib") then
+ load("SCI/modules/dynamic_link/macros/windows/lib");
end
+ cmd = dlwGetMakefileCmdCleaner(makename);
else // LINUX
- cmd = 'make ' + makename + ' clean';
- end
+ cmd = 'make ' + makename + ' clean';
+ end
endfunction
-//==========================================
+//=============================================================================
function ext = get_makefile_ext()
if getos() == 'Windows' then // WINDOWS
- // Visual Studio C++
- if ( findmsvccompiler() <> 'unknown' ) then
- ext = '.mak';
- else
- // LCC-WIN32
- if findlcccompiler() then
- ext = '.lcc';
- else
- // TO DO : Add another compiler here
- end
+ // Load dynamic_link Internal lib if it's not already loaded
+ if ~ exists("dynamic_linkwindowslib") then
+ load("SCI/modules/dynamic_link/macros/windows/lib");
end
+ ext = dlwGetMakefileExt();
else // LINUX
ext = '';
- end
+ end
endfunction
-//==========================================
+//=============================================================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) INRIA/ENPC
-//
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution. The terms
-// are also available at
+// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-//==========================================
+//=============================================================================
// ilib_gen_gateway used by ilib_build
-//==========================================
+//=============================================================================
// generate an interface gateway named name
-// from table table taking into account
-// attributes of function i.e mex fmex or scilab interface
-// if name is a full path just extract the filename
+// from table table taking into account
+// attributes of function i.e mex fmex or scilab interface
+// if name is a full path just extract the filename
function gateway_filename = ilib_gen_gateway(name,tables)
else
path='';
end
-
+
[path_name, file_name, ext_name] = fileparts(name);
if ext_name == '.c' then
name = path_name + file_name;
else
name = path_name + file_name + ext_name;
end
-
- if typeof(tables)<>'list' then
+
+ if typeof(tables)<>'list' then
tables = list(tables);
end
-
- L = length(tables);
- for itable = 1:L
- // loop on a list of tables
- if L <> 1 then
+ L = length(tables);
+
+ for itable = 1:L
+ // loop on a list of tables
+ if L <> 1 then
tname = name +string(itable);
- else
+ else
tname = name ;
end
-
+
table = tables(itable);
[mt,nt] = size(table);
-
- if (nt == 2) then
+
+ if (nt == 2) then
col = "csci";
table = [table, col(ones(mt,1))];
nt = 3;
- end
-
- if ( nt <> 3 ) then
+ end
+
+ if ( nt <> 3 ) then
error(msprintf(gettext("%s: Wrong size for input argument #%d: %d expected.\n"),"ilib_gen_gateway",2,3));
- end
- [gate,names] = new_names(table);
+ end
+ [gate,names] = new_names(table);
t = [ '#include <mex.h> ';
'#include <sci_gateway.h>';
'#include <api_scilab.h>';
+ '#include <MALLOC.h>';
'static int direct_gateway(char *fname,void F(void)) { F();return 0;};';
'extern Gatefunc ' + names(:) + ';';
'static GenericTable Tab[]={';
' Rhs = Max(0, Rhs);';
' if (*(Tab[Fin-1].f) != NULL) '
' {';
+ ' if(pvApiCtx == NULL)';
+ ' {'
+ ' pvApiCtx = (StrCtx*)MALLOC(sizeof(StrCtx));';
+ ' }';
' pvApiCtx->pstName = (char*)Tab[Fin-1].name;';
' (*(Tab[Fin-1].f))(Tab[Fin-1].name,Tab[Fin-1].F);';
' }';
'}'];
gateway_filename = path + tname + '.c';
- // first check if we have already a gateway
+ // first check if we have already a gateway
[fd, ierr] = mopen(gateway_filename, 'rt');
if ierr == 0 then
// file already exists
mputl(t, gateway_filename);
end
else
- // file does not exist we create it
- mputl(t, gateway_filename) ;
+ // file does not exist we create it
+ mputl(t, gateway_filename) ;
end
if ilib_verbose() > 1 then
end
end
endfunction
-//==========================================
-
-
-
-//==========================================
+//=============================================================================
// new_names only used by ilib_gen_gateway
-//==========================================
-function [gate,names] = new_names(table)
- // change names according to types
+//=============================================================================
+function [gate,names] = new_names(table)
+ // change names according to types
[mt,nt] = size(table);
- gate = "mex_gateway";
- gate = gate(ones(mt,1));
- names = " ";
- names = names(ones(mt,1));
- for i = 1:mt
- select table(i,3)
- case 'cmex' then
+ gate = "mex_gateway";
+ gate = gate(ones(mt,1));
+ names = " ";
+ names = names(ones(mt,1));
+ for i = 1:mt
+ select table(i,3)
+ case 'cmex' then
names(i) = "mex_" + table(i,2) ;
- case 'fmex' then
+ case 'fmex' then
gate(i) = "(Myinterfun)fortran_mex_gateway" ;
names(i) = "C2F(mex" + table(i,2) + ")" ;
- case 'Fmex' then
+ case 'Fmex' then
gate(i) = "(Myinterfun)fortran_mex_gateway" ;
names(i) = "C2F(mex" + table(i,2) + ")" ;
case 'csci' then
gate(i) = "(Myinterfun)sci_gateway" ;
end
names(i) = table(i,2) ;
- case 'fsci' then
+ case 'fsci' then
if isdef('WITHOUT_AUTO_PUTLHSVAR') then
if (WITHOUT_AUTO_PUTLHSVAR == %T) then
gate(i) = "(Myinterfun)sci_gateway_without_putlhsvar" ;
gate(i) = "(Myinterfun)sci_gateway" ;
end
names(i) = "C2F(" + table(i,2) + ")" ;
- case 'direct' then
+ case 'direct' then
gate(i) = "(Myinterfun)direct_gateway" ;
names(i) = "C2F(" + table(i,2) + ")" ;
- else
- error(999,"Wrong interface type " + table(i,3));
- end
- end
+ else
+ error(999,"Wrong interface type " + table(i,3));
+ end
+ end
endfunction
-//==========================================
+//=============================================================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) INRIA/ENPC
-// Copyright (C) DIGITEO - 2009 - Allan CORNET
-//
+// Copyright (C) DIGITEO - 2009-2010 - Allan CORNET
+//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution. The terms
-// are also available at
+// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+//=============================================================================
+function ilib_gen_loader(varargin)
+ // varargin (max) name, tables, libs, libname, flag, loadername
+ [lhs, rhs] = argn(0);
-// ilib_gen_loader also used by ilib_for_link
-// ilib_gen_loader for ilib_for_link have more options but not
-// in the same order (internal use ONLY)
+ if and(rhs <> [2 3 6]) then
+ error(msprintf(_("%s: Wrong number of input argument(s): %d,%d or %d expected.\n"), "ilib_gen_loader", 2, 3, 6));
+ end
-function ilib_gen_loader(varargin)
+ name = varargin(1);
+ tables = varargin(2);
- [lhs,rhs] = argn(0);
-
- if and(rhs<>[2 3 5]) then
- error(msprintf(_("%s: Wrong number of input argument(s): %d,%d or %d expected.\n"),"ilib_gen_loader",2,3,5));
+ if rhs > 2 then
+ libs = varargin(3);
+ else
+ libs = [];
end
-
- if ( (rhs == 2) | (rhs == 3) ) then
-
- name = varargin(1);
- tables = varargin(2);
-
- if (rhs > 2) then
- libs = varargin(3);
- else
- libs = [];
- end
-
- if type(name) <> 10 then
- error(msprintf(_("%s: Wrong type for input argument #%d: String expected.\n"),"ilib_gen_loader",1));
- end
-
- if tables <> [] then
- if type(tables) <> 10 then
- error(msprintf(_("%s: Wrong type for input argument #%d: String array expected.\n"),"ilib_gen_loader",2));
- end
- end
-
- if libs <> [] then
- if type(libs) <> 10 then
- error(msprintf(_("%s: Wrong type for input argument #%d: String array expected.\n"),"ilib_gen_loader",3));
- end
- end
-
- ilib_std_gen_loader(name,tables,libs);
-
- elseif (rhs == 5) then
-
- names = varargin(1);
- flag = varargin(2);
- loadername = varargin(3);
- libs = varargin(4);
- libname = varargin(5);
-
- if type(names) <> 10 then
- error(msprintf(_("%s: Wrong type for input argument #%d: String array expected.\n"),"ilib_gen_loader",1));
- end
-
- if type(flag) <> 10 then
- error(msprintf(_("%s: Wrong type for input argument #%d: String expected.\n"),"ilib_gen_loader",2));
+
+ if rhs > 3 then
+ libname = varargin(4);
+ else
+ libname = '';
+ end
+
+ if rhs > 4 then
+ flag = varargin(5);
+ else
+ flag = '';
+ end
+
+ if rhs > 5 then
+ loadername = varargin(6);
+ else
+ loadername = 'loader.sce';
+ end
+
+ if type(name) <> 10 then
+ error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), 'ilib_gen_loader', 1));
+ end
+
+ if tables <> [] then
+ if type(tables) <> 10 then
+ error(999, msprintf(_("%s: Wrong type for input argument #%d: String matrix expected.\n"), 'ilib_gen_loader', 2));
end
-
- if type(loadername) <> 10 then
- error(msprintf(_("%s: Wrong type for input argument #%d: String expected.\n"),"ilib_gen_loader",3));
+ else
+ backupTables = tables;
+ if ( typeof(tables) <> 'list') then
+ tables = list(tables);
end
-
- if libs <> [] then
- if type(libs) <> 10 then
- error(msprintf(_("%s: Wrong type for input argument #%d: String array expected.\n"),"ilib_gen_loader",4));
+ L = length(tables);
+ for it = 1:L
+ [mt, nt] = size(tables(it));
+
+ if ((mt == 0) & (nt == 0)) then
+ break;
end
- end
-
- if libname <> [] then
- if type(libname) <> 10 then
- error(msprintf(_("%s: Wrong type for input argument #%d: String array expected.\n"),"ilib_gen_loader",5));
+
+ if ( (nt <> 3) & ( nt <> 2) ) then
+ error(msprintf(gettext("%s: Wrong size for input argument #%d.\n"),"ilib_gen_loader", 2));
end
end
-
- ilib_4_link_gen_loader(names,flag,loadername,libs,libname);
-
+ tables = backupTables;
end
-
-endfunction
+ if libs <> [] & type(libs) <> 10 then
+ error(999, msprintf(_("%s: Wrong type for input argument #%d: String matrix expected.\n"), 'ilib_gen_loader', 3));
+ end
-//==============================================================================
-// ilib_4_link_gen_loader
-// used by ilib_for_link
-// INTERNAL USE ONLY
-//==============================================================================
+ if type(libname) <> 10 then
+ error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), 'ilib_gen_loader', 4));
+ end
-function ilib_4_link_gen_loader(names, flag, loadername, libs, libname)
-
- if libname=="" then libname = names(1);end
-
- if ( length(libname) + length("_path") ) > 24 then
- shortlibname_path = part(libname,1:(24 - length("_path")));
- else
- shortlibname_path = libname;
+ if size(libname,'*') <> 1 then
+ error(999, msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"), 'ilib_gen_loader', 4));
end
-
- fd=mopen(loadername,"wt");
- mfprintf(fd,"// This file is released into the public domain\n");
- mfprintf(fd,"// Generated by builder.sce : Please, do not edit this file\n");
- mfprintf(fd,"//\n");
- mfprintf(fd,"\n");
- mfprintf(fd,"%s_path = get_absolute_file_path(''%s'');\n",shortlibname_path,basename(loadername+'.x'));
- mfprintf(fd,"\n");
-
- //** first "link" : external libraries
- if libs=="" then
- //** do nothing : you don't need to link any "external" lib(s)
- else
- //** add one "link" line for each library (with the appropriate extension)
- nl = size(libs,'*') ;
- for i=1:nl
- if is_absolute_path(libs(i)) then
- mfprintf(fd,"link(''%s''+getdynlibext());\n",libs(i));
- else
- mfprintf(fd,"link(%s_path+''%s''+getdynlibext());\n",shortlibname_path,libs(i));
- end
- end
+
+ if type(flag) <> 10 then
+ error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), 'ilib_gen_loader', 5));
end
-
- // bug 4515 - unlink previous function with same name
- names = names(:)';
- n = size(names,'*');
- mfprintf(fd,"// ulink previous function with same name\n");
- for i = 1:n
- mfprintf(fd,"[bOK,ilib] = c_link(''%s'');if (bOK) then ulink(ilib),end\n", names(i));
+
+ if size(flag,'*') <> 1 then
+ error(999, msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"), 'ilib_gen_loader', 5));
end
- //** second "link" : user defined functions
- mfprintf(fd,"link(%s_path+''lib%s''+getdynlibext(),[",shortlibname_path,libname);
-
- for i=1:n
- mfprintf(fd,"''%s''",names(i))
- if i <>n ; mfprintf(fd,","); else mfprintf(fd,"],");end
+ if type(loadername) <> 10 then
+ error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), 'ilib_gen_loader', 6));
end
-
- // we manage .f90 as .f on windows
- if getos() == 'Windows' then
- if findmsifortcompiler()<> "unknown" then
- if flag == "f90" then
- flag = "f";
- end
- else
- if flag == "f90" then
- error(gettext("F2C cannot build fortran 90"));
- end
- end
+
+ if size(loadername,'*') <> 1 then
+ error(999, msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"), 'ilib_gen_loader', 6));
end
- mfprintf(fd,"''%s'');\n",flag);
- mfprintf(fd,"// remove temp. variables on stack\n");
- mfprintf(fd,"clear %s_path;\n",shortlibname_path);
- mfprintf(fd,"clear get_file_path;\n");
- mfprintf(fd,"// ------------------------------------------------------\n");
- mclose(fd);
-
- if ilib_verbose() > 1 then
- disp(mgetl(loadername));
+ if libname == '' then
+ libname = name(1);
end
-endfunction
+ generateLoader(name, tables, libs, libname, flag, loadername);
-//==============================================================================
-// ilib_std_gen_loader
-// INTERNAL USE ONLY
-//==============================================================================
+endfunction
+//=============================================================================
+function bOK = generateLoader(name, tables, libs, libname, flag, loadername)
+ bOK = %F;
-function ilib_std_gen_loader(name, tables, libs)
+ if ( length(libname) + length("_path") ) > 24 then
+ shortlibname_path = part(libname,1:(24 - length("_path")));
+ else
+ shortlibname_path = libname;
+ end
- if ( typeof(tables) <> 'list') then
- tables = list(tables);
+ [fd, err] = mopen(loadername, "wt");
+ if err <> 0 then
+ warning(msprintf(_("%s: Cannot open file %s.\n"), "mopen", loadername));
+ bOK = %F;
+ return
end
-
- L = length(tables);
- for it = 1:L
- [mt,nt] = size(tables(it));
- if ((mt == 0) & (nt == 0)) then
- break;
+
+ mfprintf(fd, "// This file is released into the public domain\n");
+ mfprintf(fd, "// Generated by builder.sce : Please, do not edit this file\n");
+ mfprintf(fd, "// ----------------------------------------------------------------------------\n");
+ mfprintf(fd, "//\n");
+
+ // Bug 5737
+ if getos() == 'Windows' then
+ if win64() then
+ mfprintf(fd, "if ~win64() then\n");
+ mfprintf(fd, " warning(_(""This module requires a Windows x64 platform.""));\n");
+ else
+ mfprintf(fd, "if win64() then\n");
+ mfprintf(fd, " warning(_(""This module requires a Windows x86 platform.""));\n");
end
- if ( (nt <> 3) & ( nt <> 2) ) then
- error(msprintf(gettext("%s: Wrong size for input argument #%d.\n"),"ilib_gen_loader",2));
- end
+ mfprintf(fd, " return\n");
+ mfprintf(fd, "end\n");
+ mfprintf(fd, "//\n");
end
-
- if length(name) + length('_path') > 24 then
- name_path = part(name,1:(24 - length('_path')));
- else
- name_path = name;
+
+ // remove path
+ filenamewithext = fileparts(loadername,'fname') + fileparts(loadername, 'extension');
+
+ mfprintf(fd, "%s_path = get_absolute_file_path(''%s'');\n", shortlibname_path, filenamewithext);
+ mfprintf(fd, "//\n");
+
+ // bug 4515 - unlink previous function with same name
+ name = name(:)';
+ n = size(name, '*');
+ mfprintf(fd, "// ulink previous function with same name\n");
+ for i = 1:n
+ mfprintf(fd, "[bOK, ilib] = c_link(''%s'');\n", name(i));
+ mfprintf(fd, "if bOK then\n");
+ mfprintf(fd, " ulink(ilib);\n");
+ mfprintf(fd, "end\n");
+ mfprintf(fd, "//\n");
end
-
- fd=mopen('loader.sce',"wt");
- mfprintf(fd,"// This file is released into the public domain\n");
- mfprintf(fd,"// Generated by builder.sce : Please, do not edit this file\n");
- mfprintf(fd,"//\n");
- mfprintf(fd,"%s_path = get_file_path(''loader.sce'');\n",name_path);
-
- nl = size(libs,'*');
- for i=1:nl
+
+ nl = size(libs ,'*');
+ for i = 1:nl
// Add the relative path only if the lib has a relative path
isabspath = is_absolute_path(libs(i));
- ext = getdynlibext();
libfile = libs(i);
- if isabspath then
- data = "link(''%s%s'');\n";
- mfprintf(fd,data,libfile,ext);
- else
- data = "link(%s_path+''/%s%s'');\n";
- mfprintf(fd,data,name_path,libfile,ext);
+ if libfile <> '' then
+ if isabspath then
+ mfprintf(fd, "link(''%s'' + getdynlibext());\n", libfile);
+ else
+ mfprintf(fd, "link(%s_path + filesep() + ''%s'' + getdynlibext());\n", shortlibname_path, libfile);
+ end
+ end
+ end
+
+ if tables <> [] then
+ //
+ // addinter
+ //
+ if ( typeof(tables) <> 'list') then
+ tables = list(tables);
end
- end
-
- if L == 1 then
- // direct call to addinter
- table = tables(1);
-
- mfprintf(fd,"list_functions = [ ");
- for x = table(1:$,1)'
- mfprintf(fd," ''%s'';\n",x);
+ L = length(tables);
+ if L == 1 then
+ // direct call to addinter
+ table = tables(1);
+ mfprintf(fd, "list_functions = [ ");
+ withoutSpace = %T;
+ for x = table(1:$,1)'
+ if withoutSpace then
+ withoutSpace = %F;
+ mfprintf(fd, "''%s'';\n", x);
+ else
+ mfprintf(fd, " ''%s'';\n", x);
+ end
+ end
+ mfprintf(fd, "];\n");
+
+ mfprintf(fd, "addinter(%s_path + filesep() + ''%s'' + getdynlibext(), ''%s'', list_functions);\n", shortlibname_path, ..
+ name, name);
+ else
+ // on link then a set of addinter
+ mfprintf(fd, "ilib = link(%s_path + filesep() + ''%s'' + getdynlibext());\n", shortlibname_path, ..
+ name);
+ for itable =1 :L
+ // loop on a list of tables
+ table = tables(itable);
+
+ mfprintf(fd, "list_functions = [ ''%s'';\n", table(1,1));
+ for x = table(2:$, 1)'
+ mfprintf(fd, " ''%s'';\n", x);
+ end
+ mfprintf(fd, "];\n");
+
+ mfprintf(fd, "addinter(ilib, ''%s'', list_functions);\n", ..
+ name + string(itable));
+ end
end
- mfprintf(fd,"];\n");
- mfprintf(fd,"addinter(%s_path+''/%s%s'',''%s'',list_functions);\n",name_path, ..
- name,getdynlibext(),name);
else
- // on link then a set of addinter
- mfprintf(fd,"ilib = link(%s_path+filesep()+''%s%s'');\n",name_path, ..
- name,getdynlibext());
- for itable=1:L
- // loop on a list of tables
- table = tables(itable);
-
- mfprintf(fd,"list_functions = [ ''%s'';\n",table(1,1));
- for x=table(2:$,1)'
- mfprintf(fd," ''%s'';\n",x);
+ //
+ // link
+ //
+ mfprintf(fd,"link(%s_path + ''lib%s'' + getdynlibext(), [", shortlibname_path, libname);
+
+ for i = 1:n
+ mfprintf(fd, "''%s''", name(i));
+ if i <> n then
+ mfprintf(fd, ",");
+ else
+ mfprintf(fd, "],");
end
- mfprintf(fd,"];\n");
-
- mfprintf(fd,"addinter(ilib,''%s'',list_functions);\n", ..
- name+ string(itable));
- end
+ end
+ mfprintf(fd,"''%s'');\n",flag);
+ end
+
+ mfprintf(fd, "// remove temp. variables on stack\n");
+ mfprintf(fd,"clear %s_path;\n", shortlibname_path);
+ mfprintf(fd,"clear bOK;\n");
+ mfprintf(fd,"clear ilib;\n");
+
+ if tables <> [] then
+ mfprintf(fd, "clear list_functions;\n");
end
-
- mfprintf(fd,"// remove temp. variables on stack\n");
- mfprintf(fd,"clear %s_path;\n",name_path);
- mfprintf(fd,"clear list_functions;\n");
- mfprintf(fd,"clear get_file_path;\n");
- mfprintf(fd,"// ------------------------------------------------------\n");
+
+ mfprintf(fd, "// ----------------------------------------------------------------------------\n");
mclose(fd);
-
+
if ilib_verbose() > 1 then
- disp(mgetl('loader.sce'));
+ disp(mgetl(loadername));
end
+
+ bOK = %T;
endfunction
+//=============================================================================
-//==========================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) INRIA
+// Copyright (C) INRIA
// Copyright (C) 2008 - INRIA - Sylvestre LEDRU (add cc options)
-//
+// Copyright (C) 2010 - DIGITEO - Allan CORNET
+//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution. The terms
-// are also available at
+// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-//==========================================
-function ilib_mex_build(ilib_name,table,files,libs,makename,ldflags,cflags,fflags,cc)
-
+//=============================================================================
+function ilib_mex_build(ilib_name, table, files, libs, makename, ldflags, cflags, fflags, cc)
+
if ~haveacompiler() then
- error(msprintf(gettext("%s: A Fortran or C compiler is required.\n"),'ilib_mex_build'));
- return;
+ error(msprintf(gettext("%s: A Fortran or C compiler is required.\n"), 'ilib_mex_build'));
+ return;
end
-
+
[lhs,rhs] = argn(0);
if rhs < 4 then
- error(msprintf(gettext("%s: Wrong number of input argument(s).\n"),"ilib_mex_build"));
+ error(msprintf(gettext("%s: Wrong number of input argument(s).\n"), "ilib_mex_build"));
return
end
+
+ if rhs > 4 & makename <> [] & makename <> '' then
+ warning(msprintf(_("%s: Wrong value for input argument #%d: '''' or ''[]'' expected.\n"),'ilib_mex_build', 5));
+ end
- if rhs <= 4 then makename = 'Makelib';end
- if rhs <= 5 then ldflags = ''; end
- if rhs <= 6 then cflags = ''; end
- if rhs <= 7 then fflags = ''; end
- if rhs <= 8 then cc = ''; end
-
+ if rhs <= 5 then ldflags = ''; end
+ if rhs <= 6 then cflags = ''; end
+ if rhs <= 7 then fflags = ''; end
+ if rhs <= 8 then cc = ''; end
+
+ if ~isdef('makename') then
+ makename = '';
+ end
+
+
if getos() <> 'Windows' then
- // These flags are important... The rename of the fly the name of the
+ // These flags are important... The rename of the fly the name of the
// function in the C / C++ / Fortran code
cflags=" -DmexFunction=mex_\$* " + cflags
fflags=" -Dmexfunction=mex\$* " + fflags
end
- ilib_build(ilib_name,table,files,libs,makename,ldflags,cflags,fflags,%t,cc);
-
+ ilib_build(ilib_name, table, files, libs, makename, ldflags, cflags, fflags, %t, cc);
+
endfunction
-//==========================================
+//=============================================================================
+
--- /dev/null
+@..\..\..\..\bin\scilex -nwni -ns -e exec('buildmacros.sce');quit;
\ No newline at end of file
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+//==============================================================================
+if (isdef('genlib') == %f) then
+ exec(SCI+'/modules/functions/scripts/buildmacros/loadgenlib.sce');
+end
+//==============================================================================
+genlib('dynamic_link_windowslib', 'SCI/modules/dynamic_link/macros/windows', %f, %t);
+//==============================================================================
--- /dev/null
+@del *.bin 2>NUL
+@del lib 2>NUL
+@del names 2>NUL
\ No newline at end of file
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function bOK = dlwConfigureVcx64()
+ bOK = %F;
+ msvc = findmsvccompiler();
+
+ select msvc,
+ // Microsoft Visual 2010 Studio Professional
+ case 'msvc100pro' then
+ bOK = dlwSetEnvVc10(msvc, %t);
+
+ // Microsoft Visual 2010 Express
+ case 'msvc100express' then
+ bOK = dlwSetEnvVc10(msvc, %t);
+
+ // Microsoft Visual 2008 Studio Professional
+ case 'msvc90pro' then
+ bOK = dlwSetEnvVc90(msvc, %t);
+
+ // Microsoft Visual 2008 Studio Standard
+ case 'msvc90std' then
+ bOK = dlwSetEnvVc90(msvc, %t);
+
+ // Microsoft Visual 2008 Express
+ case 'msvc90express' then
+ bOK = dlwSetEnvVc90(msvc, %t);
+ else
+ end
+endfunction
+//=============================================================================
+
+
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function bOK = dlwConfigureVcx86()
+ bOK = %F;
+ msvc = findmsvccompiler();
+
+ select msvc,
+ // Microsoft Visual 2010 Studio Professional
+ case 'msvc100pro' then
+ bOK = dlwSetEnvVc10(msvc, %f);
+
+ // Microsoft Visual 2010 Express
+ case 'msvc100express' then
+ bOK = dlwSetEnvVc10(msvc, %t);
+
+ // Microsoft Visual 2008 Studio Professional
+ case 'msvc90pro' then
+ bOK = dlwSetEnvVc90(msvc, %f);
+
+ // Microsoft Visual 2008 Studio Standard
+ case 'msvc90std' then
+ bOK = dlwSetEnvVc90(msvc, %f);
+
+ // Microsoft Visual 2008 Express
+ case 'msvc90express' then
+ bOK = dlwSetEnvVc90(msvc, %t);
+
+ // Microsoft Visual 2005 Studio Professional
+ case 'msvc80pro' then
+ bOK = dlwSetEnvVc80(msvc);
+
+ // Microsoft Visual 2005 Studio Standard
+ case 'msvc80std' then
+ bOK = dlwSetEnvVc80(msvc);
+
+ // Microsoft Visual 2005 Express
+ case 'msvc80express' then
+ bOK = dlwSetEnvVc80(msvc);
+
+ // Microsoft Visual Studio .NET 2003
+ case 'msvc71' then
+ bOK = dlwSetEnvVc71();
+
+ // Microsoft Visual Studio .NET 2002
+ case 'msvc70' then
+ bOK = dlwSetEnvVc70();
+ else
+ end
+endfunction
+//=============================================================================
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function dllinfolist = dlwDllInfo(dllname, options)
+//=============================================================================
+ function symbolslist = dllinfoimports(dllname)
+ symbolslist = list();
+ [result,bOK] = dos('dumpbin /IMPORTS ""' + dllname +'""');
+ if bOK == %T then
+ result(5) = '';
+ indicedotdll = grep(result, getdynlibext());
+
+ if (indicedotdll <> []) then
+ dlllist = result(indicedotdll);
+
+ symbolslist = list();
+
+ for i = 1:size(dlllist,'*')-1
+ symbolsdll = [];
+ symbolsdllstr = result(indicedotdll(i) + 6:indicedotdll(i + 1) - 2);
+ for j = 1: size(symbolsdllstr, '*')
+ tok = tokens(symbolsdllstr(j), ' ');
+ if size(tok, '*') >=2 then
+ symbolsdll(j) = tok(2);
+ end
+ end
+ symbolslist(i)= list(dlllist(i), symbolsdll);
+ end
+
+ symbolsdllstr = result(indicedotdll(size(dlllist, '*')) + 6:grep(result, '.data') - 4);
+ for j = 1: size(symbolsdllstr, '*')
+ symbolsdll = [];
+ tok = tokens(symbolsdllstr(j), ' ');
+ if size(tok,'*') >=2 then
+ symbolsdll(j) = tok(2);
+ end
+ end
+ symbolslist(size(dlllist, '*'))= list(dlllist(size(dlllist, '*')), symbolsdll);
+ end
+ end
+ endfunction
+//=============================================================================
+ function symbolslist = dllinfoexports(dllname)
+ symbolslist = list();
+ symbolsdll = [];
+ [result,bOK] = dos('dumpbin /EXPORTS ""' + dllname +'""');
+ if bOK == %T then
+ if size(result,'*') > 20 then
+ indicenumberfunctstr = 15;
+ numberfunctstr = result(indicenumberfunctstr);
+ numberfunct = sscanf(numberfunctstr, '%d');
+
+ indicefirstsymbolstr = 20;
+ firstsymbolstr = result(indicefirstsymbolstr);
+ for i = 0:numberfunct
+ tok = tokens(result(indicefirstsymbolstr + i), ' ');
+ if size(tok,'*') >=4 then
+ symbolsdll = [symbolsdll; tok(4)];
+ end
+ end
+ [pat, nam, ext] = fileparts(dllname);
+ symbolslist = list(nam + ext, symbolsdll);
+ end
+ end
+ endfunction
+//=============================================================================
+ function dllinfolist = dllinfomachine(dllname)
+ dllinfolist = list();
+ machine = '';
+ [result,bOK] = dos('dumpbin /HEADERS ""' + dllname +'""');
+ if bOK == %T then
+ if size(result, '*') > 20 then
+ indiceinfomachine = 12;
+ infomachinestr = result(indiceinfomachine);
+ tok = tokens(infomachinestr, ' ');
+ if size(tok, '*') == 3 then
+ machine = strsubst(tok(3), ')', '');
+ machine = strsubst(machine, '(', '');
+ end
+ [pat, nam, ext] = fileparts(dllname);
+ dllinfolist = list(nam + ext, machine);
+ end
+ end
+ endfunction
+//=============================================================================
+
+ [lhs,rhs]=argn(0);
+
+ if rhs == 1 then
+ options = 'exports';
+ end
+
+ if type(dllname) <> 10 | size(dllname) <> 1 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), 'dllinfo', 1));
+ end
+
+ if fileinfo(dllname) == [] then
+ error(msprintf(gettext("%s: The file %s does not exist.\n"), 'dllinfo', dllname));
+ end
+
+ fext = fileext(dllname);
+ if ~(strcmpi(fext, '.exe') == 0 | strcmpi(fext, '.dll')== 0) then
+ error(msprintf(gettext("%s: Cannot open file %s.\n"), 'dllinfo', dllname));
+ end
+
+ if type(options) <> 10 | size(options) <> 1 then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), 'dllinfo', 2));
+ end
+
+ if ~(strcmpi(options, 'imports')== 0 | strcmpi(options, 'exports')== 0 | strcmpi(options, 'machine')== 0) then
+ error(msprintf(gettext("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"), 'dllinfo', 2, '''imports'', ''exports'', ''machine'''));
+ end
+
+ dllinfolist = list();
+
+ if findmsvccompiler() <> 'unknown' then
+ if strcmpi(options, 'imports')== 0 then
+ dllinfolist = dllinfoimports(dllname);
+ end
+
+ if strcmpi(options, 'exports')== 0 then
+ dllinfolist = dllinfoexports(dllname);
+ end
+
+ if strcmpi(options, 'machine')== 0 then
+ dllinfolist = dllinfomachine(dllname);
+ end
+
+ else
+ warning(msprintf(gettext("%s: This feature required Microsoft visual studio C compiler.\n"), 'dllinfo'));
+ end
+
+endfunction
+//=============================================================================
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function MSCompiler = dlwFindMsVcCompiler()
+ MSCompiler = 'unknown'; // unknown
+
+ // We use always last version of MS compiler
+
+ if dlwIsVc10Pro() & dlwIsVc10Express() then
+ MSCompiler = 'msvc100express'; // Microsoft Visual 2010 Express with SDK extension
+ return;
+ end
+
+ if dlwIsVc10Pro() then
+ MSCompiler = 'msvc100pro'; // Microsoft Visual 2010 Professional (or more)
+ return;
+ end
+
+ if dlwIsVc10Express() then
+ MSCompiler = 'msvc100express'; // Microsoft Visual 2010 Express
+ return;
+ end
+
+ if dlwIsVc90Pro() then
+ MSCompiler = 'msvc90pro'; // Microsoft Visual 2008 Studio Professional
+ return;
+ end
+
+ if dlwIsVc90Std() then
+ MSCompiler = 'msvc90std'; // Microsoft Visual 2008 Studio Standard
+ return;
+ end
+
+ if dlwIsVc90Express() then
+ MSCompiler = 'msvc90express'; // Microsoft Visual 2008 Express
+ return;
+ end
+
+ if dlwIsVc80Pro() then
+ MSCompiler = 'msvc80pro'; // Microsoft Visual 2005 Studio Professional
+ return;
+ end
+
+ if dlwIsVc80Std() then
+ MSCompiler = 'msvc80std'; // Microsoft Visual 2005 Studio Standard
+ return;
+ end
+
+ if dlwIsVc80Express() then
+ MSCompiler = 'msvc80express'; // Microsoft Visual 2005 Express
+ return;
+ end
+
+ if dlwIsVc71() then
+ MSCompiler = 'msvc71'; // Microsoft Visual Studio .NET 2003
+ return;
+ end
+
+ if dlwIsVc70() then
+ MSCompiler = 'msvc70'; // Microsoft Visual Studio .NET 2002
+ return;
+ end
+endfunction
+//=============================================================================
--- /dev/null
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+//=============================================================================
+function Makename = dlwGenerateMakefile(name, ..
+ tables, ..
+ files, ..
+ libs, ..
+ makename, ..
+ with_gateway, ..
+ ldflags, ..
+ cflags, ..
+ fflags, ..
+ cc)
+
+ [lhs,rhs] = argn(0);
+ if rhs < 4 then
+ error(msprintf(gettext("%s: Wrong number of input argument(s): at least %d expected.\n"), "dlwGenerateMakefile", 4));
+ end
+
+ if argn(2) < 6 then
+ with_gateway = %t;
+ ldflags = '';
+ cflags = '';
+ fflags = '';
+ cc = '';
+ end
+
+ if ~isdef('makename') then
+ makename = '';
+ end
+
+ for i=1:size(files,'*') // compatibility scilab 4.x
+ [path_f, file_f, ext_f] = fileparts(files(i));
+ if or(ext_f == ['.o','.obj']) then
+ files(i) = path_f + file_f;
+ else
+ files(i) = path_f + file_f + ext_f;
+ end
+ end
+
+ // change table if necessary
+ if tables <> [] then
+ if typeof(tables)<>'list' then
+ tables = list(tables)
+ end
+ L = length(tables);
+
+ for it = 1:L
+ table = tables(it);
+ [mt, nt] = size(table);
+
+ if nt == 2 then
+ col= "csci";
+ table = [table, col(ones(mt,1))];
+ nt=3;
+ end
+
+ if nt<>3 then
+ error(msprintf(gettext("%s: Wrong size for input argument #%d.\n") ,"dlwGenerateMakefile", 2));
+ end
+ tables(it) = table;
+ end
+ end
+
+ if isempty(makename) then
+ Makename = dlwGetDefltMakefileName() + dlwGetMakefileExt();
+ else
+ Makename = makename + dlwGetMakefileExt();
+ end
+
+
+ ilib_gen_Make_win32(name, tables, files, libs, Makename, with_gateway, ldflags, cflags, fflags)
+
+endfunction
+//=============================================================================
+function ilib_gen_Make_win32(name, ..
+ table, ..
+ files, ..
+ libs, ..
+ Makename, ..
+ with_gateway, ..
+ ldflags, ..
+ cflags, ..
+ fflags)
+
+ managed_ext = ['.cxx', '.cpp', '.c', '.f90', '.f'];
+ obj_ext = ['.o', '.obj', ''];
+
+ SCIDIR = SCI;
+ SCIDIR1 = pathconvert(SCI,%f,%f,'w');
+ LIBRARY = name;
+ FILES_SRC = '';
+ OBJS = '';
+ OBJS_WITH_PATH = '';
+ FORTRAN_RUNTIME = '';
+ OTHERLIBS = '';
+ CC = '';
+ CFLAGS = cflags;
+ MEXCFLAGS = '';
+ FFLAGS = fflags;
+ MEXFFLAGS = '';
+ LDFLAGS = ldflags;
+
+ FILES_SRC_MATRIX = [];
+
+ [path_Make, file_Make, ext_Make] = fileparts(Makename);
+
+ for i=1:size(files,'*')
+ [path_f, file_f, ext_f] = fileparts(files(i));
+
+ if or(obj_ext == ext_f) then
+ FILENAME = [];
+ FILE_FOUNDED = %f;
+ for y = managed_ext(:)'
+ if (FILE_FOUNDED == %f) then
+ if (fileinfo(path_f + file_f + y) <> []) | (fileinfo(path_Make + file_f + y) <> []) then
+ FILENAME = path_f + file_f + y;
+ FILE_FOUNDED = %t;
+ end
+ end
+ end
+ else
+ FILENAME = files(i);
+ end
+ FILES_SRC_MATRIX = [FILES_SRC_MATRIX , FILENAME];
+ end
+
+ if typeof(tables) <> 'list' then
+ tables = list(tables);
+ end
+ L = length(tables);
+
+ if with_gateway then
+ if L == 1 then
+ FILES_SRC_MATRIX = [FILES_SRC_MATRIX , name + '.c'];
+ else
+ for i=1:L
+ FILES_SRC_MATRIX = [FILES_SRC_MATRIX , name + string(i) + '.c'];
+ end
+ end
+ end
+
+ for it=1:L
+ table = tables(it);
+ [mt,nt] = size(table);
+
+ for i=1:mt
+ if table(i,3)=='cmex' | table(i,3)=='fmex' | table(i,3)=='Fmex' then
+ MEXCFLAGS = "-Dmexfunction_=mex" + table(i,2) + "_ -DmexFunction=mex_" + table(i,2);
+ MEXFFLAGS = "-Dmexfunction=mex" + table(i,2);
+ if table(i,3)=='cmex' then
+ filenameMex = table(i,2) + '.c';
+ else
+ filenameMex = table(i,2) + '.f';
+ end
+ if grep(FILES_SRC_MATRIX,filenameMex) == [] then
+ FILES_SRC_MATRIX = [FILES_SRC_MATRIX , filenameMex];
+ end
+ end
+ end
+ end
+
+
+ FILES_SRC = strcat(FILES_SRC_MATRIX,' ');
+
+
+ OBJ_DEST_PATH = '';
+ if (getenv("DEBUG_SCILAB_DYNAMIC_LINK","NO") == "NO") then
+ OBJ_DEST_PATH = "Release/";
+ else
+ OBJ_DEST_PATH = "Debug/";
+ end
+
+ OBJS_MATRIX = [];
+ OBJS_WITH_PATH_MATRIX = [];
+
+ for y = 1:size(FILES_SRC_MATRIX,'*')
+ [path_f, file_f, ext_f] = fileparts(FILES_SRC_MATRIX(y));
+ OBJS_MATRIX = [OBJS_MATRIX, path_f + file_f + '.obj'];
+ OBJS_WITH_PATH_MATRIX = [OBJS_WITH_PATH_MATRIX, OBJ_DEST_PATH + path_f + file_f + '.obj'];
+ end
+
+ OBJS = strcat(OBJS_MATRIX, ' ');
+ OBJS_WITH_PATH = strcat(OBJS_WITH_PATH_MATRIX, ' ');
+
+ if ( or(fileext(FILES_SRC_MATRIX) == '.f90') | or(fileext(FILES_SRC_MATRIX) == '.f') ) then
+ if findmsifortcompiler() <> 'unknown' then
+ if (getenv("DEBUG_SCILAB_DYNAMIC_LINK","NO") == "NO") then
+ FORTRAN_RUNTIME = 'libifcoremd.lib libmmd.lib';
+ else
+ FORTRAN_RUNTIME = 'libifcoremdd.lib libmmdd.lib';
+ end
+ end
+ end
+
+ for x=libs(:)'
+ if (x <> [] & x <> '') then
+ if OTHERLIBS <> '' then
+ OTHERLIBS = OTHERLIBS + ' ' + x + '.lib';
+ else
+ OTHERLIBS = x + '.lib';
+ end
+ end
+ end
+
+ if isfile(SCI+'/modules/dynamic_link/src/scripts/TEMPLATE_MAKEFILE.VC') then
+ MAKEFILE_VC = mgetl(SCI+'/modules/dynamic_link/src/scripts/TEMPLATE_MAKEFILE.VC');
+ else
+ MAKEFILE_VC = '';
+ end
+
+ MAKEFILE_VC = strsubst(MAKEFILE_VC, "__SCI__", SCIDIR);
+ MAKEFILE_VC = strsubst(MAKEFILE_VC, "__SCIDIR1__", SCIDIR1);
+ MAKEFILE_VC = strsubst(MAKEFILE_VC, "__LIBNAME__", LIBRARY);
+ MAKEFILE_VC = strsubst(MAKEFILE_VC, "__FILES_SRC__", FILES_SRC);
+ MAKEFILE_VC = strsubst(MAKEFILE_VC, "__OBJS__", OBJS);
+ MAKEFILE_VC = strsubst(MAKEFILE_VC, "__OBJS_WITH_PATH__", OBJS_WITH_PATH);
+ MAKEFILE_VC = strsubst(MAKEFILE_VC, "__FORTRAN_RUNTIME__", FORTRAN_RUNTIME);
+ MAKEFILE_VC = strsubst(MAKEFILE_VC, "__OTHERSLIBS__", OTHERLIBS);
+
+ if CC <> '' then
+ MAKEFILE_VC = strsubst(MAKEFILE_VC, "__CC__",CC);
+ else
+ MAKEFILE_VC = strsubst(MAKEFILE_VC, "CC = __CC__","#CC = ");
+ end
+
+ MAKEFILE_VC = strsubst(MAKEFILE_VC, "__CFLAGS__", CFLAGS);
+ MAKEFILE_VC = strsubst(MAKEFILE_VC, "__MEXCFLAGS__", MEXCFLAGS);
+ MAKEFILE_VC = strsubst(MAKEFILE_VC, "__FFLAGS__", FFLAGS);
+ MAKEFILE_VC = strsubst(MAKEFILE_VC, "__MEXFFLAGS__", MEXFFLAGS);
+ MAKEFILE_VC = strsubst(MAKEFILE_VC, "__LDFLAGS__", LDFLAGS);
+
+ if ( MAKEFILE_VC <> '') then
+ fd = mopen(Makename, "wt");
+ mputl(MAKEFILE_VC, fd);
+ mclose(fd);
+
+ if ilib_verbose() > 1 then
+ disp(MAKEFILE_VC);
+ end
+
+ else
+ // TEMPLATE_MAKEFILE.VC not found
+ warning(SCI+'/modules/dynamic_link/src/scripts/TEMPLATE_MAKEFILE.VC'+ _('not found.') );
+ end
+endfunction
+//=============================================================================
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function vcPath64 = dlwGet64BitPath();
+ vcPath64 = [];
+ if win64() then
+ MSCompiler = findmsvccompiler();
+ if (MSCompiler == 'msvc100express' | MSCompiler == 'msvc90express') then
+ programFilesx86Path = getenv('ProgramFiles(x86)', '');
+ if (programFilesx86Path <> '') then
+ if isfile(programFilesx86Path + '\Microsoft Visual Studio 10.0\VC\bin\amd64\cl.exe') then
+ vcPath64 = programFilesx86Path + '\Microsoft Visual Studio 10.0';
+ return
+ end
+ if isfile(programFilesx86Path + '\Microsoft Visual Studio 9.0\VC\bin\amd64\cl.exe') then
+ vcPath64 = programFilesx86Path + '\Microsoft Visual Studio 9.0';
+ end
+ end
+ else
+ select MSCompiler,
+ // Microsoft Visual 2010 Studio Professional
+ case 'msvc100pro' then
+ vcPath64 = dlwGetVc10ProPath();
+
+ // Microsoft Visual 2008 Studio Professional
+ case 'msvc90pro' then
+ vcPath64 = dlwGetVc90ProPath();
+
+ // Microsoft Visual 2008 Studio Standard
+ case 'msvc90std' then
+ vcPath64 = dlwGetVc90StdPath();
+ else
+ vcPath64 = [];
+ end
+ end
+ end
+
+ // remove last file separator if it exists
+ if vcPath64 <> [] then
+ vcPath64 = pathconvert(vcPath64, %f, %t);
+ end
+endfunction
+//=============================================================================
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function makefilename = dlwGetDefltMakefileName(makename)
+ makefilename = 'Makelib';
+endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function cmdl = dlwGetMakefileCmdCleaner(makename)
+ cmdl = 'nmake /Y /nologo /f ' + makename + dlwGetMakefileExt() + ' clean';
+endfunction
+//=============================================================================
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function ext = dlwGetMakefileExt()
+ ext = '.mak';
+endfunction
+//=============================================================================
--- /dev/null
+
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function [make_command, lib_name_make, lib_name, path, makename, files] = ..
+ dlwGetParamsIlibCompil(lib_name, makename, files)
+
+ managed_ext = ['.obj', '.o'];
+ for i=1:size(files,'*') // compatibility scilab 4.x
+ [path_f, file_f, ext_f] = fileparts(files(i));
+ if or(managed_ext == ext_f) then
+ files(i) = path_f + file_f;
+ else
+ files(i) = path_f + file_f + ext_f;
+ end
+ end
+
+ k = strindex(makename,['/','\']);
+
+ if k~=[] then
+ path = part(makename,1:k($));
+ makename = part(makename,k($)+1:length(makename));
+ else
+ path='';
+ end
+
+ lib_name = lib_name+getdynlibext();
+ lib_name_make = lib_name;
+
+ FILES = [];
+ for x = files(:)'
+ [ptmp,ftmp,fext] = fileparts(x);
+ FILES = [FILES,ptmp+ftmp];
+ end
+
+ if (makename <> [] & makename <> '') then
+ makename = makename + dlwGetMakefileExt() ;
+ else
+ makename = dlwGetDefltMakefileName() + dlwGetMakefileExt() ;
+ end
+
+ make_command = 'nmake /Y /nologo /f ';
+
+ if FILES <> [] then
+ files = FILES + '.obj' ;
+ end
+
+endfunction
+//=============================================================================
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function SDKpath = dlwGetSdkPath()
+
+ SDKpath = [];
+ entries = ["Software\Microsoft\Microsoft SDKs\Windows" "CurrentInstallFolder" ; .. // Vista & Seven SDK
+ "Software\Microsoft\MicrosoftSDK\InstalledSDKs\D2FF9F89-8AA2-4373-8A31-C838BF4DBBE1" "Install Dir" ; .. // Windows 2003 R2 SDK
+ "Software\Microsoft\MicrosoftSDK\InstalledSDKs\8F9E5EF3-A9A5-491B-A889-C58EFFECE8B3" "Install Dir"]; // Windows 2003 SDK
+
+ for i = 1:size(entries(:,1),"*")
+ try
+ SDKpath = winqueryreg("HKEY_LOCAL_MACHINE", entries(i,1), entries(i,2));
+ // remove last file separator if it exists
+ if SDKpath <> [] then
+ SDKpath = pathconvert(SDKpath, %f, %t);
+ end
+ break;
+ catch
+ end
+
+ end
+
+endfunction
+//=============================================================================
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function vcPath = dlwGetVc10ExpressPath()
+ vcPath = [];
+ try
+ vcPath = winqueryreg('HKEY_LOCAL_MACHINE', ..
+ 'Software\Microsoft\VCExpress\10.0\Setup\VS', ..
+ 'ProductDir');
+ catch
+ // remove last error on 'winqueryreg' fails
+ lasterror();
+ return;
+ end
+
+ // remove last file separator if it exists
+ if vcPath <> [] then
+ vcPath = pathconvert(vcPath, %f, %t);
+ end
+endfunction
+//=============================================================================
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function vcPath = dlwGetVc10ProPath()
+ vcPath = [];
+ try
+ vcPath = winqueryreg('HKEY_LOCAL_MACHINE', ..
+ 'Software\Microsoft\VisualStudio\10.0\Setup\VS', ..
+ 'ProductDir');
+ catch
+ // remove last error on 'winqueryreg' fails
+ lasterror();
+ return;
+ end
+
+ // remove last file separator if it exists
+ if vcPath <> [] then
+ vcPath = pathconvert(vcPath, %f, %t);
+ end
+
+endfunction
+//=============================================================================
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function vcPath = dlwGetVc70Path()
+ vcPath = [];
+ try
+ vcPath = winqueryreg('HKEY_LOCAL_MACHINE', ..
+ 'SOFTWARE\Microsoft\VisualStudio\7.0\Setup\VC', ..
+ 'ProductDir');
+ catch
+ // remove last error on 'winqueryreg' fails
+ lasterror();
+ return;
+ end
+
+ // remove last file separator if it exists
+ if vcPath <> [] then
+ vcPath = pathconvert(vcPath, %f, %t);
+ end
+
+endfunction
+//=============================================================================
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function vcPath = dlwGetVc71Path()
+ vcPath = [];
+ try
+ vcPath = winqueryreg('HKEY_LOCAL_MACHINE', ..
+ 'SOFTWARE\Microsoft\VisualStudio\7.1\Setup\VC', ..
+ 'ProductDir');
+ catch
+ // remove last error on 'winqueryreg' fails
+ lasterror();
+ return;
+ end
+
+ // remove last file separator if it exists
+ if vcPath <> [] then
+ vcPath = pathconvert(vcPath, %f, %t);
+ end
+
+endfunction
+//=============================================================================
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function vcPath = dlwGetVc80ExpressPath()
+ vcPath = [];
+ try
+ vcPath = winqueryreg('HKEY_LOCAL_MACHINE', ..
+ 'Software\Microsoft\VCExpress\8.0\Setup\VS', ..
+ 'ProductDir');
+ catch
+ // remove last error on 'winqueryreg' fails
+ lasterror();
+ return;
+ end
+
+ // remove last file separator if it exists
+ if vcPath <> [] then
+ vcPath = pathconvert(vcPath, %f, %t);
+ end
+
+endfunction
+//=============================================================================
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function vcPath = dlwGetVc80ProPath()
+ vcPath = [];
+ try
+ vcPath = winqueryreg('HKEY_LOCAL_MACHINE', ..
+ 'Software\Microsoft\VisualStudio\8.0\Setup\VS\Pro', ..
+ 'ProductDir');
+ catch
+ // remove last error on 'winqueryreg' fails
+ lasterror();
+ return;
+ end
+
+ // remove last file separator if it exists
+ if vcPath <> [] then
+ vcPath = pathconvert(vcPath, %f, %t);
+ end
+
+endfunction
+//=============================================================================
+
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function vcPath = dlwGetVc80StdPath()
+ vcPath = [];
+ try
+ vcPath = winqueryreg('HKEY_LOCAL_MACHINE', ..
+ 'Software\Microsoft\VisualStudio\8.0\Setup\VS\Std', ..
+ 'ProductDir');
+ catch
+ // remove last error on 'winqueryreg' fails
+ lasterror();
+ return;
+ end
+
+ // remove last file separator if it exists
+ if vcPath <> [] then
+ vcPath = pathconvert(vcPath, %f, %t);
+ end
+
+endfunction
+//=============================================================================
+
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function vcPath = dlwGetVc90ExpressPath()
+ vcPath = [];
+ try
+ vcPath = winqueryreg('HKEY_LOCAL_MACHINE', ..
+ 'Software\Microsoft\VCExpress\9.0\Setup\VS', ..
+ 'ProductDir');
+ catch
+ // remove last error on 'winqueryreg' fails
+ lasterror();
+ return;
+ end
+
+ // remove last file separator if it exists
+ if vcPath <> [] then
+ vcPath = pathconvert(vcPath, %f, %t);
+ end
+
+endfunction
+//=============================================================================
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function vcPath = dlwGetVc90ProPath()
+ vcPath = [];
+ try
+ vcPath = winqueryreg('HKEY_LOCAL_MACHINE', ..
+ 'Software\Microsoft\VisualStudio\9.0\Setup\VS\Pro', ..
+ 'ProductDir');
+ catch
+ // remove last error on 'winqueryreg' fails
+ lasterror();
+ return;
+ end
+
+ // remove last file separator if it exists
+ if vcPath <> [] then
+ vcPath = pathconvert(vcPath, %f, %t);
+ end
+
+endfunction
+//=============================================================================
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function vcPath = dlwGetVc90StdPath()
+ vcPath = [];
+ try
+ vcPath = winqueryreg('HKEY_LOCAL_MACHINE', ..
+ 'Software\Microsoft\VisualStudio\9.0\Setup\VS\Std', ..
+ 'ProductDir');
+ catch
+ // remove last error on 'winqueryreg' fails
+ lasterror();
+ return;
+ end
+
+ // remove last file separator if it exists
+ if vcPath <> [] then
+ vcPath = pathconvert(vcPath, %f, %t);
+ end
+
+endfunction
+//=============================================================================
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function bOK = dlwHaveCompiler()
+ bOK = (findmsvccompiler() <> 'unknown');
+ if win64() then
+ if bOK & detectmsvc64tools() then
+ bOK = %T;
+ else
+ bOK = %F;
+ end
+ end
+endfunction
+//=============================================================================
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function bOK = dlwIsVc10Express()
+ bOK = (dlwGetVc10ExpressPath() <> []);
+endfunction
+//=============================================================================
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function bOK = dlwIsVc10Pro()
+ bOK = (dlwGetVc10ProPath() <> []);
+endfunction
+//=============================================================================
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function bOK = dlwIsVc70()
+ bOK = (dlwGetVc70Path() <> []);
+endfunction
+//=============================================================================
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function bOK = dlwIsVc71()
+ bOK = (dlwGetVc71Path() <> []);
+endfunction
+//=============================================================================
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function bOK = dlwIsVc80Express()
+ bOK = (dlwGetVc80ExpressPath() <> []);
+endfunction
+//=============================================================================
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function bOK = dlwIsVc80Pro()
+ bOK = (dlwGetVc80ProPath() <> []);
+endfunction
+//=============================================================================
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function bOK = dlwIsVc80Std()
+ bOK = (dlwGetVc80StdPath() <> []);
+endfunction
+//=============================================================================
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function bOK = dlwIsVc90Express()
+ bOK = (dlwGetVc90ExpressPath() <> []);
+endfunction
+//=============================================================================
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function bOK = dlwIsVc90Pro()
+ bOK = (dlwGetVc90ProPath() <> []);
+endfunction
+//=============================================================================
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function bOK = dlwIsVc90Std()
+ bOK = (dlwGetVc90StdPath() <> []);
+endfunction
+//=============================================================================
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+//=============================================================================
+function res = dlwMake(files, objects_or_dll)
+
+ if ~haveacompiler() then
+ error(msprintf(gettext('%s: A Fortran or C compiler is required.\n'), 'G_make'))
+ end
+
+ [lhs,rhs] = argn(0);
+ if rhs <> 2 then
+ error(msprintf(gettext("%s: Wrong number of input argument(s).\n"), "G_make"));
+ end
+
+ msg = '';
+
+ if typeof(objects_or_dll)<>'string' then
+ error(sprintf(gettext('%s: Wrong type for input argument #%d: String expected.'), 'G_make', 2));
+ end
+
+ OBJ = '';
+ [ptmp, ftmp, fext] = fileparts(objects_or_dll);
+ OBJ = ptmp + ftmp;
+
+ // scilab uses Visual Studio C++
+ if ilib_verbose() > 1 then
+ msg = unix_g('nmake /Y /nologo /f Makefile.mak ' + OBJ);
+ disp(msg);
+ else
+ host('nmake /Y /nologo /f Makefile.mak ' + OBJ);
+ end
+
+ res = [OBJ];
+
+endfunction
+//=============================================================================
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function bOK = dlwSetEnvCommonVc9Vc10(MSVSDir, IsExpress, bWin64)
+ bOK = %F;
+
+ windowsSdkPath = dlwGetSdkPath();
+ if (windowsSdkPath <> []) then
+ err = setenv('WindowsSdkDir', windowsSdkPath);
+ else
+ windowsSdkPath = '';
+ end
+
+ err = setenv('VSINSTALLDIR', MSVSDir);
+ if (err == %F) then
+ bOK = %F;
+ return
+ end
+
+ if ~IsExpress then
+ DevEnvDir = MSVSDir + '\Common7\IDE';
+ err = setenv('DevEnvDir', DevEnvDir);
+ if (err == %F) then
+ bOK = %F;
+ return
+ end
+ end
+
+ err = setenv('VCINSTALLDIR', MSVSDir + '\VC');
+ if (err == %F) then
+ bOK = %F;
+ return
+ end
+
+ PATH = getenv('PATH', '');
+ INCLUDE = getenv('INCLUDE', '');
+ LIB = getenv('LIB', '');
+ LIBPATH = getenv('LIBPATH', '');
+
+ if bWin64 then
+ PATH = getNewPATHx64(PATH, MSVSDir, windowsSdkPath, IsExpress);
+ INCLUDE = getNewINCLUDEx64(INCLUDE, MSVSDir, windowsSdkPath, IsExpress);
+ LIB = getNewLIBx64(LIB, MSVSDir, windowsSdkPath, IsExpress);
+ LIBPATH = getNewLIBPATHx64(LIBPATH, MSVSDir, windowsSdkPath, IsExpress);
+ else
+ PATH = getNewPATHx86(PATH, MSVSDir, windowsSdkPath, IsExpress);
+ INCLUDE = getNewINCLUDEx86(INCLUDE, MSVSDir, windowsSdkPath, IsExpress);
+ LIB = getNewLIBx86(LIB, MSVSDir, windowsSdkPath, IsExpress);
+ LIBPATH = getNewLIBPATHx86(LIBPATH, MSVSDir, windowsSdkPath, IsExpress);
+ end
+
+ err = setenv('PATH', PATH);
+ if (err == %F) then
+ bOK = %F;
+ return
+ end
+
+ err = setenv('INCLUDE', INCLUDE);
+ if (err == %F) then
+ bOK = %F;
+ return
+ end
+
+ err = setenv('LIB', LIB);
+ if (err == %F) then
+ bOK = %F;
+ return
+ end
+
+ err = setenv('LIBPATH', LIBPATH);
+ if (err == %F) then
+ bOK = %F;
+ return
+ end
+
+ bOK = %T;
+endfunction
+//=============================================================================
+function newLIB = getNewLIBx64(LIB, msvsPath, sdkPath, bIsExpress)
+ newLIB = '';
+
+ if bIsExpress then
+ Vc64Path = dlwGet64BitPath();
+ newLIB = Vc64Path + '\VC\LIB\amd64' + pathsep();
+ else
+ newLIB = msvsPath + '\VC\ATLMFC\LIB\amd64' + pathsep() + ..
+ msvsPath + '\VC\LIB\amd64' + pathsep();
+ end
+
+ newLIB = newLIB + ..
+ sdkPath + '\lib\x64' + pathsep() + LIB;
+
+endfunction
+//=============================================================================
+function newLIB = getNewLIBx86(LIB, msvsPath, sdkPath, bIsExpress)
+ newLIB = '';
+ if ~bIsExpress then
+ newLIB = msvsPath + filesep() + 'VC\ATLMFC\LIB' + pathsep();
+ end
+ newLIB = newLIB + ..
+ msvsPath + filesep() + 'VC\LIB' + pathsep() + ..
+ sdkPath + filesep() + 'lib' + pathsep() + ..
+ LIB;
+endfunction
+//=============================================================================
+function newPATH = getNewPATHx64(PATH, msvsPath, sdkPath, bIsExpress)
+ newPATH = '';
+
+ if bIsExpress then
+ Vc64Path = dlwGet64BitPath();
+ newPATH = Vc64Path + '\VC\BIN\amd64' + pathsep();
+ else
+ newPATH = msvsPath + '\VC\BIN\amd64' + pathsep();
+ end
+
+ newPATH = newPATH + ..
+ msvsPath + '\VC\VCPackages' + pathsep() + ..
+ msvsPath + '\Common7\IDE' + pathsep() + ..
+ msvsPath + '\Common7\Tools' + pathsep() + ..
+ msvsPath + '\Common7\Tools\bin' + pathsep() + ..
+ sdkPath + '\bin\x64' + pathsep() + ..
+ sdkPath + '\bin\win64\x64' + pathsep() + ..
+ sdkPath + '\bin' + pathsep() + PATH;
+
+endfunction
+//=============================================================================
+function newPATH = getNewPATHx86(PATH, msvsPath, sdkPath, bIsExpress)
+ newPATH = '';
+ if ~bIsExpress then
+ newPATH = msvsPath + '\Common7\IDE\' + pathsep();
+ end
+ newPATH = newPATH + ..
+ msvsPath + filesep() + '\VC\bin' + pathsep() + ..
+ msvsPath + filesep() + '\Common7\Tools'+ pathsep() + ..
+ msvsPath + filesep() + '\VC\VCPackages' + pathsep() + ..
+ PATH + pathsep();
+endfunction
+//=============================================================================
+function newLIBPATH = getNewLIBPATHx64(LIBPATH, msvsPath, sdkPath, bIsExpress)
+ newLIBPATH = '';
+
+ if bIsExpress then
+ Vc64Path = dlwGet64BitPath();
+ newLIBPATH = Vc64Path + '\VC\LIB\amd64' + pathsep() + LIBPATH;
+ else
+ newLIBPATH = msvsPath + '\VC\ATLMFC\LIB\amd64' + pathsep() + ..
+ msvsPath + '\VC\LIB\amd64' + pathsep() + LIBPATH;
+ end
+
+endfunction
+//=============================================================================
+function newLIBPATH = getNewLIBPATHx86(LIBPATH, msvsPath, sdkPath, bIsExpress)
+ newLIBPATH = '';
+
+ if ~bIsExpress then
+ newLIBPATH = msvsPath + '\VC\ATLMFC\LIB' + pathsep();
+ end
+
+ newLIBPATH = newLIBPATH + ..
+ msvsPath + '\VC\LIB';
+endfunction
+//=============================================================================
+function newINCLUDE = getNewINCLUDEx64(INCLUDE, msvsPath, sdkPath, bIsExpress)
+ newINCLUDE = '';
+ if bIsExpress then
+ Vc64Path = dlwGet64BitPath();
+ newINCLUDE = Vc64Path + '\VC\INCLUDE' + pathsep();
+ else
+ newINCLUDE = msvsPath + '\VC\INCLUDE' + pathsep() + ..
+ msvsPath + '\VC\ATLMFC\INCLUDE' + pathsep();
+ end
+
+ newINCLUDE = newINCLUDE + ..
+ sdkPath + '\include' + pathsep() + INCLUDE;
+
+endfunction
+//=============================================================================
+function newINCLUDE = getNewINCLUDEx86(INCLUDE, msvsPath, sdkPath, bIsExpress)
+ newINCLUDE = '';
+
+ if ~bIsExpress then
+ newINCLUDE = msvsPath + '\VC\ATLMFC\INCLUDE' + pathsep();
+ end
+
+ newINCLUDE = newINCLUDE + ..
+ msvsPath + '\VC\INCLUDE' + pathsep() + ..
+ sdkPath + '\include' + pathsep() + INCLUDE;
+endfunction
+//=============================================================================
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function bOK = dlwSetEnvVc10(msCompiler, bWin64)
+ bOK = %F;
+ MSVSDir = '';
+ select msCompiler
+ case 'msvc100pro'
+ MSVSDir = dlwGetVc10ProPath();
+ case 'msvc100express'
+ MSVSDir = dlwGetVc10ExpressPath();
+ else
+ return
+ end
+
+ IsExpress = (msCompiler == 'msvc100express');
+
+ VS100COMNTOOLS = MSVSDir + '\Common7\Tools\'
+ if ~setenv('VS100COMNTOOLS', VS100COMNTOOLS) then
+ bOK = %F;
+ return
+ end
+
+ bOK = dlwSetEnvCommonVc9Vc10(MSVSDir, IsExpress, bWin64);
+
+endfunction
+//=============================================================================
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function bOK = dlwSetEnvVc70()
+ bOK = %F;
+
+ MSVCDir = dlwGetVc70Path();
+ if (MSVCDir == []) then
+ return
+ end
+
+ err = setenv('MSVCDir', MSVCDir);
+ if (err == %F) then
+ bOK = %F;
+ return
+ end
+
+ err = setenv('DevEnvDir', MSVCDir + filesep() + '..\Common7\Tools');
+ if (err == %F) then
+ bOK = %F;
+ return
+ end
+
+ DevEnvDir = getenv('DevEnvDir', 'ndef');
+ if (DevEnvDir == 'ndef') then
+ bOK = %F;
+ return
+ end
+
+ PATH = getenv('PATH', 'ndef');
+ if (PATH == 'ndef') then
+ bOK = %F;
+ return
+ end
+
+ err = setenv('PATH', MSVCDir + filesep() + 'BIN;' + ..
+ DevEnvDir + pathsep() + ..
+ DevEnvDir + filesep() + 'bin' + pathsep() + ..
+ MSVCDir + filesep() + '..\Common7\IDE' + pathsep() + ..
+ PATH + pathsep() );
+ if (err == %F) then
+ bOK = %F;
+ return
+ end
+
+ INCLUDE = getenv('INCLUDE', '');
+
+ err = setenv('INCLUDE', MSVCDir + filesep() + 'ATLMFC\INCLUDE' + pathsep() + ..
+ MSVCDir + filesep() + 'INCLUDE' + pathsep() +..
+ MSVCDir + filesep() + 'PlatformSDK\include' + pathsep() + ..
+ INCLUDE);
+ if (err == %F) then
+ bOK = %F;
+ return
+ end
+
+ LIB = getenv('LIB', '');
+
+ err = setenv('LIB',MSVCDir + filesep() + 'ATLMFC\LIB' + pathsep() + ..
+ MSVCDir + filesep() + 'LIB'+ pathsep() +..
+ MSVCDir + filesep() + 'PlatformSDK\lib' + pathsep() + ..
+ LIB);
+ if (err == %F) then
+ bOK = %F;
+ return
+ end
+
+ bOK = %T;
+
+endfunction
+//=============================================================================
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function bOK = dlwSetEnvVc71()
+ bOK = %F;
+ MSVCDir = dlwGetVc71Path();
+ if (MSVCDir == []) then
+ return
+ end
+
+ err = setenv('MSVCDir', MSVCDir);
+ if (err == %F) then
+ bOK = %F;
+ return
+ end
+
+ err = setenv('DevEnvDir', MSVCDir + filesep() + '..\Common7\Tools');
+ if (err == %F) then
+ bOK = %F;
+ return
+ end
+
+ PATH = getenv('PATH', 'ndef');
+ if (PATH =='ndef') then
+ bOK = %F;
+ return
+ end
+
+ DevEnvDir = getenv('DevEnvDir', 'ndef');
+ if (DevEnvDir =='ndef') then
+ bOK = %F;
+ return
+ end
+
+ err = setenv('PATH',MSVCDir + filesep() + 'BIN' + pathsep() + ..
+ DevEnvDir + pathsep() + ..
+ DevEnvDir + filesep() + 'bin' + pathsep() + ..
+ MSVCDir + filesep() + '..\Common7\IDE' + pathsep() + ..
+ PATH + pathsep() );
+ if (err == %F) then
+ bOK = %F;
+ return
+ end
+
+ INCLUDE = getenv('INCLUDE', '');
+
+ err = setenv('INCLUDE', MSVCDir + filesep() + 'ATLMFC\INCLUDE' + pathsep() + ..
+ MSVCDir + filesep() + 'INCLUDE' + pathsep() + ..
+ MSVCDir + filesep() + 'PlatformSDK\include' + pathsep() + ..
+ INCLUDE);
+ if (err == %F) then
+ bOK = %F;
+ return
+ end
+
+ LIB = getenv('LIB', 'ndef');
+
+ err = setenv('LIB', MSVCDir + filesep() + 'ATLMFC\LIB' + pathsep() + ..
+ MSVCDir + filesep() + 'LIB' + pathsep() + ..
+ MSVCDir + filesep() + 'PlatformSDK\lib' + pathsep() + ..
+ LIB);
+ if (err == %F) then
+ bOK = %F;
+ return
+ end
+
+ bOK = %T;
+
+endfunction
+//=============================================================================
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function bOK = dlwSetEnvVc80(msCompiler)
+ bOK = %F;
+ MSVSDir = '';
+ select msCompiler
+ case 'msvc80pro'
+ MSVSDir = dlwGetVc80ProPath();
+ case 'msvc80std'
+ MSVSDir = dlwGetVc80StdPath();
+ case 'msvc80express'
+ MSVSDir = dlwGetVc80ExpressPath();
+ else
+ return
+ end
+
+ PATH = getenv('PATH','ndef');
+ if (PATH == 'ndef') then
+ bOK = %F;
+ return
+ end
+
+ if ~setenv('VSINSTALLDIR', MSVSDir) then
+ bOK = %F;
+ return
+ end
+
+ MSVCDir = MSVSDir + filesep() + 'VC';
+ if ~setenv('VCINSTALLDIR', MSVCDir) then
+ bOK = %F;
+ return
+ end
+
+ DevEnvDir = MSVSDir + filesep() +'Common7\IDE';
+ if ~setenv('DevEnvDir', DevEnvDir) then
+ bOK = %F;
+ return
+ end
+
+ err = setenv('PATH', DevEnvDir + pathsep() + ..
+ MSVCDir + filesep() + 'bin' + pathsep() + ..
+ MSVSDir + filesep() + 'Common7\Tools' + pathsep() + ..
+ MSVSDir + filesep() + 'SDK\v2.0\bin' + pathsep() + ..
+ MSVCDir + filesep() + 'VCPackages' + pathsep() + ..
+ PATH + pathsep() );
+ if (err == %F) then
+ bOK = %F;
+ return
+ end
+
+ LIB = getenv('LIB', '');
+ INCLUDE = getenv('INCLUDE', '');
+
+ if (msCompiler == 'msvc80express') then
+ windowsSdkPath = dlwGetSdkPath();
+ LIB = MSVCDir + filesep() + 'LIB' + pathsep() + ..
+ MSVSDir + filesep() + 'SDK\v2.0\lib' + pathsep() + ..
+ windowsSdkPath + filesep() + 'Lib' + pathsep() + ..
+ LIB;
+
+ INCLUDE = MSVCDir + filesep() + 'INCLUDE' + pathsep() + ..
+ windowsSdkPath + 'INCLUDE' + pathsep();
+ else
+ LIB = MSVCDir + filesep() + 'LIB' + pathsep() + ..
+ MSVSDir + filesep() + 'SDK\v2.0\lib' + pathsep() + ..
+ MSVSDir + filesep() + 'VC\PlatformSDK\lib' + pathsep() + ..
+ LIB;
+
+ INCLUDE = MSVCDir + filesep() + 'INCLUDE' + pathsep() + ..
+ MSVCDir + filesep() + 'PlatformSDK\include' + pathsep() + ..
+ MSVSDir + filesep() + 'SDK\v2.0\include' + pathsep() + ..
+ INCLUDE;
+ end
+
+ if ~setenv('LIB', LIB) then
+ bOK = %F;
+ return
+ end
+
+ if ~setenv('INCLUDE', INCLUDE) then
+ bOK = %F;
+ return
+ end
+
+ bOK = %T;
+endfunction
+//=============================================================================
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//=============================================================================
+function bOK = dlwSetEnvVc90(msCompiler, bWin64)
+ bOK = %F;
+ MSVSDir = '';
+ select msCompiler
+ case 'msvc90pro'
+ MSVSDir = dlwGetVc90ProPath();
+ case 'msvc90std'
+ MSVSDir = dlwGetVc90StdPath();
+ case 'msvc90express'
+ MSVSDir = dlwGetVc90ExpressPath();
+ else
+ return
+ end
+
+ IsExpress = (msCompiler == 'msvc100express');
+
+ if ~setenv('VS90COMNTOOLS', MSVSDir + '\Common7\Tools\') then
+ bOK = %F;
+ return
+ end
+
+ bOK = dlwSetEnvCommonVc9Vc10(MSVSDir, IsExpress, bWin64);
+
+endfunction
+//=============================================================================
-//==========================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) INRIA - Allan CORNET
-//
+// Copyright (C) DIGITEO - 2010 - Allan CORNET
+//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution. The terms
-// are also available at
+// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-//==========================================
+//=============================================================================
function r = with_lcc()
-
- if getos() == 'Windows' then // Windows
- // Visual Studio C++
- if ( findmsvccompiler() <> 'unknown' ) then
- r = %F;
- else
- // LCC-WIN32
- if ( findlcccompiler() == %T ) then
- r = %T;
- else
- // another compiler
- r = %F;
- end
- end
-
- else // LINUX
- r = %F;
- end
-
+ warnobsolete(_('LCC in Atoms: atomsInstall(""LCC-windows"")'), '5.3.1');
+ r = %F;
endfunction
-//==========================================
\ No newline at end of file
+//=============================================================================
!IF "$(USE_F2C)" == "NO"
FC=ifort
FC_OPTIONS_COMMON=/nologo /DFORDLL /assume:underscore \
-/noaltparam /f77rtl /arch:IA32 /fpscomp:nolibs /names:lowercase \
+/noaltparam /f77rtl /fpscomp:nolibs /names:lowercase \
/iface:cref /threads /c /Qvc9 \
/Fo"$(DIR_OBJ)/" /Fd"$(DIR_OBJ)/" \
/include:"$(SCIDIR1)/modules/core/includes"
+++ /dev/null
-#=============================================================
-# Allan CORNET - DIGITEO - 2009
-#=============================================================
-# generated by builder.sce (lcc): Please do not edit this file
-# see TEMPLATE makefile for LCC-Win32
-# see SCI/modules/dynamic_link/src/scripts/TEMPLATE_MAKEFILE.LCC
-#=============================================================
-# LCC-WIN32 does not support !IF and !INCLUDE ...
-# http://www.dirtcellar.net/lccwin32sg/featurereqlist.html
-#=============================================================
-all:
-MAKE=make -f Makelib.lcc
-#=============================================================
-CC = lcc
-LINKER = lcclnk
-OBJ = obj
-#=============================================================
-LINKER_OPTIMISATION_MODE =
-CC__OPTIMISATION_MODE =
-#=============================================================
-CC_COMMON = -DWIN32 -D_MSC_VER -DSTRICT -DFORDLL -D__STDC__ -DHAVE_EXP10 $(INCLUDES)
-CC_OPTIONS = -ansic msvcrt.lib $(CC_COMMON) $(CC__OPTIMISATION_MODE)
-CC_LDFLAGS =
-CFLAGS = $(CC_OPTIONS) __CFLAGS__ __MEXCFLAGS__
-FFLAGS = $(CC_OPTIONS) __FFLAGS__ __MEXFFLAGS__
-#=============================================================
-LINKER_FLAGS = -dll -nounderscores $(LINKER_OPTIMISATION_MODE)
-EXTRA_LDFLAGS = __LDFLAGS__
-#=============================================================
-SCIDIR = __SCI__
-SCIDIR1 = __SCIDIR1__
-LCCLIBDIR = __LCCLIBDIR__
-DUMPEXTS = "$(SCIDIR1)\bin\dumpexts"
-#=============================================================
-# name of the dll to be built
-LIBRARY = __LIBRARY__
-#=============================================================
-# list of files
-FILES_SRC = __FILES_SRC__
-#=============================================================
-# list of objects file
-OBJS = __OBJS__
-#=============================================================
-# added libraries
-OTHERLIBS = __OTHERSLIBS__
-#=============================================================
-# include options
-INCLUDES=-I"$(SCIDIR)\libs\MALLOC\includes" \
--I"$(SCIDIR)\modules\core\includes" \
--I"$(SCIDIR)\modules\api_scilab\includes" \
--I"$(SCIDIR)\modules\call_scilab\includes" \
--I"$(SCIDIR)\modules\output_stream\includes" \
--I"$(SCIDIR)\modules\jvm\includes" \
--I"$(SCIDIR)\modules\localization\includes" \
--I"$(SCIDIR)\modules\mexlib\includes" \
--I"$(SCIDIR)\modules\time\includes" \
--I"$(SCIDIR)\modules\windows_tools\includes" \
--I"$(SCIDIR)\libs\f2c" \
--I"$(SCIDIR)\libs\hashtable" \
--I"$(SCIDIR)\libs\intl"
-
-#=============================================================
-# Libraries
-#=============================================================
-# SCILAB_LIBS is used by the binary version of Scilab for linking external codes
-SCILAB_LIBS="$(LCCLIBDIR)\MALLOC.lib" "$(LCCLIBDIR)\blasplus.lib" \
-"$(LCCLIBDIR)\libf2c.lib" "$(LCCLIBDIR)\lapack.lib" \
-"$(LCCLIBDIR)\scicos.lib" "$(LCCLIBDIR)\intersci.lib" \
-"$(LCCLIBDIR)\output_stream.lib" "$(LCCLIBDIR)\dynamic_link.lib" \
-"$(LCCLIBDIR)\integer.lib" "$(LCCLIBDIR)\optimization_f.lib" \
-"$(LCCLIBDIR)\libjvm.lib" "$(LCCLIBDIR)\scilocalization.lib" \
-"$(LCCLIBDIR)\libintl.lib" "$(LCCLIBDIR)\linpack_f.lib" \
-"$(LCCLIBDIR)\call_scilab.lib" "$(LCCLIBDIR)\time.lib" \
-"$(LCCLIBDIR)\api_scilab.lib" "$(LCCLIBDIR)\hashtable.lib" \
-"$(LCCLIBDIR)\scilab_windows.lib" \
-"$(LCCLIBDIR)\libscilab.lib"
-#=============================================================
-.c.$(OBJ):
- @echo ------------- Compile file $< --------------
- $(CC) $(CFLAGS) $<
-#=============================================================
-.f.$(OBJ):
- @echo ----------- Compile file $*.f (using f2c) -------------
-# @"$(SCIDIR1)\bin\f2c.exe" -E -I"$(SCIDIR1)/modules/core/includes" $*.f 2>NUL
- @"$(SCIDIR1)\bin\f2c.exe" -I"$(SCIDIR1)/modules/core/includes" $*.f 2>NUL
- @$(CC) $(FFLAGS) $*.c
-#=============================================================
-all: $(LIBRARY).dll
-#=============================================================
-$(LIBRARY).dll: $(OBJS)
- $(DUMPEXTS) -o "$(LIBRARY).def" "$*" $(OBJS)
- $(LINKER) $(LINKER_FLAGS) $(OBJS) $(OTHERLIBS) $(SCILAB_LIBS) \
- $(EXTRA_LDFLAGS) $(LIBRARY).def -o $(LIBRARY).dll
-#=============================================================
-clean:
- del *.bak
- del *.$(OBJ)
- del *.dll
- del *.lib
- del *.def
-#=============================================================
-distclean:
- del *.bak
- del *.$(OBJ)
- del *.dll
- del *.lib
- del *.def
-#=============================================================
// =============================================================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) 2008 - INRIA - Allan CORNET
+// Copyright (C) ????-2008 - INRIA
+// Copyright (C) 2009 - DIGITEO
//
// This file is distributed under the same license as the Scilab package.
// =============================================================================
// <-- ENGLISH IMPOSED -->
// <-- JVM NOT MANDATORY -->
-// <-- Non-regression test for bug 2085 -->
-//
-// <-- Bugzilla URL -->
-// http://bugzilla.scilab.org/show_bug.cgi?id=2085
-//
-// <-- Short Description -->
-// this example fails on some pc ???
-// exec SCI/modules/dynamic_link/tests/nonreg_tests/bug_2085.tst;
-test_path = get_absolute_file_path('bug_2085.tst');
-currentpath = pwd();
-cd TMPDIR;
-cd ../;
-OS_TMP_DIR = pwd();
-mkdir(OS_TMP_DIR,'bug_2085');
-TEST_DIR = OS_TMP_DIR + filesep() + 'bug_2085';
-copyfile(SCI+'/modules/dynamic_link/tests/nonreg_tests/bug_2085.c' , TEST_DIR + filesep() + 'bug_2085.c');
-chdir(TEST_DIR);
-files=['bug_2085.c'];
-ilib_build('bug',['ex2c_1','intex2c'],files,[]);
- Generate a gateway file
+if getos() == 'Windows' then
+ TMP_OS_DIR = getenv('TMP','err');
+ if (TMP_OS_DIR == 'err') then bugmes();quit;end;
+else
+ TMP_OS_DIR = '/tmp';
+ if ~isdir(TMP_OS_DIR) then bugmes();quit;end;
+end
+TMP_DIR = TMP_OS_DIR+filesep()+'ilib_for_link';
+rmdir(TMP_DIR,'s');
+mkdir(TMP_OS_DIR,'ilib_for_link');
+f1=['int ext1c(int *n, double *a, double *b, double *c)'
+ '{int k;'
+ ' for (k = 0; k < *n; ++k) '
+ ' c[k] = a[k] + b[k];'
+ ' return(0);}'];
+mputl(f1,TMP_DIR+filesep()+'fun1.c');
+//creating the shared library (a gateway, a Makefile and a loader are
+//generated.
+cur_dir = pwd();
+chdir(TMP_DIR);
+ilib_for_link('ext1c','fun1.c',[],"c")
Generate a loader file
Generate a Makefile
ilib_gen_Make: Copy compilation files (Makefile*, libtool...) to TMPDIR
- ilib_gen_Make: Copy bug_2085.c to TMPDIR
- ilib_gen_Make: Copy libbug.c to TMPDIR
+ ilib_gen_Make: Copy fun1.c to TMPDIR
ilib_gen_Make: Modification of the Makefile in TMPDIR.
- Running the makefile
- Generate a cleaner file
-// load the shared library
-exec loader.sce
+ Running the Makefile
+ Generate a cleaner file
+ ans =
+
+ libext1c.so
+// load the shared library
+exec loader.sce
-// ------------------------------------------------------
+// This file is released into the public domain
-// generated by builder.sce: Please do not edit this file
+// Generated by builder.sce : Please, do not edit this file
-// ------------------------------------------------------
+// ----------------------------------------------------------------------------
+//
+
+ext1c_path = get_absolute_file_path('loader.sce');
-libbug_path = get_file_path('loader.sce');
+//
-list_functions = [ 'ex2c_1';
-];
+// ulink previous function with same name
-addinter(libbug_path+'/libbug.dylib','libbug',list_functions);
+[bOK, ilib] = c_link('ext1c');
+
+if bOK then
+ ulink(ilib);
+end
+
+//
+
+link(ext1c_path + 'libext1c' + getdynlibext(), ['ext1c'],'c');
Shared archive loaded.
Link done.
// remove temp. variables on stack
-clear libbug_path;
+clear ext1c_path;
-clear list_functions;
+clear bOK;
-clear get_file_path;
+clear ilib;
-// ------------------------------------------------------
+// ----------------------------------------------------------------------------
-chdir(currentpath);
+chdir(cur_dir);
//using the new primitive
-r = [1,2,3];
-nr = [4,5,5];
-a = ex2c_1(r+%i*nr);
-res = (2 * r) +%i*(nr *3);
-if a <> res then bugmes();quit;end;
+a=[1,2,3];b=[4,5,6];n=3;
+c=call('ext1c',n,1,'i',a,2,'d',b,3,'d','out',[1,3],4,'d');
+if norm(c-(a+b)) > %eps then bugmes();quit;end
// ulink() all libraries
ulink();
//remove TMP_DIR
-rmdir(TEST_DIR,'s');
-// =============================================================================
+//rmdir(TMP_DIR,'s');
ilib_gen_Make: Copy libbug.c to TMPDIR
ilib_gen_Make: Modification of the Makefile in TMPDIR.
Running the makefile
- Generate a cleaner file
-// load the shared library
+ Generate a cleaner file
+// load the shared library
exec loader.sce
-// ------------------------------------------------------
+// This file is released into the public domain
-// generated by builder.sce: Please do not edit this file
+// Generated by builder.sce : Please, do not edit this file
-// ------------------------------------------------------
+// ----------------------------------------------------------------------------
+//
+
+libbug_path = get_absolute_file_path('loader.sce');
+
+//
+
+// ulink previous function with same name
+
+[bOK, ilib] = c_link('libbug');
-libbug_path = get_file_path('loader.sce');
+if bOK then
+ ulink(ilib);
+end
-list_functions = [ 'ex2c_1';
+//
+
+list_functions = [ 'ex2c_1';
];
-addinter(libbug_path+'/libbug.so','libbug',list_functions);
+addinter(libbug_path + filesep() + 'libbug' + getdynlibext(), 'libbug', list_functions);
Shared archive loaded.
Link done.
-
+
// remove temp. variables on stack
clear libbug_path;
-clear list_functions;
+clear bOK;
+
+clear ilib;
-clear get_file_path;
+clear list_functions;
-// ------------------------------------------------------
+// ----------------------------------------------------------------------------
chdir(currentpath);
//using the new primitive
files=['bug_2085.c'];
ilib_build('bug',['ex2c_1','intex2c'],files,[]);
Generate a gateway file
-
Generate a loader file
-
Generate a Makefile: Makelib
-
Running the makefile
-
Compilation of bug_2085.c
-
Building shared library (be patient)
-
Generate a cleaner file
-
// load the shared library
exec loader.sce
// Generated by builder.sce : Please, do not edit this file
+// ----------------------------------------------------------------------------
+
+//
+
+if win64() then
+ warning(_("This module requires a Windows x86 platform."));
+ return
+end
+
+//
+
+bug_path = get_absolute_file_path('loader.sce');
+
//
-bug_path = get_file_path('loader.sce');
+// ulink previous function with same name
-list_functions = [ 'ex2c_1';
+[bOK, ilib] = c_link('bug');
+
+if bOK then
+ ulink(ilib);
+end
+
+//
+
+list_functions = [ 'ex2c_1';
];
-addinter(bug_path+'/bug.dll','bug',list_functions);
+addinter(bug_path + filesep() + 'bug' + getdynlibext(), 'bug', list_functions);
Shared archive loaded.
Link done.
clear bug_path;
-clear list_functions;
+clear bOK;
+
+clear ilib;
-clear get_file_path;
+clear list_functions;
-// ------------------------------------------------------
+// ----------------------------------------------------------------------------
chdir(currentpath);
//using the new primitive
/* Check dimensions */
if (!(m1==1)|!(n1==1))
{
- SciError(999,"%s: Wrong inputs \r\n", "c_fun");
+ Scierror(999,"%s: Wrong inputs \r\n", "c_fun");
return 0;
}
if (!(m2==1)|!(n2==1))
{
- Scirror(999,"%s: Wrong inputs \r\n", "c_fun");
+ Scierror(999,"%s: Wrong inputs \r\n", "c_fun");
return 0;
}
}
if (!(m2==1)|!(n2==1))
{
- SciError(999,"%s: Wrong inputs \r\n", "c_fun");
+ Scierror(999,"%s: Wrong inputs \r\n", "c_fun");
return 0;
}
chdir(TEST_DIR);
files=['bug_3639.c'];
ilib_build('libc_fun1',['c_sum1','c_intsum';'c_sub1','c_intsub'],files,[]);
-copyfile('loader.sce','loader1.sce');
-ilib_build('libc_fun2',['c_sum2','c_intsum';'c_sub2','c_intsub'],files,[]);
-// load the shared library
+// load the shared library
info_link = link();
if info_link <> [] then bugmes();quit;end
-exec loader1.sce;
+exec loader.sce;
+ilib_build('libc_fun2',['c_sum2','c_intsum';'c_sub2','c_intsub'],files,[]);
info_link = link();
if info_link <> 'libc_fun1' then bugmes();quit;end
exec loader.sce;
files=['bug_3639.c'];
ilib_build('libc_fun1',['c_sum1','c_intsum';'c_sub1','c_intsub'],files,[]);
-copyfile('loader.sce','loader1.sce');
-
-ilib_build('libc_fun2',['c_sum2','c_intsum';'c_sub2','c_intsub'],files,[]);
-
// load the shared library
info_link = link();
if info_link <> [] then pause,end
+exec loader.sce;
-exec loader1.sce;
+ilib_build('libc_fun2',['c_sum2','c_intsum';'c_sub2','c_intsub'],files,[]);
info_link = link();
if info_link <> 'libc_fun1' then pause,end
-
exec loader.sce;
+
info_link = link();
if or(info_link <> ['libc_fun2','libc_fun1']) then pause,end
// =============================================================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2008 - DIGITEO - Mickael BAUDIN
-// Copyright (C) 2008 - DIGITEO - Allan CORNET
+// Copyright (C) 2008-2010 - DIGITEO - Allan CORNET
//
// This file is distributed under the same license as the Scilab package.
// =============================================================================
//
// <-- Short Description -->
// Manage absolute path names in ilib_gen_loader
-cd TMPDIR
- ans =
-
- TMPDIR
+// =============================================================================
+cd(TMPDIR);
name = "skeleton";
+// call a link
tables = [];
-libs = [SCI+"/bin/linear_algebra_f",SCI+"/bin/linear_algebra"];
-ilib_gen_loader(name,tables,libs);
-res = mgetl('loader.sce');
-grepaboutlink = grep(res,'link');
-if size(grepaboutlink,'*') <> 2 then bugmes();quit;end
-refONE = "link(''" + libs(1) + getdynlibext() + ""');";
-refTWO = "link(''" + libs(2) + getdynlibext() + ""');";
-if res(grepaboutlink(1)) <> refONE then bugmes();quit;end
-if res(grepaboutlink(2)) <> refTWO then bugmes();quit;end
+libs = [SCI + "/bin/linear_algebra_f", SCI + "/bin/linear_algebra"];
+ilib_gen_loader(name, tables, libs);
+res1 = mgetl('loader.sce');
+grepaboutlink = grep(res1, 'link(');
+if size(grepaboutlink, '*') <> 5 then bugmes();quit;end
+refONE = "link(''" + libs(1) + "'' + getdynlibext());";
+refTWO = "link(''" + libs(2) + "'' + getdynlibext());";
+if res1(grepaboutlink(3)) <> refONE then bugmes();quit;end
+if res1(grepaboutlink(4)) <> refTWO then bugmes();quit;end
+// =============================================================================
+name = "skeleton2";
+tables = ['f1','sci_f1';'f2','sci_f2'];
+// call addinter
+libs = [SCI + "/bin/linear_algebra_f", SCI + "/bin/linear_algebra"];
+ilib_gen_loader(name, tables, libs);
+res2 = mgetl('loader.sce');
+grepaboutlink = grep(res2, 'link');
+if size(grepaboutlink, '*') <> 5 then bugmes();quit;end
+refONE = "link(''" + libs(1) + "'' + getdynlibext());";
+refTWO = "link(''" + libs(2) + "'' + getdynlibext());";
+if res2(grepaboutlink(4)) <> refONE then bugmes();quit;end
+if res2(grepaboutlink(5)) <> refTWO then bugmes();quit;end
+// =============================================================================
// =============================================================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2008 - DIGITEO - Mickael BAUDIN
-// Copyright (C) 2008 - DIGITEO - Allan CORNET
+// Copyright (C) 2008-2010 - DIGITEO - Allan CORNET
//
// This file is distributed under the same license as the Scilab package.
// =============================================================================
//
// <-- Short Description -->
// Manage absolute path names in ilib_gen_loader
-
-cd TMPDIR
+// =============================================================================
+cd(TMPDIR);
name = "skeleton";
+// call a link
tables = [];
-libs = [SCI+"/bin/linear_algebra_f",SCI+"/bin/linear_algebra"];
-ilib_gen_loader(name,tables,libs);
-res = mgetl('loader.sce');
-grepaboutlink = grep(res,'link');
-if size(grepaboutlink,'*') <> 2 then pause,end
-refONE = "link(''" + libs(1) + getdynlibext() + ""');";
-refTWO = "link(''" + libs(2) + getdynlibext() + ""');";
-
-if res(grepaboutlink(1)) <> refONE then pause,end
-if res(grepaboutlink(2)) <> refTWO then pause,end
+libs = [SCI + "/bin/linear_algebra_f", SCI + "/bin/linear_algebra"];
+ilib_gen_loader(name, tables, libs);
+res1 = mgetl('loader.sce');
+grepaboutlink = grep(res1, 'link(');
+if size(grepaboutlink, '*') <> 5 then pause,end
+refONE = "link(''" + libs(1) + "'' + getdynlibext());";
+refTWO = "link(''" + libs(2) + "'' + getdynlibext());";
+if res1(grepaboutlink(3)) <> refONE then pause,end
+if res1(grepaboutlink(4)) <> refTWO then pause,end
+// =============================================================================
+name = "skeleton2";
+tables = ['f1','sci_f1';'f2','sci_f2'];
+// call addinter
+libs = [SCI + "/bin/linear_algebra_f", SCI + "/bin/linear_algebra"];
+ilib_gen_loader(name, tables, libs);
+res2 = mgetl('loader.sce');
+grepaboutlink = grep(res2, 'link');
+if size(grepaboutlink, '*') <> 5 then pause,end
+refONE = "link(''" + libs(1) + "'' + getdynlibext());";
+refTWO = "link(''" + libs(2) + "'' + getdynlibext());";
+if res2(grepaboutlink(4)) <> refONE then pause,end
+if res2(grepaboutlink(5)) <> refTWO then pause,end
+// =============================================================================
// variable tables to compile other files
ilib_verbose(0);
cd(TMPDIR);
-mputl('ilib_mex_build(''libmex'',[''mexf16'',''mexfunction16'',''cmex''],[],[],''Makelib'','''','''','''')','builder.sce');
+mputl('ilib_mex_build(''libmex'',[''mexf16'',''mexfunction16'',''cmex''],[],[],'''','''','''','''')','builder.sce');
mputl([
'#include ""mex.h""'
'void mexFunction(int nlhs, mxArray *plhs[], int nrhs, mxArray *prhs[])'
ilib_verbose(0);
cd(TMPDIR);
-mputl('ilib_mex_build(''libmex'',[''mexf16'',''mexfunction16'',''cmex''],[],[],''Makelib'','''','''','''')','builder.sce');
+mputl('ilib_mex_build(''libmex'',[''mexf16'',''mexfunction16'',''cmex''],[],[],'''','''','''','''')','builder.sce');
mputl([
'#include ""mex.h""'
+++ /dev/null
-// =============================================================================
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) 2009 - DIGITEO - Allan CORNET
-//
-// This file is distributed under the same license as the Scilab package.
-// =============================================================================
-// <-- JVM NOT MANDATORY -->
-// <-- Non-regression test for bug 4386 -->
-//
-// <-- Bugzilla URL -->
-// http://bugzilla.scilab.org/show_bug.cgi?id=4298
-//
-// <-- Short Description -->
-// ilib_for_link fails with lcc-win32
-if getos() == 'Windows' then
- if with_lcc() then
- if fileinfo(SCIHOME + '/lcclib/blaspluslcc.lib') <> [] then bugmes();quit;end
- if fileinfo(SCIHOME + '/lcclib/blasplus.lib') == [] then bugmes();quit;end
- end
-end
+++ /dev/null
-// =============================================================================
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) 2009 - DIGITEO - Allan CORNET
-//
-// This file is distributed under the same license as the Scilab package.
-// =============================================================================
-
-// <-- JVM NOT MANDATORY -->
-
-
-// <-- Non-regression test for bug 4386 -->
-//
-// <-- Bugzilla URL -->
-// http://bugzilla.scilab.org/show_bug.cgi?id=4298
-//
-// <-- Short Description -->
-// ilib_for_link fails with lcc-win32
-
-i