Skip to content

Commit

Permalink
Use cmake GenerateExportHeader to hopefully fix Windows visibility as…
Browse files Browse the repository at this point in the history
… well

Signed-off-by: Adam Glustein <[email protected]>
  • Loading branch information
AdamGlustein committed Nov 8, 2024
1 parent 571b9d5 commit 512a6fd
Show file tree
Hide file tree
Showing 73 changed files with 331 additions and 120 deletions.
4 changes: 3 additions & 1 deletion cpp/csp/adapters/kafka/KafkaAdapterManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <csp/core/Enum.h>
#include <csp/core/Hash.h>
#include <csp/core/Platform.h>
#include <csp/engine/AdapterManager.h>
#include <csp/engine/Dictionary.h>
#include <csp/engine/PushInputAdapter.h>
Expand All @@ -11,6 +12,7 @@
#include <unordered_map>
#include <vector>


namespace RdKafka
{

Expand Down Expand Up @@ -47,7 +49,7 @@ struct KafkaStatusMessageTypeTraits
using KafkaStatusMessageType = csp::Enum<KafkaStatusMessageTypeTraits>;

//Top level AdapterManager object for all kafka adapters in the engine
class CSP_PUBLIC KafkaAdapterManager final : public csp::AdapterManager
class CSPKAFKAADAPTERIMPL_EXPORT KafkaAdapterManager final : public csp::AdapterManager
{
public:
KafkaAdapterManager( csp::Engine * engine, const Dictionary & properties );
Expand Down
5 changes: 3 additions & 2 deletions cpp/csp/adapters/parquet/DialectGenericListReaderInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
#define _IN_CSP_ADAPTERS_PARQUET_DialectGenericListReaderInterface_H

#include <memory>
#include <csp/core/Platform.h>
#include <csp/engine/DialectGenericType.h>
#include <csp/adapters/parquet/ParquetReaderColumnAdapter.h>
#include <arrow/array/builder_base.h>

namespace csp::adapters::parquet
{

class DialectGenericListReaderInterface
class CSPPARQUETADAPTERIMPL_EXPORT DialectGenericListReaderInterface
{
public:
using Ptr = std::shared_ptr<DialectGenericListReaderInterface>;
Expand All @@ -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<TypedDialectGenericListReaderInterface<T>>;
Expand Down
3 changes: 2 additions & 1 deletion cpp/csp/adapters/parquet/ParquetInputAdapterManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <csp/adapters/parquet/ParquetReader.h>
#include <csp/adapters/utils/StructAdapterInfo.h>
#include <csp/core/Generator.h>
#include <csp/core/Platform.h>
#include <csp/engine/AdapterManager.h>
#include <csp/engine/Dictionary.h>
#include <unordered_map>
Expand All @@ -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<std::string, csp::DateTime, csp::DateTime>::Ptr;
Expand Down
3 changes: 2 additions & 1 deletion cpp/csp/adapters/parquet/ParquetOutputAdapterManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <csp/adapters/parquet/ParquetReader.h>
#include <csp/adapters/utils/StructAdapterInfo.h>
#include <csp/core/Generator.h>
#include <csp/core/Platform.h>
#include <csp/engine/AdapterManager.h>
#include <csp/engine/Dictionary.h>
#include <set>
Expand All @@ -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<void(const std::string &)>;
Expand Down
2 changes: 1 addition & 1 deletion cpp/csp/adapters/websocket/ClientAdapterManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ struct WebsocketClientStatusTypeTraits

using ClientStatusType = Enum<WebsocketClientStatusTypeTraits>;

class CSP_PUBLIC ClientAdapterManager final : public AdapterManager
class CSPWEBSOCKETADAPTERIMPL_EXPORT ClientAdapterManager final : public AdapterManager
{
public:
ClientAdapterManager(
Expand Down
2 changes: 1 addition & 1 deletion cpp/csp/core/BasicAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace csp
{

// Extremely basic non-thread safe fixed-size allocator
class CSP_PUBLIC BasicAllocator
class CSPIMPL_EXPORT BasicAllocator
{
public:
//elemsize is size of a single alloc, blockSize is number of elements to
Expand Down
2 changes: 1 addition & 1 deletion cpp/csp/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ install(TARGETS csp_core
RUNTIME DESTINATION ${CSP_RUNTIME_INSTALL_SUBDIR}
LIBRARY DESTINATION lib/
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cpp/csp/core/Config.h DESTINATION include/csp/core)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cpp/csp/core/Config.h DESTINATION include/csp/core)
2 changes: 1 addition & 1 deletion cpp/csp/core/DynamicBitSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace csp
{

template<typename NodeT = uint64_t, typename IndexT = int32_t>
class CSP_PUBLIC DynamicBitSet
class CSPIMPL_EXPORT DynamicBitSet
{

public:
Expand Down
2 changes: 1 addition & 1 deletion cpp/csp/core/Enum.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ bool UnknownOnInvalidValue(long) { return false; }

START_PACKED
template<typename EnumTraits>
struct CSP_PUBLIC Enum : public EnumTraits
struct CSPTYPESIMPL_EXPORT Enum : public EnumTraits
{
using EnumV = typename EnumTraits::_enum;
using Mapping = std::vector<std::string>;
Expand Down
2 changes: 1 addition & 1 deletion cpp/csp/core/EnumBitSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace csp
//Utility class to hold enums as a bitmask ( where enum values are incremental from 0 )
//enum must have a NUM_TYPES entry for number of entries
template< typename EnumT >
class CSP_PUBLIC EnumBitSet
class CSPTYPESIMPL_EXPORT EnumBitSet
{
using value_type = uint64_t;

Expand Down
2 changes: 1 addition & 1 deletion cpp/csp/core/Generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace csp
{
template< typename V, typename ...Args >
class CSP_PUBLIC Generator
class CSPIMPL_EXPORT Generator
{
public:
using Ptr = std::shared_ptr<Generator<V, Args...>>;
Expand Down
27 changes: 10 additions & 17 deletions cpp/csp/core/Platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@
#include <stdint.h>
#include <time.h>

// cmake autogenerated export files
#include <csp/python/cspimpl_export.h>
#include <csp/python/csptypesimpl_export.h>

#include <csp/python/adapters/cspkafkaadapterimpl_export.h>
#include <csp/python/adapters/cspparquetadapterimpl_export.h>
#include <csp/python/adapters/cspwebsocketadapterimpl_export.h>


//TODO move Likely.h defines into Platform.h
#ifdef WIN32
#define NOMINMAX
Expand All @@ -14,20 +23,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))
Expand Down Expand Up @@ -90,10 +86,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
Expand Down
2 changes: 1 addition & 1 deletion cpp/csp/core/QueueWaiter.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace csp

class TimeDelta;

class CSP_PUBLIC QueueWaiter
class CSPIMPL_EXPORT QueueWaiter
{
public:
QueueWaiter() : m_eventsPending( false )
Expand Down
2 changes: 1 addition & 1 deletion cpp/csp/core/TaggedPointerUnion.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct IndexOf<T, TypeList<TOther, Ts...> >


template<typename... Ts>
class CSP_PUBLIC TaggedPointerUnion
class CSPIMPL_EXPORT TaggedPointerUnion
{
public:
static inline constexpr size_t NUM_TAGS = sizeof...(Ts);
Expand Down
10 changes: 5 additions & 5 deletions cpp/csp/core/Time.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const int64_t NANOS_PER_SECOND = 1000000000;
const int64_t SECONDS_PER_DAY = 86400;
const int64_t NANOS_PER_DAY = NANOS_PER_SECOND * SECONDS_PER_DAY;

class CSP_PUBLIC TimeDelta
class CSPTYPESIMPL_EXPORT TimeDelta
{
public:
constexpr TimeDelta() : TimeDelta( TimeDelta::NONE() ) {}
Expand Down Expand Up @@ -165,7 +165,7 @@ inline std::ostream & operator <<( std::ostream &os, const TimeDelta & d )
return os;
}

class CSP_PUBLIC Date
class CSPTYPESIMPL_EXPORT Date
{
public:
Date() : Date( NONE() ) {}
Expand Down Expand Up @@ -316,7 +316,7 @@ inline std::ostream & operator <<( std::ostream &os, const Date & d )
return os;
}

class CSP_PUBLIC Time
class CSPTYPESIMPL_EXPORT Time
{
public:
Time() : Time( -1 ) {} //NONE
Expand Down Expand Up @@ -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 CSP_PUBLIC DateTime
class CSPTYPESIMPL_EXPORT DateTime
{
public:
DateTime() : DateTime( DateTime::NONE() ) {}
Expand Down Expand Up @@ -597,7 +597,7 @@ inline std::ostream & operator <<( std::ostream &os, const DateTime & dt )
//Helper class to extract day/month/year/etc info from raw timestamp
//ie DateTimeEx dte( existingDt )
//dte.day, etc etc
class CSP_PUBLIC DateTimeEx : public DateTime
class CSPTYPESIMPL_EXPORT DateTimeEx : public DateTime
{
public:
DateTimeEx( const DateTime & dt );
Expand Down
4 changes: 2 additions & 2 deletions cpp/csp/engine/AdapterManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class AdapterManager;

class Engine;

class CSP_PUBLIC ManagedSimInputAdapter : public InputAdapter
class CSPIMPL_EXPORT ManagedSimInputAdapter : public InputAdapter
{
public:
ManagedSimInputAdapter( csp::Engine *engine, const CspTypePtr &type, AdapterManager *manager, PushMode pushMode );
Expand Down Expand Up @@ -94,7 +94,7 @@ bool ManagedSimInputAdapter::pushNullTick()
return true;
}

class CSP_PUBLIC AdapterManager : public EngineOwned
class CSPIMPL_EXPORT AdapterManager : public EngineOwned
{
public:
AdapterManager( csp::Engine * );
Expand Down
2 changes: 1 addition & 1 deletion cpp/csp/engine/AlarmInputAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace csp
{

template<typename T>
class CSP_PUBLIC AlarmInputAdapter final : public InputAdapter
class CSPIMPL_EXPORT AlarmInputAdapter final : public InputAdapter
{
public:
AlarmInputAdapter( Engine * engine, CspTypePtr & type ) : InputAdapter( engine, type, PushMode::NON_COLLAPSING )
Expand Down
8 changes: 4 additions & 4 deletions cpp/csp/engine/BasketInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace csp

class Node;

class CSP_PUBLIC InputBasketInfo
class CSPIMPL_EXPORT InputBasketInfo
{
using TickedInputs = std::vector<INOUT_ELEMID_TYPE>;

Expand Down Expand Up @@ -189,7 +189,7 @@ class CSP_PUBLIC InputBasketInfo
bool m_isDynamic;
};

class CSP_PUBLIC DynamicInputBasketInfo : public InputBasketInfo
class CSPIMPL_EXPORT DynamicInputBasketInfo : public InputBasketInfo
{
public:
using ChangeCallback = std::function<void(const DialectGenericType & key,bool added, int64_t elemId, int64_t replaceId )>;
Expand Down Expand Up @@ -228,7 +228,7 @@ class CSP_PUBLIC DynamicInputBasketInfo : public InputBasketInfo
TimeDelta m_timeWindowPolicy;
};

class CSP_PUBLIC OutputBasketInfo
class CSPIMPL_EXPORT OutputBasketInfo
{
public:
OutputBasketInfo( CspTypePtr & type, Node * node, size_t size, bool isDynamic = false );
Expand All @@ -255,7 +255,7 @@ class CSP_PUBLIC OutputBasketInfo
bool m_isDynamic;
};

class CSP_PUBLIC DynamicOutputBasketInfo : public OutputBasketInfo
class CSPIMPL_EXPORT DynamicOutputBasketInfo : public OutputBasketInfo
{
public:
DynamicOutputBasketInfo( CspTypePtr & type, Node * node );
Expand Down
2 changes: 1 addition & 1 deletion cpp/csp/engine/Consumer.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace csp
class InputAdapter;

//Base of either regular Nodes or output adapters
class CSP_PUBLIC Consumer
class CSPIMPL_EXPORT Consumer
{
public:
Consumer( Engine * );
Expand Down
2 changes: 1 addition & 1 deletion cpp/csp/engine/CppNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace csp

//CppNode is used specifically for C++ defined Nodes, and should only be used
//for definig c++ nodes using the macros defined at the end
class CSP_PUBLIC CppNode : public csp::Node
class CSPIMPL_EXPORT CppNode : public csp::Node
{
public:
using Shape = std::variant<std::uint64_t,std::vector<std::string>>;
Expand Down
6 changes: 3 additions & 3 deletions cpp/csp/engine/CspEnum.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace csp

class CspEnumMeta;

class CSP_PUBLIC CspEnumInstance
class CSPTYPESIMPL_EXPORT CspEnumInstance
{
public:
CspEnumInstance( std::string name, int64_t value, csp::CspEnumMeta * meta ) : m_name( name ), m_value( value ), m_meta( meta ) {}
Expand All @@ -35,7 +35,7 @@ class CSP_PUBLIC 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 CSP_PUBLIC CspEnum
class CSPTYPESIMPL_EXPORT CspEnum
{
public:
CspEnum();
Expand All @@ -59,7 +59,7 @@ class CSP_PUBLIC CspEnum

std::ostream &operator<<( std::ostream &os, const CspEnum & rhs );

class CSP_PUBLIC CspEnumMeta
class CSPTYPESIMPL_EXPORT CspEnumMeta
{
public:
using ValueDef = std::unordered_map<std::string,int64_t>;
Expand Down
Loading

0 comments on commit 512a6fd

Please sign in to comment.