Compare commits
2 Commits
8583f117cc
...
f17acc45e0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f17acc45e0 | ||
|
|
4858c3ee2e |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
|||||||
lib
|
lib
|
||||||
|
include
|
||||||
result*
|
result*
|
||||||
dist-newstyle
|
dist-newstyle
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ packages:
|
|||||||
source-repository-package
|
source-repository-package
|
||||||
type: git
|
type: git
|
||||||
location: https://github.com/well-typed/hs-bindgen.git
|
location: https://github.com/well-typed/hs-bindgen.git
|
||||||
tag: 933d11d771ff13b6a3b851cb0ec9bc3632626f2f
|
tag: f99ed4ddfc7808b3eb28bbf089612b6a52983685
|
||||||
subdir: hs-bindgen-runtime
|
subdir: hs-bindgen-runtime
|
||||||
source-repository-package
|
source-repository-package
|
||||||
type: git
|
type: git
|
||||||
location: https://github.com/well-typed/hs-bindgen.git
|
location: https://github.com/well-typed/hs-bindgen.git
|
||||||
tag: 933d11d771ff13b6a3b851cb0ec9bc3632626f2f
|
tag: f99ed4ddfc7808b3eb28bbf089612b6a52983685
|
||||||
subdir: c-expr-runtime
|
subdir: c-expr-runtime
|
||||||
|
|||||||
32
flake.lock
generated
32
flake.lock
generated
@@ -5,11 +5,11 @@
|
|||||||
"nixpkgs-lib": "nixpkgs-lib"
|
"nixpkgs-lib": "nixpkgs-lib"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1763759067,
|
"lastModified": 1767609335,
|
||||||
"narHash": "sha256-LlLt2Jo/gMNYAwOgdRQBrsRoOz7BPRkzvNaI/fzXi2Q=",
|
"narHash": "sha256-feveD98mQpptwrAEggBQKJTYbvwwglSbOv53uCfH9PY=",
|
||||||
"owner": "hercules-ci",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-parts",
|
"repo": "flake-parts",
|
||||||
"rev": "2cccadc7357c0ba201788ae99c4dfa90728ef5e0",
|
"rev": "250481aafeb741edfe23d29195671c19b36b6dca",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -25,43 +25,43 @@
|
|||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1765888948,
|
"lastModified": 1769198512,
|
||||||
"narHash": "sha256-rgGAUQVfJ0sKXm9bzh7XIJUHh/JkEsz/LX6k8aCKeD4=",
|
"narHash": "sha256-ZsQm3CwvicJBv4CMJJzRkTcYYcrghqzVabL9IehNz9k=",
|
||||||
"owner": "well-typed",
|
"owner": "well-typed",
|
||||||
"repo": "hs-bindgen",
|
"repo": "hs-bindgen",
|
||||||
"rev": "fd74e8fa4216eccd67069ec9d8637b57000ffc83",
|
"rev": "f99ed4ddfc7808b3eb28bbf089612b6a52983685",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "well-typed",
|
"owner": "well-typed",
|
||||||
"repo": "hs-bindgen",
|
"repo": "hs-bindgen",
|
||||||
"rev": "fd74e8fa4216eccd67069ec9d8637b57000ffc83",
|
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"libclang-bindings-src": {
|
"libclang-bindings-src": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1765293798,
|
"lastModified": 1768982090,
|
||||||
"narHash": "sha256-fZvyZo5emD1W5LwrIg2zTUYE9StRh3xF8TcuXjzKIAk=",
|
"narHash": "sha256-EgM9ZJvbM0+SQ8f9P27Rnx4dY8Q1fWtGVXsRl5f0Vfk=",
|
||||||
"owner": "well-typed",
|
"owner": "well-typed",
|
||||||
"repo": "libclang",
|
"repo": "libclang",
|
||||||
"rev": "b8305bd9c3e8e8f63d6f415553388be7f233ef45",
|
"rev": "27f20c2e320f779314175ee3e82072fec61b8391",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "well-typed",
|
"owner": "well-typed",
|
||||||
"repo": "libclang",
|
"repo": "libclang",
|
||||||
|
"rev": "27f20c2e320f779314175ee3e82072fec61b8391",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1764947035,
|
"lastModified": 1767364772,
|
||||||
"narHash": "sha256-EYHSjVM4Ox4lvCXUMiKKs2vETUSL5mx+J2FfutM7T9w=",
|
"narHash": "sha256-fFUnEYMla8b7UKjijLnMe+oVFOz6HjijGGNS1l7dYaQ=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "a672be65651c80d3f592a89b3945466584a22069",
|
"rev": "16c7794d0a28b5a37904d55bcca36003b9109aaa",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -73,11 +73,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs-lib": {
|
"nixpkgs-lib": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1761765539,
|
"lastModified": 1765674936,
|
||||||
"narHash": "sha256-b0yj6kfvO8ApcSE+QmA6mUfu8IYG6/uU28OFn4PaC8M=",
|
"narHash": "sha256-k00uTP4JNfmejrCLJOwdObYC9jHRrr/5M/a/8L2EIdo=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "nixpkgs.lib",
|
"repo": "nixpkgs.lib",
|
||||||
"rev": "719359f4562934ae99f5443f20aa06c2ffff91fc",
|
"rev": "2075416fcb47225d9b68ac469a5c4801a9c4dd85",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "nixpkgs/nixpkgs-unstable";
|
nixpkgs.url = "nixpkgs/nixpkgs-unstable";
|
||||||
hs-bindgen.url = "github:well-typed/hs-bindgen/fd74e8fa4216eccd67069ec9d8637b57000ffc83";
|
hs-bindgen.url = "github:well-typed/hs-bindgen";
|
||||||
self.submodules = true;
|
self.submodules = true;
|
||||||
};
|
};
|
||||||
outputs = {
|
outputs = {
|
||||||
|
|||||||
16
generate.sh
16
generate.sh
@@ -1,8 +1,22 @@
|
|||||||
|
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 \
|
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
|
||||||
|
|
||||||
|
|||||||
@@ -12,12 +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
|
||||||
, 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
|
||||||
@@ -36,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
|
||||||
|
|||||||
@@ -1,3 +1,10 @@
|
|||||||
module Main where
|
module Main where
|
||||||
|
|
||||||
|
import qualified Foreign.Ptr (ToFunPtr)
|
||||||
|
|
||||||
|
import qualified RGFW.Generated as RGFW
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = putStrLn "Hello World"
|
main = do
|
||||||
|
putStrLn "Hello World"
|
||||||
|
window <- toFunPtr ()
|
||||||
|
|||||||
Reference in New Issue
Block a user