From 66faea12854d3073bf573bb3a2d2b7213e999cc1 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Tue, 31 Aug 2021 11:03:28 +0200 Subject: [PATCH] HDF5 optional in code --- cmake/CMakeLists.txt | 18 ++++++++++-------- src/ifcconvert/IfcConvert.cpp | 4 ++++ src/serializers/HdfSerializer.cpp | 3 +++ src/serializers/HdfSerializer.h | 4 ++++ 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index ef8eceaba3..8378e329e8 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -437,7 +437,7 @@ if(HDF5_SUPPORT) set(lib_ext a) endif() - SET(HDF5_LIBRARIES + SET(HDF5_LIBRARIES "${HDF5_LIBRARY_DIR}/libhdf5_cpp.${lib_ext}" "${HDF5_LIBRARY_DIR}/libhdf5.${lib_ext}" "${HDF5_LIBRARY_DIR}/libz${zlib_post}.${lib_ext}" @@ -449,14 +449,16 @@ if(HDF5_SUPPORT) if (NOT HDF5_LIBRARIES) # debian default - SET(HDF5_LIBRARIES - /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5_cpp.a - /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.a - /usr/lib/x86_64-linux-gnu/libsz.a - /usr/lib/x86_64-linux-gnu/libaec.a - z dl - ) + SET(HDF5_LIBRARIES + /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5_cpp.a + /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.a + /usr/lib/x86_64-linux-gnu/libsz.a + /usr/lib/x86_64-linux-gnu/libaec.a + z dl + ) endif() + + add_definitions(-DWITH_HDF5) endif() IF(NOT CMAKE_BUILD_TYPE) diff --git a/src/ifcconvert/IfcConvert.cpp b/src/ifcconvert/IfcConvert.cpp index a6ab6e89b1..8076eeabf2 100644 --- a/src/ifcconvert/IfcConvert.cpp +++ b/src/ifcconvert/IfcConvert.cpp @@ -105,7 +105,9 @@ void print_usage(bool suggest_help = true) << " .igs IGES Initial Graphics Exchange Specification\n" << " .xml XML Property definitions and decomposition tree\n" << " .svg SVG Scalable Vector Graphics (2D floor plan)\n" +#ifdef WITH_HDF5 << " .h5 HDF Hierarchical Data Format storing positions, normals and indices\n" +#endif << " .ifc IFC-SPF Industry Foundation Classes\n" << "\n" << "If no output filename given, " << IfcUtil::path::from_utf8(DEFAULT_EXTENSION) << " will be used as the output file.\n"; @@ -834,10 +836,12 @@ int main(int argc, char** argv) { settings.set(IfcGeom::IteratorSettings::DISABLE_TRIANGULATION, true); serializer = boost::make_shared(IfcUtil::path::to_utf8(output_temp_filename), settings); } +#ifdef WITH_HDF5 else if (output_extension == HDF) { settings.set(IfcGeom::IteratorSettings::DISABLE_TRIANGULATION, true); serializer = boost::make_shared(IfcUtil::path::to_utf8(output_temp_filename), settings); } +#endif else { cerr_ << "[Error] Unknown output filename extension '" << output_extension << "'\n"; diff --git a/src/serializers/HdfSerializer.cpp b/src/serializers/HdfSerializer.cpp index bf534ce055..9c7be031f1 100644 --- a/src/serializers/HdfSerializer.cpp +++ b/src/serializers/HdfSerializer.cpp @@ -17,6 +17,7 @@ * * ********************************************************************************/ +#ifdef WITH_HDF5 #include "HdfSerializer.h" @@ -125,3 +126,5 @@ void HdfSerializer::write(const IfcGeom::BRepElement* o) { } } + +#endif \ No newline at end of file diff --git a/src/serializers/HdfSerializer.h b/src/serializers/HdfSerializer.h index 9e1570adc3..9cc971f602 100644 --- a/src/serializers/HdfSerializer.h +++ b/src/serializers/HdfSerializer.h @@ -20,6 +20,8 @@ #ifndef HdfSERIALIZER_H #define HdfSERIALIZER_H +#ifdef WITH_HDF5 + #include #include #include @@ -55,3 +57,5 @@ public: }; #endif + +#endif