Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ jobs:
run: |
choco install ninja

- name: Setup MSVC Developer Command Prompt (Windows)
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1

- name: Setup CMake and vcpkg
uses: lukka/get-cmake@latest

Expand All @@ -84,7 +88,7 @@ jobs:
- name: Test library linkage (Windows)
if: runner.os == 'Windows'
run: |
cd bin/build/${{ env.PRESET_NAME }}/example/${{ matrix.build_type }}
cd bin/build/${{ env.PRESET_NAME }}/example
dir

- name: Upload build artifacts
Expand Down
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,19 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
if(APPLE)
set(CMAKE_INSTALL_RPATH "@loader_path/../lib")
elseif(WIN32)
# On Windows, DLLs are found via PATH or same directory as executable
set(CMAKE_INSTALL_RPATH "")
endif()

# Options
option(BINANCECPP_BUILD_EXAMPLES "Build examples" ON)
option(BINANCECPP_DEPLOY_MODE "Enable deployment mode, disables examples" OFF)

# Deployment mode overrides examples setting
if(BINANCECPP_DEPLOY_MODE)
set(BINANCECPP_BUILD_EXAMPLES OFF CACHE BOOL "Deploy mode disables examples" FORCE)
endif()


# Find packages
Expand Down
27 changes: 18 additions & 9 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,32 @@
"name": "windows-debug",
"inherits": "debug",
"displayName": "Windows Debug",
"description": "Debug Windows build using vcpkg with Visual Studio",
"generator": "Visual Studio 17 2022",
"architecture": "x64",
"description": "Debug Windows build using vcpkg with Ninja and MSVC",
"generator": "Ninja",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"cacheVariables": {
"CMAKE_CXX_COMPILER": "cl.exe",
"CMAKE_C_COMPILER": "cl.exe"
}
},
{
"name": "windows-release",
"inherits": "release",
"displayName": "Windows Release",
"description": "Release Windows build using vcpkg with Visual Studio",
"generator": "Visual Studio 17 2022",
"architecture": "x64",
"description": "Release Windows build using vcpkg with Ninja and MSVC",
"generator": "Ninja",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"cacheVariables": {
"CMAKE_CXX_COMPILER": "cl.exe",
"CMAKE_C_COMPILER": "cl.exe"
}
},
{
Expand Down Expand Up @@ -132,13 +138,16 @@
"name": "windows-deploy",
"inherits": "deploy",
"displayName": "Windows Deploy",
"description": "Production Windows deployment build without examples",
"generator": "Visual Studio 17 2022",
"architecture": "x64",
"description": "Production Windows deployment build without examples using Ninja and MSVC",
"generator": "Ninja",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"cacheVariables": {
"CMAKE_CXX_COMPILER": "cl.exe",
"CMAKE_C_COMPILER": "cl.exe"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion example/example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <string_view>
#include <vector>

#include "binance_cpp.h"
#include "binance_api.h"
#include "binance_websocket.h"

constexpr const char* API_KEY = "api key";
Expand Down
2 changes: 1 addition & 1 deletion example/example_aggTrades.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <string>
#include <vector>

#include "binance_cpp.h"
#include "binance_api.h"
#include "binance_websocket.h"

std::map<long, std::map<std::string, double>> aggTradeCache;
Expand Down
2 changes: 1 addition & 1 deletion example/example_depthCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <string>
#include <vector>

#include "binance_cpp.h"
#include "binance_api.h"
#include "binance_websocket.h"

std::map<std::string, std::map<double, double>> depthCache;
Expand Down
2 changes: 1 addition & 1 deletion example/example_klines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <string>
#include <vector>

#include "binance_cpp.h"
#include "binance_api.h"
#include "binance_websocket.h"

std::map<long, std::map<std::string, double>> klinesCache;
Expand Down
2 changes: 1 addition & 1 deletion example/example_template.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include <string>

#include "binance_cpp.h"
#include "binance_api.h"
#include "binance_websocket.h"

#define API_KEY "myapikey"
Expand Down
2 changes: 1 addition & 1 deletion example/example_userStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <string>
#include <vector>

#include "binance_cpp.h"
#include "binance_api.h"
#include "binance_websocket.h"

#define API_KEY "api key"
Expand Down
2 changes: 1 addition & 1 deletion example/example_wapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <string>
#include <vector>

#include "binance_cpp.h"
#include "binance_api.h"
#include "binance_websocket.h"

#define API_KEY "api key"
Expand Down
14 changes: 11 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,16 @@ set_target_properties(binancecpp PROPERTIES
EXPORT_NAME binancecpp
)

# Define export macro for Windows DLL
target_compile_definitions(binancecpp PRIVATE BINANCECPP_EXPORTS)

# Link libraries
target_link_libraries(binancecpp
PRIVATE
PUBLIC
JsonCpp::JsonCpp
PRIVATE
CURL::libcurl
websockets
$<IF:$<TARGET_EXISTS:websockets>,websockets,websockets_shared>
)

# Include directories
Expand All @@ -43,9 +47,13 @@ target_include_directories(binancecpp

# Compiler-specific options for C++20
target_compile_options(binancecpp PRIVATE
-fPIC
# Position Independent Code for Unix systems only
$<$<NOT:$<PLATFORM_ID:Windows>>:-fPIC>
# C++20 concepts support
$<$<CXX_COMPILER_ID:GNU>:-fconcepts>
$<$<CXX_COMPILER_ID:Clang>:-fconcepts-ts>
# Windows-specific options
$<$<CXX_COMPILER_ID:MSVC>:/std:c++20>
)

# Add alias for consistent naming
Expand Down
187 changes: 0 additions & 187 deletions src/binance.h

This file was deleted.

Loading
Loading