4141
4242#include " ../ifcparse/utils.h"
4343
44+ #ifdef IFOPSH_WITH_OPENCASCADE
45+
4446#include < Standard_Version.hxx>
4547
4648#if OCC_VERSION_HEX < 0x60900
4749#include < IGESControl_Controller.hxx>
4850#endif
4951
52+ #endif
53+
5054#include < boost/program_options.hpp>
5155#include < boost/make_shared.hpp>
5256
5357#include < fstream>
5458#include < sstream>
5559#include < set>
5660#include < time.h>
61+ #include < iomanip>
5762
5863#if USE_VLD
5964#include < vld.h>
@@ -86,7 +91,11 @@ namespace po = boost::program_options;
8691
8792void print_version ()
8893{
89- cout_ << " IfcOpenShell IfcConvert " << IFCOPENSHELL_VERSION << " (OCC " << OCC_VERSION_STRING_EXT << " )\n " ;
94+ cout_ << " IfcOpenShell IfcConvert " << IFCOPENSHELL_VERSION;
95+ #ifdef IFOPSH_WITH_OPENCASCADE
96+ cout_ << " (OCC " << OCC_VERSION_STRING_EXT << " )" ;
97+ #endif
98+ cout_ << " \n " ;
9099}
91100
92101void print_usage (bool suggest_help = true )
@@ -383,7 +392,9 @@ int main(int argc, char** argv) {
383392 std::string section_ref, elevation_ref, elevation_ref_guid;
384393 // "none", "full" or "left"
385394 std::string storey_height_display;
395+ #ifdef IFOPSH_WITH_OPENCASCADE
386396 SvgSerializer::storey_height_display_types svg_storey_height_display = SvgSerializer::SH_NONE;
397+ #endif
387398
388399 po::options_description serializer_options (" Serialization options" );
389400 serializer_options.add_options ()
@@ -549,6 +560,7 @@ int main(int argc, char** argv) {
549560 return EXIT_FAILURE;
550561 }
551562
563+ #ifdef IFOPSH_WITH_OPENCASCADE
552564 if (vmap.count (" draw-storey-heights" )) {
553565 boost::to_lower (storey_height_display);
554566
@@ -564,6 +576,7 @@ int main(int argc, char** argv) {
564576 return EXIT_FAILURE;
565577 }
566578 }
579+ #endif
567580
568581 if (vmap.count (" log-format" ) == 1 ) {
569582 boost::to_lower (log_format);
@@ -861,6 +874,7 @@ int main(int argc, char** argv) {
861874 } else if (output_extension == GLB) {
862875 serializer = boost::make_shared<GltfSerializer>(IfcUtil::path::to_utf8 (output_temp_filename), settings);
863876#endif
877+ #ifdef IFOPSH_WITH_OPENCASCADE
864878 } else if (output_extension == STP) {
865879 serializer = boost::make_shared<StepSerializer>(IfcUtil::path::to_utf8 (output_temp_filename), settings);
866880 } else if (output_extension == IGS) {
@@ -872,15 +886,13 @@ int main(int argc, char** argv) {
872886 } else if (output_extension == SVG) {
873887 settings.set (IfcGeom::IteratorSettings::DISABLE_TRIANGULATION, true );
874888 serializer = boost::make_shared<SvgSerializer>(IfcUtil::path::to_utf8 (output_temp_filename), settings);
875- }
876889#ifdef WITH_HDF5
877- else if (output_extension == HDF) {
890+ } else if (output_extension == HDF) {
878891 settings.set (IfcGeom::IteratorSettings::DISABLE_TRIANGULATION, true );
879892 serializer = boost::make_shared<HdfSerializer>(IfcUtil::path::to_utf8 (output_temp_filename), settings);
880- }
881893#endif
882-
883- else {
894+ #endif
895+ } else {
884896 cerr_ << " [Error] Unknown output filename extension '" << output_extension << " '\n " ;
885897 write_log (!quiet);
886898 print_usage ();
@@ -1003,7 +1015,7 @@ int main(int argc, char** argv) {
10031015
10041016 IfcGeom::Iterator context_iterator (geometry_kernel, settings, ifc_file, filter_funcs, num_threads);
10051017
1006- #ifdef WITH_HDF5
1018+ #if defined( WITH_HDF5) && defined(IFOPSH_WITH_OPENCASCADE)
10071019 std::unique_ptr<HdfSerializer> cache;
10081020 if (vmap.count (" cache-file" ) || vmap.count (" cache" )) {
10091021 if (!vmap.count (" cache-file" )) {
@@ -1028,6 +1040,7 @@ int main(int argc, char** argv) {
10281040
10291041 serializer->setFile (context_iterator.file ());
10301042
1043+ #ifdef IFOPSH_WITH_OPENCASCADE
10311044 if (output_extension == SVG) {
10321045 if (vmap.count (" section-height-from-storeys" ) != 0 ) {
10331046 if (vmap.count (" section-height" )) {
@@ -1099,6 +1112,7 @@ int main(int argc, char** argv) {
10991112 );
11001113 }
11011114 }
1115+ #endif
11021116
11031117 if (convert_back_units) {
11041118 serializer->setUnitNameAndMagnitude (context_iterator.unit_name (), static_cast <float >(context_iterator.unit_magnitude ()));
0 commit comments