aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt53
-rw-r--r--config.h.cmake.in10
-rw-r--r--config.h.in10
-rw-r--r--libcrystfel/CMakeLists.txt3
-rw-r--r--libcrystfel/src/libcrystfel-version.c.cmake.in4
-rw-r--r--libcrystfel/src/libcrystfel-version.h2
-rw-r--r--libcrystfel/src/reflist-utils.c6
-rw-r--r--libcrystfel/src/stream.c5
-rw-r--r--src/ambigator.c11
-rw-r--r--src/cell_explorer.c7
-rw-r--r--src/cell_tool.c19
-rw-r--r--src/check_hkl.c18
-rw-r--r--src/compare_hkl.c17
-rw-r--r--src/crystfel_gui.c10
-rw-r--r--src/geoptimiser.c21
-rw-r--r--src/get_hkl.c18
-rw-r--r--src/indexamajig.c6
-rw-r--r--src/list_events.c14
-rw-r--r--src/make_pixelmap.c16
-rw-r--r--src/partial_sim.c25
-rw-r--r--src/partialator.c7
-rw-r--r--src/pattern_sim.c28
-rw-r--r--src/process_hkl.c28
-rw-r--r--src/render_hkl.c20
-rw-r--r--src/version.c.cmake.in13
-rw-r--r--src/version.h2
-rw-r--r--src/whirligig.c16
27 files changed, 247 insertions, 142 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 77018925..d8ab5109 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -120,8 +120,8 @@ else ()
else ()
message(STATUS "This is a packaged release version")
endif ()
-
endif ()
+configure_file(src/version.c.cmake.in version.c)
include(CheckIncludeFile)
include(CheckLibraryExists)
@@ -182,7 +182,8 @@ install(DIRECTORY ${CMAKE_SOURCE_DIR}/scripts
# FIXME: Restore!
#set(PARTIAL_SIM_SOURCES src/partial_sim.c)
-#add_executable(partial_sim ${PARTIAL_SIM_SOURCES})
+#add_executable(partial_sim ${PARTIAL_SIM_SOURCES}
+# ${CMAKE_CURRENT_BINARY_DIR}/version.c)
#target_include_directories(partial_sim PRIVATE ${COMMON_INCLUDES})
#target_link_libraries(partial_sim ${COMMON_LIBRARIES})
#list(APPEND CRYSTFEL_EXECUTABLES partial_sim)
@@ -197,7 +198,8 @@ install(DIRECTORY ${CMAKE_SOURCE_DIR}/scripts
# set(PATTERN_SIM_OPENCL_SOURCES src/cl-utils.c src/diffraction-gpu.c)
#endif(HAVE_OPENCL)
#
-#add_executable(pattern_sim ${PATTERN_SIM_SOURCES} ${PATTERN_SIM_OPENCL_SOURCES})
+#add_executable(pattern_sim ${PATTERN_SIM_SOURCES} ${PATTERN_SIM_OPENCL_SOURCES}
+# ${CMAKE_CURRENT_BINARY_DIR}/version.c)
#target_include_directories(pattern_sim PRIVATE ${COMMON_INCLUDES})
#target_link_libraries(pattern_sim ${COMMON_LIBRARIES} ${HDF5_C_LIBRARIES})
#
@@ -215,7 +217,8 @@ if (GTK_FOUND)
set(CELL_EXPLORER_SOURCES src/cell_explorer.c src/multihistogram.c)
- add_executable(cell_explorer ${CELL_EXPLORER_SOURCES})
+ add_executable(cell_explorer ${CELL_EXPLORER_SOURCES}
+ ${CMAKE_CURRENT_BINARY_DIR}/version.c)
target_include_directories(cell_explorer PRIVATE ${COMMON_INCLUDES} ${GTK_INCLUDE_DIRS})
target_link_libraries(cell_explorer ${COMMON_LIBRARIES} ${GTK_LIBRARIES})
@@ -229,7 +232,8 @@ endif (GTK_FOUND)
if (CAIRO_FOUND)
set(RENDER_HKL_SOURCES src/render_hkl.c)
- add_executable(render_hkl ${RENDER_HKL_SOURCES})
+ add_executable(render_hkl ${RENDER_HKL_SOURCES}
+ ${CMAKE_CURRENT_BINARY_DIR}/version.c)
target_include_directories(render_hkl PRIVATE ${COMMON_INCLUDES} ${CAIRO_INCLUDE_DIRS})
target_link_libraries(render_hkl ${COMMON_LIBRARIES} ${CAIRO_LIBRARIES})
@@ -242,7 +246,8 @@ endif (CAIRO_FOUND)
# process_hkl
set(PROCESS_HKL_SOURCES src/process_hkl.c)
-add_executable(process_hkl ${PROCESS_HKL_SOURCES})
+add_executable(process_hkl ${PROCESS_HKL_SOURCES}
+ ${CMAKE_CURRENT_BINARY_DIR}/version.c)
target_include_directories(process_hkl PRIVATE ${COMMON_INCLUDES})
target_link_libraries(process_hkl ${COMMON_LIBRARIES})
list(APPEND CRYSTFEL_EXECUTABLES process_hkl)
@@ -251,7 +256,8 @@ list(APPEND CRYSTFEL_EXECUTABLES process_hkl)
# list_events
set(LIST_EVENTS_SOURCES src/list_events.c)
-add_executable(list_events ${LIST_EVENTS_SOURCES})
+add_executable(list_events ${LIST_EVENTS_SOURCES}
+ ${CMAKE_CURRENT_BINARY_DIR}/version.c)
target_include_directories(list_events PRIVATE ${COMMON_INCLUDES})
target_link_libraries(list_events ${COMMON_LIBRARIES})
list(APPEND CRYSTFEL_EXECUTABLES list_events)
@@ -266,7 +272,8 @@ if ( ZMQ_FOUND AND MSGPACK_FOUND )
list(APPEND INDEXAMAJIG_SOURCES src/im-zmq.c)
endif ()
-add_executable(indexamajig ${INDEXAMAJIG_SOURCES})
+add_executable(indexamajig ${INDEXAMAJIG_SOURCES}
+ ${CMAKE_CURRENT_BINARY_DIR}/version.c)
target_include_directories(indexamajig PRIVATE ${COMMON_INCLUDES})
target_link_libraries(indexamajig ${COMMON_LIBRARIES})
list(APPEND CRYSTFEL_EXECUTABLES indexamajig)
@@ -281,7 +288,8 @@ endif ()
# get_hkl
set(GET_HKL_SOURCES src/get_hkl.c)
-add_executable(get_hkl ${GET_HKL_SOURCES})
+add_executable(get_hkl ${GET_HKL_SOURCES}
+ ${CMAKE_CURRENT_BINARY_DIR}/version.c)
target_include_directories(get_hkl PRIVATE ${COMMON_INCLUDES})
target_link_libraries(get_hkl ${COMMON_LIBRARIES})
list(APPEND CRYSTFEL_EXECUTABLES get_hkl)
@@ -290,7 +298,8 @@ list(APPEND CRYSTFEL_EXECUTABLES get_hkl)
# compare_hkl
set(COMPARE_HKL_SOURCES src/compare_hkl.c)
-add_executable(compare_hkl ${COMPARE_HKL_SOURCES})
+add_executable(compare_hkl ${COMPARE_HKL_SOURCES}
+ ${CMAKE_CURRENT_BINARY_DIR}/version.c)
target_include_directories(compare_hkl PRIVATE ${COMMON_INCLUDES})
target_link_libraries(compare_hkl ${COMMON_LIBRARIES})
list(APPEND CRYSTFEL_EXECUTABLES compare_hkl)
@@ -299,7 +308,8 @@ list(APPEND CRYSTFEL_EXECUTABLES compare_hkl)
# check_hkl
set(CHECK_HKL_SOURCES src/check_hkl.c)
-add_executable(check_hkl ${CHECK_HKL_SOURCES})
+add_executable(check_hkl ${CHECK_HKL_SOURCES}
+ ${CMAKE_CURRENT_BINARY_DIR}/version.c)
target_include_directories(check_hkl PRIVATE ${COMMON_INCLUDES})
target_link_libraries(check_hkl ${COMMON_LIBRARIES})
list(APPEND CRYSTFEL_EXECUTABLES check_hkl)
@@ -309,7 +319,8 @@ list(APPEND CRYSTFEL_EXECUTABLES check_hkl)
set(PARTIALATOR_SOURCES src/partialator.c src/post-refinement.c src/merge.c
src/rejection.c src/scaling.c)
-add_executable(partialator ${PARTIALATOR_SOURCES})
+add_executable(partialator ${PARTIALATOR_SOURCES}
+ ${CMAKE_CURRENT_BINARY_DIR}/version.c)
target_include_directories(partialator PRIVATE ${COMMON_INCLUDES})
target_link_libraries(partialator ${COMMON_LIBRARIES})
list(APPEND CRYSTFEL_EXECUTABLES partialator)
@@ -318,7 +329,8 @@ list(APPEND CRYSTFEL_EXECUTABLES partialator)
# ambigator
set(AMBIGATOR_SOURCES src/ambigator.c)
-add_executable(ambigator ${AMBIGATOR_SOURCES})
+add_executable(ambigator ${AMBIGATOR_SOURCES}
+ ${CMAKE_CURRENT_BINARY_DIR}/version.c)
target_include_directories(ambigator PRIVATE ${COMMON_INCLUDES})
target_link_libraries(ambigator ${COMMON_LIBRARIES} ${HDF5_C_LIBRARIES})
list(APPEND CRYSTFEL_EXECUTABLES ambigator)
@@ -334,7 +346,8 @@ list(APPEND CRYSTFEL_EXECUTABLES ambigator)
# FIXME: Restore!
#set(GEOPTIMISER_SOURCES src/geoptimiser.c)
-#add_executable(geoptimiser ${GEOPTIMISER_SOURCES})
+#add_executable(geoptimiser ${GEOPTIMISER_SOURCES}
+# ${CMAKE_CURRENT_BINARY_DIR}/version.c)
#target_include_directories(geoptimiser PRIVATE ${COMMON_INCLUDES})
#target_link_libraries(geoptimiser ${COMMON_LIBRARIES})
#list(APPEND CRYSTFEL_EXECUTABLES geoptimiser)
@@ -365,7 +378,8 @@ list(APPEND CRYSTFEL_EXECUTABLES ambigator)
# whirligig
set(WHIRLIGIG_SOURCES src/whirligig.c)
-add_executable(whirligig ${WHIRLIGIG_SOURCES})
+add_executable(whirligig ${WHIRLIGIG_SOURCES}
+ ${CMAKE_CURRENT_BINARY_DIR}/version.c)
target_include_directories(whirligig PRIVATE ${COMMON_INCLUDES})
target_link_libraries(whirligig ${COMMON_LIBRARIES})
list(APPEND CRYSTFEL_EXECUTABLES whirligig)
@@ -374,7 +388,8 @@ list(APPEND CRYSTFEL_EXECUTABLES whirligig)
# make_pixelmap
set(MAKE_PIXELMAP_SOURCES src/make_pixelmap.c)
-add_executable(make_pixelmap ${MAKE_PIXELMAP_SOURCES})
+add_executable(make_pixelmap ${MAKE_PIXELMAP_SOURCES}
+ ${CMAKE_CURRENT_BINARY_DIR}/version.c)
target_include_directories(make_pixelmap PRIVATE ${COMMON_INCLUDES})
target_link_libraries(make_pixelmap ${COMMON_LIBRARIES} ${HDF5_C_LIBRARIES})
list(APPEND CRYSTFEL_EXECUTABLES make_pixelmap)
@@ -383,7 +398,8 @@ list(APPEND CRYSTFEL_EXECUTABLES make_pixelmap)
# cell_tool
set(CELL_TOOL_SOURCES src/cell_tool.c)
-add_executable(cell_tool ${CELL_TOOL_SOURCES})
+add_executable(cell_tool ${CELL_TOOL_SOURCES}
+ ${CMAKE_CURRENT_BINARY_DIR}/version.c)
target_include_directories(cell_tool PRIVATE ${COMMON_INCLUDES})
target_link_libraries(cell_tool ${COMMON_LIBRARIES})
list(APPEND CRYSTFEL_EXECUTABLES cell_tool)
@@ -397,7 +413,8 @@ if (GTK_FOUND)
src/gui_peaksearch.c src/gui_index.c src/gui_backend_local.c
src/gui_project.c)
- add_executable(crystfel ${CRYSTFEL_GUI_SOURCES})
+ add_executable(crystfel ${CRYSTFEL_GUI_SOURCES}
+ ${CMAKE_CURRENT_BINARY_DIR}/version.c)
target_include_directories(crystfel PRIVATE ${COMMON_INCLUDES} ${GTK_INCLUDE_DIRS})
target_link_libraries(crystfel ${COMMON_LIBRARIES} util ${GTK_LIBRARIES})
diff --git a/config.h.cmake.in b/config.h.cmake.in
index 6d630f9e..ef53b3d1 100644
--- a/config.h.cmake.in
+++ b/config.h.cmake.in
@@ -10,13 +10,3 @@
#cmakedefine HAVE_CLOCK_GETTIME
#cmakedefine HAVE_MSGPACK
#cmakedefine HAVE_ZMQ
-
-#define PACKAGE_VERSION "${CRYSTFEL_VERSION}"
-
-#define CRYSTFEL_VERSIONSTRING "${CRYSTFEL_VERSION}"
-
-#define CRYSTFEL_BOILERPLATE "License GPLv3+: GNU GPL version 3 or later"\
- " <http://gnu.org/licenses/gpl.html>.\n"\
- "This is free software: you are free to change and redistribute it.\n"\
- "There is NO WARRANTY, to the extent permitted by law.\n\n"\
- "Written by Thomas White and others."
diff --git a/config.h.in b/config.h.in
index 3d6bb9dd..277f08fd 100644
--- a/config.h.in
+++ b/config.h.in
@@ -10,13 +10,3 @@
#mesondefine HAVE_CLOCK_GETTIME
#mesondefine HAVE_MSGPACK
#mesondefine HAVE_ZMQ
-
-#define PACKAGE_VERSION "@CRYSTFEL_VERSION@"
-
-#define CRYSTFEL_VERSIONSTRING "@CRYSTFEL_VERSION@"
-
-#define CRYSTFEL_BOILERPLATE "License GPLv3+: GNU GPL version 3 or later"\
- " <http://gnu.org/licenses/gpl.html>.\n"\
- "This is free software: you are free to change and redistribute it.\n"\
- "There is NO WARRANTY, to the extent permitted by law.\n\n"\
- "Written by Thomas White and others."
diff --git a/libcrystfel/CMakeLists.txt b/libcrystfel/CMakeLists.txt
index 5374ae00..79534f6b 100644
--- a/libcrystfel/CMakeLists.txt
+++ b/libcrystfel/CMakeLists.txt
@@ -10,6 +10,8 @@ find_package(BISON REQUIRED)
find_package(Doxygen)
pkg_search_module(FFTW fftw3)
+configure_file(src/libcrystfel-version.c.cmake.in libcrystfel-version.c)
+
set(HAVE_CURSES ${CURSES_FOUND})
set(HAVE_FFTW ${FFTW_FOUND})
set(HAVE_XGANDALF ${XGANDALF_FOUND})
@@ -120,6 +122,7 @@ endif (DOXYGEN_FOUND)
add_library(${PROJECT_NAME} SHARED
${LIBCRYSTFEL_SOURCES}
+ ${CMAKE_CURRENT_BINARY_DIR}/libcrystfel-version.c
${LIBCRYSTFEL_FFTW_SOURCES}
${LIBCRYSTFEL_HEADERS})
diff --git a/libcrystfel/src/libcrystfel-version.c.cmake.in b/libcrystfel/src/libcrystfel-version.c.cmake.in
new file mode 100644
index 00000000..513d7871
--- /dev/null
+++ b/libcrystfel/src/libcrystfel-version.c.cmake.in
@@ -0,0 +1,4 @@
+const char *libcrystfel_version_string()
+{
+ return "${CRYSTFEL_VERSION}";
+}
diff --git a/libcrystfel/src/libcrystfel-version.h b/libcrystfel/src/libcrystfel-version.h
new file mode 100644
index 00000000..7e3ac4f7
--- /dev/null
+++ b/libcrystfel/src/libcrystfel-version.h
@@ -0,0 +1,2 @@
+extern const char *libcrystfel_version_string(void);
+extern const char *libcrystfel_licence_string(void);
diff --git a/libcrystfel/src/reflist-utils.c b/libcrystfel/src/reflist-utils.c
index 7a41f335..467a3007 100644
--- a/libcrystfel/src/reflist-utils.c
+++ b/libcrystfel/src/reflist-utils.c
@@ -41,6 +41,7 @@
#include "utils.h"
#include "reflist-utils.h"
#include "symmetry.h"
+#include "libcrystfel-version.h"
/** \file reflist-utils.h
@@ -698,9 +699,8 @@ void reflist_add_command_and_version(RefList *list, int argc, char *argv[])
char *tmp;
char vers[128];
- vers[0] = '\0';
- strcat(vers, "Generated by CrystFEL ");
- strncat(vers, CRYSTFEL_VERSIONSTRING, 100);
+ snprintf(vers, 128, "Generated by CrystFEL %s",
+ libcrystfel_version_string());
reflist_add_notes(list, vers);
tmp = full_command_line(argc, argv);
diff --git a/libcrystfel/src/stream.c b/libcrystfel/src/stream.c
index 02abd549..6242071b 100644
--- a/libcrystfel/src/stream.c
+++ b/libcrystfel/src/stream.c
@@ -53,6 +53,8 @@
#include "reflist-utils.h"
#include "datatemplate.h"
#include "detgeom.h"
+#include "libcrystfel-version.h"
+
/** \file stream.h */
@@ -1319,7 +1321,8 @@ Stream *stream_open_for_write(const char *filename)
fprintf(st->fh, "CrystFEL stream format %i.%i\n",
st->major_version, st->minor_version);
- fprintf(st->fh, "Generated by CrystFEL "CRYSTFEL_VERSIONSTRING"\n");
+ fprintf(st->fh, "Generated by CrystFEL %s\n",
+ libcrystfel_version_string());
fflush(st->fh);
return st;
diff --git a/src/ambigator.c b/src/ambigator.c
index a172df48..2b59bd1e 100644
--- a/src/ambigator.c
+++ b/src/ambigator.c
@@ -55,6 +55,8 @@
#include <cell-utils.h>
#include <thread-pool.h>
+#include "version.h"
+
static void show_help(const char *s)
{
@@ -765,7 +767,8 @@ static void write_reindexed_stream(const char *infile, const char *outfile,
done = 1;
/* Add our own header */
- fprintf(ofh, "Re-indexed by ambigator "CRYSTFEL_VERSIONSTRING"\n");
+ fprintf(ofh, "Re-indexed by ambigator %s\n",
+ crystfel_version_string());
if ( argc > 0 ) {
for ( i=0; i<argc; i++ ) {
if ( i > 0 ) fprintf(ofh, " ");
@@ -1094,8 +1097,10 @@ int main(int argc, char *argv[])
return 0;
case 10 :
- printf("CrystFEL: " CRYSTFEL_VERSIONSTRING "\n");
- printf(CRYSTFEL_BOILERPLATE"\n");
+ printf("CrystFEL: %s\n",
+ crystfel_version_string());
+ printf("%s\n",
+ crystfel_licence_string());
return 0;
case 'o' :
diff --git a/src/cell_explorer.c b/src/cell_explorer.c
index 88c23dc3..2eec4a19 100644
--- a/src/cell_explorer.c
+++ b/src/cell_explorer.c
@@ -48,6 +48,7 @@
#include "cell-utils.h"
#include "multihistogram.h"
+#include "version.h"
static void show_help(const char *s)
@@ -1958,8 +1959,10 @@ int main(int argc, char *argv[])
return 0;
case 1 :
- printf("CrystFEL: " CRYSTFEL_VERSIONSTRING "\n");
- printf(CRYSTFEL_BOILERPLATE"\n");
+ printf("CrystFEL: %s\n",
+ crystfel_version_string());
+ printf("%s\n",
+ crystfel_licence_string());
return 0;
default :
diff --git a/src/cell_tool.c b/src/cell_tool.c
index 8170b27b..bcfb326f 100644
--- a/src/cell_tool.c
+++ b/src/cell_tool.c
@@ -39,10 +39,12 @@
#include <getopt.h>
#include <assert.h>
-#include "cell.h"
-#include "cell-utils.h"
-#include "reflist-utils.h"
-#include "reflist.h"
+#include <cell.h>
+#include <cell-utils.h>
+#include <reflist-utils.h>
+#include <reflist.h>
+
+#include "version.h"
static void show_help(const char *s)
@@ -54,6 +56,7 @@ static void show_help(const char *s)
" -h, --help Display this help message.\n"
" -p, --pdb=<file> Get unit cell from <file> (PDB or CrystFEL format).\n"
" -o <file> Output unit cell file.\n"
+" --version Print CrystFEL version number and exit.\n"
"\n"
" Actions:\n"
" --find-ambi Find indexing ambiguities for the cell.\n"
@@ -487,6 +490,7 @@ int main(int argc, char *argv[])
{"pdb", 1, NULL, 'p'},
{"tolerance", 1, NULL, 2},
{"output", 1, NULL, 'o'},
+ {"version", 0, NULL, 6},
/* Modes of operation */
{"find-ambi", 0, &mode, CT_FINDAMBI},
@@ -546,6 +550,13 @@ int main(int argc, char *argv[])
rmax = 1.0 / (highres/1e10);
break;
+ case 6 :
+ printf("CrystFEL: %s\n",
+ crystfel_version_string());
+ printf("%s\n",
+ crystfel_licence_string());
+ return 0;
+
case 0 :
break;
diff --git a/src/check_hkl.c b/src/check_hkl.c
index f36c9ed4..f743d575 100644
--- a/src/check_hkl.c
+++ b/src/check_hkl.c
@@ -40,11 +40,13 @@
#include <gsl/gsl_fit.h>
#include <assert.h>
-#include "utils.h"
-#include "symmetry.h"
-#include "reflist.h"
-#include "reflist-utils.h"
-#include "cell-utils.h"
+#include <utils.h>
+#include <symmetry.h>
+#include <reflist.h>
+#include <reflist-utils.h>
+#include <cell-utils.h>
+
+#include "version.h"
static void show_help(const char *s)
@@ -761,8 +763,10 @@ int main(int argc, char *argv[])
return 0;
case 9 :
- printf("CrystFEL: " CRYSTFEL_VERSIONSTRING "\n");
- printf(CRYSTFEL_BOILERPLATE"\n");
+ printf("CrystFEL: %s\n",
+ crystfel_version_string());
+ printf("%s\n",
+ crystfel_licence_string());
return 0;
case 'y' :
diff --git a/src/compare_hkl.c b/src/compare_hkl.c
index 5b0c6aa8..2a89596e 100644
--- a/src/compare_hkl.c
+++ b/src/compare_hkl.c
@@ -43,10 +43,13 @@
#include <gsl/gsl_statistics.h>
#include <gsl/gsl_fit.h>
-#include "utils.h"
-#include "symmetry.h"
-#include "reflist-utils.h"
-#include "cell-utils.h"
+#include <utils.h>
+#include <symmetry.h>
+#include <reflist-utils.h>
+#include <cell-utils.h>
+
+#include "version.h"
+
enum fom
{
@@ -1185,8 +1188,10 @@ int main(int argc, char *argv[])
return 0;
case 10 :
- printf("CrystFEL: " CRYSTFEL_VERSIONSTRING "\n");
- printf(CRYSTFEL_BOILERPLATE"\n");
+ printf("CrystFEL: %s\n",
+ crystfel_version_string());
+ printf("%s\n",
+ crystfel_licence_string());
return 0;
case 'y' :
diff --git a/src/crystfel_gui.c b/src/crystfel_gui.c
index fc7e265f..e291bc16 100644
--- a/src/crystfel_gui.c
+++ b/src/crystfel_gui.c
@@ -50,6 +50,7 @@
#include "gui_index.h"
#include "gui_backend_local.h"
#include "gui_project.h"
+#include "version.h"
static void show_help(const char *s)
@@ -602,7 +603,8 @@ static gint about_sig(GtkWidget *widget, struct crystfelproject *proj)
gtk_about_dialog_set_program_name(GTK_ABOUT_DIALOG(window),
"CrystFEL graphical user interface");
- gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(window), CRYSTFEL_VERSIONSTRING);
+ gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(window),
+ crystfel_version_string());
gtk_about_dialog_set_copyright(GTK_ABOUT_DIALOG(window),
"© 2020 Deutsches Elektronen-Synchrotron DESY, "
"a research centre of the Helmholtz Association.");
@@ -797,8 +799,10 @@ int main(int argc, char *argv[])
return 0;
case 1 :
- printf("CrystFEL: " CRYSTFEL_VERSIONSTRING "\n");
- printf(CRYSTFEL_BOILERPLATE"\n");
+ printf("CrystFEL: %s\n",
+ crystfel_version_string());
+ printf("%s\n",
+ crystfel_licence_string());
return 0;
default :
diff --git a/src/geoptimiser.c b/src/geoptimiser.c
index 385a85d4..16c59f3c 100644
--- a/src/geoptimiser.c
+++ b/src/geoptimiser.c
@@ -54,12 +54,15 @@
#endif /* HAVE_GDK */
#endif /* HAVE_CAIRO */
-#include "detector.h"
-#include "stream.h"
-#include "crystal.h"
-#include "image.h"
-#include "utils.h"
-#include "colscale.h"
+#include <detector.h>
+#include <stream.h>
+#include <crystal.h>
+#include <image.h>
+#include <utils.h>
+#include <colscale.h>
+
+#include "version.h"
+
struct imagefeature;
@@ -2730,8 +2733,10 @@ int main(int argc, char *argv[])
return 0;
case 10 :
- printf("CrystFEL: " CRYSTFEL_VERSIONSTRING "\n");
- printf(CRYSTFEL_BOILERPLATE"\n");
+ printf("CrystFEL: %s\n",
+ crystfel_version_string());
+ printf("%s\n",
+ crystfel_licence_string());
return 0;
case 'o' :
diff --git a/src/get_hkl.c b/src/get_hkl.c
index 3f3d6637..31d04181 100644
--- a/src/get_hkl.c
+++ b/src/get_hkl.c
@@ -38,11 +38,13 @@
#include <unistd.h>
#include <getopt.h>
-#include "utils.h"
-#include "reflist-utils.h"
-#include "symmetry.h"
-#include "cell.h"
-#include "cell-utils.h"
+#include <utils.h>
+#include <reflist-utils.h>
+#include <symmetry.h>
+#include <cell.h>
+#include <cell-utils.h>
+
+#include "version.h"
static void show_help(const char *s)
@@ -503,8 +505,10 @@ int main(int argc, char *argv[])
return 0;
case 5 :
- printf("CrystFEL: " CRYSTFEL_VERSIONSTRING "\n");
- printf(CRYSTFEL_BOILERPLATE"\n");
+ printf("CrystFEL: %s\n",
+ crystfel_version_string());
+ printf("%s\n",
+ crystfel_licence_string());
return 0;
case 't' :
diff --git a/src/indexamajig.c b/src/indexamajig.c
index 68b293f6..98573839 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -64,6 +64,8 @@
#include <datatemplate.h>
#include "im-sandbox.h"
+#include "version.h"
+
struct indexamajig_arguments
{
@@ -102,8 +104,8 @@ struct indexamajig_arguments
static void show_version(FILE *fh, struct argp_state *state)
{
- printf("CrystFEL: " CRYSTFEL_VERSIONSTRING "\n");
- printf(CRYSTFEL_BOILERPLATE"\n");
+ printf("CrystFEL: %s\n", crystfel_version_string());
+ printf("%s\n", crystfel_licence_string());
}
diff --git a/src/list_events.c b/src/list_events.c
index 84465dc5..c9a0ae40 100644
--- a/src/list_events.c
+++ b/src/list_events.c
@@ -38,9 +38,11 @@
#include <unistd.h>
#include <getopt.h>
-#include "utils.h"
-#include "image.h"
-#include "datatemplate.h"
+#include <utils.h>
+#include <image.h>
+#include <datatemplate.h>
+
+#include "version.h"
static void show_help(const char *s)
@@ -92,8 +94,10 @@ int main(int argc, char *argv[])
return 0;
case 2 :
- printf("CrystFEL: " CRYSTFEL_VERSIONSTRING "\n");
- printf(CRYSTFEL_BOILERPLATE"\n");
+ printf("CrystFEL: %s\n",
+ crystfel_version_string());
+ printf("%s\n",
+ crystfel_licence_string());
return 0;
case 'o' :
diff --git a/src/make_pixelmap.c b/src/make_pixelmap.c
index eedcb439..cb5afcac 100644
--- a/src/make_pixelmap.c
+++ b/src/make_pixelmap.c
@@ -43,9 +43,11 @@
#include <assert.h>
#include <hdf5.h>
-#include "utils.h"
-#include "datatemplate.h"
-#include "detgeom.h"
+#include <utils.h>
+#include <datatemplate.h>
+#include <detgeom.h>
+
+#include "version.h"
static void show_help(const char *s)
@@ -190,6 +192,7 @@ int main(int argc, char *argv[])
{"badmap", 0, &badmap, 1},
{"good-pixel", 1, NULL, 301},
{"bad-pixel", 1, NULL, 302},
+ {"version", 0, NULL, 2},
{0, 0, NULL, 0}
};
@@ -207,6 +210,13 @@ int main(int argc, char *argv[])
output_file = strdup(optarg);
break;
+ case 2 :
+ printf("CrystFEL: %s\n",
+ crystfel_version_string());
+ printf("%s\n",
+ crystfel_licence_string());
+ return 0;
+
case 301:
if (sscanf(optarg, "%d", &good_pixel_val) != 1)
{
diff --git a/src/partial_sim.c b/src/partial_sim.c
index 9e774431..5d1a79e8 100644
--- a/src/partial_sim.c
+++ b/src/partial_sim.c
@@ -42,14 +42,17 @@
#include <pthread.h>
#include <gsl/gsl_rng.h>
-#include "image.h"
-#include "utils.h"
-#include "reflist-utils.h"
-#include "symmetry.h"
-#include "geometry.h"
-#include "stream.h"
-#include "thread-pool.h"
-#include "cell-utils.h"
+#include <image.h>
+#include <utils.h>
+#include <reflist-utils.h>
+#include <symmetry.h>
+#include <geometry.h>
+#include <stream.h>
+#include <thread-pool.h>
+#include <cell-utils.h>
+
+#include "version.h"
+
/* Number of bins for partiality graph */
#define NBINS 50
@@ -589,8 +592,10 @@ int main(int argc, char *argv[])
return 0;
case 'v' :
- printf("CrystFEL: " CRYSTFEL_VERSIONSTRING "\n");
- printf(CRYSTFEL_BOILERPLATE"\n");
+ printf("CrystFEL: %s\n",
+ crystfel_version_string());
+ printf("%s\n",
+ crystfel_licence_string());
return 0;
case 'b' :
diff --git a/src/partialator.c b/src/partialator.c
index 1f87e6b8..f35d7cf8 100644
--- a/src/partialator.c
+++ b/src/partialator.c
@@ -58,6 +58,7 @@
#include "post-refinement.h"
#include "merge.h"
#include "rejection.h"
+#include "version.h"
struct csplit_hash_entry
@@ -1037,8 +1038,10 @@ int main(int argc, char *argv[])
return 0;
case 'v' :
- printf("CrystFEL: " CRYSTFEL_VERSIONSTRING "\n");
- printf(CRYSTFEL_BOILERPLATE"\n");
+ printf("CrystFEL: %s\n",
+ crystfel_version_string());
+ printf("%s\n",
+ crystfel_licence_string());
return 0;
case 'i' :
diff --git a/src/pattern_sim.c b/src/pattern_sim.c
index 2f9a228e..916257e3 100644
--- a/src/pattern_sim.c
+++ b/src/pattern_sim.c
@@ -42,19 +42,21 @@
#include <getopt.h>
#include <hdf5.h>
-#include "image.h"
+#include <image.h>
+#include <cell.h>
+#include <cell-utils.h>
+#include <utils.h>
+#include <detector.h>
+#include <peaks.h>
+#include <symmetry.h>
+#include <reflist.h>
+#include <reflist-utils.h>
+#include <stream.h>
+
#include "diffraction.h"
#include "diffraction-gpu.h"
-#include "cell.h"
-#include "cell-utils.h"
-#include "utils.h"
-#include "detector.h"
-#include "peaks.h"
-#include "symmetry.h"
-#include "reflist.h"
-#include "reflist-utils.h"
#include "pattern_sim.h"
-#include "stream.h"
+#include "version.h"
enum spectrum_type {
@@ -588,8 +590,10 @@ int main(int argc, char *argv[])
return 0;
case 'v' :
- printf("CrystFEL: " CRYSTFEL_VERSIONSTRING "\n");
- printf(CRYSTFEL_BOILERPLATE"\n");
+ printf("CrystFEL: %s\n",
+ crystfel_version_string());
+ printf("%s\n",
+ crystfel_licence_string());
return 0;
case 'b' :
diff --git a/src/process_hkl.c b/src/process_hkl.c
index b840f4ce..352bea4a 100644
--- a/src/process_hkl.c
+++ b/src/process_hkl.c
@@ -43,16 +43,18 @@
#include <unistd.h>
#include <getopt.h>
-#include "utils.h"
-#include "reflist-utils.h"
-#include "symmetry.h"
-#include "stream.h"
-#include "reflist.h"
-#include "image.h"
-#include "crystal.h"
-#include "thread-pool.h"
-#include "geometry.h"
-#include "cell-utils.h"
+#include <utils.h>
+#include <reflist-utils.h>
+#include <symmetry.h>
+#include <stream.h>
+#include <reflist.h>
+#include <image.h>
+#include <crystal.h>
+#include <thread-pool.h>
+#include <geometry.h>
+#include <cell-utils.h>
+
+#include "version.h"
static void show_help(const char *s)
@@ -664,8 +666,10 @@ int main(int argc, char *argv[])
break;
case 7 :
- printf("CrystFEL: " CRYSTFEL_VERSIONSTRING "\n");
- printf(CRYSTFEL_BOILERPLATE"\n");
+ printf("CrystFEL: %s\n",
+ crystfel_version_string());
+ printf("%s\n",
+ crystfel_licence_string());
return 0;
case '?' :
diff --git a/src/render_hkl.c b/src/render_hkl.c
index f2ffa211..3f539cb2 100644
--- a/src/render_hkl.c
+++ b/src/render_hkl.c
@@ -45,13 +45,15 @@
#include <gsl/gsl_linalg.h>
#include <gsl/gsl_blas.h>
-#include "utils.h"
-#include "symmetry.h"
-#include "colscale.h"
+#include <utils.h>
+#include <symmetry.h>
+#include <colscale.h>
+#include <reflist.h>
+#include <reflist-utils.h>
+#include <cell-utils.h>
+
#include "render_hkl.h"
-#include "reflist.h"
-#include "reflist-utils.h"
-#include "cell-utils.h"
+#include "version.h"
#define KEY_FILENAME "key.pdf"
@@ -811,8 +813,10 @@ int main(int argc, char *argv[])
return 0;
case 5 :
- printf("CrystFEL: " CRYSTFEL_VERSIONSTRING "\n");
- printf(CRYSTFEL_BOILERPLATE"\n");
+ printf("CrystFEL: %s\n",
+ crystfel_version_string());
+ printf("%s\n",
+ crystfel_licence_string());
return 0;
case 'p' :
diff --git a/src/version.c.cmake.in b/src/version.c.cmake.in
new file mode 100644
index 00000000..a22b4143
--- /dev/null
+++ b/src/version.c.cmake.in
@@ -0,0 +1,13 @@
+const char *crystfel_version_string()
+{
+ return "${CRYSTFEL_VERSION}";
+}
+
+const char *crystfel_licence_string()
+{
+ return "License GPLv3+: GNU GPL version 3 or later" \
+ " <http://gnu.org/licenses/gpl.html>.\n" \
+ "This is free software: you are free to change and redistribute it.\n" \
+ "There is NO WARRANTY, to the extent permitted by law.\n\n" \
+ "Written by Thomas White and others.";
+}
diff --git a/src/version.h b/src/version.h
new file mode 100644
index 00000000..0ecac74a
--- /dev/null
+++ b/src/version.h
@@ -0,0 +1,2 @@
+extern const char *crystfel_version_string(void);
+extern const char *crystfel_licence_string(void);
diff --git a/src/whirligig.c b/src/whirligig.c
index 6c007f0b..16688559 100644
--- a/src/whirligig.c
+++ b/src/whirligig.c
@@ -42,11 +42,13 @@
#include <image.h>
#include <utils.h>
#include <stream.h>
+#include <cell-utils.h>
+#include <integer_matrix.h>
+#include <reflist.h>
+#include <reflist-utils.h>
+
+#include "version.h"
-#include "cell-utils.h"
-#include "integer_matrix.h"
-#include "reflist.h"
-#include "reflist-utils.h"
/* Maximum number of series which can overlap at once */
#define MAX_SER 8
@@ -634,8 +636,10 @@ int main(int argc, char *argv[])
break;
case 3 :
- printf("CrystFEL: " CRYSTFEL_VERSIONSTRING "\n");
- printf(CRYSTFEL_BOILERPLATE"\n");
+ printf("CrystFEL: %s\n",
+ crystfel_version_string());
+ printf("%s\n",
+ crystfel_licence_string());
return 0;
case 4 :