From e1d4f72f9722b4670af8a0d0537d4d18e7bb06ac Mon Sep 17 00:00:00 2001 From: Johan Hattne Date: Fri, 23 Aug 2024 01:31:24 -0700 Subject: [PATCH 1/3] Unbreak CMake build * Update to HDF5-1.14.4-2 as per Makefile because CBFlib needs H5allocate_memory(), introduced in HDF5-1.8.15. Create hdf5 target for shared HDF5; anything linking against it must be compiled with H5_USE_110_API. HDF5 is a public dependency of CBFlib. * cif2cbf now depends on CQRlib, patch it for CMake support and link against the shared library. * Introduce a target for PCRE and also find shared library. A static libpcreposix requires libpcre. PCRE is a private dependencies of CBFlib. Tested with CMake 3.25.1 on Debian Bookworm (WSL). --- CMakeLists.txt | 168 +++++++++++++++++++++++++++---------- patches/cqrlib-1.1.4.patch | 164 ++++++++++++++++++++++++++++++++++++ 2 files changed, 289 insertions(+), 43 deletions(-) create mode 100644 patches/cqrlib-1.1.4.patch diff --git a/CMakeLists.txt b/CMakeLists.txt index e9d91834..1a4fc918 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -280,6 +280,13 @@ if(COMMAND cmake_policy) endif(COMMAND cmake_policy) +# Set timestamps of extracted contents to the time of extraction. +# Resolved by explicitly setting DOWNLOAD_EXTRACT_TIMESTAMP in +# externalproject_add() or fetchcontent_declare(), but the option was +# only introduced in CMake 3.24. +cmake_policy(SET CMP0135 NEW) + + set(CBF_USE_FORTRAN_ENV $ENV{CBF_USE_FORTRAN}) set(CBF_F90FLAGS_ENV $ENV{F90FLAGS}) set(CBF_USE_ULP $ENV{CBF_USE_ULP}) @@ -491,10 +498,18 @@ set(GRAPHICS "${CBFlib_SOURCE_DIR}/html_graphics" CACHE STRING "") set(CBF_TIFF "tiff-4.0.3-rev-29Sep13") set(TIFF_INSTALL_DIR "${CMAKE_BINARY_DIR}/${CBF_TIFF}") + +# +# CQRlib +set(CBF_CQRLIB "cqrlib-1.1.4") +set(CBF_CQRLIB_URL "https://github.com/yayahjb/cqrlib/archive/refs/tags/CQRlib-1.1.4.tar.gz") +set(CQRLIB_INSTALL_DIR "${CMAKE_BINARY_DIR}/${CBF_CQRLIB}") + + # # Definitions to get a version of HDF5 # -set(CBF_HDF5 "hdf5-1.8.14") +set(CBF_HDF5 "hdf5-1.14.4-2") set(CBF_HDF5URL "http://downloads.sf.net/cbflib/${CBF_HDF5}.tar.gz") set(CBF_HDF5REGISTER_ARG "--register") if (CBF_HDF5REGISTER_MANUAL_ENV STREQUAL "YES") @@ -541,6 +556,12 @@ set(CBF_HDF5URL "http://downloads.sf.net/cbflib/${CBF_HDF5}.tar.gz") find_program(WGET_EXECUTABLE wget) CBF_DEBUG_MESSAGE( "WGET found at ${WGET_EXECUTABLE}") + +# +# libm +set(libm "$<$>:m>") + + # # ZLIB # @@ -577,7 +598,45 @@ ExternalProject_add( INSTALL_DIR ${CMAKE_BINARY_DIR}/${CBF_HDF5} ) -set(HDF5_LIBRARY_PATH ${HDF5_INSTALL_DIR}/lib/libhdf5${CMAKE_SHARED_LIBRARY_SUFFIX}) + +# Cannot set INTERFACE_INCLUDE_DIRECTORIES on an imported target +# to a non-existent path: for now, create a directory now that +# will be populated during build. +file(MAKE_DIRECTORY "${HDF5_INSTALL_DIR}/include") +add_library(hdf5 SHARED IMPORTED) +add_dependencies(hdf5 ${CBF_HDF5}) +set_target_properties(hdf5 PROPERTIES + IMPORTED_LOCATION "${HDF5_INSTALL_DIR}/lib/libhdf5${CMAKE_SHARED_LIBRARY_SUFFIX}" + INTERFACE_INCLUDE_DIRECTORIES "${HDF5_INSTALL_DIR}/include") +target_compile_definitions(hdf5 + INTERFACE H5_USE_110_API) + + +# +# CQRlib +# +# If a cloned repository is patched, CMake seems to attempt to +# invoke PATCH_COMMAND on every run. For now, avoid automatically +# patching cloned repositories. +find_program(PATCH patch) +externalproject_add(${CBF_CQRLIB} + URL "${CBF_CQRLIB_URL}" + PATCH_COMMAND "${PATCH}" + -N -i "${CMAKE_CURRENT_SOURCE_DIR}/patches/cqrlib-1.1.4.patch" -p 1 -t + CMAKE_CACHE_ARGS + "-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}" + "-DCMAKE_INSTALL_BINDIR:PATH=${CQRLIB_INSTALL_DIR}/bin" + "-DCMAKE_INSTALL_INCLUDEDIR:PATH=${CQRLIB_INSTALL_DIR}/include" + "-DCMAKE_INSTALL_LIBDIR:PATH=${CQRLIB_INSTALL_DIR}/lib" + "-DCMAKE_INSTALL_PREFIX:PATH=${CQRLIB_INSTALL_DIR}") + +file(MAKE_DIRECTORY "${CQRLIB_INSTALL_DIR}/include/cqrlib") +add_library(CQR SHARED IMPORTED) +add_dependencies(CQR ${CBF_CQRLIB}) +set_target_properties(CQR PROPERTIES + IMPORTED_LOCATION "${CQRLIB_INSTALL_DIR}/lib/libCQRlib${CMAKE_SHARED_LIBRARY_SUFFIX}" + INTERFACE_INCLUDE_DIRECTORIES "${CQRLIB_INSTALL_DIR}/include") + # # CBF_REGEX or CBF_PCRE @@ -588,7 +647,7 @@ set(HDF5_LIBRARY_PATH ${HDF5_INSTALL_DIR}/lib/libhdf5${CMAKE_SHARED_LIBRARY_SUFF # - an (optional) dependency to build # # Try for PCRE first -find_library(CBF_REGEXLIB pcre) +find_library(CBF_REGEXLIB pcreposix) find_path(CBF_REGEXLIB_INCLUDE_DIR NAMES pcreposix.h) message(STATUS "CBF_REGEXLIB_INCLUDE_DIR for pcreposix.h = '${CBF_REGEXLIB_INCLUDE_DIR}'") message(STATUS "CBF_REGEXLIB = '${CBF_REGEXLIB}'") @@ -621,9 +680,25 @@ if (NOT CBF_REGEXLIB_INCLUDE_DIR OR NOT CBF_REGEXLIB) add_definitions(-DCBF_REGEXLIB_REGEX) endif () else () - set(CBF_RE "") - set(CBF_REGEXLIB_LIBRARY_PATH "${CBF_REGEXLIB}/libpcre.so") - add_definitions(-DCBF_REGEXLIB_PCRE) + add_library(pcreposix_static STATIC IMPORTED) + set_target_properties(pcreposix_static PROPERTIES + IMPORTED_LOCATION "${CBF_REGEXLIB}" + INTERFACE_INCLUDE_DIRECTORIES "${CBF_REGEXLIB_INCLUDE_DIR}") + find_library(_pcre_static pcre) + target_link_libraries(pcreposix_static INTERFACE "${_pcre_static}") + target_compile_definitions(pcreposix_static + INTERFACE CBF_REGEXLIB_PCRE) + + set(_find_library_suffix_save "${CMAKE_FIND_LIBRARY_SUFFIX}") + set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll" ".so") + find_library(_pcreposix_shared pcre) + add_library(pcreposix_shared SHARED IMPORTED) + set_target_properties(pcreposix_shared PROPERTIES + IMPORTED_LOCATION "${_pcreposix_shared}" + INTERFACE_INCLUDE_DIRECTORIES "${CBF_REGEXLIB_INCLUDE_DIR}") + target_compile_definitions(pcreposix_shared + INTERFACE CBF_REGEXLIB_PCRE) + set(CMAKE_FIND_LIBRARY_SUFFIX "${_find_library_suffix_save}") endif () # @@ -690,6 +765,7 @@ set( ${CBF__SRC}/cbf_hdf5.c ${CBF__SRC}/cbf_hdf5_filter.c ${CBF__SRC}/cbf_lex.c + ${CBF__SRC}/cbf_minicbf_header.c ${CBF__SRC}/cbf_nibble_offset.c ${CBF__SRC}/cbf_packed.c ${CBF__SRC}/cbf_predictor.c @@ -774,6 +850,7 @@ set( ${CBF__INCLUDE}/cbf_hdf5.h ${CBF__INCLUDE}/cbf_hdf5_filter.h ${CBF__INCLUDE}/cbf_lex.h + ${CBF__INCLUDE}/cbf_minicbf_header.h ${CBF__INCLUDE}/cbf_nibble_offset.h ${CBF__INCLUDE}/cbf_packed.h ${CBF__INCLUDE}/cbf_predictor.h @@ -866,8 +943,6 @@ include_directories( BEFORE SYSTEM ${CBFlib_SOURCE_DIR}/include ${CBFlib_BINARY_DIR}/${CBF_TIFF}/include - ${CBFlib_BINARY_DIR}/${CBF_HDF5}/include - ${CBF_REGEXLIB_INCLUDE_DIR} ) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CBFlib_BINARY_DIR}/bin") @@ -879,22 +954,27 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CBFlib_BINARY_DIR}/bin") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CBFlib_BINARY_DIR}/lib") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CBFlib_BINARY_DIR}/lib") add_library(cbf_static STATIC ${CBF_C_SOURCES}) -add_dependencies(cbf_static ${CBF_RE} ${CBF_TIFF} ${CBF_HDF5}) +add_dependencies(cbf_static ${CBF_TIFF}) set_target_properties(cbf_static PROPERTIES OUTPUT_NAME "cbf") set_target_properties(cbf_static PROPERTIES LINKER_LANGUAGE C) set_target_properties(cbf_static PROPERTIES SOVERSION "${CBF_APIVERSION}") -set(CBF_STATIC_LIBRARY_PATH ${CBFlib_BINARY_DIR}/lib/libcbf.a) +target_link_libraries(cbf_static + PUBLIC hdf5 + PRIVATE pcreposix_static + PRIVATE ${libm}) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CBFlib_BINARY_DIR}/lib") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CBFlib_BINARY_DIR}/lib") add_library(cbf_shared SHARED ${CBF_C_SOURCES}) -add_dependencies(cbf_shared ${CBF_RE} ${CBF_TIFF} ${CBF_HDF5}) +add_dependencies(cbf_shared ${CBF_TIFF}) set_target_properties(cbf_shared PROPERTIES OUTPUT_NAME "cbf") set_target_properties(cbf_shared PROPERTIES LINKER_LANGUAGE C) set_target_properties(cbf_shared PROPERTIES SOVERSION "${CBF_APIVERSION}") -target_link_libraries(cbf_shared ${HDF5_LIBRARY_PATH}) -set(CBF_SHARED_LIBRARY_PATH ${CBFlib_BINARY_DIR}/lib/libcbf.so) +target_link_libraries(cbf_shared + PUBLIC hdf5 + PRIVATE pcreposix_shared + PRIVATE ${libm}) # # Build the static and shared IMG libraries @@ -911,7 +991,7 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CBFlib_BINARY_DIR}/lib") add_library(img_shared SHARED ${CBF__SRC}/img.c) set_target_properties(img_shared PROPERTIES OUTPUT_NAME "img") set_target_properties(img_shared PROPERTIES LINKER_LANGUAGE C) -target_link_libraries(img_shared ${HDF5_LIBRARY_PATH}) +target_link_libraries(img_shared hdf5) set(IMG_SHARED_LIBRARY_PATH ${CBFlib_BINARY_DIR}/lib/libimg.so) @@ -949,7 +1029,7 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CBFlib_BINARY_DIR}/lib") add_library(fcb_shared SHARED ${CBF_F90_BUILT_SOURCES};${CBF_F90_SOURCES}) set_target_properties(fcb_shared PROPERTIES OUTPUT_NAME "fcb") set_target_properties(fcb_shared PROPERTIES LINKER_LANGUAGE C) -target_link_libraries(fcb_shared ${HDF5_LIBRARY_PATH}) +target_link_libraries(fcb_shared hdf5) set(FCB_SHARED_LIBRARY_PATH ${CBFlib_BINARY_DIR}/lib/libfcb.so) endif (NOT (CBF_USE_FORTRAN_ENV STREQUAL "NO")) @@ -961,37 +1041,39 @@ endif (NOT (CBF_USE_FORTRAN_ENV STREQUAL "NO")) # Note: to add a target with multiple sources/dependencies/libraries you must pass a list # separated by semicolons for the appropriate parameter. -# Note: the math library should be linked in by appending ';m' to the library list here +# Note: the math library should be linked in by appending ';${libm}' to the library list here macro(add_target target source dependencies libraries) add_executable(${target} ${source}) - add_dependencies(${target} ${dependencies}) + if("${dependencies}") + add_dependencies(${target} "${dependencies}") + endif() target_link_libraries(${target} ${libraries}) endmacro() -add_target(tiff2cbf "${CBF__EXAMPLES}/tiff2cbf.c" "cbf_static;${CBF_TIFF}" "${CBF_STATIC_LIBRARY_PATH};${TIFF_LIBRARY_PATH};${HDF5_LIBRARY_PATH}") -add_target(cbf2nexus "${CBF__EXAMPLES}/cbf2nexus.c" "cbf_static;${CBF_HDF5}" "${CBF_STATIC_LIBRARY_PATH};${HDF5_LIBRARY_PATH}") -add_target(nexus2cbf "${CBF__EXAMPLES}/nexus2cbf.c" "cbf_static;${CBF_HDF5}" "${CBF_STATIC_LIBRARY_PATH};${HDF5_LIBRARY_PATH}") -add_target(minicbf2nexus "${CBF__EXAMPLES}/minicbf2nexus.c" "cbf_static;${CBF_HDF5}" "${CBF_STATIC_LIBRARY_PATH};${HDF5_LIBRARY_PATH}") -add_target(adscimg2cbf "${CBF__EXAMPLES}/adscimg2cbf.c;${CBF__EXAMPLES}/adscimg2cbf_sub.c" "cbf_static" "${CBF_STATIC_LIBRARY_PATH};m") -add_target(cbf2adscimg "${CBF__EXAMPLES}/cbf2adscimg.c;${CBF__EXAMPLES}/cbf2adscimg_sub.c" "cbf_static" "${CBF_STATIC_LIBRARY_PATH};m") -add_target(convert_image "${CBF__EXAMPLES}/convert_image.c" "cbf_static;img_static" "${CBF_STATIC_LIBRARY_PATH};${IMG_STATIC_LIBRARY_PATH};${HDF5_LIBRARY_PATH}") -add_target(convert_minicbf "${CBF__EXAMPLES}/convert_minicbf.c" "cbf_static" "${CBF_STATIC_LIBRARY_PATH};${HDF5_LIBRARY_PATH}") -add_target(makecbf "${CBF__EXAMPLES}/makecbf.c" "cbf_static;img_static" "${CBF_STATIC_LIBRARY_PATH};${IMG_STATIC_LIBRARY_PATH};${HDF5_LIBRARY_PATH}") -add_target(cbf_tail "${CBF__EXAMPLES}/cbf_tail.c" "cbf_static" "${CBF_STATIC_LIBRARY_PATH}") -add_target(changtestcompression "${CBF__EXAMPLES}/changtestcompression.c" "cbf_static" "${CBF_STATIC_LIBRARY_PATH};${HDF5_LIBRARY_PATH}") -add_target(img2cif "${CBF__EXAMPLES}/img2cif.c" "cbf_static;img_static" "${CBF_STATIC_LIBRARY_PATH};${IMG_STATIC_LIBRARY_PATH};${HDF5_LIBRARY_PATH}") -add_target(cif2cbf "${CBF__EXAMPLES}/cif2cbf.c" "cbf_static;${CBF_HDF5}" "${CBF_STATIC_LIBRARY_PATH};${HDF5_LIBRARY_PATH};m") -add_target(cbf_template_t "${CBF__DECTRIS_EXAMPLES}/cbf_template_t.c" "cbf_static" "${CBF_STATIC_LIBRARY_PATH};${HDF5_LIBRARY_PATH}") -add_target(testcell "${CBF__EXAMPLES}/testcell.C" "cbf_static" "${CBF_STATIC_LIBRARY_PATH}") -add_target(sauter_test "${CBF__EXAMPLES}/sauter_test.C" "cbf_static" "${CBF_STATIC_LIBRARY_PATH}") -add_target(sequence_match "${CBF__EXAMPLES}/sequence_match.c" "cbf_static" "${CBF_STATIC_LIBRARY_PATH};${HDF5_LIBRARY_PATH}") -add_target(testulp "${CBF__EXAMPLES}/testulp.c" "cbf_static" "${CBF_STATIC_LIBRARY_PATH};${HDF5_LIBRARY_PATH}") -add_target(testhdf5 "${CBF__EXAMPLES}/testhdf5.c" "cbf_static;${CBF_HDF5}" "${CBF_STATIC_LIBRARY_PATH};${HDF5_LIBRARY_PATH}") -add_target(testtree "${CBF__EXAMPLES}/testtree.c" "cbf_static" "${CBF_STATIC_LIBRARY_PATH};;${HDF5_LIBRARY_PATH}") -add_target(testalloc "${CBF__EXAMPLES}/testalloc.c" "cbf_static" "${CBF_STATIC_LIBRARY_PATH};${HDF5_LIBRARY_PATH}") -add_target(testflat "${CBF__EXAMPLES}/testflat.c" "cbf_static" "${CBF_STATIC_LIBRARY_PATH};;${HDF5_LIBRARY_PATH}") -add_target(testflatpacked "${CBF__EXAMPLES}/testflatpacked.c" "cbf_static" "${CBF_STATIC_LIBRARY_PATH};;${HDF5_LIBRARY_PATH}") -add_target(testreals "${CBF__EXAMPLES}/testreals.c" "cbf_static" "${CBF_STATIC_LIBRARY_PATH};${HDF5_LIBRARY_PATH}") +add_target(tiff2cbf "${CBF__EXAMPLES}/tiff2cbf.c" "${CBF_TIFF}" "cbf_static;${TIFF_LIBRARY_PATH}") +add_target(cbf2nexus "${CBF__EXAMPLES}/cbf2nexus.c" "" cbf_static) +add_target(nexus2cbf "${CBF__EXAMPLES}/nexus2cbf.c" "" cbf_static) +add_target(minicbf2nexus "${CBF__EXAMPLES}/minicbf2nexus.c" "" cbf_static) +add_target(adscimg2cbf "${CBF__EXAMPLES}/adscimg2cbf.c;${CBF__EXAMPLES}/adscimg2cbf_sub.c" "" "cbf_static;${libm}") +add_target(cbf2adscimg "${CBF__EXAMPLES}/cbf2adscimg.c;${CBF__EXAMPLES}/cbf2adscimg_sub.c" "" "cbf_static;${libm}") +add_target(convert_image "${CBF__EXAMPLES}/convert_image.c" "img_static" "cbf_static;${IMG_STATIC_LIBRARY_PATH}") +add_target(convert_minicbf "${CBF__EXAMPLES}/convert_minicbf.c" "" cbf_static) +add_target(makecbf "${CBF__EXAMPLES}/makecbf.c" "cbf_static;img_static" "cbf_static;${IMG_STATIC_LIBRARY_PATH}") +add_target(cbf_tail "${CBF__EXAMPLES}/cbf_tail.c" "" "cbf_static") +add_target(changtestcompression "${CBF__EXAMPLES}/changtestcompression.c" "" "cbf_static") +add_target(img2cif "${CBF__EXAMPLES}/img2cif.c" "img_static" "cbf_static") +add_target(cif2cbf "${CBF__EXAMPLES}/cif2cbf.c" "" "cbf_static;CQR;${libm}") +add_target(cbf_template_t "${CBF__DECTRIS_EXAMPLES}/cbf_template_t.c" "" "cbf_static") +add_target(testcell "${CBF__EXAMPLES}/testcell.C" "" "cbf_static") +add_target(sauter_test "${CBF__EXAMPLES}/sauter_test.C" "" "cbf_static") +add_target(sequence_match "${CBF__EXAMPLES}/sequence_match.c" "" "cbf_static") +add_target(testulp "${CBF__EXAMPLES}/testulp.c" "" "cbf_static") +add_target(testhdf5 "${CBF__EXAMPLES}/testhdf5.c" "" "cbf_static") +add_target(testtree "${CBF__EXAMPLES}/testtree.c" "" "cbf_static") +add_target(testalloc "${CBF__EXAMPLES}/testalloc.c" "" "cbf_static") +add_target(testflat "${CBF__EXAMPLES}/testflat.c" "" "cbf_static") +add_target(testflatpacked "${CBF__EXAMPLES}/testflatpacked.c" "" "cbf_static") +add_target(testreals "${CBF__EXAMPLES}/testreals.c" "" "cbf_static") if (NOT (CBF_USE_FORTRAN_ENV STREQUAL "NO")) @@ -1009,8 +1091,8 @@ add_custom_command(OUTPUT "${CBF__BLDEXMP}/test_xds_binary.f90" DEPENDS ${CBF_M4_FCB_DEFINES} "${CBF__M4}/test_xds_binary.m4" COMMENT "Generating ${test_xds_binary.f90}") -add_target(test_fcb_read_image "${CBF__BLDEXMP}/test_fcb_read_image.f90" "fcb_static" "${FCB_STATIC_LIBRARY_PATH};${HDF5_LIBRARY_PATH}") -add_target(test_xds_binary "${CBF__BLDEXMP}/test_xds_binary.f90" "fcb_static" "${FCB_STATIC_LIBRARY_PATH};${HDF5_LIBRARY_PATH}") +add_target(test_fcb_read_image "${CBF__BLDEXMP}/test_fcb_read_image.f90" "fcb_static" "${FCB_STATIC_LIBRARY_PATH};hdf5") +add_target(test_xds_binary "${CBF__BLDEXMP}/test_xds_binary.f90" "fcb_static" "${FCB_STATIC_LIBRARY_PATH};hdf5") endif (NOT (CBF_USE_FORTRAN_ENV STREQUAL "NO")) diff --git a/patches/cqrlib-1.1.4.patch b/patches/cqrlib-1.1.4.patch new file mode 100644 index 00000000..9274c198 --- /dev/null +++ b/patches/cqrlib-1.1.4.patch @@ -0,0 +1,164 @@ +--- a/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 ++++ b/CMakeLists.txt 2024-05-23 18:31:38.000000000 +0000 +@@ -0,0 +1,142 @@ ++# ${CMAKE_COMMAND} -E rm was introduced in CMake 3.17. ++cmake_minimum_required(VERSION 3.17) ++project(CQRlib ++ LANGUAGES C CXX ++ VERSION 1.1.4) ++set(VERSION_INFO "3:0:1") ++ ++ ++# Under the (Linux) libtool convention, the single-component SOVERSION ++# is the difference between the current and age components of ++# VERSION_INFO. ++string(REPLACE ":" ";" _cra "${VERSION_INFO}") ++list(GET _cra 0 _current) ++list(GET _cra 2 _age) ++math(EXPR SOVERSION "${_current} - ${_age}") ++ ++ ++# ++# libm ++set(libm "$<$>:m>") ++ ++ ++# ++# CQR, builds and installs a shared libCQRlib unless configured with ++# BUILD_SHARED_LIBS=OFF. Do not set VERSION, because it is already ++# quite different from SOVERSION. ++option(BUILD_SHARED_LIBS "Build using shared libraries" ON) ++add_library(CQR ++ "cqrlib.c") ++set_target_properties(CQR PROPERTIES ++ OUTPUT_NAME "CQRlib" ++ PUBLIC_HEADER "cqrlib.h" ++ SOVERSION "${SOVERSION}") ++target_compile_definitions(CQR ++ PRIVATE USE_LOCAL_HEADERS) ++target_include_directories(CQR ++ PUBLIC "$" ++ "$") ++target_link_libraries(CQR ++ "${libm}") ++ ++include(GNUInstallDirs) ++install( ++ TARGETS CQR ++ EXPORT CQRlibTargets) ++ ++ ++# ++# CMake configuration files, targets are emitted in the CQR:: ++# namespace. ++export(EXPORT CQRlibTargets ++ FILE "${CMAKE_CURRENT_BINARY_DIR}/CQRlibTargets.cmake") ++install( ++ EXPORT CQRlibTargets ++ FILE CQRlibTargets.cmake ++ NAMESPACE "CQR::" ++ DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") ++ ++include(CMakePackageConfigHelpers) ++configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in ++ "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" ++ INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" ++ NO_CHECK_REQUIRED_COMPONENTS_MACRO ++ NO_SET_AND_CHECK_MACRO) ++write_basic_package_version_file( ++ "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" ++ COMPATIBILITY SameMajorVersion ++ VERSION "${PROJECT_VERSION}") ++install( ++ FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" ++ "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" ++ DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") ++ ++ ++# ++# Testing ++# ++# The test executables are not installed. ++enable_testing() ++ ++add_executable(CQRlibTest ++ "CQRlibTest.c") ++target_compile_definitions(CQRlibTest ++ PRIVATE USE_LOCAL_HEADERS) ++target_link_libraries(CQRlibTest ++ CQR ++ "${libm}") ++ ++add_executable(CPPQRTest ++ "CPPQRTest.cpp") ++target_compile_definitions(CPPQRTest ++ PRIVATE CQR_NOCCODE) ++target_link_libraries(CPPQRTest ++ "${libm}") ++ ++ ++# ++# CQRlibTest ++add_test(NAME CQRlibTest ++ COMMAND ${CMAKE_COMMAND} ++ "-Dcommand=$" ++ "-Doutput-file=CQRlibTest.lst" ++ -P "${CMAKE_CURRENT_SOURCE_DIR}/redirect.cmake") ++set_tests_properties(CQRlibTest PROPERTIES ++ FIXTURES_SETUP CQRlibTest) ++ ++add_test(NAME CQRlibTest-cmp ++ COMMAND ${CMAKE_COMMAND} -E compare_files ++ "${CMAKE_CURRENT_SOURCE_DIR}/CQRlibTest_orig.lst" ++ "CQRlibTest.lst") ++set_tests_properties(CQRlibTest-cmp PROPERTIES ++ FIXTURES_REQUIRED CQRlibTest ++ REQUIRED_FILES ${CMAKE_CURRENT_SOURCE_DIR}/CQRlibTest_orig.lst) ++ ++add_test(NAME CQRlibTest-cleanup ++ COMMAND ${CMAKE_COMMAND} -E rm "CQRlibTest.lst") ++set_tests_properties(CQRlibTest-cleanup PROPERTIES ++ FIXTURES_CLEANUP CQRlibTest) ++ ++ ++# ++# CPPQRTest ++add_test(NAME CPPQRTest ++ COMMAND ${CMAKE_COMMAND} ++ "-Dcommand=$" ++ "-Doutput-file=CPPQRTest.lst" ++ -P "${CMAKE_CURRENT_SOURCE_DIR}/redirect.cmake") ++set_tests_properties(CPPQRTest PROPERTIES ++ FIXTURES_SETUP CPPQRTest) ++ ++add_test(NAME CPPQRTest-cmp ++ COMMAND ${CMAKE_COMMAND} -E compare_files ++ "${CMAKE_CURRENT_SOURCE_DIR}/CPPQRTest_orig.lst" ++ "CPPQRTest.lst") ++set_tests_properties(CPPQRTest-cmp PROPERTIES ++ FIXTURES_REQUIRED CPPQRTest ++ REQUIRED_FILES ${CMAKE_CURRENT_SOURCE_DIR}/CPPQRTest_orig.lst) ++ ++add_test(NAME CPPQRTest-cleanup ++ COMMAND ${CMAKE_COMMAND} -E rm "CPPQRTest.lst") ++set_tests_properties(CPPQRTest-cleanup PROPERTIES ++ FIXTURES_CLEANUP CPPQRTest) +--- a/Config.cmake.in 1970-01-01 00:00:00.000000000 +0000 ++++ b/Config.cmake.in 2024-05-23 18:31:38.000000000 +0000 +@@ -0,0 +1,3 @@ ++@PACKAGE_INIT@ ++ ++include("${CMAKE_CURRENT_LIST_DIR}/CQRlibTargets.cmake") +--- a/redirect.cmake 1970-01-01 00:00:00.000000000 +0000 ++++ b/redirect.cmake 2024-05-23 18:31:38.000000000 +0000 +@@ -0,0 +1,10 @@ ++execute_process( ++ COMMAND "${command}" ++ OUTPUT_FILE ${output-file} ++ RESULTS_VARIABLE results ++ ERROR_VARIABLE error) ++foreach(result IN LISTS results) ++ if(result) ++ message(FATAL_ERROR "${command}: ${error}") ++ endif() ++endforeach() From 2d574fa5b55415d92f465e4cde42d33eb7f8a7a4 Mon Sep 17 00:00:00 2001 From: Johan Hattne Date: Fri, 23 Aug 2024 03:06:14 -0700 Subject: [PATCH 2/3] Remove external_packages/CMakeLists.txt Not used, largely redundant with CMakeLists.txt. --- external_packages/CMakeLists.txt | 430 ------------------------------- 1 file changed, 430 deletions(-) delete mode 100644 external_packages/CMakeLists.txt diff --git a/external_packages/CMakeLists.txt b/external_packages/CMakeLists.txt deleted file mode 100644 index f973adbb..00000000 --- a/external_packages/CMakeLists.txt +++ /dev/null @@ -1,430 +0,0 @@ -###################################################################### -# CMakeLists.txt - cmake build file for make to create # -# external_packages in CBFlib # -# # -# Version 0.9.3 28 September 2013 # -# # -# Paul Ellis and # -# Herbert J. Bernstein (yaya@bernstein-plus-sons.com) # -# # -# (C) Copyright 2006 - 2013 Herbert J. Bernstein # -# # -###################################################################### - -###################################################################### -# # -# YOU MAY REDISTRIBUTE THE CBFLIB PACKAGE UNDER THE TERMS OF THE GPL # -# # -# ALTERNATIVELY YOU MAY REDISTRIBUTE THE CBFLIB API UNDER THE TERMS # -# OF THE LGPL # -# # -###################################################################### - -########################### GPL NOTICES ############################## -# # -# This program is free software; you can redistribute it and/or # -# modify it under the terms of the GNU General Public License as # -# published by the Free Software Foundation; either version 2 of # -# (the License, or (at your option) any later version. # -# # -# This program is distributed in the hope that it will be useful, # -# but WITHOUT ANY WARRANTY; without even the implied warranty of # -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # -# GNU General Public License for more details. # -# # -# You should have received a copy of the GNU General Public License # -# along with this program; if not, write to the Free Software # -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA # -# 02111-1307 USA # -# # -###################################################################### - -######################### LGPL NOTICES ############################### -# # -# This library is free software; you can redistribute it and/or # -# modify it under the terms of the GNU Lesser General Public # -# License as published by the Free Software Foundation; either # -# version 2.1 of the License, or (at your option) any later version. # -# # -# This library is distributed in the hope that it will be useful, # -# but WITHOUT ANY WARRANTY; without even the implied warranty of # -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # -# Lesser General Public License for more details. # -# # -# You should have received a copy of the GNU Lesser General Public # -# License along with this library; if not, write to the Free # -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, # -# MA 02110-1301 USA # -# # -###################################################################### - -###################################################################### -# # -# Stanford University Notices # -# for the CBFlib software package that incorporates SLAC software # -# on which copyright is disclaimed # -# # -# This software # -# ------------- # -# The term "this software", as used in these Notices, refers to # -# those portions of the software package CBFlib that were created by # -# employees of the Stanford Linear Accelerator Center, Stanford # -# University. # -# # -# Stanford disclaimer of copyright # -# -------------------------------- # -# Stanford University, owner of the copyright, hereby disclaims its # -# copyright and all other rights in this software. Hence, anyone # -# may freely use it for any purpose without restriction. # -# # -# Acknowledgement of sponsorship # -# ------------------------------ # -# This software was produced by the Stanford Linear Accelerator # -# Center, Stanford University, under Contract DE-AC03-76SFO0515 with # -# the Department of Energy. # -# # -# Government disclaimer of liability # -# ---------------------------------- # -# Neither the United States nor the United States Department of # -# Energy, nor any of their employees, makes any warranty, express or # -# implied, or assumes any legal liability or responsibility for the # -# accuracy, completeness, or usefulness of any data, apparatus, # -# product, or process disclosed, or represents that its use would # -# not infringe privately owned rights. # -# # -# Stanford disclaimer of liability # -# -------------------------------- # -# Stanford University makes no representations or warranties, # -# express or implied, nor assumes any liability for the use of this # -# software. # -# # -# Maintenance of notices # -# ---------------------- # -# In the interest of clarity regarding the origin and status of this # -# software, this and all the preceding Stanford University notices # -# are to remain affixed to any copy or derivative of this software # -# made or distributed by the recipient and are to be affixed to any # -# copy of software made or distributed by the recipient that # -# contains a copy or derivative of this software. # -# # -# Based on SLAC Software Notices, Set 4 # -# OTT.002a, 2004 FEB 03 # -###################################################################### - - - -###################################################################### -# NOTICE # -# Creative endeavors depend on the lively exchange of ideas. There # -# are laws and customs which establish rights and responsibilities # -# for authors and the users of what authors create. This notice # -# is not intended to prevent you from using the software and # -# documents in this package, but to ensure that there are no # -# misunderstandings about terms and conditions of such use. # -# # -# Please read the following notice carefully. If you do not # -# understand any portion of this notice, please seek appropriate # -# professional legal advice before making use of the software and # -# documents included in this software package. In addition to # -# whatever other steps you may be obliged to take to respect the # -# intellectual property rights of the various parties involved, if # -# you do make use of the software and documents in this package, # -# please give credit where credit is due by citing this package, # -# its authors and the URL or other source from which you obtained # -# it, or equivalent primary references in the literature with the # -# same authors. # -# # -# Some of the software and documents included within this software # -# package are the intellectual property of various parties, and # -# placement in this package does not in any way imply that any # -# such rights have in any way been waived or diminished. # -# # -# With respect to any software or documents for which a copyright # -# exists, ALL RIGHTS ARE RESERVED TO THE OWNERS OF SUCH COPYRIGHT. # -# # -# Even though the authors of the various documents and software # -# found here have made a good faith effort to ensure that the # -# documents are correct and that the software performs according # -# to its documentation, and we would greatly appreciate hearing of # -# any problems you may encounter, the programs and documents any # -# files created by the programs are provided **AS IS** without any * -# warranty as to correctness, merchantability or fitness for any # -# particular or general use. # -# # -# THE RESPONSIBILITY FOR ANY ADVERSE CONSEQUENCES FROM THE USE OF # -# PROGRAMS OR DOCUMENTS OR ANY FILE OR FILES CREATED BY USE OF THE # -# PROGRAMS OR DOCUMENTS LIES SOLELY WITH THE USERS OF THE PROGRAMS # -# OR DOCUMENTS OR FILE OR FILES AND NOT WITH AUTHORS OF THE # -# PROGRAMS OR DOCUMENTS. # -###################################################################### - -###################################################################### -# # -# The IUCr Policy # -# for the Protection and the Promotion of the STAR File and # -# CIF Standards for Exchanging and Archiving Electronic Data # -# # -# Overview # -# # -# The Crystallographic Information File (CIF)[1] is a standard for # -# information interchange promulgated by the International Union of # -# Crystallography (IUCr). CIF (Hall, Allen & Brown, 1991) is the # -# recommended method for submitting publications to Acta # -# Crystallographica Section C and reports of crystal structure # -# determinations to other sections of Acta Crystallographica # -# and many other journals. The syntax of a CIF is a subset of the # -# more general STAR File[2] format. The CIF and STAR File approaches # -# are used increasingly in the structural sciences for data exchange # -# and archiving, and are having a significant influence on these # -# activities in other fields. # -# # -# Statement of intent # -# # -# The IUCr's interest in the STAR File is as a general data # -# interchange standard for science, and its interest in the CIF, # -# a conformant derivative of the STAR File, is as a concise data # -# exchange and archival standard for crystallography and structural # -# science. # -# # -# Protection of the standards # -# # -# To protect the STAR File and the CIF as standards for # -# interchanging and archiving electronic data, the IUCr, on behalf # -# of the scientific community, # -# # -# # holds the copyrights on the standards themselves, * -# # -# # owns the associated trademarks and service marks, and * -# # -# # holds a patent on the STAR File. * -# # -# These intellectual property rights relate solely to the # -# interchange formats, not to the data contained therein, nor to # -# the software used in the generation, access or manipulation of # -# the data. # -# # -# Promotion of the standards # -# # -# The sole requirement that the IUCr, in its protective role, # -# imposes on software purporting to process STAR File or CIF data # -# is that the following conditions be met prior to sale or # -# distribution. # -# # -# # Software claiming to read files written to either the STAR * -# File or the CIF standard must be able to extract the pertinent # -# data from a file conformant to the STAR File syntax, or the CIF # -# syntax, respectively. # -# # -# # Software claiming to write files in either the STAR File, or * -# the CIF, standard must produce files that are conformant to the # -# STAR File syntax, or the CIF syntax, respectively. # -# # -# # Software claiming to read definitions from a specific data * -# dictionary approved by the IUCr must be able to extract any # -# pertinent definition which is conformant to the dictionary # -# definition language (DDL)[3] associated with that dictionary. # -# # -# The IUCr, through its Committee on CIF Standards, will assist # -# any developer to verify that software meets these conformance # -# conditions. # -# # -# Glossary of terms # -# # -# [1] CIF: is a data file conformant to the file syntax defined # -# at http://www.iucr.org/iucr-top/cif/spec/index.html # -# # -# [2] STAR File: is a data file conformant to the file syntax # -# defined at http://www.iucr.org/iucr-top/cif/spec/star/index.html # -# # -# [3] DDL: is a language used in a data dictionary to define data # -# items in terms of "attributes". Dictionaries currently approved # -# by the IUCr, and the DDL versions used to construct these # -# dictionaries, are listed at # -# http://www.iucr.org/iucr-top/cif/spec/ddl/index.html # -# # -# Last modified: 30 September 2000 # -# # -# IUCr Policy Copyright (C) 2000 International Union of # -# Crystallography # -###################################################################### - -###################################################################### -# CMakeLists.txt for CBFlib # -# # -# Assumed directory structure # -# CBFlib_SOURCE_DIR CBFlib kit containing this file # -# doc Directory with documentation # -# examples Directory with example programs # -# external_packages Directory for external packages # -# include Directory with header files # -# m4 Directory with m4 files # -# src Directory with source files # -# # -# CBFlib_EXTP_BINARY_DIR CBFlib build directory # -# usually ${CBFlib_SOURCE_DIR}/build # -# external_packages Directory for HDF5, libtiff, etc. # -# hdf5-1.8.11 # -# tiff-3.9.4-rev-6Feb11 # -# regex-20090805 # -# data_files Directory for test files # -# bin Directory for executable programs # -# include Directory with build-created headers # -# src Directory with build-created source # -# # -###################################################################### - - -cmake_minimum_required (VERSION 2.8) - -project (CBFlib_EXTP C CXX Fortran) - -# -# User setable parameters -# -# NONE - -# -# Macros -# - -# -# CBF_DEBUG_MESSAGE if CBF_CMAKE_DEBUG issue str -# -macro(CBF_DEBUG_MESSAGE str) - if(CBF_CMAKE_DEBUG) - message(STATUS ${str}) - endif(CBF_CMAKE_DEBUG) -endmacro (CBF_DEBUG_MESSAGE) - -# -# CBF_REQUIRE_DIRECTORY -- require directory dir -# -macro(CBF_REQUIRE_DIRECTORY dir) - if (NOT EXISTS "${dir}") - file(MAKE_DIRECTORY "${dir}") - CBF_DEBUG_MESSAGE("Created directory ${dir}") - endif (NOT EXISTS "${dir}") -endmacro(CBF_REQUIRE_DIRECTORY) - -# -# CBF_LOAD_TARBALL -- load TARBALL into WORK_DIR as UNPACKED_DIRECTORY -# Use an absolute path for UNPACKED_DIRECTORY -# -macro(CBF_LOAD_TARBALL WORK_DIR UNPACKED_DIRECTORY TARBALL) -if (NOT EXISTS ${UNPACKED_DIRECTORY}) -execute_process( - COMMAND ${WGET_EXECUTABLE} ${TARBALL} - WORKING_DIRECTORY ${WORK_DIR} -) -execute_process( - COMMAND ${CMAKE_COMMAND} -E tar xzvf ${UNPACKED_DIRECTORY}.tar.gz - WORKING_DIRECTORY ${WORK_DIR} -) -execute_process( - COMMAND ${CMAKE_COMMAND} -E remove ${UNPACKED_DIRECTORY}.tar.gz - WORKING_DIRECTORY ${WORK_DIR} -) -endif (NOT EXISTS ${UNPACKED_DIRECTORY}) -endmacro(CBF_LOAD_TARBALL) - -# -# Directories -# -# Defined in parent CMakeLists.txt - - -# -# ZLIB -# -find_package(ZLIB) - -# -# CBF_HDF5 -# -CBF_LOAD_TARBALL(${CBF__EXT_PKG} ${CBF__EXT_PKG}/${CBF_HDF5} ${CBF_HDF5URL}) -include(ExternalProject) -ExternalProject_add(HDF5 - SOURCE_DIR ${CBF__EXT_PKG}/${CBF_HDF5} - BINARY_DIR ${CBF__EXT_PKG}/${CBF_HDF5}-build - CMAKE_ARGS - -DCMAKE_BUILD_TYPE:STRING=RELEASE DEBUG - -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=On - -DHDF5_BUILD_CPP_LIB:BOOL=Off - -DBUILD_SHARED_LIBS:BOOL=On - -DHDF5_BUILD_TOOLS:BOOL=On - -DCMAKE_INSTALL_PREFIX:PATH=${CBFlib_BINARY_DIR} - INSTALL_DIR ${CBFlib_BINARY_DIR}/ -) -SET (HDF5_INCLUDE_DIR ${CBFlib_BINARY_DIR}/include) -SET (HDF5_LIBRARY_DIR ${CBFlib_BINARY_DIR}/lib) - -install(DIRECTORY ${CBF__EXT_PKG}/${CBF_HDF5}-build/include/ DESTINATION ${CBFlib_BINARY_DIR}/include FILES_MATCHING PATTERN "*.h") -install(DIRECTORY ${CBF__EXT_PKG}/${CBF_HDF5}-build/lib/ DESTINATION ${CBFlib_BINARY_DIR}/lib FILES_MATCHING PATTERN "*hdf5*") -install(DIRECTORY ${CBF__EXT_PKG}/${CBF_HDF5}-build/bin/ DESTINATION ${CBFlib_BINARY_DIR}/bin FILES_MATCHING PATTERN "*hdf5*") - -# -# CBF_TIFF -# -CBF_LOAD_TARBALL(${CBF__EXT_PKG} ${CBF__EXT_PKG}/${CBF_TIFF} ${CBF_TIFFURL}) -ExternalProject_add(TIFF - SOURCE_DIR ${CBF__EXT_PKG}/${CBF_TIFF} - BINARY_DIR ${CBF__EXT_PKG}/${CBF_TIFF}-build - CMAKE_ARGS - -DCMAKE_BUILD_TYPE:STRING=RELEASE DEBUG - -DCMAKE_INSTALL_PREFIX:PATH=${CBFlib_BINARY_DIR} - INSTALL_DIR ${CBFlib_BINARY_DIR}/ -) -SET (TIFF_INCLUDE_DIR ${CBFlib_BINARY_DIR}/include) -SET (TIFF_LIBRARY_DIR ${CBFlib_BINARY_DIR}/lib) - -install(DIRECTORY ${CBF__EXT_PKG}/${CBF_TIFF}-build/include/ DESTINATION ${CBFlib_BINARY_DIR}/include FILES_MATCHING PATTERN "*.h") -install(DIRECTORY ${CBF__EXT_PKG}/${CBF_TIFF}-build/lib/ DESTINATION ${CBFlib_BINARY_DIR}/lib FILES_MATCHING PATTERN "*tif*") -install(DIRECTORY ${CBF__EXT_PKG}/${CBF_TIFF}-build/bin/ DESTINATION ${CBFlib_BINARY_DIR}/bin FILES_MATCHING PATTERN "*tif*") - - - -# -# CBF_REGEX or CBF_PCRE -# -# Try for PCRE first -find_library(CBF_REGEXLIB pcre) -find_path(CBF_REGEXLIB_INCLUDE_DIR NAMES pcreposix.h) -message(STATUS "CBF_REGEXLIB_INCLUDE_DIR for pcreposix.h ${CBF_REGEXLIB_INCLUDE_DIR}") -if (${CBF_REGEXLIB_INCLUDE_DIR} STREQUAL "CBF_REGEXLIB_INCLUDE_DIR-NOTFOUND" - OR ${CBF_REGEXLIB} STREQUAL "CBF_REGEXLIB-NOTFOUND") - # PCRE not found, try for REGEX - find_library(CBF_REGEXLIB regex) - find_path(CBF_REGEXLIB_INCLUDE_DIR NAMES regex.h) - message(STATUS "CBF_REGEXLIB_INCLUDE_DIR for regex.h ${CBF_REGEXLIB_INCLUDE_DIR}") - if (${CBF_REGEXLIB_INCLUDE_DIR} STREQUAL "CBF_REGEXLIB_INCLUDE_DIR-NOTFOUND" - OR ${CBF_REGEXLIB} STREQUAL "CBF_REGEXLIB-NOTFOUND") - # Neither PCRE not REGEX found, load and build PCRE - CBF_LOAD_TARBALL(${CBF__EXT_PKG} ${CBF__EXT_PKG}/${CBF_PCRE} ${CBF_PCREURL}) - ExternalProject_add(PCRE - SOURCE_DIR ${CBF__EXT_PKG}/${CBF_PCRE} - BINARY_DIR ${CBF__EXT_PKG}/${CBF_PCRE}-build - CMAKE_ARGS - -DCMAKE_BUILD_TYPE:STRING=RELEASE DEBUG - -DCMAKE_INSTALL_PREFIX:PATH=${CBFlib_BINARY_DIR} - INSTALL_DIR ${CBFlib_BINARY_DIR}/ - ) - SET (CBF_REGEXLIB_INCLUDE_DIR ${CBFlib_BINARY_DIR}/include) - SET (CBF_REGEXLIB_LIBRARY_DIR ${CBFlib_BINARY_DIR}/lib) - install(DIRECTORY ${CBF__EXT_PKG}/${CBF_PCRE}-build/include/ DESTINATION ${CBFlib_BINARY_DIR}/include FILES_MATCHING PATTERN "*.h") - install(DIRECTORY ${CBF__EXT_PKG}/${CBF_PCRE}-build/lib/ DESTINATION ${CBFlib_BINARY_DIR}/lib FILES_MATCHING PATTERN "*pcre*") - install(DIRECTORY ${CBF__EXT_PKG}/${CBF_PCRE}-build/bin/ DESTINATION ${CBFlib_BINARY_DIR}/bin FILES_MATCHING PATTERN "*pcre*") - add_definitions(-DCBF_REGEXLIB_PCRE) - - else (${CBF_REGEXLIB_INCLUDE_DIR} STREQUAL "CBF_REGEXLIB_INCLUDE_DIR-NOTFOUND" - OR ${CBF_REGEXLIB} STREQUAL "CBF_REGEXLIB-NOTFOUND") - add_definitions(-DCBF_REGEXLIB_REGEX) - endif (${CBF_REGEXLIB_INCLUDE_DIR} STREQUAL "CBF_REGEXLIB_INCLUDE_DIR-NOTFOUND" - OR ${CBF_REGEXLIB} STREQUAL "CBF_REGEXLIB-NOTFOUND") -else (${CBF_REGEXLIB_INCLUDE_DIR} STREQUAL "CBF_REGEXLIB_INCLUDE_DIR-NOTFOUND" - OR ${CBF_REGEXLIB} STREQUAL "CBF_REGEXLIB-NOTFOUND") - add_definitions(-DCBF_REGEXLIB_PCRE) -endif (${CBF_REGEXLIB_INCLUDE_DIR} STREQUAL "CBF_REGEXLIB_INCLUDE_DIR-NOTFOUND" - OR ${CBF_REGEXLIB} STREQUAL "CBF_REGEXLIB-NOTFOUND") -CBF_DEBUG_MESSAGE("CBF_REGEXLIB: ${CBF_REGEXLIB}") -CBF_DEBUG_MESSAGE("CBF_REGEXLIB_INCLUDE_DIR: ${CBF_REGEXLIB_INCLUDE_DIR}") - From a4bd3797112c5a3e2d024d4f570fc025ed303d14 Mon Sep 17 00:00:00 2001 From: Johan Hattne Date: Fri, 20 Sep 2024 10:44:57 -0700 Subject: [PATCH 3/3] Fix underlinking: nexus2cbf needs hdf5 --- CMakeLists.txt | 2 +- examples/nexus2cbf.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a4fc918..2de29ecf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1052,7 +1052,7 @@ endmacro() add_target(tiff2cbf "${CBF__EXAMPLES}/tiff2cbf.c" "${CBF_TIFF}" "cbf_static;${TIFF_LIBRARY_PATH}") add_target(cbf2nexus "${CBF__EXAMPLES}/cbf2nexus.c" "" cbf_static) -add_target(nexus2cbf "${CBF__EXAMPLES}/nexus2cbf.c" "" cbf_static) +add_target(nexus2cbf "${CBF__EXAMPLES}/nexus2cbf.c" "" "cbf_static;hdf5") add_target(minicbf2nexus "${CBF__EXAMPLES}/minicbf2nexus.c" "" cbf_static) add_target(adscimg2cbf "${CBF__EXAMPLES}/adscimg2cbf.c;${CBF__EXAMPLES}/adscimg2cbf_sub.c" "" "cbf_static;${libm}") add_target(cbf2adscimg "${CBF__EXAMPLES}/cbf2adscimg.c;${CBF__EXAMPLES}/cbf2adscimg_sub.c" "" "cbf_static;${libm}") diff --git a/examples/nexus2cbf.c b/examples/nexus2cbf.c index 18122434..8a5eb347 100644 --- a/examples/nexus2cbf.c +++ b/examples/nexus2cbf.c @@ -242,6 +242,8 @@ #include #include +#include + #include "cbf.h" #include "cbf_simple.h" #include "img.h"