aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-02-12 12:40:50 +0100
committerThomas White <taw@physics.org>2021-02-12 17:27:44 +0100
commit5ceed23ffdae85bb42b4d2f01a7a02485dd8c954 (patch)
tree785c77b19e1f9746b044409591f6f00ff7021730
parenta9334fdf379923d737bf3be504c42a901f5b8009 (diff)
GUI: Add CCP4 libraries and hide MTZ export options if not found
-rw-r--r--CMakeLists.txt8
-rw-r--r--config.h.cmake.in1
-rw-r--r--config.h.in1
-rw-r--r--meson.build9
-rw-r--r--src/gui_export.c2
5 files changed, 18 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 23aacde2..bdd31cb4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -76,6 +76,7 @@ endif()
pkg_search_module(CAIRO cairo)
pkg_search_module(GDKPIXBUF gdk-pixbuf-2.0)
+pkg_search_module(LIBCCP4 libccp4c)
include(CheckCCompilerFlag)
check_c_compiler_flag("-fdiagnostics-color=always" HAVE_DIAG_COLOR)
@@ -119,6 +120,7 @@ set(HAVE_GDKPIXBUF ${GDKPIXBUF_FOUND})
set(HAVE_GDK ${GDK_FOUND})
set(HAVE_MSGPACK ${MSGPACK_FOUND})
set(HAVE_ZMQ ${ZMQ_FOUND})
+set(HAVE_LIBCCP4 ${LIBCCP4_FOUND})
set(PACKAGE_VERSION ${PROJECT_VERSION})
@@ -403,8 +405,10 @@ if (GTK_FOUND)
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})
+ target_include_directories(crystfel PRIVATE ${COMMON_INCLUDES} ${GTK_INCLUDE_DIRS}
+ ${LIBCCP4_INCLUDES})
+ target_link_libraries (crystfel ${COMMON_LIBRARIES} util ${GTK_LIBRARIES}
+ ${LIBCCP4_LIBRARIES})
if (HAVE_SLURM)
target_link_libraries(crystfel slurm)
diff --git a/config.h.cmake.in b/config.h.cmake.in
index d8c1cbfa..db1f6ec5 100644
--- a/config.h.cmake.in
+++ b/config.h.cmake.in
@@ -11,3 +11,4 @@
#cmakedefine HAVE_MSGPACK
#cmakedefine HAVE_ZMQ
#cmakedefine HAVE_SLURM
+#cmakedefine HAVE_LIBCCP4
diff --git a/config.h.in b/config.h.in
index 1d917494..59f4281a 100644
--- a/config.h.in
+++ b/config.h.in
@@ -11,3 +11,4 @@
#mesondefine HAVE_MSGPACK
#mesondefine HAVE_ZMQ
#mesondefine HAVE_SLURM
+#mesondefine HAVE_LIBCCP4
diff --git a/meson.build b/meson.build
index b7ba1c4b..21bfa2f6 100644
--- a/meson.build
+++ b/meson.build
@@ -94,6 +94,11 @@ if cc.has_function('clock_gettime', prefix : '#include <time.h>')
conf_data.set10('HAVE_CLOCK_GETTIME', 1)
endif
+ccp4dep = dependency('libccp4c', required: false)
+if ccp4dep.found()
+ conf_data.set10('HAVE_LIBCCP4', 1)
+endif
+
# ************************ libcrystfel (subdir) ************************
subdir('libcrystfel')
@@ -231,8 +236,10 @@ if gtkdep.found()
gui_sources += 'src/gui_backend_slurm.c'
endif
+
executable('crystfel', gui_sources,
- dependencies : [mdep, libcrystfeldep, gtkdep, gsldep, slurmdep],
+ dependencies : [mdep, libcrystfeldep, gtkdep, gsldep, slurmdep,
+ ccp4dep],
install : true,
install_rpath: '$ORIGIN/../lib64/:$ORIGIN/../lib')
diff --git a/src/gui_export.c b/src/gui_export.c
index 0daf8ae5..4f300594 100644
--- a/src/gui_export.c
+++ b/src/gui_export.c
@@ -350,10 +350,12 @@ gint export_sig(GtkWidget *widget, struct crystfelproject *proj)
win->format = gtk_combo_box_text_new();
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(win->format),
FALSE, FALSE, 4.0);
+#ifdef HAVE_LIBCCP4
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(win->format), "mtz",
"MTZ, plain");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(win->format), "mtz-bij",
"MTZ, Bijvoet pairs together");
+#endif
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(win->format), "xds",
"XDS ASCII");
gtk_combo_box_set_active(GTK_COMBO_BOX(win->format), 0);