Markus Mottl avatar Markus Mottl committed fb29e7b

Improved Windows support with MSVC

Comments (0)

Files changed (4)

+2010-10-31:  Improved Windows support with MSVC.
+
+             Thanks to Sylvain Le Gall <sylvain@le-gall.net> for the patch!
+
 2010-04-01:  Added new function:
 
                * regexp_or
 name="pcre"
-version="6.1.0"
+version="6.1.1"
 description="Perl Compatibility Regular Expressions"
 requires=""
 archive(byte)="pcre.cma"

lib/make_msvc.bat

 set INSTALLDIR=%OCAMLLIB%\pcre
 set STUBDIR=%OCAMLLIB%\stublibs
 
-set PCRE_H=C:\pcre
+set PCRE_H=C:\pcre\pcre-7.7\include
 REM Full path of the pcre C lib:
-set PCRE_LIB="C:\pcre"\libpcre.lib
+set PCRE_LIB=C:\pcre\pcre-7.7\lib\libpcre.lib
 
 set OCAMLC=ocamlc
 set OCAMLOPT=ocamlopt
 
 %OCAMLC% -c pcre.mli
 @echo --- Byte code library ---
-cl /nologo /Ox /MT  /DPCRE_STATIC /I "%OCAMLLIB%" /I "%PCRE_H%" /c pcre_stubs.c /Fopcre_stubs.s.obj
-lib /nologo /out:libpcre_stubs.lib pcre_stubs.s.obj
+REM cl /nologo /Ox /MT  /DPCRE_STATIC /I "%OCAMLLIB%" /I "%PCRE_H%" /c pcre_stubs.c /Fopcre_stubs.s.obj
+REM lib /nologo /out:libpcre_stubs.lib pcre_stubs.s.obj
+%OCAMLC% -I "%PCRE_H%" -ccopt /DPCRE_STATIC pcre_stubs.c
+ocamlmklib -o pcre_stubs pcre_stubs.obj
 
 @REM cl /nologo /Ox /MD /DCAML_DLL /I "%OCAMLLIB%" /I "%PCRE_H%" /c pcre_stubs.c /Fopcre_stubs.d.obj
 @REM link /nologo /dll /out:dllpcre_stubs.dll /def:pcre_stubs.DEF pcre_stubs.d.obj "%OCAMLLIB%"\ocamlrun.lib %PCRE_LIB%
 @REM copy dllpcre_stubs.dll "%STUBDIR%" >NUL
 
-%OCAMLC% -custom -a -o pcre.cma pcre.ml pcre.mli -cclib %PCRE_LIB% -cclib -lpcre_stubs
+%OCAMLC% -custom -a -o pcre.cma pcre.ml pcre.mli -cclib "%PCRE_LIB%" -cclib -lpcre_stubs
 
 @echo --- Native code library ---
-%OCAMLOPT% -a -o pcre.cmxa pcre.ml pcre.mli -cclib %PCRE_LIB% -cclib -lpcre_stubs
+%OCAMLOPT% -a -o pcre.cmxa pcre.ml pcre.mli -cclib "%PCRE_LIB%" -cclib -lpcre_stubs
 
 @echo --- Installation ---
-mkdir "%INSTALLDIR%"
-copy libpcre_stubs.lib "%INSTALLDIR%" >NUL
-copy pcre.mli       "%INSTALLDIR%"  >NUL
-copy pcre.cmi       "%INSTALLDIR%"  >NUL
-copy pcre.cma       "%INSTALLDIR%"  >NUL
-copy pcre.cmxa      "%INSTALLDIR%"  >NUL
-copy pcre_stubs.lib "%INSTALLDIR%"  >NUL
-copy pcre.lib       "%INSTALLDIR%"  >NUL
+ocamlfind install pcre META libpcre_stubs.lib pcre.mli pcre.cmi pcre.cma pcre.cmxa pcre.lib
+REM mkdir "%INSTALLDIR%"
+REM copy libpcre_stubs.lib "%INSTALLDIR%" >NUL
+REM copy pcre.mli       "%INSTALLDIR%"  >NUL
+REM copy pcre.cmi       "%INSTALLDIR%"  >NUL
+REM copy pcre.cma       "%INSTALLDIR%"  >NUL
+REM copy pcre.cmxa      "%INSTALLDIR%"  >NUL
+REM copy pcre_stubs.lib "%INSTALLDIR%"  >NUL
+REM copy pcre.lib       "%INSTALLDIR%"  >NUL
+REM copy META           "%INSTALLDIR%"  >NUL
 
 @prompt $P$G$S
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
 
-#if defined(_WIN32) && defined(_DLL)
-#  define PCREextern __declspec(dllexport)
-#else
-#  define PCREextern
+#if defined(_WIN32)
+#  define snprintf _snprintf
+#  if defined(_DLL)
+#    define PCREextern __declspec(dllexport)
+#  else
+#    define PCREextern
+#  endif
 #endif
 
 #if __GNUC__ >= 3
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.