mirror of https://github.com/mamba-org/mamba.git
adding version info to cpp lib
This commit is contained in:
parent
2ca1126ebe
commit
08564eec06
|
@ -1,3 +1,5 @@
|
|||
include/version.hpp
|
||||
|
||||
*build
|
||||
__cache__/
|
||||
.ipynb_checkpoints/
|
||||
|
|
|
@ -41,6 +41,21 @@ set(MAMBA_REQUIRED_LIBS
|
|||
nlohmann_json::nlohmann_json
|
||||
)
|
||||
|
||||
# Getting the mamba version from python
|
||||
file (READ mamba/_version.py VERSION_FILE)
|
||||
|
||||
STRING(REGEX REPLACE "\r?\n" ";" TMP_VERSION_FILE_LIST "${VERSION_FILE}")
|
||||
LIST(GET TMP_VERSION_FILE_LIST 1 VERSION_LINE)
|
||||
string(REGEX MATCHALL "version_info = \\(([0-9]*), ([0-9]*), ([0-9]*)\\)" MATCHES ${VERSION_LINE})
|
||||
|
||||
set(MAMBA_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
||||
set(MAMBA_VERSION_MINOR "${CMAKE_MATCH_2}")
|
||||
set(MAMBA_VERSION_PATCH "${CMAKE_MATCH_3}")
|
||||
|
||||
message("--> mamba version: ${MAMBA_VERSION_MAJOR}.${MAMBA_VERSION_MINOR}.${MAMBA_VERSION_PATCH}")
|
||||
|
||||
configure_file(include/version.hpp.in ${CMAKE_SOURCE_DIR}/include/version.hpp @ONLY)
|
||||
|
||||
if (LINK_STATIC)
|
||||
|
||||
set(MAMBA_STATIC_LIBS
|
||||
|
@ -122,6 +137,7 @@ set(MAMBA_SOURCES
|
|||
${CMAKE_SOURCE_DIR}/src/transaction.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/util.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/validate.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/version.cpp
|
||||
)
|
||||
|
||||
add_library(mamba_lib STATIC ${MAMBA_SOURCES})
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
#define MAMBA_VERSION_MAJOR @MAMBA_VERSION_MAJOR@
|
||||
#define MAMBA_VERSION_MINOR @MAMBA_VERSION_MINOR@
|
||||
#define MAMBA_VERSION_PATCH @MAMBA_VERSION_PATCH@
|
||||
|
||||
#define MAMBA_VERSION (MAMBA_VERSION_MAJOR * 10000 + MAMBA_VERSION_MINOR * 100 + MAMBA_VERSION_PATCH)
|
||||
#define MAMBA_VERSION_STRING "@MAMBA_VERSION_MAJOR@.@MAMBA_VERSION_MINOR@.@MAMBA_VERSION_PATCH@"
|
||||
|
||||
extern const char mamba_version[];
|
||||
extern int mamba_version_major;
|
||||
extern int mamba_version_minor;
|
||||
extern int mamba_version_patch;
|
1
setup.py
1
setup.py
|
@ -84,6 +84,7 @@ ext_modules = [
|
|||
'src/url.cpp',
|
||||
'src/util.cpp',
|
||||
'src/validate.cpp',
|
||||
'src/version.cpp',
|
||||
'src/link.cpp'
|
||||
],
|
||||
include_dirs=[
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
#include "version.hpp"
|
||||
|
||||
const char mamba_version[] = MAMBA_VERSION_STRING;
|
||||
int mamba_version_major = MAMBA_VERSION_MAJOR;
|
||||
int mamba_version_minor = MAMBA_VERSION_MINOR;
|
||||
int mamba_version_patch = MAMBA_VERSION_PATCH;
|
Loading…
Reference in New Issue