[opam-devel] lablgl.1.04

Florent Monnier monnier.florent at gmail.com
Sat Mar 30 15:47:09 GMT 2013


Hi,

On my Windows test environment I can not use "lablgl-20120306" because
of the glShader module that I myself provided before I get a Windows
test environment.

But the vanilla "lablgl-1.04" works fine.

If I've understood correctly Opam is a source package manager, so
maybe opam could provide "lablgl.1.04" for Windows users that have a
similar environment than mine ?

My windows test environment is:
Windows 7 starter with protz's ocaml version 4.00.1

Well in this environment only lablgl itself compiles out of the box.
LablGlut does not.
Togl (Tk) does not either.
(I think that the devel libs for both glut and tkgl are there)

LablGlut and Togl are for windowing, so if we use OCamlSDL instead
this is just fine we don't need these. OCamlSDL1 compiles out of the
box in my win env.

In this environment I compile the Vanilla LablGL like this:

cp Makefile.config.mingw Makefile.config
# need to add -I/usr/include, the patch below does this:
patch < Makefile.config-cygwin-needs-I_usr_include.patch

# don't build anything else than lablgl itself or we get errors:
make lib
make libopt

LABLGL_INSTALLDIR="/tmp/mylblgl0"
make install INSTALLDIR="$LABLGL_INSTALLDIR"
# it seems that the file "dlllablgl.dll" is not installed, so:
cp src/dlllablgl.dll "$LABLGL_INSTALLDIR"/

Now a hello-world works fine.
(I'm providing this hello at the end after the config patch)

===============

$ cat Makefile.config-cygwin-needs-I_usr_include.patch
+++ Makefile.config~    2013-03-12 18:11:58.945140000 +0100
--- Makefile.config     2013-03-30 13:55:08.524315300 +0100
@@ -35,7 +35,7 @@
   -lws2_32 -luser32 -lgdi32

 # Where to find OpenGL/Mesa/Glut headers and libraries
-GLINCLUDES = -DHAS_GLEXT_H -DGL_GLEXT_PROTOTYPES -DGLU_VERSION_1_3
+GLINCLUDES = -I/usr/include -DHAS_GLEXT_H -DGL_GLEXT_PROTOTYPES
-DGLU_VERSION_1_3
 GLLIBS = -lglu32 -lopengl32
 GLLIBS0 = $(GLLIBS)
 GLUTLIBS = -lglut32


============

$ cat lblgl_hello.ml
let display () =
  GlClear.color (0.0, 0.0, 0.0);
  GlClear.clear [`color];
  GlDraw.color (1.0, 1.0, 0.0);
  GlMat.mode `projection;
  GlMat.load_identity ();
  GlMat.ortho ~x:(-1.0,1.0) ~y:(-1.0,1.0) ~z:(-1.0,1.0);
  GlDraw.begins `polygon;
  GlDraw.vertex ~x:(-0.5) ~y:(-0.5) ();
  GlDraw.vertex ~x:(-0.5) ~y:(0.5) ();
  GlDraw.vertex ~x:(0.5) ~y:(0.5) ();
  GlDraw.vertex ~x:(0.5) ~y:(-0.5) ();
  GlDraw.ends ();
  Gl.flush ()

let () =
  Sdl.init [`EVERYTHING];
  let _ =
    Sdlvideo.set_video_mode ~w:640 ~h:400
      [`HWSURFACE; `DOUBLEBUF; `OPENGL; `RESIZABLE]
  in
  for i = 1 to 6 do
    display ();
    Sdlgl.swap_buffers ();
    Sdltimer.delay 1000;
  done;
  Sdl.quit ()


# using full windows path, because protz's ocaml doesn't like cygwin ones:
$ ocaml bigarray.cma -I +site-lib/sdl sdl.cma -I
C:/cygwin/tmp/mylblgl0 lablgl.cma lblgl_hello.ml


===========

# completely untested, just copied and modified from "lablgl.20120306"

$ cat opam

opam-version: "1"
maintainer: "contact at ocamlpro.com"
homepage: "https://forge.ocamlcore.org/projects/lablgl/"
authors: [
  "Jacques Garrigue"
  "Isaac Trotts"
  "Erick Tryzelaar"
  "Christophe Raffali"
]
# "Jon Harrop" contributed the files "gluTess.ml" / "ml_glutess.c"
# should he be considered as one of the authors? or just a contributor?
build: [
  ["cp" "Makefile.config.ex" "Makefile.config"]
  ["cp" "Makefile.config.osx" "Makefile.config"] {"%{os}%" = "darwin"}
  ["cp" "Makefile.config.mingw" "Makefile.config"] {"%{os}%" =
"windows 7 starter with protz's ocaml 4"}

  ["mkdir" "-p" "%{bin}%"]

#  [make "glut"]  ### do not build this one, it doesn't compile out of
the box in my W env
#  [make "glutopt"]  ### do not build this one, it doesn't compile out
of the box in my W env

### in my W env, only build lablgl.{cma,cmxa}
  [make "lib"]
  [make "libopt"]

  [make "install" "-C" "src" "BINDIR=%{bin}%"
"INSTALLDIR=%{lib}%/lablgl" "DLLDIR=%{lib}%/stublibs"]
  # it seems that the makefile forgets to install this one:
  ["cp" "src/dlllablgl.dll" "DLLDIR=%{lib}%/stublibs"] {"%{os:env}%" =
"win7::protz"}

### do not install LablGlut, it doesn't compile out of the box in my W env
### [make "install" "-C" "LablGlut/src" "BINDIR=%{bin}%"
"INSTALLDIR=%{lib}%/lablgl" "DLLDIR=%{lib}%/stublibs"]
]

-- 
Cheers


More information about the opam-devel mailing list