diff options
-rw-r--r-- | CMakeLists.txt | 21 | ||||
-rw-r--r-- | config.h.cmake.in | 22 | ||||
-rw-r--r-- | libcrystfel/CMakeLists.txt | 29 | ||||
-rw-r--r-- | libcrystfel/config.h.cmake.in | 19 |
4 files changed, 54 insertions, 37 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1bf6ec7d..2dbf2877 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,16 +14,9 @@ find_package(GSL REQUIRED) find_package(GTK2 2.0.0 COMPONENTS gtk) find_package(GdkPixbuf2) find_package(GDK) -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) -find_package(Curses) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdiagnostics-color=always") @@ -46,14 +39,9 @@ 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}) set(HAVE_GDKPIXBUF ${GDKPIXBUF_FOUND}) set(HAVE_GDK ${GDK_FOUND}) -set(HAVE_CURSES ${CURSES_FOUND}) set(PACKAGE_VERSION ${PROJECT_VERSION}) @@ -68,17 +56,12 @@ endif (OpenCL_FOUND) # Check for nice clock function check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME) -# Check for CPU affinity functions (Linux-specific) -set(CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE") -check_symbol_exists(sched_setaffinity "sched.h" HAVE_CPU_AFFINITY) -unset(CMAKE_REQUIRED_DEFINITIONS) +# Add the libcrystfel target +add_subdirectory(libcrystfel) configure_file(config.h.cmake.in config.h) include_directories(${CMAKE_CURRENT_BINARY_DIR}) -# Add the libcrystfel target -add_subdirectory(libcrystfel) - # Add tests enable_testing() add_subdirectory(tests) diff --git a/config.h.cmake.in b/config.h.cmake.in index 2db30860..24b2ab86 100644 --- a/config.h.cmake.in +++ b/config.h.cmake.in @@ -1,24 +1,12 @@ -#cmakedefine HAVE_CAIRO -#cmakedefine HAVE_CLOCK_GETTIME -#cmakedefine HAVE_CPU_AFFINITY -#cmakedefine HAVE_FFTW +/* config.h for CrystFEL main programs */ + #cmakedefine HAVE_GTK #cmakedefine HAVE_GDKPIXBUF #cmakedefine HAVE_GDK -#cmakedefine HAVE_OPENCL -#cmakedefine HAVE_CL_CL_H #cmakedefine HAVE_TIFF -#cmakedefine HAVE_XGANDALF -#cmakedefine HAVE_FDIP -#cmakedefine HAVE_CURSES - -/* We avoid adding the full path to cbf.h, because CBFlib unhelpfully installs - * some conflicting HDF5 headers which we want to keep out of the include path. - * Unfortunately, sometimes CBFlib installs cbf/cbf.h, other times cbflib/cbf.h. - * These defines tell whether we have CBFlib at all, and if so, what to #include */ -#cmakedefine HAVE_CBFLIB -#cmakedefine HAVE_CBF_CBF_H -#cmakedefine HAVE_CBFLIB_CBF_H +#cmakedefine HAVE_CAIRO +#cmakedefine HAVE_OPENCL +#cmakedefine HAVE_CLOCK_GETTIME #define PACKAGE_VERSION "${PROJECT_VERSION}" diff --git a/libcrystfel/CMakeLists.txt b/libcrystfel/CMakeLists.txt index a6671d8c..83a561d1 100644 --- a/libcrystfel/CMakeLists.txt +++ b/libcrystfel/CMakeLists.txt @@ -1,4 +1,28 @@ -project(libcrystfel) +project(libcrystfel VERSION ${CRYSTFEL_VERSION} LANGUAGES C) + +find_package(Curses) +find_package(FFTW) +find_package(CBF) +find_package(XGANDALF) +find_package(PINKINDEXER) +find_package(NBP) +find_package(FDIP) + +set(HAVE_CURSES ${CURSES_FOUND}) +set(HAVE_FFTW ${FFTW_FOUND}) +set(HAVE_XGANDALF ${XGANDALF_FOUND}) +set(HAVE_FDIP ${FDIP_FOUND}) +set(HAVE_CBFLIB ${CBF_FOUND}) + +# Check for CPU affinity functions (Linux-specific) +set(CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE") +check_symbol_exists(sched_setaffinity "sched.h" HAVE_CPU_AFFINITY) +unset(CMAKE_REQUIRED_DEFINITIONS) + +# Check for nice clock function +check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME) + +configure_file(config.h.cmake.in config.h) set(LIBCRYSTFEL_SOURCES src/reflist.c @@ -83,6 +107,9 @@ set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${CRYSTFEL_VERSION}) set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "") target_include_directories(${PROJECT_NAME} INTERFACE ${PROJECT_SOURCE_DIR}/src) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) +add_definitions(-DHAVE_CONFIG_H) + target_include_directories(${PROJECT_NAME} PRIVATE ${HDF5_INCLUDE_DIRS}) target_link_libraries(${PROJECT_NAME} PUBLIC util ${HDF5_C_LIBRARIES}) diff --git a/libcrystfel/config.h.cmake.in b/libcrystfel/config.h.cmake.in new file mode 100644 index 00000000..36bbba60 --- /dev/null +++ b/libcrystfel/config.h.cmake.in @@ -0,0 +1,19 @@ +/* config.h for libcrystfel */ + +#cmakedefine HAVE_CLOCK_GETTIME +#cmakedefine HAVE_CPU_AFFINITY +#cmakedefine HAVE_FFTW +#cmakedefine HAVE_CL_CL_H +#cmakedefine HAVE_XGANDALF +#cmakedefine HAVE_FDIP +#cmakedefine HAVE_CURSES + +/* We avoid adding the full path to cbf.h, because CBFlib unhelpfully installs + * some conflicting HDF5 headers which we want to keep out of the include path. + * Unfortunately, sometimes CBFlib installs cbf/cbf.h, other times cbflib/cbf.h. + * These defines tell whether we have CBFlib at all, and if so, what to #include */ +#cmakedefine HAVE_CBFLIB +#cmakedefine HAVE_CBF_CBF_H +#cmakedefine HAVE_CBFLIB_CBF_H + +#define CRYSTFEL_VERSIONSTRING "${PROJECT_VERSION}+${GIT_SHA1}" |