Skip to content

Commit 1b1df0f

Browse files
committed
feat: add unified rix facade
1 parent 28b289e commit 1b1df0f

13 files changed

Lines changed: 369 additions & 264 deletions

File tree

.gitignore

Lines changed: 6 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,12 @@
1-
# Prerequisites
2-
*.d
1+
build*/
2+
.vix/
3+
.cache/
34

4-
# Compiled Object files
5-
*.slo
6-
*.lo
75
*.o
86
*.obj
9-
10-
# Precompiled Headers
11-
*.gch
12-
*.pch
13-
14-
# Linker files
15-
*.ilk
16-
17-
# Debugger Files
18-
*.pdb
19-
20-
# Compiled Dynamic libraries
21-
*.so
22-
*.dylib
23-
*.dll
24-
25-
# Fortran module files
26-
*.mod
27-
*.smod
28-
29-
# Compiled Static libraries
30-
*.lai
31-
*.la
327
*.a
338
*.lib
34-
35-
# Executables
9+
*.so
10+
*.dll
11+
*.dylib
3612
*.exe
37-
*.out
38-
*.app
39-
40-
# debug information files
41-
*.dwo
42-
build-ninja/
43-
build/
44-
docker/
45-
.github/
46-
infra/
47-
scripts/
48-
db.sql
49-
.env
50-
vix.log
51-
configs/
52-
docs/
53-
cmd.md
54-
.vscode/

CMakeLists.txt

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
cmake_minimum_required(VERSION 3.20)
2+
3+
project(rix
4+
VERSION 0.1.0
5+
DESCRIPTION "Unified Rix facade for Vix C++ projects"
6+
LANGUAGES CXX
7+
)
8+
9+
option(RIX_BUILD_EXAMPLES "Build Rix examples" ON)
10+
option(RIX_BUILD_TESTS "Build Rix tests" ON)
11+
12+
include(${CMAKE_CURRENT_SOURCE_DIR}/.vix/vix_deps.cmake OPTIONAL)
13+
14+
add_library(rix INTERFACE)
15+
add_library(rix::rix ALIAS rix)
16+
17+
target_compile_features(rix INTERFACE cxx_std_20)
18+
19+
target_include_directories(rix
20+
INTERFACE
21+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
22+
$<INSTALL_INTERFACE:include>
23+
)
24+
25+
target_link_libraries(rix
26+
INTERFACE
27+
rix::csv
28+
)
29+
30+
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
31+
if(RIX_BUILD_EXAMPLES)
32+
add_subdirectory(examples)
33+
endif()
34+
35+
if(RIX_BUILD_TESTS)
36+
enable_testing()
37+
add_subdirectory(tests)
38+
endif()
39+
endif()

Makefile

Lines changed: 0 additions & 216 deletions
This file was deleted.

examples/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
add_executable(rix_basic
2+
basic.cpp
3+
)
4+
5+
target_link_libraries(rix_basic
6+
PRIVATE
7+
rix::rix
8+
)

examples/basic.cpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/**
2+
* @file basic.cpp
3+
* @brief Basic example for the Rix facade.
4+
*/
5+
6+
#include <rix.hpp>
7+
8+
#include <iostream>
9+
#include <string>
10+
11+
namespace
12+
{
13+
void run_basic_example()
14+
{
15+
const std::string input =
16+
"name,language\n"
17+
"Ada,C++\n"
18+
"Gaspard,Vix\n";
19+
20+
const auto table = rix.csv.parse(input);
21+
22+
for (const auto &row : table)
23+
{
24+
for (const auto &field : row)
25+
{
26+
std::cout << field << ' ';
27+
}
28+
29+
std::cout << '\n';
30+
}
31+
}
32+
}
33+
34+
int main()
35+
{
36+
run_basic_example();
37+
return 0;
38+
}

0 commit comments

Comments
 (0)