sylvainboilard / glfw-ocaml Goto Github PK
View Code? Open in Web Editor NEWA GLFW binding for OCaml.
License: zlib License
A GLFW binding for OCaml.
License: zlib License
I had already brew install glfw
first attempt to opam instal glfw-ocaml
failed with:
# File "glfw-ocaml/dune", line 9, characters 15-25:
# 9 | (names GLFW_stubs)
# ^^^^^^^^^^
# (cd _build/default/glfw-ocaml && /usr/bin/cc -O2 -fno-strict-aliasing -fwrapv -pthread -D_FILE_OFFSET_BITS=64 -O2 -fno-strict-aliasing -fwrapv -pthread -g -I /Users/paul/.opam/oktree/lib/ocaml -o GLFW_stubs.o -c GLFW_stubs.c)
# GLFW_stubs.c:1:10: fatal error: 'GLFW/glfw3.h' file not found
# #include <GLFW/glfw3.h>
# ^~~~~~~~~~~~~~
# 1 error generated.
from this answer https://stackoverflow.com/a/67378304/202168 I fixed that by export CPATH=/opt/homebrew/include
installed successfully
then I copied the code from example window.ml and tried to compile it:
ocamlfind ocamlopt -package glfw-ocaml -thread -linkpkg -o glfw.native glfw.ml
File "glfw.ml", line 8, characters 15-32:
8 | let window = GLFW.createWindow 640 480 "Hello World" () in
^^^^^^^^^^^^^^^^^
Warning 6 [labels-omitted]: labels width, height, title were omitted in the application of this function.
File "glfw.ml", line 10, characters 2-25:
10 | GLFW.makeContextCurrent (Some window);
^^^^^^^^^^^^^^^^^^^^^^^
Warning 6 [labels-omitted]: label window was omitted in the application of this function.
File "glfw.ml", line 12, characters 13-35:
12 | while not (GLFW.windowShouldClose window) do
^^^^^^^^^^^^^^^^^^^^^^
Warning 6 [labels-omitted]: label window was omitted in the application of this function.
File "glfw.ml", line 16, characters 4-20:
16 | GLFW.swapBuffers window;
^^^^^^^^^^^^^^^^
Warning 6 [labels-omitted]: label window was omitted in the application of this function.
Undefined symbols for architecture arm64:
"_caml_glClearColorBufferBit", referenced from:
_camlGlfw__entry in glfw.o
_camlGlfw__1 in glfw.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
File "caml_startup", line 1:
Error: Error during linking (exit code 1)
I found a couple of answers:
the solution there seems to revolve around having a CMakeLists.txt
file with target_link_libraries(<project> glfw)
but I have no idea how to relate that back to glfw-ocaml ...do you have any tips? thank you!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.