Skip to content
Snippets Groups Projects
Commit 824df143 authored by Cyril Moineau's avatar Cyril Moineau Committed by Maxence Naud
Browse files

Update backend_cpu with aidge_core!277

parent 7e5f09c4
No related branches found
No related tags found
1 merge request!132[UPD] version 0.4.1 -> 0.5.0
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
# C++ Build # C++ Build
build*/ build*/
install*/ install*/
include/aidge/backend/cpu_version.h
# VSCode # VSCode
.vscode .vscode
......
...@@ -3,15 +3,18 @@ set(CXX_STANDARD 14) ...@@ -3,15 +3,18 @@ set(CXX_STANDARD 14)
file(STRINGS "${CMAKE_SOURCE_DIR}/version.txt" version) file(STRINGS "${CMAKE_SOURCE_DIR}/version.txt" version)
# Parse version.txt to retrieve Major, Minor and Path
string(REGEX MATCH "([0-9]+\\.[0-9]+\\.[0-9]+)" _ MATCHES ${version})
set(PROJECT_VERSION_MAJOR ${CMAKE_MATCH_1})
set(PROJECT_VERSION_MINOR ${CMAKE_MATCH_2})
set(PROJECT_VERSION_PATCH ${CMAKE_MATCH_3})
project(aidge_backend_cpu project(aidge_backend_cpu
VERSION ${version} VERSION ${version}
DESCRIPTION "CPU implementations of the operators of aidge framework." DESCRIPTION "CPU implementations of the operators of aidge framework."
LANGUAGES CXX) LANGUAGES CXX)
message(STATUS "Project name: ${CMAKE_PROJECT_NAME}") # Retrieve latest git commit
message(STATUS "Project version: ${version}")
add_definitions(-DPROJECT_VERSION="${version}")
execute_process( execute_process(
COMMAND git rev-parse --short HEAD COMMAND git rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
...@@ -19,8 +22,10 @@ execute_process( ...@@ -19,8 +22,10 @@ execute_process(
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET ERROR_QUIET
) )
message(STATUS "Project name: ${CMAKE_PROJECT_NAME}")
message(STATUS "Project version: ${version}")
message(STATUS "Latest git commit: ${GIT_COMMIT_HASH}") message(STATUS "Latest git commit: ${GIT_COMMIT_HASH}")
add_definitions(-DGIT_COMMIT_HASH="${GIT_COMMIT_HASH}")
# helper for LSP users # helper for LSP users
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
...@@ -115,6 +120,13 @@ if(CMAKE_COMPILER_IS_GNUCXX AND COVERAGE) ...@@ -115,6 +120,13 @@ if(CMAKE_COMPILER_IS_GNUCXX AND COVERAGE)
append_coverage_compiler_flags() append_coverage_compiler_flags()
endif() endif()
message(STATUS "Creating ${CMAKE_CURRENT_SOURCE_DIR}/include/aidge/backend/cpu_version.h")
# Generate version.h file from config file version.h.in
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/include/aidge/backend/version.h.in"
"${CMAKE_CURRENT_SOURCE_DIR}/include/aidge/backend/cpu_version.h"
)
############################################## ##############################################
# Installation instructions # Installation instructions
include(GNUInstallDirs) include(GNUInstallDirs)
......
import aidge_core import aidge_core
from aidge_backend_cpu.aidge_backend_cpu import * # import so generated by PyBind from aidge_backend_cpu.aidge_backend_cpu import * # import so generated by PyBind
from ._version import *
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
#ifndef AIDGE_CPU_IMPORTS_H_ #ifndef AIDGE_CPU_IMPORTS_H_
#define AIDGE_CPU_IMPORTS_H_ #define AIDGE_CPU_IMPORTS_H_
#include "aidge/backend/cpu_version.h"
#include "aidge/backend/cpu/operator/AbsImpl.hpp" #include "aidge/backend/cpu/operator/AbsImpl.hpp"
#include "aidge/backend/cpu/operator/AddImpl.hpp" #include "aidge/backend/cpu/operator/AddImpl.hpp"
#include "aidge/backend/cpu/operator/AndImpl.hpp" #include "aidge/backend/cpu/operator/AndImpl.hpp"
......
#ifndef VERSION_H
#define VERSION_H
namespace Aidge {
static constexpr const int PROJECT_VERSION_MAJOR = @PROJECT_VERSION_MAJOR@;
static constexpr const int PROJECT_VERSION_MINOR = @PROJECT_VERSION_MINOR@;
static constexpr const int PROJECT_VERSION_PATCH = @PROJECT_VERSION_PATCH@;
static constexpr const char * PROJECT_VERSION = "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@";
static constexpr const char * PROJECT_GIT_HASH = "@GIT_COMMIT_HASH@";
}
#endif // VERSION_H
...@@ -2,17 +2,20 @@ ...@@ -2,17 +2,20 @@
#define AIDGE_UTILS_SYS_INFO_CPU_VERSION_INFO_H #define AIDGE_UTILS_SYS_INFO_CPU_VERSION_INFO_H
#include "aidge/utils/Log.hpp" #include "aidge/utils/Log.hpp"
#include "aidge/backend/cpu_version.h"
namespace Aidge { namespace Aidge {
#ifndef PROJECT_VERSION // Normally defined in CMakeLists.txt constexpr inline const char * getBackendCPUProjectVersion(){
#define PROJECT_VERSION "Unknown version" return PROJECT_VERSION;
#endif }
#ifndef GIT_COMMIT_HASH
#define GIT_COMMIT_HASH "" constexpr inline const char * getBackendCPUGitHash(){
#endif return PROJECT_GIT_HASH;
void showCpuVersion() { }
Log::info("Aidge backend CPU: {} ({}), {} {}", PROJECT_VERSION, GIT_COMMIT_HASH, __DATE__, __TIME__);
void showBackendCpuVersion() {
Log::info("Aidge backend CPU: {} ({}), {} {}", getBackendCPUProjectVersion(), getBackendCPUGitHash(), __DATE__, __TIME__);
// Compiler version // Compiler version
#if defined(__clang__) #if defined(__clang__)
/* Clang/LLVM. ---------------------------------------------- */ /* Clang/LLVM. ---------------------------------------------- */
......
aidge_backend_cpu
...@@ -7,17 +7,25 @@ dependencies = [ ...@@ -7,17 +7,25 @@ dependencies = [
requires-python = ">= 3.7" requires-python = ">= 3.7"
readme = "README.md" readme = "README.md"
license = { file = "LICENSE" } license = { file = "LICENSE" }
classifiers = [ classifiers = [
"Development Status :: 2 - Pre-Alpha", "Development Status :: 2 - Pre-Alpha",
"Programming Language :: Python :: 3" "Programming Language :: Python :: 3"
] ]
dynamic = ["version"] # defined in tool.setuptools_scm dynamic = ["version"] # defined by pbr
[project.urls]
Homepage = "https://www.deepgreen.ai/en/platform"
Documentation = "https://eclipse-aidge.readthedocs.io/en/latest/"
Repository = "https://gitlab.eclipse.org/eclipse/aidge/aidge_backend_cpu"
Issues = "https://gitlab.eclipse.org/eclipse/aidge/aidge_backend_cpu/-/issues"
Changelog = "https://gitlab.eclipse.org/eclipse/aidge/aidge_backend_cpu/-/releases"
[build-system] [build-system]
requires = [ requires = [
"setuptools>=64", "setuptools>=64",
"setuptools_scm[toml]==7.1.0", "cmake>=3.18.4.post1",
"cmake>=3.18.4.post1" "pbr"
] ]
build-backend = "setuptools.build_meta" build-backend = "setuptools.build_meta"
...@@ -29,9 +37,6 @@ where = ["."] # list of folders that contain the packages (["."] by default) ...@@ -29,9 +37,6 @@ where = ["."] # list of folders that contain the packages (["."] by default)
include = ["aidge_backend_cpu*"] # package names should match these glob patterns (["*"] by default) include = ["aidge_backend_cpu*"] # package names should match these glob patterns (["*"] by default)
exclude = ["aidge_backend_cpu.unit_tests*"] # exclude packages matching these glob patterns (empty by default) exclude = ["aidge_backend_cpu.unit_tests*"] # exclude packages matching these glob patterns (empty by default)
namespaces = false # to disable scanning PEP 420 namespaces (true by default) namespaces = false # to disable scanning PEP 420 namespaces (true by default)
# SETUPTOOLS_SCM
[tool.setuptools_scm]
write_to = "aidge_backend_cpu/_version.py"
##################################################### #####################################################
# CIBUILDWHEEL # CIBUILDWHEEL
......
...@@ -6,10 +6,10 @@ namespace py = pybind11; ...@@ -6,10 +6,10 @@ namespace py = pybind11;
namespace Aidge { namespace Aidge {
void init_cpu_sys_info(py::module& m); void init_CpuVersionInfo(py::module& m);
void init_Aidge(py::module& m){ void init_Aidge(py::module& m){
init_cpu_sys_info(m); init_CpuVersionInfo(m);
} }
......
...@@ -3,7 +3,9 @@ ...@@ -3,7 +3,9 @@
namespace py = pybind11; namespace py = pybind11;
namespace Aidge { namespace Aidge {
void init_cpu_sys_info(py::module& m){ void init_CpuVersionInfo(py::module& m){
m.def("show_cpu_version", &showCpuVersion); m.def("show_version", &showBackendCpuVersion);
m.def("get_project_version", &getBackendCPUProjectVersion);
m.def("get_git_hash", &getBackendCPUGitHash);
} }
} }
# pbr file
[metadata]
version = file: version.txt
...@@ -11,8 +11,10 @@ from math import ceil ...@@ -11,8 +11,10 @@ from math import ceil
from setuptools import setup, Extension from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext from setuptools.command.build_ext import build_ext
def get_project_name() -> str:
return open(pathlib.Path().absolute() / "project_name.txt", "r").read().strip()
PROJECT_NAME = "aidge_backend_cpu" PROJECT_NAME = get_project_name()
SETUP_DIR = pathlib.Path(__file__).parent SETUP_DIR = pathlib.Path(__file__).parent
...@@ -66,7 +68,7 @@ class AidgePkgBuild(build_ext): ...@@ -66,7 +68,7 @@ class AidgePkgBuild(build_ext):
else [] else []
) )
test_onoff = os.environ.get("AIDGE_BUILD_TEST", "OFF") test_onoff = os.environ.get("AIDGE_BUILD_TEST", "OFF")
self.spawn( self.spawn(
[ [
"cmake", "cmake",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment