diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/blpapi | |
Diffstat (limited to 'vcpkg/ports/blpapi')
| -rw-r--r-- | vcpkg/ports/blpapi/portfile.cmake | 60 | ||||
| -rw-r--r-- | vcpkg/ports/blpapi/update-blpapi-lib-include-dir.patch | 46 | ||||
| -rw-r--r-- | vcpkg/ports/blpapi/usage | 4 | ||||
| -rw-r--r-- | vcpkg/ports/blpapi/vcpkg.json | 7 |
4 files changed, 117 insertions, 0 deletions
diff --git a/vcpkg/ports/blpapi/portfile.cmake b/vcpkg/ports/blpapi/portfile.cmake new file mode 100644 index 0000000..41ac08c --- /dev/null +++ b/vcpkg/ports/blpapi/portfile.cmake @@ -0,0 +1,60 @@ +# According to Bloomberg Helpdesk on 2023-07-18, the last digit of the version string is just a build identifier, +# not an actual version identifier, and can be different between the latest Linux and Windows distfiles. + +if (VCPKG_TARGET_IS_LINUX) + vcpkg_download_distfile(ARCHIVE + URLS "https://blpapi.bloomberg.com/download/releases/raw/files/blpapi_cpp_${VERSION}.1-linux.tar.gz" + FILENAME "blpapi_cpp_${VERSION}.1-linux.tar.gz" + SHA512 3D1FC0E8E37E21EE53310649EA7D915A4E991DD2FCA400FCD5E490C4533F6C83710426C5D98927631BBDB2622D9FFA864096C82F275DC1C547FCAFE9D1013895 + ) +elseif (VCPKG_TARGET_IS_WINDOWS) + vcpkg_download_distfile(ARCHIVE + URLS "https://blpapi.bloomberg.com/download/releases/raw/files/blpapi_cpp_${VERSION}.1-windows.zip" + FILENAME "blpapi_cpp_${VERSION}.1-windows.zip" + SHA512 ED57BF390417D6ED189A3D4379DAE5716441627B20C63B8BEBAAC0AD66C32B89D17697B1C5CE79010F7FFF3F71BC6EC57D15A5D79B597F3507A0A4D2658A6103 + ) +endif() + +vcpkg_extract_source_archive( + SOURCE_PATH + ARCHIVE "${ARCHIVE}" + PATCHES update-blpapi-lib-include-dir.patch +) + +if ("${VCPKG_TARGET_ARCHITECTURE}" MATCHES "x86") + set(BITS_SUFFIX 32) +elseif ("${VCPKG_TARGET_ARCHITECTURE}" MATCHES "x64") + set(BITS_SUFFIX 64) +else() + message(FATAL_ERROR "Unrecognized architecture.") +endif() + +if (VCPKG_TARGET_IS_LINUX) + file(GLOB SO_FILES LIST_DIRECTORIES false "${SOURCE_PATH}/Linux/*${BITS_SUFFIX}.so") +else() + file(GLOB DLL_FILES LIST_DIRECTORIES false "${SOURCE_PATH}/lib/*${BITS_SUFFIX}.dll") + file(GLOB LIB_FILES LIST_DIRECTORIES false "${SOURCE_PATH}/lib/*${BITS_SUFFIX}.lib") +endif() + +if (VCPKG_TARGET_IS_LINUX) + file(COPY ${SO_FILES} DESTINATION "${CURRENT_PACKAGES_DIR}/lib") + if (NOT VCPKG_BUILD_TYPE) + file(COPY ${SO_FILES} DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib") + endif() +else() + file(COPY ${DLL_FILES} DESTINATION "${CURRENT_PACKAGES_DIR}/bin") + file(COPY ${LIB_FILES} DESTINATION "${CURRENT_PACKAGES_DIR}/lib") + if (NOT VCPKG_BUILD_TYPE) + file(COPY ${DLL_FILES} DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin") + file(COPY ${LIB_FILES} DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib") + endif() +endif() + +file(COPY "${SOURCE_PATH}/include" DESTINATION "${CURRENT_PACKAGES_DIR}") + +file(GLOB CMAKE_FILES LIST_DIRECTORIES false "${SOURCE_PATH}/cmake/*.cmake") +file(COPY ${CMAKE_FILES} DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") + +configure_file("${CMAKE_CURRENT_LIST_DIR}/usage" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" @ONLY) + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/License.txt") diff --git a/vcpkg/ports/blpapi/update-blpapi-lib-include-dir.patch b/vcpkg/ports/blpapi/update-blpapi-lib-include-dir.patch new file mode 100644 index 0000000..401d77a --- /dev/null +++ b/vcpkg/ports/blpapi/update-blpapi-lib-include-dir.patch @@ -0,0 +1,46 @@ +diff --git a/cmake/blpapiTargets-release.cmake b/cmake/blpapiTargets-release.cmake +index 12bcaa6..af5c135 100644 +--- a/cmake/blpapiTargets-release.cmake ++++ b/cmake/blpapiTargets-release.cmake +@@ -5,21 +5,18 @@ + # Import targets for configuration "Release". + + # Path to blpapi shared object in relation to blpapiConfig.cmake: +-# 1. On Windows +-# a. For release ../lib/ +-# 2. On other platforms +-# a. For release ../<SystemName>/. For example for linux it is ../Linux/ ++# 1. For release ../../lib/ + + # Windows + if(WIN32) + set(_BLPAPI_SHARED_OBJ_NAME "${_BLPAPI_PREFIX}_${_ARCH}.dll") + set(_BLPAPI_SHARED_IMP_OBJ_NAME "${_BLPAPI_PREFIX}_${_ARCH}.lib") +- set(_BLPAPI_SHARED_OBJ "${_BLPAPI_CONFIG_CMAKE_DIR}/../lib/${_BLPAPI_SHARED_OBJ_NAME}") +- set(_BLPAPI_IMP_OBJ "${_BLPAPI_CONFIG_CMAKE_DIR}/../lib/${_BLPAPI_SHARED_IMP_OBJ_NAME}") ++ set(_BLPAPI_SHARED_OBJ "${_BLPAPI_CONFIG_CMAKE_DIR}/../../bin/${_BLPAPI_SHARED_OBJ_NAME}") ++ set(_BLPAPI_IMP_OBJ "${_BLPAPI_CONFIG_CMAKE_DIR}/../../lib/${_BLPAPI_SHARED_IMP_OBJ_NAME}") + else() # Other platforms + set(_BLPAPI_SHARED_OBJ_NAME "lib${_BLPAPI_PREFIX}_${_ARCH}.so") + set(_BLPAPI_SHARED_OBJ +- "${_BLPAPI_CONFIG_CMAKE_DIR}/../${CMAKE_SYSTEM_NAME}/${_BLPAPI_SHARED_OBJ_NAME}") ++ "${_BLPAPI_CONFIG_CMAKE_DIR}/../../lib/${_BLPAPI_SHARED_OBJ_NAME}") + endif() + + set_property(TARGET blpapi APPEND PROPERTY IMPORTED_LOCATION "${_BLPAPI_SHARED_OBJ}") +diff --git a/cmake/blpapiTargets.cmake b/cmake/blpapiTargets.cmake +index b4c4a73..ef4421c 100644 +--- a/cmake/blpapiTargets.cmake ++++ b/cmake/blpapiTargets.cmake +@@ -47,9 +47,9 @@ unset(_expectedTargets) + # Create imported shared object target blpapi. + add_library(blpapi SHARED IMPORTED) + +-# Include headers can be found at ../include/ from location ++# Include headers can be found at ../../include/ from location + # of blpapiConfig.cmake file. +-set(_BLPAPI_LIB_INCLUDE_DIR "${_BLPAPI_CONFIG_CMAKE_DIR}/../include") ++set(_BLPAPI_LIB_INCLUDE_DIR "${_BLPAPI_CONFIG_CMAKE_DIR}/../../include") + + # Add path to the include directories. + set_property(TARGET blpapi APPEND PROPERTY diff --git a/vcpkg/ports/blpapi/usage b/vcpkg/ports/blpapi/usage new file mode 100644 index 0000000..3802d90 --- /dev/null +++ b/vcpkg/ports/blpapi/usage @@ -0,0 +1,4 @@ +The package blpapi provides CMake targets: + + find_package(blpapi CONFIG REQUIRED) + target_link_libraries(main PRIVATE blpapi) diff --git a/vcpkg/ports/blpapi/vcpkg.json b/vcpkg/ports/blpapi/vcpkg.json new file mode 100644 index 0000000..17cf6e9 --- /dev/null +++ b/vcpkg/ports/blpapi/vcpkg.json @@ -0,0 +1,7 @@ +{ + "name": "blpapi", + "version": "3.25.1", + "description": "Bloomberg API Library (BLPAPI)", + "homepage": "https://www.bloomberg.com/professional/support/api-library/", + "supports": "(linux | (windows & !uwp)) & !static & (x86 | x64)" +} |