-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added version.h and report_compiler.h to include
- Loading branch information
Showing
2 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |