Skip to content

Commit

Permalink
Merge pull request #26 from klusta-team/print_version
Browse files Browse the repository at this point in the history
Print tag/short commit hash to screen and logfile. Fixes #23
  • Loading branch information
thesamovar committed Jan 14, 2015
2 parents 203493a + 174898f commit 8495f7d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions klustakwik.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
//
// Fast clustering using the CEM algorithm with Masks.

#ifndef VERSION
#define VERSION "0.3.0-nogit"
#endif

// Disable some Visual Studio warnings
#define _CRT_SECURE_NO_WARNINGS

Expand Down Expand Up @@ -1783,6 +1787,7 @@ int main(int argc, char **argv)
scalar BestScore = HugeScore;
integer p, i;
SetupParams((integer)argc, argv); // This function is defined in parameters.cpp
Output("Starting KlustaKwik. Version: %s\n", VERSION);
if (RamLimitGB == 0.0)
{
RamLimitGB = (1.0*total_physical_memory()) / (1024.0*1024.0*1024.0);
Expand Down
7 changes: 7 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,21 @@ CC = g++
DEBUG = -g
PROFILE = -pg
OPTIMISATIONS = -O3 -ffast-math -march=native
GIT_VERSION := $(shell git describe --abbrev=4 --dirty --always --tags)

ifdef NOOPENMP
OPENMPFLAG =
else
OPENMPFLAG = -fopenmp
endif

# If the git command failed, GIT_VERSION will be empty, so don't pass a DVERSION flag (fallback)
ifeq ($(strip $(GIT_VERSION)),)
CFLAGS = -Wall -c -Wno-write-strings $(OPTIMISATIONS) $(OPENMPFLAG)
else
CFLAGS = -Wall -c -Wno-write-strings $(OPTIMISATIONS) $(OPENMPFLAG) -DVERSION=\"$(GIT_VERSION)\"
endif

LFLAGS = -Wall $(OPENMPFLAG)

all: executable
Expand Down

0 comments on commit 8495f7d

Please sign in to comment.