Skip to content

Commit 984c786

Browse files
committed
Use a cmake variable to control shim class build
1 parent a6744ee commit 984c786

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

core/CMakeLists.txt

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,19 @@ else(APPLE)
55
set(CORE_EXTRA_SRCS "")
66
endif(APPLE)
77

8+
if(NOT DEFINED WITHOUT_SUPERTIMESTREAM)
9+
set(WITHOUT_SUPERTIMESTREAM FALSE CACHE BOOL "Build G3SuperTimestream class")
10+
endif()
11+
if(NOT WITHOUT_SUPERTIMESTREAM)
12+
set(CORE_EXTRA_SRCS ${CORE_EXTRA_SRCS} src/G3SuperTimestream.cxx)
13+
endif()
14+
815
add_spt3g_library(core SHARED
916
src/G3EventBuilder.cxx src/G3Frame.cxx src/G3TimeStamp.cxx
1017
src/G3Pipeline.cxx src/G3Writer.cxx src/G3Reader.cxx
1118
src/G3InfiniteSource.cxx src/G3Logging.cxx src/G3PrintfLogger.cxx
1219
src/G3Data.cxx src/G3Vector.cxx src/G3Map.cxx src/G3Timestream.cxx
13-
src/G3Timesample.cxx src/G3SuperTimestream.cxx
20+
src/G3Timesample.cxx
1421
src/G3TriggeredBuilder.cxx src/G3MultiFileWriter.cxx src/dataio.cxx
1522
src/compression.cxx src/crc32.c ${CORE_EXTRA_SRCS}
1623
src/G3NetworkSender.cxx src/G3SyslogLogger.cxx
@@ -40,9 +47,13 @@ if(FLAC_FOUND)
4047
target_link_libraries(core PRIVATE FLAC::FLAC)
4148
endif()
4249

43-
find_package(OpenMP)
44-
if(OpenMP_FOUND)
45-
target_link_libraries(core PRIVATE OpenMP::OpenMP_CXX)
50+
if(NOT WITHOUT_SUPERTIMESTREAM)
51+
find_package(OpenMP QUIET)
52+
if(OpenMP_FOUND)
53+
target_link_libraries(core PRIVATE OpenMP::OpenMP_CXX)
54+
endif()
55+
56+
target_compile_definitions(core PRIVATE -DHAS_SUPERTIMESTREAM)
4657
endif()
4758

4859
# Link against Z library

core/src/G3Frame.cxx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#include <G3Frame.h>
22
#include <G3Data.h>
33
#include <G3Quat.h>
4+
#ifdef HAS_SUPERTIMESTREAM
45
#include "G3SuperTimestream.h"
6+
#endif
57
#include <serialization.h>
68
#include <pybindings.h>
79

@@ -360,10 +362,12 @@ void G3Frame::blob_decode(struct blob_container &blob)
360362
cereal::PortableBinaryInputArchive item_ar(is);
361363
item_ar >> make_nvp("val", ptr);
362364

365+
#ifdef HAS_SUPERTIMESTREAM
363366
// Convert to public type
364367
auto v = std::dynamic_pointer_cast<G3SuperTimestream>(ptr);
365368
if (!!v)
366369
ptr = std::make_shared<G3TimestreamMap>(*v);
370+
#endif
367371

368372
blob.frameobject = ptr;
369373

0 commit comments

Comments
 (0)