Skip to content

Commit

Permalink
added version.h and report_compiler.h to include
Browse files Browse the repository at this point in the history
  • Loading branch information
maccallum committed Jan 18, 2013
1 parent f8cf433 commit 68eadcb
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
38 changes: 38 additions & 0 deletions include/report_compiler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#ifndef __REPORT_COMPILER_H__
#define __REPORT_COMPILER_H__

#ifdef __clang__

#define CNMAT_HAVE_COMPILER 1
#define CNMAT_COMPILER "clang (llvm)"
#define CNMAT_COMPILER_MAJOR __clang_major__
#define CNMAT_COMPILER_MINOR __clang_minor__
#define CNMAT_COMPILER_PATCHLEVEL __clang_patchlevel__

#elif defined __GNUC__

#define CNMAT_HAVE_COMPILER 1
#define CNMAT_COMPILER "gcc"
#define CNMAT_COMPILER_MAJOR __GNUC__
#define CNMAT_COMPILER_MINOR __GNUC_MINOR__
#define CNMAT_COMPILER_PATCHLEVEL __GNUC_PATCHLEVEL__

#else

#define CNMAT_COMPILER "unknown compiler"
#define CNMAT_COMPILER_MAJOR
#define CNMAT_COMPILER_MINOR
#define CNMAT_COMPILER_PATCHLEVEL

#endif

void post_compiler(void)
{
#ifdef CNMAT_HAVE_COMPILER
post("Compiled on %s at %s with %s version %d.%d.%d", __DATE__, __TIME__, CNMAT_COMPILER, CNMAT_COMPILER_MAJOR, CNMAT_COMPILER_MINOR, CNMAT_COMPILER_PATCHLEVEL);
#else
post("Compiled by something other than clang or gcc");
#endif
}

#endif
25 changes: 25 additions & 0 deletions include/version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#ifndef __CNMAT_VERSION_H__
#define __CNMAT_VERSION_H__

#include "ext.h"

#include "current_version.h"
#include "report_compiler.h"


void version(void *x) {
if(!(gensym("CNMAT_did_post_copyright")->s_thing)){
post("CNMAT Externals v%s", CNMAT_EXT_VERSION);
gensym("CNMAT_did_post_copyright")->s_thing = (t_object *)1;
}
post("%s Version %s, by %s.", NAME, CNMAT_EXT_VERSION, AUTHORS);
post("Copyright (c) " COPYRIGHT_YEARS " Regents of the University of California. All rights reserved.");
if(x){
// Not called from main()
post_compiler();
}
}

#define version_post_copyright() version(NULL)

#endif

0 comments on commit 68eadcb

Please sign in to comment.