Skip to content

Commit

Permalink
Restructure c_src tree
Browse files Browse the repository at this point in the history
c_src/
├── device/
│   ├── cairo/
│   │   ├── cairo_common.c
│   │   ├── cairo_ctx.h
│   │   ├── cairo_fb.c
│   │   ├── cairo_fb.c.new
│   │   ├── cairo_font_ops.c
│   │   ├── cairo_gtk.c
│   │   ├── cairo_image_ops.c
│   │   └── cairo_script_ops.c
│   ├── device.h
│   └── nvg/
│       ├── bcm.c
│       ├── drm.c
│       ├── glfw.c
│       ├── gl_helpers.c
│       ├── nanovg/
│       │   ├── LICENSE.txt
│       │   ├── nanovg.c
│       │   ├── nanovg_gl.h
│       │   ├── nanovg_gl_utils.h
│       │   └── nanovg.h
│       ├── nvg_font_ops.c
│       ├── nvg_image_ops.c
│       └── nvg_script_ops.c
├── font/
│   ├── font.c
│   ├── font.h
│   ├── font_ops.h
│   ├── fontstash.h
│   └── stb_truetype.h
├── image/
│   ├── image.c
│   ├── image.h
│   ├── image_ops.h
│   └── stb_image.h
├── main.c
├── scenic/
│   ├── common.h
│   ├── comms.c
│   ├── comms.h
│   ├── scenic_ops.c
│   ├── scenic_ops.h
│   ├── scenic_types.h
│   ├── script.c
│   ├── script.h
│   ├── script_ops.c
│   ├── script_ops.h
│   ├── unix_comms.c
│   ├── unix_comms.h
│   ├── utils.c
│   └── utils.h
└── tommyds/
  • Loading branch information
ringlej committed Sep 30, 2023
1 parent d671be2 commit 20a05e0
Show file tree
Hide file tree
Showing 25 changed files with 56 additions and 58 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
36 changes: 18 additions & 18 deletions c_src/nanovg/LICENSE.txt → c_src/device/nvg/nanovg/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
Copyright (c) 2013 Mikko Mononen [email protected]
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Copyright (c) 2013 Mikko Mononen [email protected]

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.

Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

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 20a05e0

Please sign in to comment.