🎉 C meson project.

main
bog 2023-12-07 20:16:58 +01:00
parent 2da5939d81
commit e434d5c4ae
7 changed files with 85 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*~*
*\#*
.cache
build

19
Makefile Normal file
View File

@ -0,0 +1,19 @@
.PHONY: build tests
build:
meson setup build
meson compile -C build
tests: build
build/roza-tests
install: build
meson install -C build
check:
@cppcheck --language=c --enable=all lib src -q \
--suppress=missingIncludeSystem
@cppcheck --language=c --enable=all tests/units -q \
--suppress=missingIncludeSystem \
--suppress=unusedFunction

0
doc/roza.bnf Normal file
View File

6
lib/conf.in.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef RZ_CONF_IN_H
#define RZ_CONF_IN_H
#define ROZA_VERSION "@version@"
#endif

43
meson.build Normal file
View File

@ -0,0 +1,43 @@
project(
'roza',
'c',
version: '0.0.0'
)
conf = configuration_data()
conf.set('version', meson.project_version())
configure_file(
input: 'lib/conf.in.h',
output: 'conf.h',
configuration: conf
)
roza_lib = static_library(
'roza',
sources: [
]
)
roza_dep = declare_dependency(
link_with: roza_lib,
include_directories: ['lib']
)
executable('roza',
sources: [
'src/main.c'
],
dependencies: [
roza_dep
],
install: true)
executable('roza-tests',
sources: [
'tests/units/trivial.c'
],
dependencies: [
roza_dep,
dependency('criterion')
])

8
src/main.c Normal file
View File

@ -0,0 +1,8 @@
#include <stdio.h>
#include <conf.h>
int main()
{
printf("Roza v%s\n", ROZA_VERSION);
return 0;
}

5
tests/units/trivial.c Normal file
View File

@ -0,0 +1,5 @@
#include <criterion/criterion.h>
Test(trivial, trivial) {
cr_assert(1 + 1 == 2);
}