Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

made it install via github cleanly at least on my machine #8

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
49 changes: 0 additions & 49 deletions CMakeLists.txt

This file was deleted.

21 changes: 21 additions & 0 deletions doc-me-this.janet
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env janet
(import janetui :as ui)

(defn main [& args]
(let [w (ui/window "doc-me-this" 500 250 true)
outerbox (ui/vertical-box)
entrybox (ui/search-entry )
biglabel (ui/multiline-entry)]
(ui/entry/on-changed entrybox |(let [entry (ui/entry/text entrybox)
doctext (let [buffer (buffer/new 4096)]
(with-dyns [*out* buffer]
(when (> (length entry) 0)
(doc* entry)
(doc* (symbol entry))))
(string buffer))]
(ui/multiline-entry/text biglabel doctext)))
(ui/box/append outerbox entrybox)
(ui/box/append outerbox biglabel true)
(ui/window/set-child w outerbox)
(ui/show w))
(ui/main))
2 changes: 1 addition & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* IN THE SOFTWARE.
*/

#include <janet/janet.h>
#include <janet.h>

#include <string.h>
#include <stdlib.h>
Expand Down
46 changes: 38 additions & 8 deletions project.janet
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,43 @@
:url "https://github.com/janet-lang/janetui"
:repo "https://github.com/janet-lang/janetui.git")

(rule "build/janetui.so" ["CMakeLists.txt"]
(do
(os/mkdir "build")
(os/cd "build")
(os/execute ["cmake" ".."] :p)
(assert
# build with --workers=1

(def o (os/which))

(defn buildwithcmake []
(do
(os/cd "libui")
## need to make this error more verbose
(assert
(and
(zero?
(os/execute ["make"] :p)))))
(os/execute ["cmake" "-B" "build" "-DBUILD_SHARED_LIBS=OFF"] :p))
(zero?
(os/execute ["cmake" "--build" "build"] :p))) "! use jpm build --workers=1 !")
(os/cd "..")))

(rule "libui/build/out/libui.a" ["libui"] (buildwithcmake))

(add-dep "build" "libui/build/out/libui.a")

(declare-native
:name "janetui"
:source ["main.c"]
:cflags [;default-cflags ;(case o
:macos '["-Ilibui" "-Ilibui/darwin"]
:windows '["-Ilibui" "-Ilibui/windows" ]
#default
'["-Ilibui" "-Ilibui/unix"])]
:lflags [;default-lflags ;(case o
:linux '[ "libui/build/out/libui.a" "-lglib-2.0" "-lgtk-3" "-lgdk-3"]
#default
'[ "libui/build/out/libui.a" "-lglib-2.0" "-lgtk-3" "-lgdk-3"])])

(add-dep "build" "build/janetui.so")
(comment
(declare-executable
:name "doc-me-this"
:entry "doc-me-this.janet"
:install false
:deps [(native-module :static)])
)
2 changes: 1 addition & 1 deletion test.janet
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env janet

(import build/libjanetui :as ui)
(import ./build/janetui :as ui)

(def menu (ui/menu "File"))

Expand Down