create new project
This commit is contained in:
parent
e55f035f80
commit
0e751a2896
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build*/
|
31
CMakeLists.txt
Normal file
31
CMakeLists.txt
Normal file
@ -0,0 +1,31 @@
|
||||
cmake_minimum_required(VERSION 3.27)
|
||||
|
||||
project(nf7 C)
|
||||
set(CMAKE_C_STANDARD 23)
|
||||
|
||||
add_subdirectory(thirdparty EXCLUDE_FROM_ALL)
|
||||
|
||||
|
||||
# ---- interface library
|
||||
add_library(nf7if INTERFACE)
|
||||
target_sources(nf7if INTERFACE nf7.h)
|
||||
target_include_directories(nf7if INTERFACE ${PROJECT_SOURCE_DIR})
|
||||
target_compile_options(nf7if INTERFACE
|
||||
$<$<CXX_COMPILER_ID:MSVC>:
|
||||
/W4
|
||||
$<$<CONFIG:Debug>:/WX>
|
||||
>
|
||||
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:
|
||||
-Wall -Wextra -Wpedantic
|
||||
$<$<CONFIG:Debug>:-Werror>
|
||||
>
|
||||
)
|
||||
|
||||
# ---- main executable
|
||||
add_executable(nf7)
|
||||
target_sources(nf7 PRIVATE main.c)
|
||||
target_link_libraries(nf7
|
||||
PRIVATE
|
||||
nf7if
|
||||
uv
|
||||
)
|
19
README.md
Normal file
19
README.md
Normal file
@ -0,0 +1,19 @@
|
||||
Nf7
|
||||
====
|
||||
|
||||
Nf7 is an abstraction layer for Media-programming.
|
||||
The goal is to allow creative activities on any platforms without any differences.
|
||||
|
||||
**UNDER REFACTORING:** Please checkout tag v0.4.1 to see a codebase which works.
|
||||
|
||||
## Build
|
||||
|
||||
```bash
|
||||
$ cmake -B build
|
||||
$ cmake --build build -j4
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
WTFPLv2
|
||||
|
38
main.c
Normal file
38
main.c
Normal file
@ -0,0 +1,38 @@
|
||||
// No copyright
|
||||
#include <stdatomic.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <uv.h>
|
||||
|
||||
#include "nf7.h"
|
||||
|
||||
|
||||
static void cb_close_all_handles_(uv_handle_t*, void*);
|
||||
|
||||
|
||||
int main(int, char**) {
|
||||
// init
|
||||
uv_loop_t uv;
|
||||
if (0 != uv_loop_init(&uv)) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// main loop
|
||||
if (0 != uv_run(&uv, UV_RUN_DEFAULT)) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// teardown
|
||||
uv_walk(&uv, cb_close_all_handles_, NULL);
|
||||
uv_run(&uv, UV_RUN_DEFAULT);
|
||||
if (0 != uv_loop_close(&uv)) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
static void cb_close_all_handles_(uv_handle_t* handle, void*) {
|
||||
uv_close(handle, NULL);
|
||||
}
|
34
nf7.h
Normal file
34
nf7.h
Normal file
@ -0,0 +1,34 @@
|
||||
// No copyright
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
struct nf7;
|
||||
struct nf7_mod;
|
||||
struct nf7_value;
|
||||
|
||||
|
||||
struct nf7 {
|
||||
uint32_t ver;
|
||||
|
||||
struct {
|
||||
void* uv; /* libuv: uv_loop_t */
|
||||
} libs;
|
||||
|
||||
struct {
|
||||
uint32_t n;
|
||||
struct nf7_mod** ptr;
|
||||
} mods;
|
||||
};
|
||||
|
||||
struct nf7_mod {
|
||||
const uint8_t* name;
|
||||
const uint8_t* desc;
|
||||
uint32_t ver;
|
||||
|
||||
void* (*new)(void* ctx);
|
||||
void (*delete)(void* ctx);
|
||||
|
||||
void (*push_lua)(void* ctx);
|
||||
};
|
11
thirdparty/CMakeLists.txt
vendored
Normal file
11
thirdparty/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
include(FetchContent)
|
||||
|
||||
|
||||
# ---- libuv (MIT)
|
||||
FetchContent_Declare(
|
||||
libuv
|
||||
GIT_REPOSITORY https://github.com/libuv/libuv.git
|
||||
GIT_TAG v1.47.0
|
||||
)
|
||||
FetchContent_MakeAvailable(libuv)
|
||||
|
Loading…
Reference in New Issue
Block a user