initial Julia test

This commit is contained in:
Simeon Schaub 2021-06-17 11:56:14 +02:00
parent 3d00746904
commit 2630a7dfe4
No known key found for this signature in database
GPG Key ID: EB2EE6B6F3725876
3 changed files with 18 additions and 3 deletions

View File

@ -65,7 +65,7 @@ static const int natural_scrolling = 0;
static const char *termcmd[] = { "alacritty", NULL };
static const char *menucmd[] = { "bemenu-run", NULL };
static const Key keys[] = {
const Key keys[] = {
/* Note that Shift changes certain key codes: c -> C, 2 -> at, etc. */
/* modifier key function argument */
{ MODKEY, XKB_KEY_p, spawn, {.v = menucmd} },

View File

@ -2,7 +2,14 @@
PREFIX = /usr/local
# Default compile flags (overridable by environment)
CFLAGS ?= -g -Wall -Wextra -Werror -Wno-unused-parameter -Wno-sign-compare -Wno-unused-function -Wno-unused-variable -Wdeclaration-after-statement
#CFLAGS ?= -g -Wall -Wextra -Werror -Wno-unused-parameter -Wno-sign-compare -Wno-unused-function -Wno-unused-variable -Wdeclaration-after-statement
# Uncomment to build XWayland support
#CFLAGS += -DXWAYLAND
CFLAGS += -DXWAYLAND
JL_BIN = ./julia/julia
JL_SHARE = $(shell $(JL_BIN) -e 'print(joinpath(Sys.BINDIR, Base.DATAROOTDIR, "julia"))')
CFLAGS += $(shell $(JL_BIN) $(JL_SHARE)/julia-config.jl --cflags)
CXXFLAGS += $(shell $(JL_BIN) $(JL_SHARE)/julia-config.jl --cflags)
LDFLAGS += $(shell $(JL_BIN) $(JL_SHARE)/julia-config.jl --ldflags)
LDLIBS += $(shell $(JL_BIN) $(JL_SHARE)/julia-config.jl --ldlibs)

8
dwl.c
View File

@ -48,6 +48,9 @@
#include <wlr/xwayland.h>
#endif
#include <julia.h>
JULIA_DEFINE_FAST_TLS // only define this once, in an executable (not in a shared library) if you want fast code.
/* macros */
#define BARF(fmt, ...) do { fprintf(stderr, fmt "\n", ##__VA_ARGS__); exit(EXIT_FAILURE); } while (0)
#define EBARF(fmt, ...) BARF(fmt ": %s", ##__VA_ARGS__, strerror(errno))
@ -2571,6 +2574,10 @@ main(int argc, char *argv[])
if (optind < argc)
goto usage;
/* required: setup the Julia context */
jl_init();
jl_eval_string("@show(cglobal(:keys))");
// Wayland requires XDG_RUNTIME_DIR for creating its communications
// socket
if (!getenv("XDG_RUNTIME_DIR"))
@ -2578,6 +2585,7 @@ main(int argc, char *argv[])
setup();
run(startup_cmd);
cleanup();
jl_atexit_hook(0);
return EXIT_SUCCESS;
usage: