Skip to content

Commit

Permalink
Get SPAdes version from single common place
Browse files Browse the repository at this point in the history
  • Loading branch information
asl committed May 13, 2024
1 parent 77aa33c commit fb78220
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 33 deletions.
18 changes: 2 additions & 16 deletions make-targz.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# See file LICENSE for details.
############################################################################

VERSION="$(cat assembler/VERSION)"
VERSION="$(cat VERSION)"
: "${TARGET_DIR:=SPAdes-$VERSION}"
rm -rf $TARGET_DIR
SRC_DIR=$TARGET_DIR/src
Expand All @@ -15,11 +15,10 @@ cp -r src/common $SRC_DIR/
cp -r src/projects $SRC_DIR/
cp -r src/include $SRC_DIR/
cp -r src/cmake $SRC_DIR/
cp -r src/spades_pipeline $SRC_DIR/
cp src/CMakeLists.txt $SRC_DIR/

cp -r configs $TARGET_DIR/configs
cp -r ext $TARGET_DIR/ext
cp -r docs $TARGET_DIR/docs

# cleaning .pyc and .pyo
rm -f $SRC_DIR/*.pyc
Expand All @@ -35,23 +34,10 @@ rm -f $TARGET_DIR/ext/src/python_libs/*/*.pyc
rm -f $TARGET_DIR/ext/src/python_libs/*/*.pyo
rm -rf $TARGET_DIR/ext/src/python_libs/*/__pycache__/

cp -r biosynthetic_spades_hmms $TARGET_DIR/
cp -r coronaspades_hmms $TARGET_DIR/
cp -r test_dataset $TARGET_DIR/test_dataset
cp -r test_dataset_plasmid $TARGET_DIR/test_dataset_plasmid
cp LICENSE $TARGET_DIR/
cp README.md $TARGET_DIR/
cp VERSION $TARGET_DIR/
cp spades.py $TARGET_DIR/
cp rnaviralspades.py $TARGET_DIR/
cp rnaspades.py $TARGET_DIR/
cp metaspades.py $TARGET_DIR/
cp plasmidspades.py $TARGET_DIR/
cp metaviralspades.py $TARGET_DIR/
cp metaplasmidspades.py $TARGET_DIR/
cp coronaspades.py $TARGET_DIR/
cp spades_compile.sh $TARGET_DIR/
cp spades_init.py $TARGET_DIR/
cp changelog.html $TARGET_DIR/
cp GPLv2.txt $TARGET_DIR/

Expand Down
17 changes: 17 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,23 @@ if (NOT SPADES_GIT_SHA1)
set(SPADES_GIT_SHA1 "N/A")
endif()

file(STRINGS "${CMAKE_SOURCE_DIR}/../VERSION" VERSION_STRING LIMIT_COUNT 1)
string(REGEX MATCH "([a-zA-Z]*)-\?([0-9]+)\.([0-9]+)\.([0-9]+)(.*)" ver "${VERSION_STRING}")
if (ver STREQUAL "")
message(FATAL_ERROR "Error to parse version string from ${VERSION_STRING}")
endif()
if (CMAKE_MATCH_1 STREQUAL "")
set(SPADES_FLAVOUR "SPAdes")
else()
set(SPADES_FLAVOUR "${CMAKE_MATCH_1}")
endif()
set(SPADES_VERSION_MAJOR "${CMAKE_MATCH_2}")
set(SPADES_VERSION_MINOR "${CMAKE_MATCH_3}")
set(SPADES_VERSION_PATCH "${CMAKE_MATCH_4}")
set(SPADES_VERSION_SUFFIX "${CMAKE_MATCH_5}")
set(SPADES_PACKAGE_VERSION "${SPADES_VERSION_MAJOR}.${SPADES_VERSION_MINOR}.${SPADES_VERSION_PATCH}${SPADES_VERSION_SUFFIX}")
message(STATUS "Building ${SPADES_FLAVOUR} version ${SPADES_PACKAGE_VERSION}")

# Testing
include(test)

Expand Down
24 changes: 9 additions & 15 deletions src/cmake/pack.cmake
Original file line number Diff line number Diff line change
@@ -1,27 +1,21 @@
# -*- cmake -*-

# Binary stuff
set(CPACK_CMAKE_GENERATOR "Unix Makefiles")
if (APPLE)
set(CPACK_GENERATOR "TGZ")
else()
set(CPACK_GENERATOR "TGZ")
endif()

set(CPACK_PACKAGE_NAME "SPAdes")
set(CPACK_PACKAGE_VENDOR "Saint Petersburg State University")
# Binary stuff
set(CPACK_GENERATOR "TGZ")
set(CPACK_PACKAGE_NAME "${SPADES_FLAVOUR}")
set(CPACK_PACKAGE_VENDOR "SPAdes Team")
#set(CPACK_PACKAGE_DESCRIPTION_FILE "${SPADES_MAIN_SRC_DIR}/../README")
set(CPACK_RESOURCE_FILE_LICENSE "${SPADES_MAIN_SRC_DIR}/../LICENSE")
set(CPACK_PACKAGE_VERSION "3.16.0-dev")
set(CPACK_PACKAGE_VERSION_MAJOR "3")
set(CPACK_PACKAGE_VERSION_MINOR "16")
set(CPACK_PACKAGE_VERSION_PATCH "0")
set(CPACK_STRIP_FILES bin/spades-bwa bin/spades-core bin/spades-corrector-core bin/spades-gbuilder bin/spades-gmapper bin/spades-hammer bin/spades-ionhammer bin/spades-kmercount)

set(CPACK_PACKAGE_VERSION "${SPADES_PACKAGE_VERSION}")
set(CPACK_PACKAGE_VERSION_MAJOR "${SPADES_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${SPADES_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${SPADES_VERSION_PATCH}")

# Source stuff
set(CPACK_SOURCE_GENERATOR "TBZ2")
set(CPACK_SOURCE_IGNORE_FILES tools test web_service online_vis cap)
set(CPACK_SOURCE_IGNORE_FILES tools test online_vis)
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")

include(CPack)
20 changes: 20 additions & 0 deletions src/common/utils/version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,26 @@

namespace version {

const char *major() {
return SPADES_VERSION_MAJOR;
}

const char *minor() {
return SPADES_VERSION_MINOR;
}

const char *patch() {
return SPADES_VERSION_PATCH;
}

const char *flavour() {
return SPADES_FLAVOUR;
}

const char *package() {
return SPADES_PACKAGE_VERSION;
}

const char *refspec() {
return SPADES_GIT_REFSPEC;
}
Expand Down
9 changes: 7 additions & 2 deletions src/include/version-gen.hpp.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#ifndef __SPADES_VERSION_HPP__
#define __SPADES_VERSION_HPP__

#cmakedefine SPADES_GIT_REFSPEC "${SPADES_GIT_REFSPEC}"
#cmakedefine SPADES_GIT_SHA1 "${SPADES_GIT_SHA1}"
#define SPADES_FLAVOUR "${SPADES_FLAVOUR}"
#define SPADES_PACKAGE_VERSION "${SPADES_PACKAGE_VERSION}"
#define SPADES_VERSION_MAJOR "${SPADES_VERSION_MAJOR}"
#define SPADES_VERSION_MINOR "${SPADES_VERSION_MINOR}"
#define SPADES_VERSION_PATCH "${SPADES_VERSION_PATCH}"
#define SPADES_GIT_REFSPEC "${SPADES_GIT_REFSPEC}"
#define SPADES_GIT_SHA1 "${SPADES_GIT_SHA1}"

#endif // __SPADES_VERSION_HPP__

0 comments on commit fb78220

Please sign in to comment.