This commit is contained in:
andromeda
2026-01-27 09:32:23 +01:00
parent 4858c3ee2e
commit f17acc45e0
4 changed files with 28 additions and 8 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
lib lib
include
result* result*
dist-newstyle dist-newstyle

View File

@@ -1,11 +1,22 @@
echo "#" echo "# copying header..."
echo "# generating library RGFW.Generated in folder lib"
echo "#" mkdir lib
mkdir lib/include
cp rgfw/RGFW.h lib/include/RGFW.h
echo "# creating c file to generate from..."
clang -E -DRGFW_IMPLEMENTATION -DRGFW_OPENGL lib/include/RGFW.h -o lib/include/RGFW.c
echo "# generating library RGFW.Generated..."
hs-bindgen-cli preprocess \ hs-bindgen-cli preprocess \
-Irgfw \ -Ilib/include \
--create-output-dirs \ --create-output-dirs \
--overwrite-files \ --overwrite-files \
--hs-output-dir lib \ --hs-output-dir lib \
--module RGFW.Generated \ --module RGFW.Generated \
--clang-option=-DRGFW_OPENGL \ --clang-option=-DRGFW_OPENGL \
--clang-option=-DRGFW_EXPORT \
RGFW.h RGFW.h

View File

@@ -12,13 +12,17 @@ common warnings
library library
import: warnings import: warnings
exposed-modules: RGFW.Generated exposed-modules:
, RGFW.Generated
, RGFW.Generated.FunPtr
, RGFW.Generated.Safe
, RGFW.Generated.Unsafe
build-depends: build-depends:
, base , base
, primitive , primitive
, c-expr-runtime , c-expr-runtime
, hs-bindgen-runtime , hs-bindgen-runtime
include-dirs: rgfw include-dirs: lib/include
hs-source-dirs: lib hs-source-dirs: lib
default-language: Haskell2010 default-language: Haskell2010
default-extensions: FlexibleInstances default-extensions: FlexibleInstances
@@ -37,6 +41,6 @@ executable hs-rgfw
, xcursor , xcursor
, xrandr , xrandr
, xi , xi
include-dirs: rgfw include-dirs: lib/include
hs-source-dirs: src hs-source-dirs: src
default-language: Haskell2010 default-language: Haskell2010

View File

@@ -1,6 +1,10 @@
module Main where module Main where
import qualified Foreign.Ptr (ToFunPtr)
import qualified RGFW.Generated as RGFW import qualified RGFW.Generated as RGFW
main :: IO () main :: IO ()
main = putStrLn "Hello World" main = do
putStrLn "Hello World"
window <- toFunPtr ()