Skip to content

Commit

Permalink
Merge pull request #51 from gridpoint-com/jringle/restructure-c_src
Browse files Browse the repository at this point in the history
Cairo support, pt 2 of 3.
  • Loading branch information
crertel authored Oct 7, 2023
2 parents 1a3ceba + 70286a8 commit 653bd98
Show file tree
Hide file tree
Showing 25 changed files with 38 additions and 40 deletions.
52 changes: 26 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,24 @@ TOMMYDS_SRCS = \

SCENIC_SRCS = \
c_src/scenic/comms.c \
c_src/scenic/ops/scenic_ops.c \
c_src/scenic/ops/script_ops.c \
c_src/scenic/scenic_ops.c \
c_src/scenic/script_ops.c \
c_src/scenic/script.c \
c_src/scenic/unix_comms.c \
c_src/scenic/utils.c

NVG_COMMON_SRCS = \
c_src/device/nvg/gl_helpers.c \
c_src/device/nvg/nanovg/nanovg.c \
c_src/device/nvg/nvg_font_ops.c \
c_src/device/nvg/nvg_image_ops.c \
c_src/device/nvg/nvg_script_ops.c

CAIRO_COMMON_SRCS = \
c_src/device/cairo/cairo_font_ops.c \
c_src/device/cairo/cairo_image_ops.c \
c_src/device/cairo/cairo_script_ops.c

ifeq ($(SCENIC_LOCAL_TARGET),glfw)
CFLAGS = -O3 -std=c99

Expand Down Expand Up @@ -85,25 +97,17 @@ ifeq ($(SCENIC_LOCAL_TARGET),glfw)
endif

DEVICE_SRCS += \
c_src/device/glfw.c \
c_src/device/gl_helpers.c \
c_src/nanovg/nanovg.c
FONT_SRCS += c_src/font/nvg_font_ops.c
IMAGE_SRCS += c_src/image/nvg_image_ops.c
SCENIC_SRCS += c_src/scenic/ops/nvg_script_ops.c
$(NVG_COMMON_SRCS) \
c_src/device/nvg/glfw.c

else ifeq ($(SCENIC_LOCAL_TARGET),bcm)
LDFLAGS += -lGLESv2 -lEGL -lm -lvchostif -lbcm_host
CFLAGS ?= -O2 -Wall -Wextra -Wno-unused-parameter -pedantic
CFLAGS += -std=gnu99

DEVICE_SRCS += \
c_src/device/bcm.c \
c_src/device/gl_helpers.c \
c_src/nanovg/nanovg.c
FONT_SRCS += c_src/font/nvg_font_ops.c
IMAGE_SRCS += c_src/image/nvg_image_ops.c
SCENIC_SRCS += c_src/scenic/ops/nvg_script_ops.c
$(NVG_COMMON_SRCS) \
c_src/device/nvg/bcm.c

ifeq ($(SCENIC_LOCAL_GL),gles2)
CFLAGS += -DSCENIC_GLES2
Expand All @@ -119,29 +123,26 @@ else ifeq ($(SCENIC_LOCAL_TARGET),drm)
CFLAGS += -fPIC -I$(NERVES_SDK_SYSROOT)/usr/include/drm

DEVICE_SRCS += \
c_src/device/drm.c \
c_src/device/gl_helpers.c \
c_src/nanovg/nanovg.c
FONT_SRCS += c_src/font/nvg_font_ops.c
IMAGE_SRCS += c_src/image/nvg_image_ops.c
SCENIC_SRCS += c_src/scenic/ops/nvg_script_ops.c
$(NVG_COMMON_SRCS) \
c_src/device/nvg/drm.c

ifeq ($(SCENIC_LOCAL_GL),gles2)
CFLAGS += -DSCENIC_GLES2
else
CFLAGS += -DSCENIC_GLES3
endif
else ifeq ($(SCENIC_LOCAL_TARGET),cairo)

else ifeq ($(SCENIC_LOCAL_TARGET),cairo-fb)
LDFLAGS += `pkg-config --static --libs freetype2 cairo`
CFLAGS += `pkg-config --static --cflags freetype2 cairo`
LDFLAGS += -lm
CFLAGS ?= -O2 -Wall -Wextra -Wno-unused-parameter -pedantic
CFLAGS += -std=gnu99

DEVICE_SRCS += c_src/device/cairo.c
FONT_SRCS += c_src/font/cairo_font_ops.c
IMAGE_SRCS += c_src/image/cairo_image_ops.c
SCENIC_SRCS += c_src/scenic/ops/cairo_script_ops.c
DEVICE_SRCS += \
$(CAIRO_COMMON_SRCS) \
c_src/device/cairo/cairo_fb.c

else
$(info ------ no SCENIC_LOCAL_TARGET set ------)
$(info If you get here, then you are probably using a custom Nerves system)
Expand Down Expand Up @@ -173,7 +174,6 @@ CFLAGS += \
-Ic_src/device \
-Ic_src/font \
-Ic_src/image \
-Ic_src/nanovg \
-Ic_src/scenic \
-Ic_src/tommyds/src

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <cairo.h>
#include <ft2build.h>
#include FT_FREETYPE_H
#include "ops/script_ops.h"
#include "script_ops.h"

typedef struct {
cairo_pattern_t* fill;
Expand Down
1 change: 0 additions & 1 deletion c_src/device/cairo.c → c_src/device/cairo/cairo_fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "comms.h"
#include "device.h"
#include "fontstash.h"
#include "ops/script_ops.h"

const char* device = "/dev/fb0";

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions c_src/device/bcm.c → c_src/device/nvg/bcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
#include <EGL/eglext.h>

#define NANOVG_GLES2_IMPLEMENTATION
#include "nanovg.h"
#include "nanovg_gl.h"
#include "nanovg/nanovg.h"
#include "nanovg/nanovg_gl.h"

#include "scenic_types.h"
#include "comms.h"
Expand Down
4 changes: 2 additions & 2 deletions c_src/device/drm.c → c_src/device/nvg/drm.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
#define NANOVG_GLES3_IMPLEMENTATION
#endif
#include <EGL/egl.h>
#include "nanovg.h"
#include "nanovg_gl.h"
#include "nanovg/nanovg.h"
#include "nanovg/nanovg_gl.h"

#include "scenic_types.h"
#include "comms.h"
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions c_src/device/glfw.c → c_src/device/nvg/glfw.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#include <GLFW/glfw3.h>

#define NANOVG_GL2_IMPLEMENTATION
#include "nanovg.h"
#include "nanovg_gl.h"
#include "nanovg/nanovg.h"
#include "nanovg/nanovg_gl.h"

#include "scenic_types.h"
#include "utils.h"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "font_ops.h"
#include "nanovg.h"
#include "nanovg/nanovg.h"

int32_t font_ops_create(void* v_ctx, font_t* p_font, uint32_t size)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "comms.h"
#include "image_ops.h"
#include "nanovg.h"
#include "nanovg/nanovg.h"

#define REPEAT_XY (NVG_IMAGE_REPEATX | NVG_IMAGE_REPEATY)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "image.h"
#include "script_ops.h"
#include "scenic_types.h"
#include "nanovg.h"
#include "nanovg/nanovg.h"

extern device_opts_t g_opts;

Expand Down
1 change: 0 additions & 1 deletion c_src/font/font.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#pragma once

#include "scenic_types.h"
#include "nanovg.h"
#include "font_ops.h"

void init_fonts(void);
Expand Down
2 changes: 1 addition & 1 deletion c_src/scenic/comms.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The caller will typically be erlang, so use the 2-byte length indicator
#include "device.h"
#include "font.h"
#include "image.h"
#include "ops/scenic_ops.h"
#include "scenic_ops.h"
#include "script.h"
#include "utils.h"

Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion c_src/scenic/script.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "comms.h"
#include "font.h"
#include "image.h"
#include "ops/script_ops.h"
#include "script_ops.h"
#include "script.h"
#include "utils.h"

Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 653bd98

Please sign in to comment.