|
dxFeed Graal CXX API v9.0.0
|
or use the scripts/build.sh or scripts/build.cmd. Make sure that you use command prompt for VS on Win.
A release has two source bundles for Windows x64. Each has the sources and all the dependencies, the Graal Native SDK too, so it builds without network access. They differ in the C runtime of the SDK:
| Bundle | C runtime | Graal Native SDK in third_party |
|---|---|---|
| dxFeedGraalCxxApi-<version>-x86_64-windows-Full-Source-Bundle.zip | dynamic (/MD) | amd64-windows, amd64-windows-debug |
| dxFeedGraalCxxApi-<version>-x86_64-windows-Full-Source-Bundle-static-mt.zip | static (/MT) | amd64-windows-static-crt, amd64-windows-debug-static-crt, amd64-windows-static-lib, amd64-windows-debug-static-lib |
The SDK of a bundle is in third_party/graal-native-sdk-<SDK version>-<variant>, and CMake takes the variant that the options select, as it does when it downloads the SDK:
An option that needs the SDK of the other bundle fails the configuration, and the message names that bundle. Without the SDK in third_party (a git checkout), CMake downloads it.
In the x64 Native Tools Command Prompt for VS 2022:
The static-mt bundle builds the libraries the same way; this installs the content of a -static-mt archive (see "Windows without the Visual C++ Redistributable" in README.md):
Add -DDXFCXX_USE_DEBUG_DXFEED_GRAAL_NATIVE_SDK=ON and build with --config Debug for the Debug SDK and C runtime.
With the static C runtime, dxFeedGraalCxxApi.dll is built but not installed: the DLL has its own C runtime, and the C++ API passes standard library objects (std::string, std::shared_ptr, etc.) between the DLL and the code that uses it. Link dxFeedGraalCxxApi_static.lib instead. Only the C API of the DLL (include/dxfeed_graal_c_api/api.h) can be used across this boundary; take the DLL and its import library from the build directory if you need it.
The unit tests do not need external network: they use a LOCAL_HUB endpoint or a loopback TCP server. The tests over a network connection to a QDS server that sends a test tape (tests/data/tapes/network.txt) are built only with -DDXFCXX_ENABLE_NETWORK_TESTS=ON and have the CTest label network:
On Linux CTest starts the server itself with the Tools (so -DDXFCXX_BUILD_TOOLS=ON is required) on 127.0.0.1:17300 and stops it after the tests; -DDXFCXX_NETWORK_TEST_PORT=<port> changes the port. On other systems, or to run the tests against another server that sends the same tape, set DXFCXX_NETWORK_TEST_ADDRESS and exclude the local server:
With -DDXFCXX_DYNAMICALLY_LINK_UNIT_TESTS=ON the tests are linked with the shared library instead of the static one, as an application that uses the DLL. This finds what works only with the static library: a function that is not exported (a link error) and state that the public headers keep outside the library (on Windows, the DLL and each executable have their own copies of it). The rules for the public headers are in include/dxfeed_graal_cpp_api/detail/Conf.hpp next to DXFCPP_EXPORT.
The shared library exports only what DXFCPP_EXPORT marks (hidden visibility with gcc and clang). The tests and the Tools also use internal classes of src/, marked DXFCPP_INTERNAL_EXPORT: the option DXFCXX_EXPORT_INTERNALS exports them too. It is ON when the tests or the Tools are linked dynamically (DXFCXX_DYNAMICALLY_LINK_UNIT_TESTS, DXFCXX_DYNAMICALLY_LINK_TOOLS), and the shared variants of the static-init, exit and isolate-args tests are built only with it. Do not ship a library built with it: its symbols differ from abi/symbols-<os>.txt.
DXFCXX_BUILD_UI_SAMPLES controls the UI samples (Dear ImGui, GLFW, OpenGL):
On Linux, GLFW is built with every window system backend that is found, X11, Wayland or both, and selects one at run time: the one of XDG_SESSION_TYPE (x11 or wayland), otherwise the first that connects. With -DDXFCXX_SAMPLE_GLFW_BUILD_WAYLAND=ON, the configuration fails when the Wayland backend cannot be built.
On Debian/Ubuntu, install OpenGL and one of the backends (or both, then GLFW gets both):
libgl1-mesa-dev brings the core X11 headers (libx11-dev) with it, but the X11 backend also needs the extension headers, so the Wayland set builds only the Wayland backend.
Both library targets and all their consumers (tests, samples, tools) are instrumented. With MSVC, the ASan runtime DLL is copied next to the unit tests, so they can be run outside the Visual Studio developer prompt.
Sanitized builds also add the dxFeedGraalCxxApi_SanitizerCanary_<asan|ubsan|tsan> tests: they call a deliberately defective library function and pass only if the sanitizer reports it, so a sanitizer that is silently not applied to the library makes them fail.
The libraries are built with the hardening options of the compiler and the linker (DXFCXX_HARDENING, ON by default):
The options are used in the optimized configurations only (Release, RelWithDebInfo, MinSizeRel; not in Debug or a build without a build type), not in sanitized builds, and are not passed to the projects that use the library. MinGW builds are not hardened.
This project's own code (the libraries, tests, samples, tools, fuzzers) is compiled with -Wshadow, -Wsign-conversion, -Wfloat-equal and -Wextra-semi (MSVC: C4365) on top of -Wall -Wextra -pedantic (/W4). These warnings are not passed to the projects that use the library, and the headers of the dependencies are included as system headers, so their warnings are not reported. With -DDXFCXX_WARNINGS_AS_ERRORS=ON (the CI builds) the warnings of this project's code are errors (-Werror, /WX), except the use of deprecated functions, which stays a warning (MSVC: C4996 is disabled).
DXFCXX_BUILD_HEADER_CHECK compiles every public header on its own to check that it includes everything it uses. Build with DXFCXX_USE_PRECOMPILED_HEADERS=OFF, since precompiled headers hide missing includes.
The installed headers are checked separately: each one must compile with the include directory of the installation as the only include directory (on Windows, also after <windows.h>).