On 06/14/17 00:15, Edzard Egberts wrote:
> (BTW - is there a way to query FLTK build number from software?)
Not that I'm aware of.
Would certainly be good if FLTK had that built into a variable like FL_SCM_VERSION
during builds. Perhaps for 1.4 we can add this.
In my own software, I use the Makefile to run a small perl script
to get the svnversion of FLTK, and define it as a string in the
macro variable FL_SCM_VERSION.
I like to show the build date + FLTK svn version# in my FLTK app's
"About" dialog, so customers can paste it back to me when they
encounter drawing problems. Helps for bisects.
Here's the perl script which outputs a .h file that defines some
macros with date/time + FLTK svn version info that my apps then #include:
# GET DATE/TIME
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year += 1900;
$date = sprintf("%02d/%02d/%02d,%02d:%02d", ($mon+1),$mday,($year % 100),$hour,$min);
# USE SVNVERSION TO GET FLTK REV#
my $scm_rev = `( cd FLTK/fltk && svnversion )`; chomp($scm_rev);
if ( $scm_rev eq "" ) { $scm_rev = "????"; }
print <<"EOF";
#ifndef COPYRIGHT_YEAR
#define COPYRIGHT_YEAR "$year"
#define BUILD_DATE "$date"
#define FL_SCM_VERSION "$scm_rev"
#endif
EOF
exit(0);
..and here's the Makefile target that runs it to generate the .h file:
----
copyright_year.h: FORCE
perl
copyright_year.pl > copyright_year.h
----