Skip to content

Commit 1b1c5e2

Browse files
committed
Merge branch 'master' of gits-15.sys.kth.se:maaskola/spatial-transcriptome-deconvolution
2 parents 45e1ae2 + 76c5a80 commit 1b1c5e2

9 files changed

+50
-17
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
build
1+
build/release
2+
build/debug
23
*.swp
34
*.swo
45
*~

CMakeLists.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
2222
# Change build configuration
2323
#
2424
# SET(CMAKE_BUILD_TYPE Debug)
25-
SET(CMAKE_BUILD_TYPE Release)
25+
# SET(CMAKE_BUILD_TYPE Release)
26+
27+
SET(CMAKE_DEBUG_POSTFIX -dbg)
2628

2729
# Set installation destination and prefix path to find libraries installed on
2830
# this sytem. If this is not specified, /usr/local/ will be used.

build/Makefile

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
SUBDIRS := $(wildcard */.) # e.g. "foo/. bar/."
2+
TARGETS := all install clean # whatever else, but must not contain '/'
3+
4+
# foo/.all bar/.all foo/.clean bar/.clean
5+
SUBDIRS_TARGETS := \
6+
$(foreach t,$(TARGETS),$(addsuffix $t,$(SUBDIRS)))
7+
8+
.PHONY : $(TARGETS) $(SUBDIRS_TARGETS)
9+
10+
# static pattern rule, expands into:
11+
# all clean : % : foo/.% bar/.%
12+
$(TARGETS) : % : $(addsuffix %,$(SUBDIRS))
13+
@echo 'Done "$*" target'
14+
15+
# here, for foo/.all:
16+
# $(@D) is foo
17+
# $(@F) is .all, with leading period
18+
# $(@F:.%=%) is just all
19+
$(SUBDIRS_TARGETS) :
20+
$(MAKE) -C $(@D) $(@F:.%=%)

build/gen_build.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
mkdir -p release && cd release && cmake ../.. -DCMAKE_BUILD_TYPE=Release $@ && cd ..
3+
mkdir -p debug && cd debug && cmake ../.. -DCMAKE_BUILD_TYPE=Debug $@ && cd ..

src/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ IF(GOOGLEPERFTOOLS_FOUND)
4747
ENDIF()
4848

4949
CONFIGURE_FILE(git_config.hpp.in git_config.hpp)
50+
SET_TARGET_PROPERTIES(std PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
5051

5152
# INSTALL(TARGETS enrich DESTINATION bin)
5253
INSTALL(TARGETS std DESTINATION bin)

src/cli.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,11 @@ int process_cli_options(
5858
const std::string &usage_string,
5959
boost::program_options::options_description &cli_options,
6060
bool use_positional_options,
61-
boost::program_options::positional_options_description &positional_options) {
61+
boost::program_options::positional_options_description
62+
&positional_options) {
6263
namespace po = boost::program_options;
63-
exec_info
64-
= ExecutionInformation(argv[0], GIT_DESCRIPTION, GIT_BRANCH, argc, argv);
64+
exec_info = ExecutionInformation(argv[0], GIT_DESCRIPTION, GIT_BRANCH,
65+
BUILD_TYPE, argc, argv);
6566

6667
const size_t MIN_COLS = 60;
6768
const size_t MAX_COLS = 80;

src/executioninformation.cpp

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11

2+
#include "executioninformation.hpp"
3+
#include <boost/date_time/posix_time/posix_time.hpp>
4+
#include <boost/filesystem.hpp>
25
#include <cstdio>
36
#include <ctime>
47
#include <random>
5-
#include <boost/filesystem.hpp>
6-
#include <boost/date_time/posix_time/posix_time.hpp>
78
#include "entropy.hpp"
8-
#include "executioninformation.hpp"
99

1010
using namespace std;
1111

@@ -17,22 +17,25 @@ string reconstitute_cmdline(int argc, const char **argv) {
1717
}
1818

1919
ExecutionInformation::ExecutionInformation()
20-
: ExecutionInformation("program_name", "unknown", "unknown", "") {}
20+
: ExecutionInformation("program_name", "unknown", "unknown", "unknown", "") {}
2121

2222
ExecutionInformation::ExecutionInformation(const string &name,
2323
const string &version,
24-
const string &branch, int argc,
24+
const string &branch,
25+
const string &build, int argc,
2526
const char **argv)
26-
: ExecutionInformation(name, version, branch,
27+
: ExecutionInformation(name, version, branch, build,
2728
reconstitute_cmdline(argc, argv)) {}
2829

2930
ExecutionInformation::ExecutionInformation(const string &name,
3031
const string &version,
3132
const string &branch,
33+
const string &build,
3234
const string &cmd)
3335
: program_name(boost::filesystem::path(name).filename().string()),
3436
program_version(version),
3537
git_branch(branch),
38+
build_type(build),
3639
cmdline(cmd),
3740
datetime(),
3841
directory(boost::filesystem::initial_path().string()) {
@@ -43,7 +46,7 @@ ExecutionInformation::ExecutionInformation(const string &name,
4346
}
4447

4548
string ExecutionInformation::name_and_version() const {
46-
return program_name + " " + program_version + " [" + git_branch + " branch]";
49+
return program_name + " " + program_version + " [" + git_branch + " branch] - " + build_type + " build";
4750
}
4851

4952
string generate_random_label(const string &prefix, size_t n_rnd_char) {

src/executioninformation.hpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,16 @@
3535

3636
struct ExecutionInformation {
3737
ExecutionInformation();
38-
ExecutionInformation(const std::string &name, const std::string &hmm_version,
39-
const std::string &git_branch, int argc,
40-
const char **argv);
41-
ExecutionInformation(const std::string &name, const std::string &hmm_version,
42-
const std::string &git_branch,
38+
ExecutionInformation(const std::string &name, const std::string &version,
39+
const std::string &git_branch, const std::string &build,
40+
int argc, const char **argv);
41+
ExecutionInformation(const std::string &name, const std::string &version,
42+
const std::string &git_branch, const std::string &build,
4343
const std::string &cmdline);
4444
std::string program_name;
4545
std::string program_version;
4646
std::string git_branch;
47+
std::string build_type;
4748
std::string cmdline;
4849
std::string datetime;
4950
std::string directory;

src/git_config.hpp.in

+1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
#define GIT_SHA1 "@GIT_SHA1@"
55
#define GIT_DESCRIPTION "@GIT_DESCRIPTION@"
66
#define GIT_BRANCH "@GIT_BRANCH@"
7+
#define BUILD_TYPE "@CMAKE_BUILD_TYPE@"
78

89
#endif

0 commit comments

Comments
 (0)