Skip to content
Open
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
40 changes: 40 additions & 0 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: C/C++ CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
strategy:
matrix:
os: [ubuntu-16.04, ubuntu-18.04, ubuntu-20.04, macos-latest]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- name: Run vcpkg
uses: lukka/run-vcpkg@v3
with:
vcpkgArguments: 'curl openssl libuuid'
vcpkgDirectory: '${{ runner.workspace }}/b/vcpkg'
vcpkgGitCommitId: '2cb28482bb5f10332b3458502a3370f821b8f69c'
- name: Run CMake+Ninja
uses: lukka/run-cmake@v2
with:
cmakeGenerator: 'Ninja'
cmakeListsOrSettingsJson: 'CMakeListsTxtAdvanced'
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
cmakeAppendedArgs: '-DCMAKE_INSTALL_PREFIX=${{ runner.workspace }}/install'
buildWithCMakeArgs: '-t install'
useVcpkgToolchainFile: true
buildDirectory: '${{ runner.workspace }}/build'
env:
PKG_CONFIG_PATH: ${{ runner.workspace }}/b/vcpkg/installed/x64-linux/lib/pkgconfig
- uses: actions/upload-artifact@v2
with:
name: azure-storage-cpplite
path: '${{ runner.workspace }}/install/**/*'
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ if (UNIX)
list(APPEND EXTRA_LIBRARIES ${GNUTLS_LIBRARIES})
endif()

if(NOT APPLE)
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Linux)
find_package(PkgConfig REQUIRED)
pkg_check_modules(uuid REQUIRED IMPORTED_TARGET uuid)
list(APPEND EXTRA_LIBRARIES PkgConfig::uuid)
Expand Down
20 changes: 16 additions & 4 deletions src/utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#else
#ifdef __QNXNTO__
#include <uuid.h> // OSSP uuid
#else
#include <uuid/uuid.h>
#endif
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
Expand Down Expand Up @@ -37,11 +41,19 @@ namespace azure { namespace storage_lite {
res = std::string(uuid_cstr);
RpcStringFreeA(reinterpret_cast<RPC_CSTR*>(&uuid_cstr));
#else
uuid_t uuid;
char uuid_cstr[37]; // 36 byte uuid plus null.
uuid_generate(uuid);
uuid_unparse(uuid, uuid_cstr);
res = std::string(uuid_cstr);
#ifdef __UUID_H__
uuid_t *uuid;
uuid_create(&uuid);
uuid_make(uuid, UUID_MAKE_V1);
uuid_export(uuid, UUID_FMT_STR, &uuid_cstr, NULL);
uuid_destroy(uuid);
#else
uuid_t uuid;
uuid_generate(uuid);
uuid_unparse(uuid, uuid_cstr);
#endif
res = std::string(uuid_cstr);
#endif

return res;
Expand Down