diff --git a/.gitignore b/.gitignore index f99931a..8b4d2a7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ lib +include result* dist-newstyle diff --git a/generate.sh b/generate.sh index 87c9761..22b50e6 100755 --- a/generate.sh +++ b/generate.sh @@ -1,11 +1,22 @@ -echo "#" -echo "# generating library RGFW.Generated in folder lib" -echo "#" +echo "# copying header..." + +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 \ - -Irgfw \ + -Ilib/include \ --create-output-dirs \ --overwrite-files \ --hs-output-dir lib \ --module RGFW.Generated \ --clang-option=-DRGFW_OPENGL \ + --clang-option=-DRGFW_EXPORT \ RGFW.h + diff --git a/hs-rgfw.cabal b/hs-rgfw.cabal index 8e7daf5..cca8327 100644 --- a/hs-rgfw.cabal +++ b/hs-rgfw.cabal @@ -12,13 +12,17 @@ common warnings library import: warnings - exposed-modules: RGFW.Generated + exposed-modules: + , RGFW.Generated + , RGFW.Generated.FunPtr + , RGFW.Generated.Safe + , RGFW.Generated.Unsafe build-depends: , base , primitive , c-expr-runtime , hs-bindgen-runtime - include-dirs: rgfw + include-dirs: lib/include hs-source-dirs: lib default-language: Haskell2010 default-extensions: FlexibleInstances @@ -37,6 +41,6 @@ executable hs-rgfw , xcursor , xrandr , xi - include-dirs: rgfw + include-dirs: lib/include hs-source-dirs: src default-language: Haskell2010 diff --git a/src/Main.hs b/src/Main.hs index 3a4853c..eaf5eab 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -1,6 +1,10 @@ module Main where +import qualified Foreign.Ptr (ToFunPtr) + import qualified RGFW.Generated as RGFW main :: IO () -main = putStrLn "Hello World" +main = do + putStrLn "Hello World" + window <- toFunPtr ()