chore: figure out how to compile everything with C

c-skills
Jef Roosens 2022-11-19 23:53:42 +01:00
parent 3e40eeff2d
commit 32ff120600
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
8 changed files with 29 additions and 2 deletions

View File

@ -3,7 +3,8 @@ SRC_DIR := src
SOURCES != find '$(SRC_DIR)' -iname '*.v'
V_PATH ?= v
V := $(V_PATH) -showcc -gc boehm -W -d use_openssl
# We need to use GCC because TCC doesn't like the way we use C bindings
V := $(V_PATH) -showcc -gc boehm -W -d use_openssl -cc gcc
all: vieter

View File

@ -9,7 +9,7 @@ static char *ignored_names[5] = {
};
static int ignored_words_len = sizeof(ignored_names) / sizeof(char *);
inline Pkg *package_init() {
Pkg *package_init() {
return calloc(sizeof(PkgInfo), 1);
}

View File

@ -0,0 +1,13 @@
module package
#flag -I @VMODROOT/c
// We need to specify *every* C file here. Otherwise, Vieter doesn't compile.
#flag @VMODROOT/c/package.o
#flag @VMODROOT/c/package_info.o
#include "package.h"
struct C.Pkg{}
fn C.package_read_archive(pkg_path &char) &C.pkg

View File

@ -0,0 +1,3 @@
Module{
name: 'package'
}

View File

@ -0,0 +1,7 @@
module util
#flag -I @VMODROOT/c
// This makes the V compiler include this object file when linking, allowing
// all other C parts of the codebase to use it as well.
#flag @VMODROOT/c/dynarray.o

3
src/util/v.mod 100644
View File

@ -0,0 +1,3 @@
Module{
name: 'util'
}