Skip to content

Commit d6479c5

Browse files
AdamGlusteinCarreau
authored andcommitted
Upgrade CSP to C++20; build websocket against C++17; rename .hi files (#224)
Signed-off-by: Adam Glustein <[email protected]>
1 parent 68927fe commit d6479c5

File tree

7 files changed

+17
-15
lines changed

7 files changed

+17
-15
lines changed

CMakeLists.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#########################
44
cmake_minimum_required(VERSION 3.20.0)
55
project(csp VERSION "0.0.3")
6-
set(CMAKE_CXX_STANDARD 17)
6+
set(CMAKE_CXX_STANDARD 20)
77

88
###################################################################################################################################################
99
# CMake Dependencies #
@@ -153,9 +153,6 @@ endif()
153153
###################################################################################################################################################
154154
# Flags #
155155
#########
156-
# Compiler version flags
157-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
158-
159156
# Optimization Flags
160157
if(WIN32)
161158
if(CMAKE_BUILD_TYPE_LOWER STREQUAL debug)

cpp/csp/adapters/websocket/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
csp_autogen( csp.adapters.websocket_types websocket_types WEBSOCKET_HEADER WEBSOCKET_SOURCE )
22

3+
# Need to build websocket adapter under cpp17 standard due to websocketpp incompatibility issues
4+
set(CMAKE_CXX_STANDARD 17)
5+
36
set(WS_CLIENT_HEADER_FILES
47
ClientAdapterManager.h
58
ClientInputAdapter.h

cpp/csp/python/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ set(CSPTYPESIMPL_PUBLIC_HEADERS
44
PyCspEnum.h
55
PyCspType.h
66
PyStruct.h
7-
PyStructList.h)
7+
PyStructList.h
8+
PyStructList_impl.h)
89

910
add_library(csptypesimpl
1011
csptypesimpl.cpp
1112
CspTypeFactory.cpp
1213
PyCspEnum.cpp
1314
PyCspType.cpp
1415
PyStruct.cpp
15-
PyStructToJson.cpp
16-
PyStructList.hi)
16+
PyStructToJson.cpp)
1717
set_target_properties(csptypesimpl PROPERTIES PUBLIC_HEADER "${CSPTYPESIMPL_PUBLIC_HEADERS}")
1818
target_compile_definitions(csptypesimpl PUBLIC RAPIDJSON_HAS_STDSTRING=1)
1919
target_link_libraries(csptypesimpl csp_core csp_types)
@@ -42,7 +42,8 @@ set(CSPIMPL_PUBLIC_HEADERS
4242
PyOutputProxy.h
4343
PyConstants.h
4444
PyStructToJson.h
45-
PyStructList.h)
45+
PyStructList.h
46+
PyStructList_impl.h)
4647

4748
add_library(cspimpl SHARED
4849
cspimpl.cpp
@@ -73,7 +74,6 @@ add_library(cspimpl SHARED
7374
PyManagedSimInputAdapter.cpp
7475
PyTimerAdapter.cpp
7576
PyConstants.cpp
76-
PyStructList.hi
7777
${CSPIMPL_PUBLIC_HEADERS})
7878

7979
set_target_properties(cspimpl PROPERTIES PUBLIC_HEADER "${CSPIMPL_PUBLIC_HEADERS}")

cpp/csp/python/PyStruct.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include <csp/python/InitHelper.h>
44
#include <csp/python/PyObjectPtr.h>
55
#include <csp/python/PyStruct.h>
6-
#include <csp/python/PyStructList.hi>
6+
#include <csp/python/PyStructList_impl.h>
77
#include <csp/python/PyStructToJson.h>
88
#include <unordered_set>
99
#include <type_traits>

cpp/csp/python/PyStructList.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ struct PyStructList : public PyObject
1414
{
1515
using ElemT = typename CspType::Type::toCArrayElemType<StorageT>::type;
1616

17-
PyStructList<StorageT>( PyStruct * p, std::vector<StorageT> & v, const CspType & type ) : pystruct( p ), vector( v ), field_type( type )
17+
PyStructList( PyStruct * p, std::vector<StorageT> & v, const CspType & type ) : pystruct( p ), vector( v ), field_type( type )
1818
{
1919
Py_INCREF( pystruct );
2020
}

cpp/csp/python/PyStructList.hi renamed to cpp/csp/python/PyStructList_impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ PyStructList_dealloc( PyStructList<StorageT> * self )
435435
}
436436

437437
template<typename StorageT> PyTypeObject PyStructList<StorageT>::PyType = {
438-
PyVarObject_HEAD_INIT( NULL, 0 )
438+
.ob_base = PyVarObject_HEAD_INIT( NULL, 0 )
439439
.tp_name = "_cspimpl.PyStructList",
440440
.tp_basicsize = sizeof( PyStructList<StorageT> ),
441441
.tp_itemsize = 0,

cpp/csp/python/adapters/CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ if(CSP_BUILD_PARQUET_ADAPTER)
3535
endif()
3636

3737
if(CSP_BUILD_WS_CLIENT_ADAPTER)
38-
add_library(websocketadapterimpl SHARED websocketadapterimpl.cpp)
39-
target_link_libraries(websocketadapterimpl csp_core csp_engine cspimpl csp_websocket_client_adapter)
40-
install(TARGETS websocketadapterimpl RUNTIME DESTINATION bin/ LIBRARY DESTINATION lib/)
38+
set(CMAKE_CXX_STANDARD 17)
39+
add_library(websocketadapterimpl SHARED websocketadapterimpl.cpp)
40+
target_link_libraries(websocketadapterimpl csp_core csp_engine cspimpl csp_websocket_client_adapter)
41+
install(TARGETS websocketadapterimpl RUNTIME DESTINATION bin/ LIBRARY DESTINATION lib/)
42+
set(CMAKE_CXX_STANDARD 20)
4143
endif()

0 commit comments

Comments
 (0)