Skip to content

Commit

Permalink
Upgrade CSP to C++20; build websocket against C++17; rename .hi files
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Glustein <Adam.Glustein@Point72.com>
  • Loading branch information
AdamGlustein committed May 9, 2024
1 parent e1e1f82 commit dcc525c
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 15 deletions.
5 changes: 1 addition & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#########################
cmake_minimum_required(VERSION 3.20.0)
project(csp VERSION "0.0.3")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)

###################################################################################################################################################
# CMake Dependencies #
Expand Down Expand Up @@ -153,9 +153,6 @@ endif()
###################################################################################################################################################
# Flags #
#########
# Compiler version flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")

# Optimization Flags
if(WIN32)
if(CMAKE_BUILD_TYPE_LOWER STREQUAL debug)
Expand Down
3 changes: 3 additions & 0 deletions cpp/csp/adapters/websocket/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
csp_autogen( csp.adapters.websocket_types websocket_types WEBSOCKET_HEADER WEBSOCKET_SOURCE )

# Need to build websocket adapter under cpp17 standard due to websocketpp incompatibility issues
set(CMAKE_CXX_STANDARD 17)

set(WS_CLIENT_HEADER_FILES
ClientAdapterManager.h
ClientInputAdapter.h
Expand Down
10 changes: 5 additions & 5 deletions cpp/csp/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ set(CSPTYPESIMPL_PUBLIC_HEADERS
PyCspEnum.h
PyCspType.h
PyStruct.h
PyStructList.h)
PyStructList.h
PyStructList_impl.h)

add_library(csptypesimpl
csptypesimpl.cpp
CspTypeFactory.cpp
PyCspEnum.cpp
PyCspType.cpp
PyStruct.cpp
PyStructToJson.cpp
PyStructList.hi)
PyStructToJson.cpp)
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)
Expand Down Expand Up @@ -42,7 +42,8 @@ set(CSPIMPL_PUBLIC_HEADERS
PyOutputProxy.h
PyConstants.h
PyStructToJson.h
PyStructList.h)
PyStructList.h
PyStructList_impl.h)

add_library(cspimpl SHARED
cspimpl.cpp
Expand Down Expand Up @@ -73,7 +74,6 @@ add_library(cspimpl SHARED
PyManagedSimInputAdapter.cpp
PyTimerAdapter.cpp
PyConstants.cpp
PyStructList.hi
${CSPIMPL_PUBLIC_HEADERS})

set_target_properties(cspimpl PROPERTIES PUBLIC_HEADER "${CSPIMPL_PUBLIC_HEADERS}")
Expand Down
2 changes: 1 addition & 1 deletion cpp/csp/python/PyStruct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <csp/python/InitHelper.h>
#include <csp/python/PyObjectPtr.h>
#include <csp/python/PyStruct.h>
#include <csp/python/PyStructList.hi>
#include <csp/python/PyStructList_impl.h>
#include <csp/python/PyStructToJson.h>
#include <unordered_set>
#include <type_traits>
Expand Down
2 changes: 1 addition & 1 deletion cpp/csp/python/PyStructList.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct PyStructList : public PyObject
{
using ElemT = typename CspType::Type::toCArrayElemType<StorageT>::type;

PyStructList<StorageT>( PyStruct * p, std::vector<StorageT> & v, const CspType & type ) : pystruct( p ), vector( v ), field_type( type )
PyStructList( PyStruct * p, std::vector<StorageT> & v, const CspType & type ) : pystruct( p ), vector( v ), field_type( type )
{
Py_INCREF( pystruct );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ PyStructList_dealloc( PyStructList<StorageT> * self )
}

template<typename StorageT> PyTypeObject PyStructList<StorageT>::PyType = {
PyVarObject_HEAD_INIT( NULL, 0 )
.ob_base = PyVarObject_HEAD_INIT( NULL, 0 )
.tp_name = "_cspimpl.PyStructList",
.tp_basicsize = sizeof( PyStructList<StorageT> ),
.tp_itemsize = 0,
Expand Down
8 changes: 5 additions & 3 deletions cpp/csp/python/adapters/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ if(CSP_BUILD_PARQUET_ADAPTER)
endif()

if(CSP_BUILD_WS_CLIENT_ADAPTER)
add_library(websocketadapterimpl SHARED websocketadapterimpl.cpp)
target_link_libraries(websocketadapterimpl csp_core csp_engine cspimpl csp_websocket_client_adapter)
install(TARGETS websocketadapterimpl RUNTIME DESTINATION bin/ LIBRARY DESTINATION lib/)
set(CMAKE_CXX_STANDARD 17)
add_library(websocketadapterimpl SHARED websocketadapterimpl.cpp)
target_link_libraries(websocketadapterimpl csp_core csp_engine cspimpl csp_websocket_client_adapter)
install(TARGETS websocketadapterimpl RUNTIME DESTINATION bin/ LIBRARY DESTINATION lib/)
set(CMAKE_CXX_STANDARD 20)
endif()

0 comments on commit dcc525c

Please sign in to comment.