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

Version information are generated by CMakeLists.txt (+add a function to show version information.

parent 7f37a494
No related branches found
No related tags found
2 merge requests!318[Upd] release verision 0.5.0,!277Remove scm
......@@ -3,17 +3,29 @@ set(CXX_STANDARD 14)
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})
# Retrieve latest git commit
execute_process(
COMMAND git rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
project(aidge_core
VERSION ${version}
DESCRIPTION "Core algorithms for operators and graph of the AIDGE framework"
LANGUAGES CXX)
message(STATUS "Project name: ${CMAKE_PROJECT_NAME}")
message(STATUS "Project version: ${version}")
add_definitions(-DPROJECT_VERSION="${version}")
message(STATUS "Project name: ${CMAKE_PROJECT_NAME}")
message(STATUS "Project version: ${version}")
message(STATUS "Latest git commit: ${GIT_COMMIT_HASH}")
# helper for LSP users
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
......@@ -29,6 +41,10 @@ option(TEST "Enable tests" ON)
option(COVERAGE "Enable coverage" OFF)
option(ENABLE_ASAN "Enable ASan (AddressSanitizer) for runtime analysis of memory use (over/underflow, memory leak, ...)" OFF)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/include/aidge/version.h.in"
"${CMAKE_CURRENT_SOURCE_DIR}/include/aidge/version.h"
)
##############################################
# Import utils CMakeLists
......
......@@ -11,6 +11,7 @@
#ifndef AIDGE_IMPORTS_H_
#define AIDGE_IMPORTS_H_
#include "version.h"
#include "aidge/backend/OperatorImpl.hpp"
#include "aidge/backend/TensorImpl.hpp"
......
#ifndef AIDGE_UTILS_SYS_INFO_CORE_VERSION_INFO_H
#define AIDGE_UTILS_SYS_INFO_CORE_VERSION_INFO_H
#include "aidge/utils/Log.hpp"
#include "aidge/version.h"
namespace Aidge {
constexpr inline const char * getCoreProjectVersion(){
return PROJECT_VERSION;
}
constexpr inline const char * getCoreGitHash(){
return PROJECT_GIT_HASH;
}
void showCoreVersion() {
Log::info("Aidge core: {} ({}), {} {}", getCoreProjectVersion(), getCoreGitHash(), __DATE__, __TIME__);
// Compiler version
#if defined(__clang__)
/* Clang/LLVM. ---------------------------------------------- */
Log::info("Clang/LLVM compiler version: {}.{}.{}\n", __clang_major__ , __clang_minor__, __clang_patchlevel__);
#elif defined(__ICC) || defined(__INTEL_COMPILER)
/* Intel ICC/ICPC. ------------------------------------------ */
Log::info("Intel ICC/ICPC compiler version: {}\n", __INTEL_COMPILER);
#elif defined(__GNUC__) || defined(__GNUG__)
/* GNU GCC/G++. --------------------------------------------- */
Log::info("GNU GCC/G++ compiler version: {}.{}.{}", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
#elif defined(_MSC_VER)
/* Microsoft Visual Studio. --------------------------------- */
Log::info("Microsoft Visual Studio compiler version: {}\n", _MSC_VER);
#else
Log::info("Unknown compiler\n");
#endif
}
} // namespace Aidge
#endif // AIDGE_UTILS_SYS_INFO_CORE_VERSION_INFO_H
#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
......@@ -16,6 +16,7 @@
namespace py = pybind11;
namespace Aidge {
void init_CoreSysInfo(py::module&);
void init_Random(py::module&);
void init_Data(py::module&);
void init_Database(py::module&);
......@@ -104,6 +105,7 @@ void init_TensorUtils(py::module&);
void init_Filler(py::module&);
void init_Aidge(py::module& m) {
init_CoreSysInfo(m);
init_Random(m);
init_Data(m);
......
#include <pybind11/pybind11.h>
#include "aidge/utils/sys_info/CoreVersionInfo.hpp"
namespace py = pybind11;
namespace Aidge {
void init_CoreSysInfo(py::module& m){
m.def("show_core_version", &showCoreVersion);
m.def("get_core_project_version", &getCoreProjectVersion);
m.def("get_core_git_hash", &getCoreGitHash);
}
}
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