diff --git a/.github/workflows/conda.yml b/.github/workflows/conda.yml index 903647308..ee5791526 100644 --- a/.github/workflows/conda.yml +++ b/.github/workflows/conda.yml @@ -32,9 +32,9 @@ jobs: strategy: matrix: os: - - ubuntu-24.04 - - macos-14 - - macos-12 + # - ubuntu-24.04 + # - macos-14 + # - macos-12 - windows-2019 runs-on: ${{ matrix.os }} steps: diff --git a/cpp/csp/adapters/kafka/KafkaAdapterManager.h b/cpp/csp/adapters/kafka/KafkaAdapterManager.h index bf4e23158..925062422 100644 --- a/cpp/csp/adapters/kafka/KafkaAdapterManager.h +++ b/cpp/csp/adapters/kafka/KafkaAdapterManager.h @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -11,6 +12,7 @@ #include #include + namespace RdKafka { diff --git a/cpp/csp/adapters/parquet/DialectGenericListReaderInterface.h b/cpp/csp/adapters/parquet/DialectGenericListReaderInterface.h index 61b77cd85..417e080e3 100644 --- a/cpp/csp/adapters/parquet/DialectGenericListReaderInterface.h +++ b/cpp/csp/adapters/parquet/DialectGenericListReaderInterface.h @@ -2,6 +2,7 @@ #define _IN_CSP_ADAPTERS_PARQUET_DialectGenericListReaderInterface_H #include +#include #include #include #include @@ -9,7 +10,7 @@ namespace csp::adapters::parquet { -class DialectGenericListReaderInterface +class CSPPARQUETADAPTERIMPL_EXPORT DialectGenericListReaderInterface { public: using Ptr = std::shared_ptr; @@ -25,7 +26,7 @@ class DialectGenericListReaderInterface }; template< typename T > -class CSP_PUBLIC TypedDialectGenericListReaderInterface : public DialectGenericListReaderInterface +class CSPPARQUETADAPTERIMPL_EXPORT TypedDialectGenericListReaderInterface : public DialectGenericListReaderInterface { public: using Ptr = std::shared_ptr>; diff --git a/cpp/csp/adapters/parquet/ParquetInputAdapterManager.h b/cpp/csp/adapters/parquet/ParquetInputAdapterManager.h index 8f3effa1e..479eac517 100644 --- a/cpp/csp/adapters/parquet/ParquetInputAdapterManager.h +++ b/cpp/csp/adapters/parquet/ParquetInputAdapterManager.h @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -18,7 +19,7 @@ namespace csp::adapters::parquet //Top level AdapterManager object for all parquet adapters in the engine -class CSP_PUBLIC ParquetInputAdapterManager final : public csp::AdapterManager +class CSPPARQUETADAPTERIMPL_EXPORT ParquetInputAdapterManager final : public csp::AdapterManager { public: using GeneratorPtr = csp::Generator::Ptr; diff --git a/cpp/csp/adapters/parquet/ParquetOutputAdapterManager.h b/cpp/csp/adapters/parquet/ParquetOutputAdapterManager.h index b7fe029f4..2ac6139bd 100644 --- a/cpp/csp/adapters/parquet/ParquetOutputAdapterManager.h +++ b/cpp/csp/adapters/parquet/ParquetOutputAdapterManager.h @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -21,7 +22,7 @@ class ParquetOutputFilenameAdapter; class ParquetDictBasketOutputWriter; //Top level AdapterManager object for all parquet adapters in the engine -class CSP_PUBLIC ParquetOutputAdapterManager final : public csp::AdapterManager +class CSPPARQUETADAPTERIMPL_EXPORT ParquetOutputAdapterManager final : public csp::AdapterManager { public: using FileVisitorCallback = std::function; diff --git a/cpp/csp/adapters/websocket/ClientAdapterManager.h b/cpp/csp/adapters/websocket/ClientAdapterManager.h index b2b15fa78..3930f24e0 100644 --- a/cpp/csp/adapters/websocket/ClientAdapterManager.h +++ b/cpp/csp/adapters/websocket/ClientAdapterManager.h @@ -40,7 +40,7 @@ struct WebsocketClientStatusTypeTraits using ClientStatusType = Enum; -class CSP_PUBLIC ClientAdapterManager final : public AdapterManager +class CSPWEBSOCKETADAPTERIMPL_EXPORT ClientAdapterManager final : public AdapterManager { public: ClientAdapterManager( diff --git a/cpp/csp/core/CMakeLists.txt b/cpp/csp/core/CMakeLists.txt index 592ca9b60..126a4874e 100644 --- a/cpp/csp/core/CMakeLists.txt +++ b/cpp/csp/core/CMakeLists.txt @@ -1,3 +1,5 @@ +include(GenerateExportHeader) + set(CORE_PUBLIC_HEADERS BasicAllocator.h Config.h.in @@ -25,7 +27,11 @@ set(CORE_SOURCE_FILES configure_file(Config.h.in ${CMAKE_CURRENT_BINARY_DIR}/cpp/csp/core/Config.h) -add_library(csp_core STATIC ${CORE_SOURCE_FILES}) +add_library(csp_core SHARED ${CORE_SOURCE_FILES}) +generate_export_header(csp_core + BASE_NAME cspcore + EXPORT_MACRO_NAME CSPCORE_EXPORT +) set_target_properties(csp_core PROPERTIES PUBLIC_HEADER "${CORE_PUBLIC_HEADERS}") install(TARGETS csp_core @@ -34,3 +40,4 @@ install(TARGETS csp_core LIBRARY DESTINATION lib/ ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cpp/csp/core/Config.h DESTINATION include/csp/core) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cspcore_export.h DESTINATION include/csp/core) \ No newline at end of file diff --git a/cpp/csp/core/Enum.h b/cpp/csp/core/Enum.h index aac11fd5d..9c98e589d 100644 --- a/cpp/csp/core/Enum.h +++ b/cpp/csp/core/Enum.h @@ -73,7 +73,7 @@ bool UnknownOnInvalidValue(long) { return false; } START_PACKED template -struct Enum : public EnumTraits +struct CSP_PUBLIC Enum : public EnumTraits // need to export for autogen build { using EnumV = typename EnumTraits::_enum; using Mapping = std::vector; diff --git a/cpp/csp/core/EnumBitSet.h b/cpp/csp/core/EnumBitSet.h index 660681029..dd510e441 100644 --- a/cpp/csp/core/EnumBitSet.h +++ b/cpp/csp/core/EnumBitSet.h @@ -1,6 +1,8 @@ #ifndef _IN_CSP_CORE_ENUMBITSET_H #define _IN_CSP_CORE_ENUMBITSET_H +#include + #include #include #include diff --git a/cpp/csp/core/Generator.h b/cpp/csp/core/Generator.h index 8f33eaddf..3ec5324f3 100644 --- a/cpp/csp/core/Generator.h +++ b/cpp/csp/core/Generator.h @@ -1,6 +1,7 @@ #ifndef _IN_CSP_CORE_GENERATOR_H #define _IN_CSP_CORE_GENERATOR_H +#include #include namespace csp diff --git a/cpp/csp/core/Platform.h b/cpp/csp/core/Platform.h index eb6e0c058..e2a2ff6ab 100644 --- a/cpp/csp/core/Platform.h +++ b/cpp/csp/core/Platform.h @@ -4,6 +4,19 @@ #include #include +// cmake autogenerated export files +#include +#include +#include + +#include +#include + +#include +#include +#include + + //TODO move Likely.h defines into Platform.h #ifdef WIN32 #define NOMINMAX @@ -14,20 +27,7 @@ #undef ERROR #undef GetMessage -#define CSP_LOCAL -#define CSP_PUBLIC __declspec(dllexport) - -#ifdef CSPTYPESIMPL_EXPORTS -#define CSPTYPESIMPL_EXPORT __declspec(dllexport) -#else -#define CSPTYPESIMPL_EXPORT __declspec(dllimport) -#endif - -#ifdef CSPIMPL_EXPORTS -#define CSPIMPL_EXPORT __declspec(dllexport) -#else -#define CSPIMPL_EXPORT __declspec(dllimport) -#endif +#define CSP_PUBLIC __declspec(dllexport) // just for exceptions! #define START_PACKED __pragma( pack(push, 1) ) #define END_PACKED __pragma( pack(pop)) @@ -90,10 +90,7 @@ inline uint8_t ffs(uint64_t n) } #else -#define CSPIMPL_EXPORT __attribute__ ((visibility ("default"))) -#define CSPTYPESIMPL_EXPORT __attribute__ ((visibility ("default"))) -#define CSP_LOCAL __attribute__ ((visibility ("hidden"))) #define CSP_PUBLIC __attribute__ ((visibility ("default"))) #define START_PACKED diff --git a/cpp/csp/core/QueueWaiter.h b/cpp/csp/core/QueueWaiter.h index 307930cd5..05aeb5775 100644 --- a/cpp/csp/core/QueueWaiter.h +++ b/cpp/csp/core/QueueWaiter.h @@ -1,10 +1,13 @@ #ifndef _IN_CSP_CORE_QUEUEBLOCKINGWAIT_H #define _IN_CSP_CORE_QUEUEBLOCKINGWAIT_H +#include +#include +#include + #include #include -#include -#include + namespace csp { diff --git a/cpp/csp/core/TaggedPointerUnion.h b/cpp/csp/core/TaggedPointerUnion.h index 43a41a85f..045d56bb2 100644 --- a/cpp/csp/core/TaggedPointerUnion.h +++ b/cpp/csp/core/TaggedPointerUnion.h @@ -1,6 +1,7 @@ #ifndef _IN_CSP_CORE_TAGGEDPOINTERUNION_H #define _IN_CSP_CORE_TAGGEDPOINTERUNION_H +#include #include namespace csp diff --git a/cpp/csp/core/Time.h b/cpp/csp/core/Time.h index 07a2247ac..fdf27bb82 100644 --- a/cpp/csp/core/Time.h +++ b/cpp/csp/core/Time.h @@ -446,7 +446,7 @@ inline std::ostream & operator <<( std::ostream &os, const Time & t ) // Time is internally stored as an int64_t nanoseconds since 1970. // All DateTime objects are stored as UTC and should be treated as such -class DateTime +class CSPCORE_EXPORT DateTime { public: DateTime() : DateTime( DateTime::NONE() ) {} diff --git a/cpp/csp/engine/AdapterManager.h b/cpp/csp/engine/AdapterManager.h index fd71126c9..21f300312 100644 --- a/cpp/csp/engine/AdapterManager.h +++ b/cpp/csp/engine/AdapterManager.h @@ -1,6 +1,7 @@ #ifndef _IN_CSP_ADAPTER_MANAGER_H #define _IN_CSP_ADAPTER_MANAGER_H +#include #include #include #include @@ -16,7 +17,7 @@ class AdapterManager; class Engine; -class ManagedSimInputAdapter : public InputAdapter +class CSPENGINE_EXPORT ManagedSimInputAdapter : public InputAdapter { public: ManagedSimInputAdapter( csp::Engine *engine, const CspTypePtr &type, AdapterManager *manager, PushMode pushMode ); @@ -93,7 +94,7 @@ bool ManagedSimInputAdapter::pushNullTick() return true; } -class CSP_PUBLIC AdapterManager : public EngineOwned +class CSPENGINE_EXPORT AdapterManager : public EngineOwned { public: AdapterManager( csp::Engine * ); diff --git a/cpp/csp/engine/AlarmInputAdapter.h b/cpp/csp/engine/AlarmInputAdapter.h index 28b70f704..b37e51a0f 100644 --- a/cpp/csp/engine/AlarmInputAdapter.h +++ b/cpp/csp/engine/AlarmInputAdapter.h @@ -1,6 +1,7 @@ #ifndef _IN_CSP_ENGINE_ALARMINPUTADAPTER_H #define _IN_CSP_ENGINE_ALARMINPUTADAPTER_H +#include #include #include diff --git a/cpp/csp/engine/BasketInfo.h b/cpp/csp/engine/BasketInfo.h index 4fa50cb8a..752cae57f 100644 --- a/cpp/csp/engine/BasketInfo.h +++ b/cpp/csp/engine/BasketInfo.h @@ -2,6 +2,7 @@ #define _IN_CSP_ENGINE_BASKETINFO_H #include +#include #include #include #include @@ -12,7 +13,7 @@ namespace csp class Node; -class InputBasketInfo +class CSPENGINE_EXPORT InputBasketInfo { using TickedInputs = std::vector; @@ -188,7 +189,7 @@ class InputBasketInfo bool m_isDynamic; }; -class DynamicInputBasketInfo : public InputBasketInfo +class CSPENGINE_EXPORT DynamicInputBasketInfo : public InputBasketInfo { public: using ChangeCallback = std::function; @@ -227,7 +228,7 @@ class DynamicInputBasketInfo : public InputBasketInfo TimeDelta m_timeWindowPolicy; }; -class OutputBasketInfo +class CSPENGINE_EXPORT OutputBasketInfo { public: OutputBasketInfo( CspTypePtr & type, Node * node, size_t size, bool isDynamic = false ); @@ -254,7 +255,7 @@ class OutputBasketInfo bool m_isDynamic; }; -class DynamicOutputBasketInfo : public OutputBasketInfo +class CSPENGINE_EXPORT DynamicOutputBasketInfo : public OutputBasketInfo { public: DynamicOutputBasketInfo( CspTypePtr & type, Node * node ); diff --git a/cpp/csp/engine/CMakeLists.txt b/cpp/csp/engine/CMakeLists.txt index ce035b691..61a3a05b4 100644 --- a/cpp/csp/engine/CMakeLists.txt +++ b/cpp/csp/engine/CMakeLists.txt @@ -1,3 +1,4 @@ +include(GenerateExportHeader) csp_autogen( csp.impl.types.autogen_types autogen_types ENGINE_AUTOGEN_HEADER ENGINE_AUTOGEN_SOURCE ) set(CSP_TYPES_PUBLIC_HEADERS @@ -12,10 +13,7 @@ set(CSP_TYPES_PUBLIC_HEADERS set(CSP_TYPES_SOURCE_FILES CspEnum.cpp CspType.cpp - DialectGenericType.h - PartialSwitchCspType.h Struct.cpp - TypeCast.h ) set(ENGINE_PUBLIC_HEADERS @@ -83,10 +81,19 @@ set(ENGINE_SOURCE_FILES ${ENGINE_PUBLIC_HEADERS} ) -add_library(csp_types STATIC ${CSP_TYPES_SOURCE_FILES}) +add_library(csp_types SHARED ${CSP_TYPES_SOURCE_FILES}) +generate_export_header(csp_types + BASE_NAME csptypes + EXPORT_MACRO_NAME CSPTYPES_EXPORT +) set_target_properties(csp_types PROPERTIES PUBLIC_HEADER "${CSP_TYPES_PUBLIC_HEADERS}") +target_link_libraries(csp_types csp_core) -add_library(csp_engine STATIC ${ENGINE_SOURCE_FILES}) +add_library(csp_engine SHARED ${ENGINE_SOURCE_FILES}) +generate_export_header(csp_engine + BASE_NAME cspengine + EXPORT_MACRO_NAME CSPENGINE_EXPORT +) set_target_properties(csp_engine PROPERTIES PUBLIC_HEADER "${ENGINE_PUBLIC_HEADERS}") target_link_libraries(csp_engine csp_core csp_types) @@ -97,3 +104,7 @@ install(TARGETS csp_types csp_engine RUNTIME DESTINATION ${CSP_RUNTIME_INSTALL_SUBDIR} LIBRARY DESTINATION lib/ ) + +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cspengine_export.h + ${CMAKE_CURRENT_BINARY_DIR}/csptypes_export.h + DESTINATION include/csp/engine) diff --git a/cpp/csp/engine/Consumer.h b/cpp/csp/engine/Consumer.h index f9d2bc7c6..d697d7c7e 100644 --- a/cpp/csp/engine/Consumer.h +++ b/cpp/csp/engine/Consumer.h @@ -1,6 +1,7 @@ #ifndef _IN_CSP_ENGINE_CONSUMER_H #define _IN_CSP_ENGINE_CONSUMER_H +#include #include #include #include @@ -13,7 +14,7 @@ namespace csp class InputAdapter; //Base of either regular Nodes or output adapters -class Consumer +class CSPENGINE_EXPORT Consumer { public: Consumer( Engine * ); diff --git a/cpp/csp/engine/CspEnum.h b/cpp/csp/engine/CspEnum.h index 93f083369..266a00b52 100644 --- a/cpp/csp/engine/CspEnum.h +++ b/cpp/csp/engine/CspEnum.h @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -14,7 +15,7 @@ namespace csp class CspEnumMeta; -class CspEnumInstance +class CSPTYPES_EXPORT CspEnumInstance { public: CspEnumInstance( std::string name, int64_t value, csp::CspEnumMeta * meta ) : m_name( name ), m_value( value ), m_meta( meta ) {} @@ -34,7 +35,7 @@ class CspEnumInstance //As an optimization we do NOT attach meta or value to every instance of an enum. Instead, the enum //holds only a pointer to a singleton CspEnumInstance, which holds the value, name, and meta pointer. -class CspEnum +class CSPTYPES_EXPORT CspEnum { public: CspEnum(); @@ -58,7 +59,7 @@ class CspEnum std::ostream &operator<<( std::ostream &os, const CspEnum & rhs ); -class CspEnumMeta +class CSPTYPES_EXPORT CspEnumMeta { public: using ValueDef = std::unordered_map; diff --git a/cpp/csp/engine/CspType.h b/cpp/csp/engine/CspType.h index b85ab4148..7a98750e4 100644 --- a/cpp/csp/engine/CspType.h +++ b/cpp/csp/engine/CspType.h @@ -2,6 +2,7 @@ #define _IN_CSP_ENGINE_CSPTYPE_H #include +#include #include #include #include @@ -14,7 +15,7 @@ namespace csp class CspStringType; -class CspType +class CSPTYPES_EXPORT CspType { public: @@ -115,7 +116,7 @@ class CspType Type m_type; }; -class CspStringType : public CspType +class CSPTYPES_EXPORT CspStringType : public CspType { public: CspStringType(bool isBytes) @@ -134,7 +135,7 @@ class CspEnum; class CspEnumMeta; -class CspEnumType : public CspType +class CSPTYPES_EXPORT CspEnumType : public CspType { public: CspEnumType( std::shared_ptr & meta ) : CspType( CspType::Type::ENUM ), @@ -154,7 +155,7 @@ using StructPtr = TypedStructPtr; class StructMeta; -class CspStructType : public CspType +class CSPTYPES_EXPORT CspStructType : public CspType { public: CspStructType( const std::shared_ptr & meta ) : CspType( CspType::Type::STRUCT ), @@ -167,7 +168,7 @@ class CspStructType : public CspType std::shared_ptr m_meta; }; -class CspArrayType : public CspType +class CSPTYPES_EXPORT CspArrayType : public CspType { public: CspArrayType( CspTypePtr elemType, bool isPyStructFastList = false ) : diff --git a/cpp/csp/engine/CycleStepTable.h b/cpp/csp/engine/CycleStepTable.h index 8605a7c2e..22fd80bf7 100644 --- a/cpp/csp/engine/CycleStepTable.h +++ b/cpp/csp/engine/CycleStepTable.h @@ -2,6 +2,7 @@ #define _IN_CSP_ENGINE_CYCLESTEPTABLE_H #include +#include #include #include @@ -11,7 +12,7 @@ namespace csp class Consumer; class Profiler; -class CycleStepTable +class CSPENGINE_EXPORT CycleStepTable { public: CycleStepTable(); diff --git a/cpp/csp/engine/DialectGenericType.h b/cpp/csp/engine/DialectGenericType.h index 0aa0dfad0..1ffdb9aaf 100644 --- a/cpp/csp/engine/DialectGenericType.h +++ b/cpp/csp/engine/DialectGenericType.h @@ -5,6 +5,7 @@ #include #include + namespace csp { diff --git a/cpp/csp/engine/Dictionary.h b/cpp/csp/engine/Dictionary.h index 1e7a2c82a..cc671f1c3 100644 --- a/cpp/csp/engine/Dictionary.h +++ b/cpp/csp/engine/Dictionary.h @@ -2,6 +2,7 @@ #define _IN_CSP_CORE_DICTIONARY_H #include +#include #include #include #include @@ -22,7 +23,7 @@ using DictionaryPtr = std::shared_ptr; class StructMeta; using StructMetaPtr = std::shared_ptr; -class Dictionary +class CSPENGINE_EXPORT Dictionary { public: struct Data; diff --git a/cpp/csp/engine/DynamicEngine.h b/cpp/csp/engine/DynamicEngine.h index e45392c6d..a9435ef13 100644 --- a/cpp/csp/engine/DynamicEngine.h +++ b/cpp/csp/engine/DynamicEngine.h @@ -1,6 +1,7 @@ #ifndef _IN_CSP_ENGINE_DYNAMICENGINE_H #define _IN_CSP_ENGINE_DYNAMICENGINE_H +#include #include #include #include @@ -9,7 +10,7 @@ namespace csp { -class DynamicEngine final : public Engine +class CSPENGINE_EXPORT DynamicEngine final : public Engine { public: using ShutdownFn = std::function; diff --git a/cpp/csp/engine/DynamicNode.h b/cpp/csp/engine/DynamicNode.h index 3ad3711a6..a8884ef41 100644 --- a/cpp/csp/engine/DynamicNode.h +++ b/cpp/csp/engine/DynamicNode.h @@ -1,6 +1,7 @@ #ifndef _IN_CSP_ENGINE_DYNAMIC_H #define _IN_CSP_ENGINE_DYNAMIC_H +#include #include #include #include @@ -17,7 +18,7 @@ class DynamicEngine; //external inputs and triggering a cycle step. //All dynamic engine input adapters as well as all external timeseries wired into dynamic are registered as inputs //into the DynanicNode instance so that it can invoke cycle step at the appropriate times. -class DynamicNode final : public Node +class CSPENGINE_EXPORT DynamicNode final : public Node { public: using Outputs = std::vector; diff --git a/cpp/csp/engine/Engine.h b/cpp/csp/engine/Engine.h index ed8799625..84c7ce56c 100644 --- a/cpp/csp/engine/Engine.h +++ b/cpp/csp/engine/Engine.h @@ -2,6 +2,7 @@ #define _IN_CSP_ENGINE_ENGINE_H #include +#include #include #include #include @@ -23,7 +24,7 @@ class TimeSeriesProvider; class Engine; class RootEngine; -struct EngineOwned +struct CSPENGINE_EXPORT EngineOwned { //force objects derived from EngineOwned to go through engine createOwnedObject methods //little trick here to force all derivations to fail @@ -34,7 +35,7 @@ struct EngineOwned void operator delete( void* ptr ) { ::operator delete(ptr); } }; -class Engine +class CSPENGINE_EXPORT Engine { using AdapterManagers = std::vector>; using InputAdapters = std::vector>; diff --git a/cpp/csp/engine/Enums.h b/cpp/csp/engine/Enums.h index 9581ba0e0..eecff885a 100644 --- a/cpp/csp/engine/Enums.h +++ b/cpp/csp/engine/Enums.h @@ -2,12 +2,13 @@ #define _IN_CSP_ENGINE_ENUMS_H #include +#include namespace csp { // NOTE this must align with the python side Enum definition /// -struct PushModeTraits +struct CSPENGINE_EXPORT PushModeTraits { enum _enum : unsigned char { diff --git a/cpp/csp/engine/EventPropagator.h b/cpp/csp/engine/EventPropagator.h index 3627d6b5f..68dec4a83 100644 --- a/cpp/csp/engine/EventPropagator.h +++ b/cpp/csp/engine/EventPropagator.h @@ -1,6 +1,7 @@ #ifndef _IN_CSP_ENGINE_EVENTPROPAGATOR_H #define _IN_CSP_ENGINE_EVENTPROPAGATOR_H +#include #include #include @@ -9,7 +10,7 @@ namespace csp class Consumer; -class EventPropagator +class CSPENGINE_EXPORT EventPropagator { public: EventPropagator(); diff --git a/cpp/csp/engine/Feedback.h b/cpp/csp/engine/Feedback.h index ae02925aa..52ccaa622 100644 --- a/cpp/csp/engine/Feedback.h +++ b/cpp/csp/engine/Feedback.h @@ -1,6 +1,7 @@ #ifndef _IN_CSP_ENGINE_FEEDBACK_H #define _IN_CSP_ENGINE_FEEDBACK_H +#include #include #include @@ -28,7 +29,7 @@ class FeedbackOutputAdapter final : public OutputAdapter }; template -class CSP_PUBLIC FeedbackInputAdapter final : public InputAdapter +class FeedbackInputAdapter final : public InputAdapter { public: using InputAdapter::InputAdapter; diff --git a/cpp/csp/engine/GraphOutputAdapter.h b/cpp/csp/engine/GraphOutputAdapter.h index c160f9d1a..020b95ecc 100644 --- a/cpp/csp/engine/GraphOutputAdapter.h +++ b/cpp/csp/engine/GraphOutputAdapter.h @@ -1,6 +1,7 @@ #ifndef _IN_CSP_ENGINE_GRAPHOUTPUTADAPTER_H #define _IN_CSP_ENGINE_GRAPHOUTPUTADAPTER_H +#include #include #include @@ -14,7 +15,7 @@ namespace csp //GraphOutputAdapters are also special in that they are registered in both a dynamic engine and the root engine as sahred_ptr. They make it into root //so that the root processes them at the end of the csp.run call ( dynamics could be shutdown by then ). We also register in root //to ensure we dont hit key clashses. -class GraphOutputAdapter : public OutputAdapter, public std::enable_shared_from_this +class CSPENGINE_EXPORT GraphOutputAdapter : public OutputAdapter, public std::enable_shared_from_this { public: GraphOutputAdapter( csp::Engine * engine, int32_t tickCount, TimeDelta tickHistory ); diff --git a/cpp/csp/engine/InputAdapter.h b/cpp/csp/engine/InputAdapter.h index f992d6ff2..cc4c89f5a 100644 --- a/cpp/csp/engine/InputAdapter.h +++ b/cpp/csp/engine/InputAdapter.h @@ -1,6 +1,7 @@ #ifndef _IN_CSP_ENGINE_INPUTADAPTER_H #define _IN_CSP_ENGINE_INPUTADAPTER_H +#include #include #include #include @@ -11,7 +12,7 @@ namespace csp class Consumer; -class InputAdapter : public TimeSeriesProvider, public EngineOwned +class CSPENGINE_EXPORT InputAdapter : public TimeSeriesProvider, public EngineOwned { public: InputAdapter( Engine * engine, const CspTypePtr & type, PushMode pushMode ); diff --git a/cpp/csp/engine/Node.h b/cpp/csp/engine/Node.h index 23ab37a4d..f983e1bdf 100644 --- a/cpp/csp/engine/Node.h +++ b/cpp/csp/engine/Node.h @@ -2,6 +2,7 @@ #define _IN_CSP_ENGINE_NODE_H #include +#include #include #include #include @@ -24,7 +25,7 @@ struct NodeDef INOUT_ID_TYPE numOutputs; }; -class Node : public Consumer, public EngineOwned +class CSPENGINE_EXPORT Node : public Consumer, public EngineOwned { public: Node( NodeDef def, Engine * ); diff --git a/cpp/csp/engine/OutputAdapter.h b/cpp/csp/engine/OutputAdapter.h index 7a3f1040d..887e223c8 100644 --- a/cpp/csp/engine/OutputAdapter.h +++ b/cpp/csp/engine/OutputAdapter.h @@ -1,6 +1,7 @@ #ifndef _IN_CSP_ENGINE_OUTPUTADAPTER_H #define _IN_CSP_ENGINE_OUTPUTADAPTER_H +#include #include #include @@ -9,7 +10,7 @@ namespace csp class TimeSeriesProvider; -class OutputAdapter : public Consumer, public EngineOwned +class CSPENGINE_EXPORT OutputAdapter : public Consumer, public EngineOwned { public: OutputAdapter( csp::Engine * engine ); diff --git a/cpp/csp/engine/PendingPushEvents.h b/cpp/csp/engine/PendingPushEvents.h index 5036e7fd2..5e14ceafb 100644 --- a/cpp/csp/engine/PendingPushEvents.h +++ b/cpp/csp/engine/PendingPushEvents.h @@ -1,6 +1,7 @@ #ifndef _IN_CSP_ENGINE_PENDINGPUSHEVENTS_H #define _IN_CSP_ENGINE_PENDINGPUSHEVENTS_H +#include #include #include @@ -10,7 +11,7 @@ namespace csp struct PushGroup; class PushInputAdapters; -class PendingPushEvents +class CSPENGINE_EXPORT PendingPushEvents { public: PendingPushEvents(); diff --git a/cpp/csp/engine/PullInputAdapter.h b/cpp/csp/engine/PullInputAdapter.h index 5da071e23..f65ed1a7e 100644 --- a/cpp/csp/engine/PullInputAdapter.h +++ b/cpp/csp/engine/PullInputAdapter.h @@ -1,6 +1,7 @@ #ifndef _IN_CSP_ENGINE_PULLINPUTADAPTER_H #define _IN_CSP_ENGINE_PULLINPUTADAPTER_H +#include #include #include #include diff --git a/cpp/csp/engine/PushEvent.h b/cpp/csp/engine/PushEvent.h index bc16c024d..1f664d8ec 100644 --- a/cpp/csp/engine/PushEvent.h +++ b/cpp/csp/engine/PushEvent.h @@ -1,6 +1,7 @@ #ifndef _IN_CSP_ENGINE_PUSHEVENT_H #define _IN_CSP_ENGINE_PUSHEVENT_H +#include #include namespace csp diff --git a/cpp/csp/engine/PushInputAdapter.h b/cpp/csp/engine/PushInputAdapter.h index 665962a7a..cf7a48bc0 100644 --- a/cpp/csp/engine/PushInputAdapter.h +++ b/cpp/csp/engine/PushInputAdapter.h @@ -1,6 +1,7 @@ #ifndef _IN_CSP_ENGINE_PUSHINPUTADAPTER_H #define _IN_CSP_ENGINE_PUSHINPUTADAPTER_H +#include #include #include #include diff --git a/cpp/csp/engine/PushPullInputAdapter.h b/cpp/csp/engine/PushPullInputAdapter.h index 2cd46bee7..7df8a203c 100644 --- a/cpp/csp/engine/PushPullInputAdapter.h +++ b/cpp/csp/engine/PushPullInputAdapter.h @@ -1,6 +1,7 @@ #ifndef _IN_CSP_ENGINE_PUSHPULLINPUTADAPTER_H #define _IN_CSP_ENGINE_PUSHPULLINPUTADAPTER_H +#include #include #include @@ -9,7 +10,7 @@ namespace csp //A variation of PushInputAdapter that lets you schedule historical data as well. Used for adapters //that can replay history and switch to realtime seamlessly ( ie kafka ) -class PushPullInputAdapter : public PushInputAdapter +class CSPENGINE_EXPORT PushPullInputAdapter : public PushInputAdapter { public: PushPullInputAdapter( Engine * engine, CspTypePtr & type, PushMode pushMode, diff --git a/cpp/csp/engine/RootEngine.h b/cpp/csp/engine/RootEngine.h index 746704580..1e9fe8924 100644 --- a/cpp/csp/engine/RootEngine.h +++ b/cpp/csp/engine/RootEngine.h @@ -2,6 +2,7 @@ #define _IN_CSP_ENGINE_ROOTENGINE_H #include +#include #include #include #include @@ -33,7 +34,7 @@ class EndCycleListener bool m_dirty = false; }; -class RootEngine : public Engine +class CSPENGINE_EXPORT RootEngine : public Engine { using PushEventQueue = SRMWLockFreeQueue; diff --git a/cpp/csp/engine/Scheduler.h b/cpp/csp/engine/Scheduler.h index 96efc2c58..c7a1a47c4 100644 --- a/cpp/csp/engine/Scheduler.h +++ b/cpp/csp/engine/Scheduler.h @@ -2,6 +2,7 @@ #define _IN_CSP_ENGINE_SCHEDULER_H #include +#include #include #include #include @@ -14,7 +15,7 @@ namespace csp class InputAdapter; -class Scheduler +class CSPENGINE_EXPORT Scheduler { struct Event; diff --git a/cpp/csp/engine/StatusAdapter.h b/cpp/csp/engine/StatusAdapter.h index f243c7c70..a6ee6d254 100644 --- a/cpp/csp/engine/StatusAdapter.h +++ b/cpp/csp/engine/StatusAdapter.h @@ -1,6 +1,7 @@ #ifndef _IN_CSP_ADAPTERS_STATUSADAPTER_H #define _IN_CSP_ADAPTERS_STATUSADAPTER_H +#include #include #include @@ -29,7 +30,7 @@ struct StatusLevelTraits using StatusLevel = csp::Enum; -class StatusAdapter : public PushInputAdapter +class CSPENGINE_EXPORT StatusAdapter : public PushInputAdapter { public: StatusAdapter( Engine * engine, CspTypePtr & type, PushMode pushMode, PushGroup * group = nullptr ) : PushInputAdapter( engine, type, pushMode, group ) diff --git a/cpp/csp/engine/Struct.h b/cpp/csp/engine/Struct.h index 1b09cb97b..94c3892a0 100644 --- a/cpp/csp/engine/Struct.h +++ b/cpp/csp/engine/Struct.h @@ -2,6 +2,7 @@ #define _IN_CSP_ENGINE_STRUCT_H #include +#include #include #include #include @@ -18,7 +19,7 @@ class TypedStructPtr; using StructPtr = TypedStructPtr; -class StructField +class CSPTYPES_EXPORT StructField { public: @@ -580,7 +581,7 @@ TypedStructPtr structptr_cast( const TypedStructPtr & r ) return out; } -class StructMeta : public std::enable_shared_from_this +class CSPTYPES_EXPORT StructMeta : public std::enable_shared_from_this { public: using Fields = std::vector; @@ -684,7 +685,7 @@ std::shared_ptr::type> StructMeta::getMetaField( using StructMetaPtr = std::shared_ptr; -class Struct +class CSPTYPES_EXPORT Struct { public: diff --git a/cpp/csp/engine/TickBuffer.h b/cpp/csp/engine/TickBuffer.h index b3d94f20e..f721517d9 100644 --- a/cpp/csp/engine/TickBuffer.h +++ b/cpp/csp/engine/TickBuffer.h @@ -6,6 +6,7 @@ ** it uses a circular buffer for storage but only allows pushing back ** and resizing ***********************************************************************/ +#include #include #include #include diff --git a/cpp/csp/engine/TimeSeries.h b/cpp/csp/engine/TimeSeries.h index 0f5b43522..dcc235d3d 100644 --- a/cpp/csp/engine/TimeSeries.h +++ b/cpp/csp/engine/TimeSeries.h @@ -3,6 +3,7 @@ #include #include +#include #include #include @@ -10,7 +11,7 @@ namespace csp { template -class TickBufferAccess +class CSPENGINE_EXPORT TickBufferAccess { public: TickBufferAccess() : m_buffer( nullptr ), m_lastValue() { } @@ -55,11 +56,11 @@ class TickBufferAccess T m_lastValue; }; -class TimeSeries +class CSPENGINE_EXPORT TimeSeries { public: // Should match the DuplicatePolicy enum in python!!! - struct DuplicatePolicyTraits { + struct CSPENGINE_EXPORT DuplicatePolicyTraits { enum _enum : uint8_t { UNKNOWN = 0, LAST_VALUE = 1, @@ -143,7 +144,7 @@ class TimeSeries }; template< typename T > -class TimeSeriesTyped : public TimeSeries +class CSPENGINE_EXPORT TimeSeriesTyped : public TimeSeries { public: TimeSeriesTyped() : m_dataline() diff --git a/cpp/csp/engine/TimeSeriesProvider.h b/cpp/csp/engine/TimeSeriesProvider.h index dbb0fd774..766212b5b 100644 --- a/cpp/csp/engine/TimeSeriesProvider.h +++ b/cpp/csp/engine/TimeSeriesProvider.h @@ -2,6 +2,7 @@ #define _IN_CSP_ENGINE_TIMESERIESPROVIDER_H #include +#include #include #include #include @@ -13,7 +14,7 @@ class Consumer; class Node; //Holder of a single timeseries buffer and all associated links to consumers -class TimeSeriesProvider +class CSPENGINE_EXPORT TimeSeriesProvider { public: using DuplicatePolicyEnum = TimeSeries::DuplicatePolicyEnum; diff --git a/cpp/csp/engine/TimerInputAdapter.h b/cpp/csp/engine/TimerInputAdapter.h index af72dabe5..3a54c3aee 100644 --- a/cpp/csp/engine/TimerInputAdapter.h +++ b/cpp/csp/engine/TimerInputAdapter.h @@ -1,13 +1,14 @@ #ifndef _IN_CSP_ENGINE_TIMERINPUTADAPTER_H #define _IN_CSP_ENGINE_TIMERINPUTADAPTER_H +#include #include namespace csp { template -class TimerInputAdapter : public PullInputAdapter +class CSPTYPESIMPL_EXPORT TimerInputAdapter : public PullInputAdapter { public: TimerInputAdapter( Engine * engine, CspTypePtr & type, TimeDelta interval, diff --git a/cpp/csp/engine/VectorContainer.h b/cpp/csp/engine/VectorContainer.h index 4e211dc4e..2cd1000af 100644 --- a/cpp/csp/engine/VectorContainer.h +++ b/cpp/csp/engine/VectorContainer.h @@ -1,11 +1,12 @@ #ifndef _IN_CSP_ENGINE_VECTORALLOCATOR_H #define _IN_CSP_ENGINE_VECTORALLOCATOR_H +#include #include namespace csp { -class VectorContainer +class CSPENGINE_EXPORT VectorContainer { public: VectorContainer(const VectorContainer&) = delete; diff --git a/cpp/csp/engine/WindowBuffer.h b/cpp/csp/engine/WindowBuffer.h index 3c7823b33..1d8942050 100644 --- a/cpp/csp/engine/WindowBuffer.h +++ b/cpp/csp/engine/WindowBuffer.h @@ -1,6 +1,7 @@ #ifndef _IN_CSP_ENGINE_WINDOWBUFFER_H #define _IN_CSP_ENGINE_WINDOWBUFFER_H +#include #include /************************************************************************ diff --git a/cpp/csp/python/CMakeLists.txt b/cpp/csp/python/CMakeLists.txt index d5f863e1a..4009811fb 100644 --- a/cpp/csp/python/CMakeLists.txt +++ b/cpp/csp/python/CMakeLists.txt @@ -1,3 +1,5 @@ +include(GenerateExportHeader) + # types library set(CSPTYPESIMPL_PUBLIC_HEADERS CspTypeFactory.h @@ -19,9 +21,12 @@ add_library(csptypesimpl PyStructToJson.cpp PyStructToDict.cpp) + +message(STATUS "\n\n\nBinary directory: ${CMAKE_CURRENT_BINARY_DIR}\n\n\n") +generate_export_header(csptypesimpl) set_target_properties(csptypesimpl PROPERTIES PUBLIC_HEADER "${CSPTYPESIMPL_PUBLIC_HEADERS}") target_compile_definitions(csptypesimpl PUBLIC RAPIDJSON_HAS_STDSTRING=1) -target_link_libraries(csptypesimpl csp_core csp_types) +target_link_libraries(csptypesimpl csp_core csp_types csp_engine) target_compile_definitions(csptypesimpl PRIVATE CSPTYPESIMPL_EXPORTS=1) @@ -82,6 +87,8 @@ add_library(cspimpl SHARED PyConstants.cpp ${CSPIMPL_PUBLIC_HEADERS}) + +generate_export_header(cspimpl) set_target_properties(cspimpl PROPERTIES PUBLIC_HEADER "${CSPIMPL_PUBLIC_HEADERS}") target_link_libraries(cspimpl csptypesimpl csp_core csp_engine ) @@ -92,6 +99,7 @@ target_compile_definitions(cspimpl PRIVATE CSPIMPL_EXPORTS=1) ## Baselib c++ module add_library(cspbaselibimpl SHARED cspbaselibimpl.cpp) +generate_export_header(cspbaselibimpl) target_link_libraries(cspbaselibimpl cspimpl baselibimpl) # Include exprtk include directory for exprtk node @@ -125,3 +133,9 @@ install(TARGETS csptypesimpl cspimpl cspbaselibimpl cspbasketlibimpl cspmathimpl RUNTIME DESTINATION ${CSP_RUNTIME_INSTALL_SUBDIR} LIBRARY DESTINATION lib/ ) + +install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/csptypesimpl_export.h + ${CMAKE_CURRENT_BINARY_DIR}/cspimpl_export.h + DESTINATION include/csp/python +) diff --git a/cpp/csp/python/Common.h b/cpp/csp/python/Common.h index e8ecb0b1f..0521229ca 100644 --- a/cpp/csp/python/Common.h +++ b/cpp/csp/python/Common.h @@ -1,6 +1,7 @@ #ifndef _IN_CSP_PYTHON_COMMON_H #define _IN_CSP_PYTHON_COMMON_H +#include #include #define IS_PRE_PYTHON_3_11 (PY_MAJOR_VERSION < 3 || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 11) ) @@ -10,7 +11,7 @@ namespace csp::python { -class AcquireGIL +class CSPIMPL_EXPORT AcquireGIL { public: AcquireGIL() { m_state = PyGILState_Ensure(); } @@ -20,7 +21,7 @@ class AcquireGIL PyGILState_STATE m_state; }; -class ReleaseGIL +class CSPIMPL_EXPORT ReleaseGIL { public: ReleaseGIL() { m_saveState = PyEval_SaveThread(); } diff --git a/cpp/csp/python/InitHelper.h b/cpp/csp/python/InitHelper.h index 1665f847f..4f424a7a2 100644 --- a/cpp/csp/python/InitHelper.h +++ b/cpp/csp/python/InitHelper.h @@ -10,7 +10,7 @@ namespace csp::python { -class CSP_LOCAL InitHelper +class InitHelper { public: ~InitHelper() {} diff --git a/cpp/csp/python/NumpyInputAdapter.h b/cpp/csp/python/NumpyInputAdapter.h index 0d4bd7c8b..3552e5023 100644 --- a/cpp/csp/python/NumpyInputAdapter.h +++ b/cpp/csp/python/NumpyInputAdapter.h @@ -1,6 +1,7 @@ #ifndef _IN_CSP_PYTHON_NUMPYINPUTADAPTER_H #define _IN_CSP_PYTHON_NUMPYINPUTADAPTER_H +#include #include #include @@ -11,7 +12,7 @@ namespace csp::python { -class NumpyCurveAccessor +class CSPIMPL_EXPORT NumpyCurveAccessor { // Accesses values by indexing only on the outermost dimension of an n-dimensional Numpy array and then creating a view to the subarray // Thus, you can get the nested Numpy array values in csp.curve with zero-copy operations diff --git a/cpp/csp/python/PyAdapterManager.h b/cpp/csp/python/PyAdapterManager.h index 0e537f3b9..a5c6cb3e8 100644 --- a/cpp/csp/python/PyAdapterManager.h +++ b/cpp/csp/python/PyAdapterManager.h @@ -2,13 +2,14 @@ #define _IN_CSP_PYTHON_PYADAPTERMANAGER_H #include +#include namespace csp { class AdapterManager; } namespace csp::python { -struct PyAdapterManager_PyObject +struct CSPIMPL_EXPORT PyAdapterManager_PyObject { PyObject_HEAD csp::AdapterManager * manager; diff --git a/cpp/csp/python/PyAdapterManagerWrapper.h b/cpp/csp/python/PyAdapterManagerWrapper.h index 9503f0473..91e13394c 100644 --- a/cpp/csp/python/PyAdapterManagerWrapper.h +++ b/cpp/csp/python/PyAdapterManagerWrapper.h @@ -2,6 +2,7 @@ #define _IN_CSP_PYTHON_PYADAPTERMANAGERWRAPPER_H #include +#include #include #include diff --git a/cpp/csp/python/PyBasketInputProxy.h b/cpp/csp/python/PyBasketInputProxy.h index 6617f4e22..2dec0acf9 100644 --- a/cpp/csp/python/PyBasketInputProxy.h +++ b/cpp/csp/python/PyBasketInputProxy.h @@ -1,6 +1,7 @@ #ifndef _IN_CSP_PYTHON_PYBASKETINPUTPROXY_H #define _IN_CSP_PYTHON_PYBASKETINPUTPROXY_H +#include #include #include #include @@ -14,7 +15,7 @@ class PyInputProxy; using PyInputProxyPtr = PyPtr; class PyNode; -class PyBaseBasketInputProxy : public PyObject +class CSPIMPL_EXPORT PyBaseBasketInputProxy : public PyObject { public: PyBaseBasketInputProxy( PyNode * node, INOUT_ID_TYPE id ); @@ -37,7 +38,7 @@ class PyBaseBasketInputProxy : public PyObject }; -class PyListBasketInputProxy final: public PyBaseBasketInputProxy +class CSPIMPL_EXPORT PyListBasketInputProxy final: public PyBaseBasketInputProxy { public: PyListBasketInputProxy( PyNode * node, INOUT_ID_TYPE id, size_t shape ); @@ -62,7 +63,7 @@ class PyListBasketInputProxy final: public PyBaseBasketInputProxy }; -class PyDictBasketInputProxy : public PyBaseBasketInputProxy +class CSPIMPL_EXPORT PyDictBasketInputProxy : public PyBaseBasketInputProxy { public: PyDictBasketInputProxy( PyNode * node, INOUT_ID_TYPE id, PyObject * shape ); @@ -85,7 +86,7 @@ class PyDictBasketInputProxy : public PyBaseBasketInputProxy PyObjectPtr m_proxyMapping; }; -class PyDynamicBasketInputProxy final : public PyDictBasketInputProxy +class CSPIMPL_EXPORT PyDynamicBasketInputProxy final : public PyDictBasketInputProxy { public: PyDynamicBasketInputProxy( PyNode * node, INOUT_ID_TYPE id, PyObject * shape ); diff --git a/cpp/csp/python/PyBasketOutputProxy.h b/cpp/csp/python/PyBasketOutputProxy.h index 1d9aea51d..046b8b560 100644 --- a/cpp/csp/python/PyBasketOutputProxy.h +++ b/cpp/csp/python/PyBasketOutputProxy.h @@ -1,6 +1,7 @@ #ifndef _IN_CSP_PYTHON_PYBASKETOUTPUTPROXY_H #define _IN_CSP_PYTHON_PYBASKETOUTPUTPROXY_H +#include #include #include #include @@ -12,7 +13,7 @@ class PyOutputProxy; using PyOutputProxyPtr = PyPtr; class PyNode; -class PyBaseBasketOutputProxy : public PyObject +class CSPIMPL_EXPORT PyBaseBasketOutputProxy : public PyObject { public: PyBaseBasketOutputProxy( Node * node, INOUT_ID_TYPE id ); @@ -22,7 +23,7 @@ class PyBaseBasketOutputProxy : public PyObject INOUT_ID_TYPE m_id; }; -class PyListBasketOutputProxy final : public PyBaseBasketOutputProxy +class CSPIMPL_EXPORT PyListBasketOutputProxy final : public PyBaseBasketOutputProxy { public: PyListBasketOutputProxy( PyObject *pyType, Node * node, INOUT_ID_TYPE id, size_t shape ); @@ -43,7 +44,7 @@ class PyListBasketOutputProxy final : public PyBaseBasketOutputProxy std::vector m_proxies; }; -class PyDictBasketOutputProxy : public PyBaseBasketOutputProxy +class CSPIMPL_EXPORT PyDictBasketOutputProxy : public PyBaseBasketOutputProxy { public: PyDictBasketOutputProxy( PyObject *pyType, Node * node, INOUT_ID_TYPE id, PyObject * shape ); @@ -58,7 +59,7 @@ class PyDictBasketOutputProxy : public PyBaseBasketOutputProxy PyObjectPtr m_proxyMapping; }; -class PyDynamicBasketOutputProxy final : public PyDictBasketOutputProxy +class CSPIMPL_EXPORT PyDynamicBasketOutputProxy final : public PyDictBasketOutputProxy { public: PyDynamicBasketOutputProxy( PyObject *pyType, Node * node, INOUT_ID_TYPE id, PyObject * shape ); diff --git a/cpp/csp/python/PyEngine.h b/cpp/csp/python/PyEngine.h index d58289501..8602651aa 100644 --- a/cpp/csp/python/PyEngine.h +++ b/cpp/csp/python/PyEngine.h @@ -1,6 +1,7 @@ #ifndef _IN_CSP_PYTHON_PYENGINE_H #define _IN_CSP_PYTHON_PYENGINE_H +#include #include #include #include @@ -16,7 +17,7 @@ namespace csp::python class PyEngine; //This is the actual python root engine -class PythonEngine final : public csp::RootEngine +class CSPIMPL_EXPORT PythonEngine final : public csp::RootEngine { public: PythonEngine( PyEngine * parent, const Dictionary & ); diff --git a/cpp/csp/python/PyGraphOutputAdapter.h b/cpp/csp/python/PyGraphOutputAdapter.h index f7fd8daf1..8b0c7ae01 100644 --- a/cpp/csp/python/PyGraphOutputAdapter.h +++ b/cpp/csp/python/PyGraphOutputAdapter.h @@ -1,13 +1,14 @@ #ifndef _IN_CSP_PYTHON_PYGRAPHOUPUTADAPTER_H #define _IN_CSP_PYTHON_PYGRAPHOUPUTADAPTER_H +#include #include #include namespace csp::python { -class PyGraphOutputAdapter : public GraphOutputAdapter +class CSPIMPL_EXPORT PyGraphOutputAdapter : public GraphOutputAdapter { public: using GraphOutputAdapter::GraphOutputAdapter; diff --git a/cpp/csp/python/PyInputProxy.h b/cpp/csp/python/PyInputProxy.h index b392a2a52..2f3e5de74 100644 --- a/cpp/csp/python/PyInputProxy.h +++ b/cpp/csp/python/PyInputProxy.h @@ -1,6 +1,7 @@ #ifndef _IN_CSP_PYTHON_PYINPUTPROXY_H #define _IN_CSP_PYTHON_PYINPUTPROXY_H +#include #include #include #include @@ -11,7 +12,7 @@ namespace csp::python class PyNode; -class PyInputProxy : public PyObject +class CSPIMPL_EXPORT PyInputProxy : public PyObject { public: PyInputProxy( PyNode * node, InputId id ); diff --git a/cpp/csp/python/PyNode.h b/cpp/csp/python/PyNode.h index 248943ae9..c5a4a2131 100644 --- a/cpp/csp/python/PyNode.h +++ b/cpp/csp/python/PyNode.h @@ -1,6 +1,7 @@ #ifndef _IN_CSP_PYTHON_PYNODE_H #define _IN_CSP_PYTHON_PYNODE_H +#include #include #include #include @@ -11,7 +12,7 @@ namespace csp::python class PyEngine; -class PyNode final: public csp::Node +class CSPIMPL_EXPORT PyNode final: public csp::Node { public: PyNode( csp::Engine * engine, PyObjectPtr gen, PyObjectPtr inputs, PyObjectPtr outputs, diff --git a/cpp/csp/python/PyNodeWrapper.h b/cpp/csp/python/PyNodeWrapper.h index 0af60d305..e98bc6344 100644 --- a/cpp/csp/python/PyNodeWrapper.h +++ b/cpp/csp/python/PyNodeWrapper.h @@ -1,3 +1,7 @@ +#ifndef _IN_CSP_PYTHON_PYNODEWRAPPER_H +#define _IN_CSP_PYTHON_PYNODEWRAPPER_H + +#include #include #include @@ -5,7 +9,7 @@ namespace csp::python { //simple wrapper for python level access when wiring -class PyNodeWrapper : public PyObject +class CSPIMPL_EXPORT PyNodeWrapper : public PyObject { public: csp::Node * node() { return m_node; } @@ -20,3 +24,5 @@ class PyNodeWrapper : public PyObject }; } + +#endif \ No newline at end of file diff --git a/cpp/csp/python/PyNumbaNode.h b/cpp/csp/python/PyNumbaNode.h index cc71a05fe..4dffe7c2b 100644 --- a/cpp/csp/python/PyNumbaNode.h +++ b/cpp/csp/python/PyNumbaNode.h @@ -1,6 +1,7 @@ #ifndef _IN_PYTHON_PYNUMBANODE_H #define _IN_PYTHON_PYNUMBANODE_H +#include #include #include #include @@ -12,7 +13,7 @@ class PyEngine; typedef void (*CallbackType)(void *node, void *state); -class PyNumbaNode final : public csp::Node +class CSPIMPL_EXPORT PyNumbaNode final : public csp::Node { public: // TODO: Add suppot for initialization callback as well diff --git a/cpp/csp/python/PyOutputProxy.h b/cpp/csp/python/PyOutputProxy.h index 4b63a9857..f351a61df 100644 --- a/cpp/csp/python/PyOutputProxy.h +++ b/cpp/csp/python/PyOutputProxy.h @@ -1,6 +1,7 @@ #ifndef _IN_CSP_PYTHON_PYOUTPUTPROXY_H #define _IN_CSP_PYTHON_PYOUTPUTPROXY_H +#include #include #include #include @@ -8,7 +9,7 @@ namespace csp::python { -class PyOutputProxy final: public PyObject +class CSPIMPL_EXPORT PyOutputProxy final: public PyObject { public: PyOutputProxy( PyObject *pyType, Node * node, OutputId ); diff --git a/cpp/csp/python/PyPushInputAdapter.h b/cpp/csp/python/PyPushInputAdapter.h index 525f8bf3c..748a9c05d 100644 --- a/cpp/csp/python/PyPushInputAdapter.h +++ b/cpp/csp/python/PyPushInputAdapter.h @@ -1,13 +1,14 @@ #ifndef _IN_CSP_PYTHON_PYPUSHINPUTADAPTER_H #define _IN_CSP_PYTHON_PYPUSHINPUTADAPTER_H +#include #include namespace csp::python { //PushBatch -struct PyPushBatch +struct CSPIMPL_EXPORT PyPushBatch { PyObject_HEAD PushBatch batch; diff --git a/cpp/csp/python/PyStructFastList.h b/cpp/csp/python/PyStructFastList.h index 4c065c48a..a10c70d27 100644 --- a/cpp/csp/python/PyStructFastList.h +++ b/cpp/csp/python/PyStructFastList.h @@ -1,6 +1,7 @@ #ifndef _IN_CSP_PYTHON_PYSTRUCTFASTLIST_H #define _IN_CSP_PYTHON_PYSTRUCTFASTLIST_H +#include #include #include #include @@ -13,7 +14,7 @@ namespace csp::python { template -struct PyStructFastList : public PyObject +struct CSPTYPESIMPL_EXPORT PyStructFastList : public PyObject { using ElemT = typename CspType::Type::toCArrayElemType::type; diff --git a/cpp/csp/python/PyStructList.h b/cpp/csp/python/PyStructList.h index 3c51758e2..a515ee711 100644 --- a/cpp/csp/python/PyStructList.h +++ b/cpp/csp/python/PyStructList.h @@ -1,6 +1,7 @@ #ifndef _IN_CSP_PYTHON_PYSTRUCTLIST_H #define _IN_CSP_PYTHON_PYSTRUCTLIST_H +#include #include #include #include @@ -11,7 +12,7 @@ namespace csp::python { template -struct PyStructList : public PyObject +struct CSPTYPESIMPL_EXPORT PyStructList : public PyObject { using ElemT = typename CspType::Type::toCArrayElemType::type; diff --git a/cpp/csp/python/adapters/CMakeLists.txt b/cpp/csp/python/adapters/CMakeLists.txt index 8cb34950f..b5b68b610 100644 --- a/cpp/csp/python/adapters/CMakeLists.txt +++ b/cpp/csp/python/adapters/CMakeLists.txt @@ -1,6 +1,12 @@ +include(GenerateExportHeader) + if(CSP_BUILD_KAFKA_ADAPTER) add_library(kafkaadapterimpl SHARED kafkaadapterimpl.cpp) + generate_export_header(kafkaadapterimpl + BASE_NAME cspkafkaadapterimpl + EXPORT_MACRO_NAME CSPKAFKAADAPTERIMPL_EXPORT + ) target_link_libraries(kafkaadapterimpl csp_core csp_engine cspimpl csp_kafka_adapter) install(TARGETS kafkaadapterimpl RUNTIME DESTINATION ${CSP_RUNTIME_INSTALL_SUBDIR}) endif() @@ -29,6 +35,10 @@ if(CSP_BUILD_PARQUET_ADAPTER) ${VENDORED_PYARROW_ROOT}/arrow/python/csv.cc ${VENDORED_PYARROW_ROOT}/arrow/python/filesystem.cc) add_library(parquetadapterimpl SHARED parquetadapterimpl.cpp ${ARROW_PYTHON_SRCS}) + generate_export_header(parquetadapterimpl + BASE_NAME cspparquetadapterimpl + EXPORT_MACRO_NAME CSPPARQUETADAPTERIMPL_EXPORT + ) # Ignore warning regarding static datetime API initialization coming from vendored Arrow code if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") set_target_properties(parquetadapterimpl PROPERTIES COMPILE_OPTIONS "-Wno-unused-variable") @@ -41,6 +51,17 @@ endif() if(CSP_BUILD_WS_CLIENT_ADAPTER) add_library(websocketadapterimpl SHARED websocketadapterimpl.cpp) + generate_export_header(websocketadapterimpl + BASE_NAME cspwebsocketadapterimpl + EXPORT_MACRO_NAME CSPWEBSOCKETADAPTERIMPL_EXPORT + ) target_link_libraries(websocketadapterimpl csp_core csp_engine cspimpl csp_websocket_client_adapter) install(TARGETS websocketadapterimpl RUNTIME DESTINATION ${CSP_RUNTIME_INSTALL_SUBDIR}) endif() + +install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/cspkafkaadapterimpl_export.h + ${CMAKE_CURRENT_BINARY_DIR}/cspparquetadapterimpl_export.h + ${CMAKE_CURRENT_BINARY_DIR}/cspwebsocketadapterimpl_export.h + DESTINATION include/csp/python/adapters +) diff --git a/cpp/tests/core/CMakeLists.txt b/cpp/tests/core/CMakeLists.txt index 724bc42a0..140a556c7 100644 --- a/cpp/tests/core/CMakeLists.txt +++ b/cpp/tests/core/CMakeLists.txt @@ -1,6 +1,8 @@ enable_testing() find_package(GTest CONFIG REQUIRED) +list(APPEND CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib) + add_executable(test_basic_allocator test_basic_allocator.cpp) target_link_libraries(test_basic_allocator GTest::gtest GTest::gtest_main) diff --git a/cpp/tests/engine/CMakeLists.txt b/cpp/tests/engine/CMakeLists.txt index f6d01e63d..e14264341 100644 --- a/cpp/tests/engine/CMakeLists.txt +++ b/cpp/tests/engine/CMakeLists.txt @@ -1,5 +1,7 @@ find_package(GTest CONFIG REQUIRED) +list(APPEND CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib) + add_executable(test_dictionary test_dictionary.cpp ) target_link_libraries(test_dictionary csp_engine GTest::gtest GTest::gtest_main) # For DialectGeneric impl registration ( needed on windows to get it exported ) diff --git a/cpp/tests/extensions/CMakeLists.txt b/cpp/tests/extensions/CMakeLists.txt new file mode 100644 index 000000000..481501997 --- /dev/null +++ b/cpp/tests/extensions/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory( test_ext_node ) +add_subdirectory( test_ext_adapter ) diff --git a/cpp/tests/extensions/test_ext_adapter/CMakeLists.txt b/cpp/tests/extensions/test_ext_adapter/CMakeLists.txt new file mode 100644 index 000000000..e69de29bb diff --git a/cpp/tests/extensions/test_ext_node/CMakeLists.txt b/cpp/tests/extensions/test_ext_node/CMakeLists.txt new file mode 100644 index 000000000..dc8bcc9a7 --- /dev/null +++ b/cpp/tests/extensions/test_ext_node/CMakeLists.txt @@ -0,0 +1,106 @@ +# cmake_minimum_required(VERSION 3.20.0) +# project(csp-example-piglatin VERSION "0.0.1") +# set(CMAKE_CXX_STANDARD 17) + +# include(CheckCCompilerFlag) + +# if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") +# set(MACOS ON) +# set(LINUX OFF) +# else() +# set(MACOS OFF) +# set(LINUX ON) +# endif() + +# list(PREPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../../../cpp/cmake/modules") + +# set(CMAKE_MACOSX_RPATH TRUE) +# set(CMAKE_SKIP_RPATH FALSE) +# set(CMAKE_SKIP_BUILD_RPATH FALSE) +# set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) +# set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) +# set(CMAKE_INSTALL_NAME_DIR "@rpath") +# set(CMAKE_POSITION_INDEPENDENT_CODE ON) + +# if(NOT DEFINED PYTHON_VERSION) +# set(PYTHON_VERSION 3.11) +# endif() + +# find_package(Color) + +# if(MACOS) +# # fix for threads on osx +# # assume built-in pthreads on MacOS +# set(CMAKE_THREAD_LIBS_INIT "-lpthread") +# set(CMAKE_HAVE_THREADS_LIBRARY 1) +# set(CMAKE_USE_WIN32_THREADS_INIT 0) +# set(CMAKE_USE_PTHREADS_INIT 1) +# set(THREADS_PREFER_PTHREAD_FLAG ON) + +# set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13" CACHE STRING "Minimum OS X deployment version") + +# # don't link against build python +# # https://blog.tim-smith.us/2015/09/python-extension-modules-os-x/ +# set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -undefined dynamic_lookup") + +# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-ld_classic") +# set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-ld_classic") + +# # Support cross build +# check_c_compiler_flag("-arch x86_64" x86_64Supported) +# check_c_compiler_flag("-arch arm64" arm64Supported) + +# if(x86_64Supported AND arm64Supported) +# set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "Build universal architecture for OSX" FORCE) +# elseif(x86_64Supported) +# set(CMAKE_REQUIRED_LINK_OPTIONS "-arch;x86_64") +# set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Build universal architecture for OSX" FORCE) +# elseif(arm64Supported) +# set(CMAKE_REQUIRED_LINK_OPTIONS "-arch;arm64") +# set(CMAKE_OSX_ARCHITECTURES "arm64" CACHE STRING "Build universal architecture for OSX" FORCE) +# endif() + +# set(CMAKE_INSTALL_RPATH "@loader_path/../csp/lib") + +# message("${Cyan}Use python shared libraries${ColorReset}") +# find_package(Python ${PYTHON_VERSION} EXACT REQUIRED COMPONENTS Interpreter Development) + +# # Run with exact version so its cached for pybind +# find_package(PythonInterp ${PYTHON_VERSION} EXACT REQUIRED) +# find_package(PythonLibs ${PYTHON_VERSION} EXACT REQUIRED) + +# link_directories(${Python_LIBRARY_DIRS}) +# elseif(LINUX) +# set(CMAKE_INSTALL_RPATH "\$ORIGIN/../csp/lib") + +# # Manylinux docker images have no shared libraries +# # The instead use a statically built python. +# # Cmake's default FindPython can't find the python headers +# # without also finding (or failing to find) the python libraries +# # so we use a custom FindPythonHeaders that is the same as the +# # default, but ignores when the python libraries can't be found. +# message("${Red}Manylinux build has no python shared libraries${ColorReset}") +# find_package(Python ${PYTHON_VERSION} EXACT REQUIRED COMPONENTS Interpreter) +# find_package(PythonHeaders ${PYTHON_VERSION} EXACT REQUIRED) + +# # Run with exact version so its cached for pybind +# find_package(PythonInterp ${PYTHON_VERSION} EXACT REQUIRED) +# endif() + +# message("${Cyan}Using Python ${Python_VERSION}\nPython_INCLUDE_DIRS: ${Python_INCLUDE_DIRS}\nPython_LIBRARIES: ${Python_LIBRARIES}\nPython_EXECUTABLE: ${Python_EXECUTABLE} ${ColorReset}") +# include_directories(${Python_INCLUDE_DIRS}) + +# # prefix is _ by default +# set(CMAKE_SHARED_LIBRARY_PREFIX _) + +# # shared suffix is .so for both linux and mac +# set(CMAKE_SHARED_LIBRARY_SUFFIX .so) + +# find_package(CSP REQUIRED) +# message("${Cyan}Found CSP:\n\tincludes in: ${CSP_INCLUDE_DIR}\n\tlibraries in: ${CSP_LIBS_DIR}${ColorReset}") +# include_directories(${CSP_INCLUDE_DIR}) + +# add_library(piglatin SHARED piglatin.cpp) +# target_link_libraries(piglatin ${CSP_LIBRARY}) + +# install(TARGETS piglatin LIBRARY DESTINATION piglatin) diff --git a/cpp/tests/extensions/test_ext_node/accumulator.cpp b/cpp/tests/extensions/test_ext_node/accumulator.cpp new file mode 100644 index 000000000..226466946 --- /dev/null +++ b/cpp/tests/extensions/test_ext_node/accumulator.cpp @@ -0,0 +1,69 @@ +#include +#include +#include + +namespace csp::test_ext +{ + +DECLARE_CPPNODE( accumulate ) +{ + INIT_CPPNODE( accumulate ) {} + + // try to hit all node features + + TS_INPUT( int64_t, x ); + SCALAR_INPUT( int64_t, start_value ); + + SCALAR_INPUT( TimeDelta, reset_interval ); + ALARM( bool, reset ); + + STATE_VAR( int64_t, m_sum ); + TS_OUTPUT( int64_t, x ); + + START() + { + m_sum = start_value; + csp.schedule_alarm( reset, reset_interval, true ); + } + + INVOKE() + { + if( csp.ticked( reset ) ) + { + m_sum = 0; + csp.schedule_alarm( reset, reset_interval, true ); + } + if( csp.ticked( x ) ) + m_sum += x; + + RETURN( m_sum ); + } +}; + +EXPORT_CPPNODE( accumulate ); + +} + +REGISTER_CPPNODE( csp::test_ext, accumulate ); + +static PyModuleDef _test_ext_module = { + PyModuleDef_HEAD_INIT, + "_test_ext", + "_test_ext c++ module", + -1, + NULL, NULL, NULL, NULL, NULL +}; + +PyMODINIT_FUNC PyInit__test_ext( void ) +{ + PyObject * m; + + m = PyModule_Create( &_test_ext_module ); + if( m == NULL ) + return NULL; + + if( !csp::python::InitHelper::instance().execute( m ) ) + return NULL; + + return m; +}