feat: added example
This commit is contained in:
parent
5afb5cd843
commit
0555ba6253
3 changed files with 21 additions and 1 deletions
|
|
@ -2,8 +2,13 @@ cmake_minimum_required(VERSION 3.5)
|
|||
project(onus VERSION 0.1 LANGUAGES C)
|
||||
|
||||
option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
|
||||
option(ONUS_BUILD_EXAMPLES "Build examples" OFF)
|
||||
|
||||
set(CMAKE_C_STANDARD 90)
|
||||
|
||||
add_subdirectory(pkg/common)
|
||||
add_subdirectory(pkg/fs)
|
||||
add_subdirectory(pkg/fs)
|
||||
|
||||
if(ONUS_BUILD_EXAMPLES)
|
||||
add_subdirectory(examples/cache)
|
||||
endif()
|
||||
3
examples/cache/CMakeLists.txt
vendored
Normal file
3
examples/cache/CMakeLists.txt
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
add_executable(test_cache)
|
||||
target_sources(test_cache PRIVATE src/main.c)
|
||||
target_link_libraries(test_cache PRIVATE onus::fs)
|
||||
12
examples/cache/src/main.c
vendored
Normal file
12
examples/cache/src/main.c
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
#include <linux/limits.h>
|
||||
#include "onus/fs.h"
|
||||
|
||||
int main() {
|
||||
char tmp[PATH_MAX];
|
||||
int status = onus_fs_make_tmp(tmp, sizeof(tmp), NULL);
|
||||
printf("Got status: %d. Path: %s\n", status, tmp);
|
||||
// onus_fs_del_tmp(tmp);
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue