aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMake/FindCBF.cmake22
-rw-r--r--CMake/FindCairo.cmake47
-rw-r--r--CMake/FindFDIP.cmake27
-rw-r--r--CMake/FindFFTW.cmake22
-rw-r--r--CMake/FindNBP.cmake26
-rw-r--r--CMake/FindPINKINDEXER.cmake26
-rw-r--r--CMake/FindXGANDALF.cmake26
-rw-r--r--CMake/config.cmake23
-rw-r--r--CMakeLists.txt361
-rw-r--r--config.h.cmake.in62
-rw-r--r--libcrystfel/CMakeLists.txt121
11 files changed, 763 insertions, 0 deletions
diff --git a/CMake/FindCBF.cmake b/CMake/FindCBF.cmake
new file mode 100644
index 00000000..390c9c2e
--- /dev/null
+++ b/CMake/FindCBF.cmake
@@ -0,0 +1,22 @@
+# - Find CBF
+# Find the native CBF includes and library
+#
+# CBF_INCLUDES - where to find fftw3.h
+# CBF_LIBRARIES - List of libraries when using CBF.
+# CBF_FOUND - True if CBF found.
+
+if (CBF_INCLUDES)
+ # Already in cache, be silent
+ set (CBF_FIND_QUIETLY TRUE)
+endif (CBF_INCLUDES)
+
+find_path (CBF_INCLUDES cbf.h PATH_SUFFIXES libcbf cbf)
+
+find_library (CBF_LIBRARIES NAMES cbf)
+
+# handle the QUIETLY and REQUIRED arguments and set CBF_FOUND to TRUE if
+# all listed variables are TRUE
+include (FindPackageHandleStandardArgs)
+find_package_handle_standard_args (CBF DEFAULT_MSG CBF_LIBRARIES CBF_INCLUDES)
+
+mark_as_advanced (CBF_LIBRARIES CBF_INCLUDES)
diff --git a/CMake/FindCairo.cmake b/CMake/FindCairo.cmake
new file mode 100644
index 00000000..f03079af
--- /dev/null
+++ b/CMake/FindCairo.cmake
@@ -0,0 +1,47 @@
+# - Try to find the cairo library
+# Once done this will define
+#
+# CAIRO_FOUND - system has cairo
+# CAIRO_INCLUDE_DIRS - the cairo include directory
+# CAIRO_LIBRARIES - Link these to use cairo
+#
+# Define CAIRO_MIN_VERSION for which version desired.
+#
+
+INCLUDE(FindPkgConfig)
+
+IF(Cairo_FIND_REQUIRED)
+ SET(_pkgconfig_REQUIRED "REQUIRED")
+ELSE(Cairo_FIND_REQUIRED)
+ SET(_pkgconfig_REQUIRED "")
+ENDIF(Cairo_FIND_REQUIRED)
+
+IF(CAIRO_MIN_VERSION)
+ PKG_SEARCH_MODULE(CAIRO ${_pkgconfig_REQUIRED} cairo>=${CAIRO_MIN_VERSION})
+ELSE(CAIRO_MIN_VERSION)
+ PKG_SEARCH_MODULE(CAIRO ${_pkgconfig_REQUIRED} cairo)
+ENDIF(CAIRO_MIN_VERSION)
+
+IF(NOT CAIRO_FOUND AND NOT PKG_CONFIG_FOUND)
+ FIND_PATH(CAIRO_INCLUDE_DIRS cairo.h)
+ FIND_LIBRARY(CAIRO_LIBRARIES cairo)
+
+ # Report results
+ IF(CAIRO_LIBRARIES AND CAIRO_INCLUDE_DIRS)
+ SET(CAIRO_FOUND 1)
+ IF(NOT Cairo_FIND_QUIETLY)
+ MESSAGE(STATUS "Found Cairo: ${CAIRO_LIBRARIES}")
+ ENDIF(NOT Cairo_FIND_QUIETLY)
+ ELSE(CAIRO_LIBRARIES AND CAIRO_INCLUDE_DIRS)
+ IF(Cairo_FIND_REQUIRED)
+ MESSAGE(SEND_ERROR "Could not find Cairo")
+ ELSE(Cairo_FIND_REQUIRED)
+ IF(NOT Cairo_FIND_QUIETLY)
+ MESSAGE(STATUS "Could not find Cairo")
+ ENDIF(NOT Cairo_FIND_QUIETLY)
+ ENDIF(Cairo_FIND_REQUIRED)
+ ENDIF(CAIRO_LIBRARIES AND CAIRO_INCLUDE_DIRS)
+ENDIF(NOT CAIRO_FOUND AND NOT PKG_CONFIG_FOUND)
+
+# Hide advanced variables from CMake GUIs
+MARK_AS_ADVANCED(CAIRO_LIBRARIES CAIRO_INCLUDE_DIRS)
diff --git a/CMake/FindFDIP.cmake b/CMake/FindFDIP.cmake
new file mode 100644
index 00000000..fb38e0db
--- /dev/null
+++ b/CMake/FindFDIP.cmake
@@ -0,0 +1,27 @@
+# - Find FDIP
+# Find the native FDIP includes and library
+#
+# FDIP_INCLUDES - where to find streakFinder.h
+# FDIP_LIBRARIES - List of libraries when using FDIP.
+# FDIP_FOUND - True if FDIP found.
+
+if (FDIP_INCLUDES)
+ # Already in cache, be silent
+ set (FDIP_FIND_QUIETLY TRUE)
+endif (FDIP_INCLUDES)
+
+find_path (FDIP_INCLUDES streakFinder.h
+ PATHS
+ ${CMAKE_INSTALL_PREFIX}/include
+ PATH_SUFFIXES fastDiffractionImageProcessing)
+
+find_library (FDIP_LIBRARIES fastDiffractionImageProcessing
+ PATHS
+ ${CMAKE_INSTALL_PREFIX}/lib)
+
+# handle the QUIETLY and REQUIRED arguments and set FDIP_FOUND to TRUE if
+# all listed variables are TRUE
+include (FindPackageHandleStandardArgs)
+find_package_handle_standard_args (FDIP DEFAULT_MSG FDIP_LIBRARIES FDIP_INCLUDES)
+
+mark_as_advanced (FDIP_LIBRARIES FDIP_INCLUDES)
diff --git a/CMake/FindFFTW.cmake b/CMake/FindFFTW.cmake
new file mode 100644
index 00000000..00c3401c
--- /dev/null
+++ b/CMake/FindFFTW.cmake
@@ -0,0 +1,22 @@
+# - Find FFTW
+# Find the native FFTW includes and library
+#
+# FFTW_INCLUDES - where to find fftw3.h
+# FFTW_LIBRARIES - List of libraries when using FFTW.
+# FFTW_FOUND - True if FFTW found.
+
+if (FFTW_INCLUDES)
+ # Already in cache, be silent
+ set (FFTW_FIND_QUIETLY TRUE)
+endif (FFTW_INCLUDES)
+
+find_path (FFTW_INCLUDES fftw3.h)
+
+find_library (FFTW_LIBRARIES NAMES fftw3)
+
+# handle the QUIETLY and REQUIRED arguments and set FFTW_FOUND to TRUE if
+# all listed variables are TRUE
+include (FindPackageHandleStandardArgs)
+find_package_handle_standard_args (FFTW DEFAULT_MSG FFTW_LIBRARIES FFTW_INCLUDES)
+
+mark_as_advanced (FFTW_LIBRARIES FFTW_INCLUDES)
diff --git a/CMake/FindNBP.cmake b/CMake/FindNBP.cmake
new file mode 100644
index 00000000..63906ea4
--- /dev/null
+++ b/CMake/FindNBP.cmake
@@ -0,0 +1,26 @@
+# - Find NBP - numericalBraggPrediction
+# Find the native NBP includes and library
+#
+# NBP_INCLUDES - where to find IndexerBase.h
+# NBP_LIBRARIES - List of libraries when using NBP.
+# NBP_FOUND - True if NBP found.
+
+if (NBP_INCLUDES)
+ # Already in cache, be silent
+ set (NBP_FIND_QUIETLY TRUE)
+endif (NBP_INCLUDES)
+
+find_path (NBP_INCLUDES numericalBraggPrediction/ProjectionCalculation.h
+ PATHS
+ ${CMAKE_INSTALL_PREFIX}/include)
+
+find_library (NBP_LIBRARIES numericalBraggPrediction
+ PATHS
+ ${CMAKE_INSTALL_PREFIX}/lib)
+
+# handle the QUIETLY and REQUIRED arguments and set NBP_FOUND to TRUE if
+# all listed variables are TRUE
+include (FindPackageHandleStandardArgs)
+find_package_handle_standard_args (NBP DEFAULT_MSG NBP_LIBRARIES NBP_INCLUDES)
+
+mark_as_advanced (NBP_LIBRARIES NBP_INCLUDES)
diff --git a/CMake/FindPINKINDEXER.cmake b/CMake/FindPINKINDEXER.cmake
new file mode 100644
index 00000000..6a96786e
--- /dev/null
+++ b/CMake/FindPINKINDEXER.cmake
@@ -0,0 +1,26 @@
+# - Find PINKINDEXER
+# Find the native PINKINDEXER includes and library
+#
+# PINKINDEXER_INCLUDES - where to find IndexerBase.h
+# PINKINDEXER_LIBRARIES - List of libraries when using PINKINDEXER.
+# PINKINDEXER_FOUND - True if PINKINDEXER found.
+
+if (PINKINDEXER_INCLUDES)
+ # Already in cache, be silent
+ set (PINKINDEXER_FIND_QUIETLY TRUE)
+endif (PINKINDEXER_INCLUDES)
+
+find_path (PINKINDEXER_INCLUDES pinkIndexer/PinkIndexer.h
+ PATHS
+ ${CMAKE_INSTALL_PREFIX}/include)
+
+find_library (PINKINDEXER_LIBRARIES pinkIndexer
+ PATHS
+ ${CMAKE_INSTALL_PREFIX}/lib)
+
+# handle the QUIETLY and REQUIRED arguments and set PINKINDEXER_FOUND to TRUE if
+# all listed variables are TRUE
+include (FindPackageHandleStandardArgs)
+find_package_handle_standard_args (PINKINDEXER DEFAULT_MSG PINKINDEXER_LIBRARIES PINKINDEXER_INCLUDES)
+
+mark_as_advanced (PINKINDEXER_LIBRARIES PINKINDEXER_INCLUDES)
diff --git a/CMake/FindXGANDALF.cmake b/CMake/FindXGANDALF.cmake
new file mode 100644
index 00000000..1c6999a3
--- /dev/null
+++ b/CMake/FindXGANDALF.cmake
@@ -0,0 +1,26 @@
+# - Find XGANDALF
+# Find the native XGANDALF includes and library
+#
+# XGANDALF_INCLUDES - where to find IndexerBase.h
+# XGANDALF_LIBRARIES - List of libraries when using XGANDALF.
+# XGANDALF_FOUND - True if XGANDALF found.
+
+if (XGANDALF_INCLUDES)
+ # Already in cache, be silent
+ set (XGANDALF_FIND_QUIETLY TRUE)
+endif (XGANDALF_INCLUDES)
+
+find_path (XGANDALF_INCLUDES xgandalf/IndexerBase.h
+ PATHS
+ ${CMAKE_INSTALL_PREFIX}/include)
+
+find_library (XGANDALF_LIBRARIES xgandalf
+ PATHS
+ ${CMAKE_INSTALL_PREFIX}/lib)
+
+# handle the QUIETLY and REQUIRED arguments and set XGANDALF_FOUND to TRUE if
+# all listed variables are TRUE
+include (FindPackageHandleStandardArgs)
+find_package_handle_standard_args (XGANDALF DEFAULT_MSG XGANDALF_LIBRARIES XGANDALF_INCLUDES)
+
+mark_as_advanced (XGANDALF_LIBRARIES XGANDALF_INCLUDES)
diff --git a/CMake/config.cmake b/CMake/config.cmake
new file mode 100644
index 00000000..239ba13a
--- /dev/null
+++ b/CMake/config.cmake
@@ -0,0 +1,23 @@
+include(CheckIncludeFile)
+include(CheckLibraryExists)
+
+set(HAVE_CAIRO ${CAIRO_FOUND})
+set(HAVE_TIFF ${TIFF_FOUND})
+set(HAVE_GTK ${GTK2_FOUND})
+set(HAVE_FFTW ${FFTW_FOUND})
+set(HAVE_XGANDALF ${XGANDALF_FOUND})
+set(HAVE_FDIP ${FDIP_FOUND})
+set(HAVE_OPENCL ${OpenCL_FOUND})
+set(HAVE_CBFLIB ${CBF_FOUND})
+
+
+check_include_file(fcntl.h HAVE_FCNTL_H)
+check_include_file(stdlib.h HAVE_STDLIB_H)
+check_include_file(unistd.h HAVE_UNISTD_H)
+if(OpenCL_FOUND)
+ check_include_file(CL/cl.h HAVE_CL_CL_H "-I${OpenCL_INCLUDE_DIRS}")
+endif(OpenCL_FOUND)
+
+check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME)
+
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake.in ${CMAKE_CURRENT_SOURCE_DIR}/config.h)
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 00000000..530c5320
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,361 @@
+cmake_minimum_required(VERSION 3.6)
+project(crystfel)
+
+include(GNUInstallDirs)
+
+option(BUILD_HDFSEE "Build hdfsee" ON)
+option(BUILD_EXPLORER "Build the cell_explorer" ON)
+
+# Set CMAKE_MODULE_PATH to assist cmake in finding our own package definitions
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMake")
+
+find_package(HDF5 REQUIRED COMPONENTS C)
+find_package(Threads REQUIRED)
+find_package(GSL REQUIRED)
+find_package(GTK2 2.0.0 COMPONENTS gtk)
+find_package(FFTW)
+find_package(CBF)
+find_package(TIFF)
+find_package(Cairo)
+find_package(XGANDALF)
+find_package(PINKINDEXER)
+find_package(NBP)
+find_package(FDIP)
+find_package(OpenCL)
+
+include(config)
+
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+add_definitions(-DHAVE_CONFIG_H -DDATADIR=\"${CMAKE_INSTALL_FULL_DATADIR}\")
+set(CMAKE_C_STANDARD 99)
+
+# Make programs work without LD_LIBRARY_PATH when installed to a non system directory
+list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
+if("${isSystemDir}" STREQUAL "-1")
+ set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
+endif("${isSystemDir}" STREQUAL "-1")
+
+# Common include directories and libraries
+
+set(COMMON_INCLUDES
+ ${HDF5_INCLUDE_DIRS}
+ )
+
+set(COMMON_LIBRARIES
+ libcrystfel
+ ${HDF5_C_LIBRARIES}
+ Threads::Threads
+ GSL::gsl
+ )
+
+
+# Add the libcrystfel target
+add_subdirectory(libcrystfel)
+add_custom_target(
+ versionh
+ BYPRODUCTS ${CMAKE_SOURCE_DIR}/version.h
+ COMMAND ${CMAKE_SOURCE_DIR}/version.sh ${CMAKE_SOURCE_DIR}
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ )
+add_dependencies(libcrystfel versionh)
+
+# ----------------------------------------------------------------------
+# Build Target
+# partial_sim
+
+set(PARTIAL_SIM_SOURCES
+ src/partial_sim.c)
+
+add_executable(partial_sim ${PARTIAL_SIM_SOURCES})
+target_include_directories(partial_sim PRIVATE ${COMMON_INCLUDES})
+target_link_libraries(partial_sim ${COMMON_LIBRARIES})
+
+# ----------------------------------------------------------------------
+# Build Target
+# pattern_sim
+
+set(PATTERN_SIM_SOURCES
+ src/pattern_sim.c
+ src/diffraction.c
+ )
+
+if(HAVE_OPENCL)
+ set(PATTERN_SIM_OPENCL_SOURCES
+ src/cl-utils.c
+ src/diffraction-gpu.c
+ )
+ set(PATTERN_SIM_RESOURCE_FILES
+ data/diffraction.cl
+ )
+endif(HAVE_OPENCL)
+
+add_executable(pattern_sim ${PATTERN_SIM_SOURCES} ${PATTERN_SIM_OPENCL_SOURCES})
+target_include_directories(pattern_sim PRIVATE ${COMMON_INCLUDES})
+target_link_libraries(pattern_sim ${COMMON_LIBRARIES})
+
+if(HAVE_OPENCL)
+ target_include_directories(pattern_sim PRIVATE ${OpenCL_INCLUDE_DIRS})
+ target_link_libraries(pattern_sim ${OpenCL_LIBRARIES})
+endif(HAVE_OPENCL)
+
+set_target_properties(pattern_sim PROPERTIES
+ RESOURCE "${PATTERN_SIM_RESOURCE_FILES}"
+ )
+
+# ----------------------------------------------------------------------
+# Build Target
+# hdfsee
+
+if(BUILD_HDFSEE AND GTK2_FOUND AND TIFF_FOUND)
+
+ set(HDFSEE_SOURCES
+ src/hdfsee.c
+ src/dw-hdfsee.c
+ src/hdfsee-render.c
+ )
+
+ set(HDFSEE_RESOURCE_FILES
+ data/hdfsee.ui
+ )
+
+ add_executable(hdfsee ${HDFSEE_SOURCES})
+ target_include_directories(hdfsee PRIVATE
+ ${COMMON_INCLUDES}
+ ${GTK2_INCLUDE_DIRS}
+ )
+ target_link_libraries(hdfsee
+ ${COMMON_LIBRARIES}
+ TIFF::TIFF
+ ${GTK2_LIBRARIES}
+ )
+ set_target_properties(hdfsee PROPERTIES
+ RESOURCE "${HDFSEE_RESOURCE_FILES}"
+ )
+
+ install(
+ TARGETS
+ hdfsee
+
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ RESOURCE DESTINATION share/crystfel
+ )
+
+endif(BUILD_HDFSEE AND GTK2_FOUND AND TIFF_FOUND)
+
+# ----------------------------------------------------------------------
+# Build Target
+# cell_explorer
+
+if(BUILD_EXPLORER AND GTK2_FOUND)
+
+ set(CELL_EXPLORER_SOURCES
+ src/cell_explorer.c
+ src/multihistogram.c
+ )
+
+ add_executable(cell_explorer ${CELL_EXPLORER_SOURCES})
+ target_include_directories(cell_explorer PRIVATE ${COMMON_INCLUDES} ${GTK2_INCLUDE_DIRS})
+ target_link_libraries(cell_explorer ${COMMON_LIBRARIES} ${GTK2_LIBRARIES})
+
+ install(
+ TARGETS
+ cell_explorer
+
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ )
+
+endif(BUILD_EXPLORER AND GTK2_FOUND)
+
+# ----------------------------------------------------------------------
+# Build Target
+# render_hkl
+
+if(CAIRO_FOUND AND GTK2_FOUND)
+
+ set(RENDER_HKL_SOURCES
+ src/render_hkl.c
+ )
+
+ add_executable(render_hkl ${RENDER_HKL_SOURCES})
+ target_include_directories(render_hkl PRIVATE
+ ${COMMON_INCLUDES}
+ ${GTK2_INCLUDE_DIRS}
+ ${CAIRO_INCLUDE_DIRS}
+ )
+ target_link_libraries(render_hkl
+ ${COMMON_LIBRARIES}
+ ${GTK2_LIBRARIES}
+ ${CAIRO_LIBRARIES}
+ )
+
+ install(
+ TARGETS
+ render_hkl
+
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ )
+endif(CAIRO_FOUND AND GTK2_FOUND)
+
+# ----------------------------------------------------------------------
+# Build Target
+# process_hkl
+
+set(PROCESS_HKL_SOURCES
+ src/process_hkl.c
+ )
+
+add_executable(process_hkl ${PROCESS_HKL_SOURCES})
+target_include_directories(process_hkl PRIVATE ${COMMON_INCLUDES})
+target_link_libraries(process_hkl ${COMMON_LIBRARIES})
+
+# ----------------------------------------------------------------------
+# Build Target
+# list_events
+
+set(LIST_EVENTS_SOURCES
+ src/list_events.c
+ )
+
+add_executable(list_events ${LIST_EVENTS_SOURCES})
+target_include_directories(list_events PRIVATE ${COMMON_INCLUDES})
+target_link_libraries(list_events ${COMMON_LIBRARIES})
+
+# ----------------------------------------------------------------------
+# Build Target
+# indexamajig
+
+set(INDEXAMAJIG_SOURCES
+ src/indexamajig.c
+ src/im-sandbox.c
+ src/process_image.c
+ src/time-accounts.c
+ )
+
+add_executable(indexamajig ${INDEXAMAJIG_SOURCES})
+target_include_directories(indexamajig PRIVATE ${COMMON_INCLUDES})
+target_link_libraries(indexamajig ${COMMON_LIBRARIES})
+
+# ----------------------------------------------------------------------
+# Build Target
+# get_hkl
+
+set(GET_HKL_SOURCES
+ src/get_hkl.c
+ )
+
+add_executable(get_hkl ${GET_HKL_SOURCES})
+target_include_directories(get_hkl PRIVATE ${COMMON_INCLUDES})
+target_link_libraries(get_hkl ${COMMON_LIBRARIES})
+
+# ----------------------------------------------------------------------
+# Build Target
+# compare_hkl
+
+set(COMPARE_HKL_SOURCES
+ src/compare_hkl.c
+ )
+
+add_executable(compare_hkl ${COMPARE_HKL_SOURCES})
+target_include_directories(compare_hkl PRIVATE ${COMMON_INCLUDES})
+target_link_libraries(compare_hkl ${COMMON_LIBRARIES})
+
+# ----------------------------------------------------------------------
+# Build Target
+# check_hkl
+
+set(CHECK_HKL_SOURCES
+ src/check_hkl.c
+ )
+
+add_executable(check_hkl ${CHECK_HKL_SOURCES})
+target_include_directories(check_hkl PRIVATE ${COMMON_INCLUDES})
+target_link_libraries(check_hkl ${COMMON_LIBRARIES})
+
+# ----------------------------------------------------------------------
+# Build Target
+# partialator
+
+set(PARTIALATOR_SOURCES
+ src/partialator.c
+ src/post-refinement.c
+ src/merge.c
+ src/rejection.c
+ src/scaling.c
+ )
+
+add_executable(partialator ${PARTIALATOR_SOURCES})
+target_include_directories(partialator PRIVATE ${COMMON_INCLUDES})
+target_link_libraries(partialator ${COMMON_LIBRARIES})
+
+# ----------------------------------------------------------------------
+# Build Target
+# ambigator
+
+set(AMBIGATOR_SOURCES
+ src/ambigator.c
+ )
+
+add_executable(ambigator ${AMBIGATOR_SOURCES})
+target_include_directories(ambigator PRIVATE ${COMMON_INCLUDES})
+target_link_libraries(ambigator ${COMMON_LIBRARIES})
+
+# ----------------------------------------------------------------------
+# Build Target
+# geoptimizer
+
+if (CAIRO_FOUND AND GTK2_FOUND AND TIFF_FOUND)
+ set(GEOPTIMIZER_SOURCES
+ src/geoptimiser.c
+ src/hdfsee-render.c
+ )
+
+ add_executable(geoptimizer ${GEOPTIMIZER_SOURCES})
+ target_include_directories(geoptimizer PRIVATE ${COMMON_INCLUDES} ${CAIRO_INCLUDE_DIRS} ${GTK2_INCLUDE_DIRS})
+ target_link_libraries(geoptimizer ${COMMON_LIBRARIES} ${CAIRO_LIBRARIES} ${GTK2_LIBRARIES} ${TIFF_LIBRARIES})
+
+ install(
+ TARGETS
+ geoptimizer
+
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ )
+endif (CAIRO_FOUND AND GTK2_FOUND AND TIFF_FOUND)
+
+# ----------------------------------------------------------------------
+# Build Target
+# geoptimizer
+
+set(WHIRLIGIG_SOURCES
+ src/whirligig.c
+ )
+
+add_executable(whirligig ${WHIRLIGIG_SOURCES})
+target_include_directories(whirligig PRIVATE ${COMMON_INCLUDES})
+target_link_libraries(whirligig ${COMMON_LIBRARIES})
+
+
+# install targets
+
+install(
+ TARGETS
+ partial_sim
+ pattern_sim
+ process_hkl
+ list_events
+ indexamajig
+ get_hkl
+ compare_hkl
+ check_hkl
+ partialator
+ ambigator
+ whirligig
+
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ RESOURCE DESTINATION share/crystfel
+ )
+
diff --git a/config.h.cmake.in b/config.h.cmake.in
new file mode 100644
index 00000000..11e0a87c
--- /dev/null
+++ b/config.h.cmake.in
@@ -0,0 +1,62 @@
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define to 1 if Cairo is available */
+#cmakedefine HAVE_CAIRO
+
+/* Define to 1 if clock_gettime is available. */
+#cmakedefine HAVE_CLOCK_GETTIME
+
+/* Define to 1 if sched_setaffinity is available. */
+#undef HAVE_CPU_AFFINITY
+
+/* Define to 1 if a SysV or X/Open compatible Curses library is present */
+#undef HAVE_CURSES
+
+/* Define to 1 if library supports color (enhanced functions) */
+#undef HAVE_CURSES_COLOR
+
+/* Define to 1 if FFTW is available */
+#cmakedefine HAVE_FFTW
+
+/* Define to 1 if GTK and GDK are available */
+#cmakedefine HAVE_GTK
+
+/* Define to 1 if OpenCL is available */
+#cmakedefine HAVE_OPENCL
+
+/* Define to 1 if CL/cl.h should be used */
+#cmakedefine HAVE_CL_CL_H
+
+/* Define to 1 if libTIFF is available */
+#cmakedefine HAVE_TIFF
+
+/* Define to 1 if libxgandalf is available */
+#cmakedefine HAVE_XGANDALF
+
+/* Define to 1 if libfastDiffractionImageProcessing is available */
+#cmakedefine HAVE_FDIP
+
+/* Define to 1 if libcbf is available */
+#cmakedefine HAVE_CBFLIB
+
+/* Name of package */
+#define PACKAGE "crystfel"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "taw@physics.org"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "crystfel"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "crystfel 0.6.2"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "crystfel"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "0.6.3"
+
diff --git a/libcrystfel/CMakeLists.txt b/libcrystfel/CMakeLists.txt
new file mode 100644
index 00000000..ade08ed9
--- /dev/null
+++ b/libcrystfel/CMakeLists.txt
@@ -0,0 +1,121 @@
+project(libcrystfel)
+
+
+set(LIBCRYSTFEL_SOURCES
+ src/reflist.c
+ src/utils.c
+ src/cell.c
+ src/detector.c
+ src/thread-pool.c
+ src/image.c
+ src/hdf5-file.c
+ src/geometry.c
+ src/peakfinder8.c
+ src/statistics.c
+ src/symmetry.c
+ src/stream.c
+ src/peaks.c
+ src/reflist-utils.c
+ src/filters.c
+ src/render.c
+ src/index.c
+ src/dirax.c
+ src/mosflm.c
+ src/cell-utils.c
+ src/integer_matrix.c
+ src/crystal.c
+ src/xds.c
+ src/integration.c
+ src/predict-refine.c
+ src/histogram.c
+ src/events.c
+ src/felix.c
+ src/peakfinder8.c
+ src/taketwo.c
+ )
+
+if(HAVE_FFTW)
+ set(LIBCRYSTFEL_FFTW_SOURCES
+ src/asdf.c
+ )
+endif(HAVE_FFTW)
+
+set(LIBCRYSTFEL_HEADER
+ ../version.h
+ src/hdf5-file.h
+ src/reflist.h
+ src/symmetry.h
+ src/cell.h
+ src/reflist-utils.h
+ src/thread-pool.h
+ src/statistics.h
+ src/utils.h
+ src/detector.h
+ src/geometry.h
+ src/peakfinder8.h
+ src/peaks.h
+ src/stream.h
+ src/render.h
+ src/index.h
+ src/image.h
+ src/filters.h
+ src/dirax.h
+ src/mosflm.h
+ src/cell-utils.h
+ src/integer_matrix.h
+ src/crystal.h
+ src/xds.h
+ src/predict-refine.h
+ src/integration.h
+ src/histogram.h
+ src/events.h
+ src/asdf.h
+ src/felix.h
+ src/peakfinder8.h
+ src/taketwo.h
+ )
+
+add_library(${PROJECT_NAME} SHARED
+ ${LIBCRYSTFEL_SOURCES}
+ ${LIBCRYSTFEL_FFTW_SOURCES}
+ ${LIBCRYSTFEL_HEADER}
+ )
+
+set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
+target_include_directories(${PROJECT_NAME} INTERFACE ${PROJECT_SOURCE_DIR}/src)
+target_include_directories(${PROJECT_NAME} PRIVATE ${HDF5_INCLUDE_DIRS})
+target_link_libraries(${PROJECT_NAME} PRIVATE util ${HDF5_C_LIBRARIES})
+
+if(XGANDALF_FOUND)
+ target_include_directories(${PROJECT_NAME} PRIVATE ${XGANDALF_INCLUDES})
+ target_link_libraries(${PROJECT_NAME} PRIVATE ${XGANDALF_LIBRARIES})
+endif(XGANDALF_FOUND)
+if(FDIP_FOUND)
+ target_include_directories(${PROJECT_NAME} PRIVATE ${FDIP_INCLUDES})
+ target_link_libraries(${PROJECT_NAME} PRIVATE ${FDIP_LIBRARIES})
+endif(FDIP_FOUND)
+if(PINKINDEXER_FOUND)
+ target_include_directories(${PROJECT_NAME} PRIVATE ${PINKINDEXER_INCLUDES})
+ target_link_libraries(${PROJECT_NAME} PRIVATE ${PINKINDEXER_LIBRARIES})
+endif(PINKINDEXER_FOUND)
+if(NBP_FOUND)
+ target_include_directories(${PROJECT_NAME} PRIVATE ${NBP_INCLUDES})
+ target_link_libraries(${PROJECT_NAME} PRIVATE ${NBP_LIBRARIES})
+endif(NBP_FOUND)
+if(FFTW_FOUND)
+ target_include_directories(${PROJECT_NAME} PRIVATE ${FFTW_INCLUDES})
+ target_link_libraries(${PROJECT_NAME} PRIVATE ${FFTW_LIBRARIES})
+endif(FFTW_FOUND)
+if(CBF_FOUND)
+ target_include_directories(${PROJECT_NAME} PRIVATE ${CBF_INCLUDES})
+ target_link_libraries(${PROJECT_NAME} PRIVATE ${CBF_LIBRARIES})
+endif(CBF_FOUND)
+target_compile_options(${PROJECT_NAME} PRIVATE -Wall)
+
+install(
+ TARGETS
+ libcrystfel
+
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ )