Skip to content

Commit

Permalink
[EN-7409] Implement WriteTapeFile sample
Browse files Browse the repository at this point in the history
  • Loading branch information
AnatolyKalin committed Aug 29, 2023
1 parent 7250775 commit b91f904
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 16 deletions.
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ option(DXFCXX_INSTALL_LIB "Prepare install the libraries" ON)
option(DXFCXX_INSTALL_SAMPLES "Prepare install the samples" ${DXFCXX_IS_ROOT_PROJECT})
option(DXFCXX_INSTALL_TOOLS "Prepare install the tools" ${DXFCXX_IS_ROOT_PROJECT})
option(DXFCXX_USE_DXFEED_GRAAL_NATIVE_SDK_JFROG "" ON)
set(DXFEED_GRAAL_NATIVE_SDK_VERSION "1.0.1" CACHE STRING "")
set(DXFEED_GRAAL_NATIVE_SDK_VERSION "1.0.2" CACHE STRING "")
set(DXFEED_GRAAL_NATIVE_SDK_JFROG_BASE_URL "https://dxfeed.jfrog.io/artifactory/maven-open/com/dxfeed/graal-native-sdk/" CACHE STRING "")

option(DXFCXX_ENABLE_ASAN_UBSAN "Enable address, UB sanitizers etc" OFF)
Expand Down Expand Up @@ -249,6 +249,12 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE
target_link_libraries(${PROJECT_NAME}_static PUBLIC DxFeedGraalNativeSdk utf8cpp fmt::fmt-header-only PUBLIC ${PROJECT_NAME}_CompilerOptions)
target_link_libraries(${PROJECT_NAME} PUBLIC DxFeedGraalNativeSdk utf8cpp fmt::fmt-header-only PUBLIC ${PROJECT_NAME}_CompilerOptions)

if (DXFCXX_ENABLE_ASAN_UBSAN)
target_compile_options(${PROJECT_NAME} PRIVATE "-fsanitize=address" "-fsanitize=undefined" "-fPIC")
target_link_options(${PROJECT_NAME} PRIVATE "-fsanitize=address" "-fsanitize=undefined" "-fPIC")
target_link_libraries(${PROJECT_NAME} PUBLIC asan ubsan)
endif ()

add_custom_command(TARGET ${PROJECT_NAME}_static POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:DxFeedGraalNativeSdk> $<TARGET_FILE_DIR:${PROJECT_NAME}_static>)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different
Expand Down
20 changes: 9 additions & 11 deletions samples/cpp/WriteTapeFile/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,6 @@ elseif (UNIX)
set(CMAKE_INSTALL_RPATH "$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:$ORIGIN/../lib64:$ORIGIN/../lib:$ORIGIN")
endif ()

if (DXFCXX_ENABLE_ASAN_UBSAN)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fsanitize=undefined")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fsanitize=undefined")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address -fsanitize=undefined")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address -fsanitize=undefined")
endif ()

add_executable(${PROJECT_NAME} src/main.cpp)

if (DXFCXX_ENABLE_VS_ASAN)
Expand All @@ -55,15 +48,20 @@ if (DXFCXX_ENABLE_VS_ASAN)
)
endif ()

if (DXFCXX_ENABLE_ASAN_UBSAN)
target_compile_options(${PROJECT_NAME} PRIVATE "-fsanitize=address" "-fsanitize=undefined" "-fPIC")
target_link_options(${PROJECT_NAME} PRIVATE "-fsanitize=address" "-fsanitize=undefined" "-fPIC")
endif ()

target_include_directories(${PROJECT_NAME} PRIVATE ../../../include)

target_link_libraries(${PROJECT_NAME} PRIVATE dxfcxx::static)
#target_link_libraries(${PROJECT_NAME} PRIVATE dxfcxx)
#target_compile_definitions(${PROJECT_NAME} PRIVATE DXFCPP_USE_DLLS)
#target_link_libraries(${PROJECT_NAME} PRIVATE dxfcxx::static)
target_link_libraries(${PROJECT_NAME} PRIVATE dxfcxx)
target_compile_definitions(${PROJECT_NAME} PRIVATE DXFCPP_USE_DLLS)

add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:dxfcxx::graal>
# $<TARGET_FILE:dxfcxx>
$<TARGET_FILE:dxfcxx>
# ${CMAKE_CURRENT_SOURCE_DIR}/dxfeed.properties
$<TARGET_FILE_DIR:${PROJECT_NAME}>)

Expand Down
2 changes: 2 additions & 0 deletions samples/cpp/WriteTapeFile/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@ int main() {
// Wait until all data is written, close, and wait until it closes.
endpoint->awaitProcessed();
endpoint->closeAndAwaitTermination();

return 0;
}
5 changes: 5 additions & 0 deletions src/event/candle/CandleSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@

namespace dxfcpp {

const SessionType SessionType::NO_TRADING{"NO_TRADING", false};
const SessionType SessionType::PRE_MARKET{"PRE_MARKET", true};
const SessionType SessionType::REGULAR{"REGULAR", true};
const SessionType SessionType::AFTER_MARKET{"AFTER_MARKET", true};

const SessionFilter SessionFilter::ANY{std::nullopt, std::nullopt};
const SessionFilter SessionFilter::TRADING{std::nullopt, true};
const SessionFilter SessionFilter::NON_TRADING{std::nullopt, false};
Expand Down
5 changes: 1 addition & 4 deletions src/schedule/SessionType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

namespace dxfcpp {

const SessionType SessionType::NO_TRADING{"NO_TRADING", false};
const SessionType SessionType::PRE_MARKET{"PRE_MARKET", true};
const SessionType SessionType::REGULAR{"REGULAR", true};
const SessionType SessionType::AFTER_MARKET{"AFTER_MARKET", true};
// The SessionType static fields are initialized in CandleSession.cpp

} // namespace dxfcpp

0 comments on commit b91f904

Please sign in to comment.