Skip to content

Commit a211422

Browse files
committed
Merge branch 'dev'
2 parents 249d696 + 044da6b commit a211422

File tree

13 files changed

+244
-0
lines changed

13 files changed

+244
-0
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# 🧠 Changelog — vix-ai-core
2+
3+
Ce fichier suit les changements majeurs du module **vix-ai-core**.
4+
Le format est inspiré de [Keep a Changelog](https://keepachangelog.com/fr/1.0.0/)
5+
et respecte le [Semantic Versioning](https://semver.org/lang/fr/).
6+
7+
---
8+
9+
## [v0.1.0] — 2025-11-05
10+
### 🚀 Initial release
11+
- Initialisation du module **vix-ai-core**
12+
- Ajout des dossiers `include/`, `src/`, `scripts/`, `CMakeLists.txt`, et `Makefile`
13+
- Première intégration avec le projet parent **vix-ai**

CMakeLists.txt

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Core library
2+
add_library(vix_ai_core
3+
src/Version.cpp
4+
src/Tensor.cpp
5+
src/Device.cpp
6+
src/Engine.cpp
7+
)
8+
9+
add_library(Vix::AI::core ALIAS vix_ai_core)
10+
11+
# Public headers
12+
target_include_directories(vix_ai_core
13+
PUBLIC
14+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
15+
$<INSTALL_INTERFACE:include>
16+
)
17+
18+
# Compile features
19+
target_compile_features(vix_ai_core PUBLIC cxx_std_20)
20+
21+
# Simple compile definitions (version)
22+
set(VIX_AI_CORE_VERSION "0.1.0")
23+
target_compile_definitions(vix_ai_core PUBLIC VIX_AI_CORE_VERSION="${VIX_AI_CORE_VERSION}")
24+
25+
# Install rules (optional but nice)
26+
include(GNUInstallDirs)
27+
install(TARGETS vix_ai_core
28+
EXPORT vix_ai_coreTargets
29+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
30+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
31+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
32+
)
33+
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
34+
install(EXPORT vix_ai_coreTargets
35+
FILE vix_ai_coreTargets.cmake
36+
NAMESPACE Vix::AI::
37+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/vix_ai_core
38+
)

Makefile

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
VERSION ?= v0.1.0
2+
BRANCH_DEV = dev
3+
BRANCH_MAIN = main
4+
5+
.PHONY: help release commit push merge tag test changelog
6+
7+
help:
8+
@echo "Available commands:"
9+
@echo " make commit - Add and commit all files (on $(BRANCH_DEV) branch)"
10+
@echo " make push - Push the $(BRANCH_DEV) branch"
11+
@echo " make merge - Merge $(BRANCH_DEV) into $(BRANCH_MAIN)"
12+
@echo " make tag VERSION=vX.Y.Z - Create and push a Git tag (default: $(VERSION))"
13+
@echo " make release VERSION=vX.Y.Z - Full release: changelog + commit + push + merge + tag"
14+
@echo " make test - Compile and run tests"
15+
@echo " make changelog - Update CHANGELOG.md using script"
16+
17+
commit:
18+
git checkout $(BRANCH_DEV)
19+
@if [ -n "$$(git status --porcelain)" ]; then \
20+
echo "📝 Committing changes..."; \
21+
git add .; \
22+
git commit -m "chore(release): prepare $(VERSION)"; \
23+
else \
24+
echo "✅ Nothing to commit."; \
25+
fi
26+
27+
push:
28+
git push origin $(BRANCH_DEV)
29+
30+
merge:
31+
git checkout $(BRANCH_MAIN)
32+
git merge --no-ff --no-edit $(BRANCH_DEV)
33+
git push origin $(BRANCH_MAIN)
34+
35+
tag:
36+
@if git rev-parse $(VERSION) >/dev/null 2>&1; then \
37+
echo "❌ Tag $(VERSION) already exists."; \
38+
exit 1; \
39+
else \
40+
echo "🏷️ Creating annotated tag $(VERSION)..."; \
41+
git tag -a $(VERSION) -m "Release version $(VERSION)"; \
42+
git push origin $(VERSION); \
43+
fi
44+
45+
release:
46+
make changelog
47+
make commit
48+
make push
49+
make merge
50+
make tag VERSION=$(VERSION)
51+
52+
test:
53+
cd build && ctest --output-on-failure
54+
55+
changelog:
56+
bash scripts/update_changelog.sh

include/vix/ai/core/Device.hpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#pragma once
2+
#include <string>
3+
4+
namespace vix::ai::core
5+
{
6+
7+
enum class DeviceType
8+
{
9+
CPU,
10+
CUDA
11+
};
12+
13+
class Device
14+
{
15+
public:
16+
explicit Device(DeviceType type = DeviceType::CPU) : type_(type) {}
17+
DeviceType type() const noexcept { return type_; }
18+
std::string name() const { return type_ == DeviceType::CPU ? "cpu" : "cuda"; }
19+
20+
private:
21+
DeviceType type_{};
22+
};
23+
24+
} // namespace vix::ai::core

include/vix/ai/core/Engine.hpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#pragma once
2+
#include <string>
3+
#include <memory>
4+
#include "Tensor.hpp"
5+
#include "Device.hpp"
6+
7+
namespace vix::ai::core
8+
{
9+
10+
class Engine
11+
{
12+
public:
13+
Engine() = default;
14+
explicit Engine(Device dev) : device_(std::move(dev)) {}
15+
16+
const Device &device() const noexcept { return device_; }
17+
18+
// hyper basique: "compute" renvoie une string informative
19+
std::string compute(const Tensor &t) const
20+
{
21+
(void)t; // unused for now
22+
return std::string{"Engine["} + device().name() + "] ok";
23+
}
24+
25+
private:
26+
Device device_{}; // default CPU
27+
};
28+
29+
} // namespace vix::ai::core

include/vix/ai/core/Tensor.hpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#pragma once
2+
#include <cstddef>
3+
#include <vector>
4+
5+
namespace vix::ai::core
6+
{
7+
8+
class Tensor
9+
{
10+
public:
11+
Tensor() = default;
12+
explicit Tensor(std::vector<std::size_t> shape)
13+
: shape_(std::move(shape)) {}
14+
15+
const std::vector<std::size_t> &shape() const noexcept { return shape_; }
16+
std::size_t rank() const noexcept { return shape_.size(); }
17+
18+
private:
19+
std::vector<std::size_t> shape_{};
20+
};
21+
22+
} // namespace vix::ai::core

include/vix/ai/core/Version.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#pragma once
2+
3+
namespace vix::ai::core
4+
{
5+
inline constexpr const char *version() noexcept
6+
{
7+
return VIX_AI_CORE_VERSION; // provided by target_compile_definitions
8+
}
9+
}

scripts/changelog-release.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
echo "Version ? (ex: 0.1.1)"
4+
read VERSION
5+
TODAY=$(date +%F)
6+
7+
echo -e "## [$VERSION] - $TODAY\n### Added\n- \n\n### Changed\n- \n\n### Removed\n- \n\n" | cat - CHANGELOG.md > temp && mv temp CHANGELOG.md

scripts/update_changelog.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
3+
CHANGELOG_FILE="CHANGELOG.md"
4+
5+
echo "📝 Entrez la nouvelle version (ex: 0.1.1) :"
6+
read VERSION
7+
8+
if grep -q "## \[$VERSION\]" "$CHANGELOG_FILE"; then
9+
echo "❌ La version $VERSION existe déjà dans le changelog."
10+
exit 1
11+
fi
12+
13+
TODAY=$(date +%F)
14+
15+
if [ ! -f "$CHANGELOG_FILE" ]; then
16+
echo "❌ Le fichier $CHANGELOG_FILE n'existe pas."
17+
exit 1
18+
fi
19+
20+
NEW_ENTRY="## [$VERSION] - $TODAY
21+
22+
### Added
23+
-
24+
25+
### Changed
26+
-
27+
28+
### Removed
29+
-
30+
"
31+
32+
awk -v new_entry="$NEW_ENTRY" '
33+
BEGIN { inserted=0 }
34+
/## \[Unreleased\]/ && !inserted {
35+
print $0 "\n" new_entry
36+
inserted=1
37+
next
38+
}
39+
{ print }
40+
' "$CHANGELOG_FILE" > "$CHANGELOG_FILE.tmp" && mv "$CHANGELOG_FILE.tmp" "$CHANGELOG_FILE"
41+
42+
echo "✅ Bloc version $VERSION ajouté dans $CHANGELOG_FILE."

src/Device.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "vix/ai/core/Device.hpp"

0 commit comments

Comments
 (0)