Skip to content

Commit

Permalink
Merge pull request #172 from pangenome/simplify_versioning
Browse files Browse the repository at this point in the history
Simplify versioning
  • Loading branch information
AndreaGuarracino authored Oct 27, 2022
2 parents 1c0b639 + 51057e2 commit 479180a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 148 deletions.
10 changes: 4 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,7 @@ add_library(smoothxg_objs OBJECT
src/zstdutil.cpp
${sautocorr_INCLUDE}/sautocorr.cpp
src/maf.hpp
src/consensus_graph.cpp
src/version.cpp)
src/consensus_graph.cpp)

add_dependencies(smoothxg_objs handlegraph)
add_dependencies(smoothxg_objs sdsl-lite)
Expand Down Expand Up @@ -422,14 +421,13 @@ target_include_directories(smoothxg PUBLIC ${smoothxg_INCLUDES})
#set_target_properties(libsmoothxg_static PROPERTIES PUBLIC_HEADER "${smoothxg_HEADERS}")
#set_target_properties(libsmoothxg_shared PROPERTIES PUBLIC_HEADER "${smoothxg_HEADERS}")

# version stuff
file(MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/include)
execute_process(COMMAND bash ${CMAKE_SOURCE_DIR}/scripts/generate_git_version.sh ${CMAKE_SOURCE_DIR}/include)

install(TARGETS smoothxg DESTINATION bin)
#install(TARGETS libsmoothxg_static ARCHIVE DESTINATION lib LIBRARY DESTINATION lib PUBLIC_HEADER DESTINATION include/smoothxg)
#install(TARGETS libsmoothxg_shared ARCHIVE DESTINATION lib LIBRARY DESTINATION lib PUBLIC_HEADER DESTINATION include/smoothxg)

# version stuff
file(MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/include)
execute_process(COMMAND bash ${CMAKE_SOURCE_DIR}/scripts/generate_git_version.sh ${CMAKE_SOURCE_DIR}/include)

add_test(
NAME smoothxg-test
Expand Down
4 changes: 1 addition & 3 deletions scripts/generate_git_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@ INC_DIR=$1

GIT_VERSION=$(git describe --always --tags)

echo "#define SMOOTHXG_GIT_VERSION" \"$GIT_VERSION\" > $1/smoothxg_git_version.hpp.tmp
diff $1/smoothxg_git_version.hpp.tmp $1/smoothxg_git_version.hpp >/dev/null || cp $1/smoothxg_git_version.hpp.tmp $1/smoothxg_git_version.hpp
rm -f $1/smoothxg_git_version.hpp.tmp
echo "#define SMOOTHXG_GIT_VERSION" \"$GIT_VERSION\" > "$INC_DIR"/smoothxg_git_version.hpp
12 changes: 8 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,21 @@
#include "consensus_graph.hpp"
#include "rkmh.hpp"
#include <chrono>
#include "version.hpp"
#include "include/smoothxg_git_version.hpp"
#include <filesystem>
#include <deps/odgi/src/algorithms/xp.hpp>

// If the SMOOTHXG_GIT_VERSION doesn't exist at all, define a placeholder
#ifndef SMOOTHXG_GIT_VERSION
#define SMOOTHXG_GIT_VERSION "not-from-git"
#endif

using namespace std;
using namespace xg;


int main(int argc, char **argv) {
args::ArgumentParser parser("smoothxg: collinear block finder and graph consensus generator\n" + smoothxg::Version::get_version() + ": " +
smoothxg::Version::get_codename());
args::ArgumentParser parser("smoothxg: collinear block finder and graph consensus generator\n" + std::string(SMOOTHXG_GIT_VERSION));
args::Group mandatory_opts(parser, "[ MANDATORY OPTIONS ]");
args::ValueFlag<std::string> gfa_in(mandatory_opts, "FILE", "index the graph in this GFA file", {'g', "gfa-in"});
args::ValueFlag<std::string> smoothed_out(mandatory_opts, "FILE",
Expand Down Expand Up @@ -189,7 +193,7 @@ int main(int argc, char **argv) {
}

if (version) {
std::cerr << smoothxg::Version::get_version() << std::endl;
std::cerr << SMOOTHXG_GIT_VERSION << std::endl;
exit(0);
}

Expand Down
96 changes: 0 additions & 96 deletions src/version.cpp

This file was deleted.

39 changes: 0 additions & 39 deletions src/version.hpp

This file was deleted.

0 comments on commit 479180a

Please sign in to comment.