diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml new file mode 100644 index 0000000..63fc83d --- /dev/null +++ b/.github/workflows/c-cpp.yml @@ -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/**/*' diff --git a/CMakeLists.txt b/CMakeLists.txt index 0a6cc58..b0d89da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/src/utility.cpp b/src/utility.cpp index 538df8e..23bbae1 100644 --- a/src/utility.cpp +++ b/src/utility.cpp @@ -8,7 +8,11 @@ #define WIN32_LEAN_AND_MEAN #include #else +#ifdef __QNXNTO__ +#include // OSSP uuid +#else #include +#endif #include #include #include @@ -37,11 +41,19 @@ namespace azure { namespace storage_lite { res = std::string(uuid_cstr); RpcStringFreeA(reinterpret_cast(&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;