adding meson build

This commit is contained in:
Arthur Barraux
2025-09-19 11:02:44 +02:00
parent 19601a0078
commit 91e247d1de
5 changed files with 65 additions and 32 deletions
+3
View File
@@ -0,0 +1,3 @@
[submodule "lisp-interpreter"]
path = lisp-interpreter
url = https://github.com/justinmeiners/lisp-interpreter.git
-32
View File
@@ -1,32 +0,0 @@
##
# TEST
#
# @file
# @version 0.1
BELUGA_OUTPUT=bin
BUILD_FLAGS=-Wall -Wextra -pedantic
build: main.c src/*
if [ ! -d $(BELUGA_OUTPUT) ]; then mkdir $(BELUGA_OUTPUT); fi
$(CC) main.c -o $(BELUGA_OUTPUT)/beluga src/* $(BUILD_FLAGS)
DEBUG_FLAGS=-Wall -Wextra -pedantic -Werror -fsanitize=address -g
debug: main.c src/*
if [ ! -d $(BELUGA_OUTPUT) ]; then mkdir $(BELUGA_OUTPUT); fi
$(CC) main.c -o $(BELUGA_OUTPUT)/beluga src/* $(DEBUG_FLAGS)
doc:
if [ ! -d doc/ ]; then mkdir doc; fi
doxygen
clean:
rm -r $(BELUGA_OUTPUT)
rm -rf doc/
rm -rf tmp/
all: build doc
# end
+1
Submodule lisp-interpreter added at 366bfb9bdb
+56
View File
@@ -0,0 +1,56 @@
project('editor', 'c',
version : '1.0.0',
default_options : [
'warning_level=2',
'c_std=c99'
]
)
# Check if we're using Clang and add Clang-specific options
cc = meson.get_compiler('c')
if cc.get_id() == 'clang'
add_project_arguments([
'-Wextra',
'-Wpedantic',
'-Wno-unused-parameter',
'-fcolor-diagnostics' # Colored output
], language : 'c')
# Add debug options for debug builds
if get_option('buildtype') == 'debug'
add_project_arguments([
'-fsanitize=address', # AddressSanitizer
'-fsanitize=undefined', # UndefinedBehaviorSanitizer
'-g3', # Full debug info
'-O0' # No optimization
], language : 'c')
add_project_link_arguments([
'-fsanitize=address',
'-fsanitize=undefined'
], language : 'c')
endif
endif
# Include directory
inc_dir = include_directories('include')
# Source files
src_files = files(
'main.c',
'src/append_buffer.c',
'src/editor_op.c',
'src/file_io.c',
'src/init.c',
'src/input.c',
'src/output.c',
'src/row_op.c',
'src/terminal.c'
)
# Executable
executable('editor',
src_files,
include_directories : inc_dir,
install : true
)
+5
View File
@@ -8,6 +8,11 @@
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
extern char *strdup(const char *);
extern ssize_t getline(char **restrict lineptr, size_t *restrict n,
FILE *restrict stream);
extern int ftruncate(int fd, off_t length);
char *editorRowsToString(struct editorConfig *E, int *buffer_len) { char *editorRowsToString(struct editorConfig *E, int *buffer_len) {
int tot_len = 0; int tot_len = 0;
int j; int j;