Skip to content

Commit

Permalink
Add samples into samples folders (Azure#352)
Browse files Browse the repository at this point in the history
* Add samples into Sample folders
Add ability to build the SDK without building samples
  -By default samples are built
  -To disable samples set AZ_SDK_C_NO_SAMPLES=1
  • Loading branch information
RickWinter authored Feb 13, 2020
1 parent 8895f4e commit 3bfc7ee
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 22 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,9 @@ add_subdirectory(sdk/core/core)
add_subdirectory(sdk/transport_policies/curl)
add_subdirectory(sdk/keyvault/keyvault)
add_subdirectory(sdk/storage/blobs)

if(NOT DEFINED ENV{AZ_SDK_C_NO_SAMPLES})
add_subdirectory(sdk/keyvault/keyvault/samples)
add_subdirectory(sdk/storage/blobs/samples)
endif()
# add_subdirectory(sdk/storage/ustorageclient)
4 changes: 1 addition & 3 deletions sdk/core/core/samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ This document explains samples and how to use them.
This project welcomes contributions and suggestions. Find [more contributing][SDK_README_CONTRIBUTING] details here.

<!-- LINKS -->
[SDK_README_CONTRIBUTING]:../../README.md#contributing
[SDK_README_GETTING_STARTED]: ../../README.md#getting-started
[SDK_README_KEY_CONCEPTS]: ../../README.md#key-concepts
[SDK_README_CONTRIBUTING]: https://github.com/Azure/azure-sdk-for-c/blob/master/CONTRIBUTING.md

![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-c%2Fsdk%2Fcore%2Fcore%2Fsamples%2FREADME.png)
5 changes: 0 additions & 5 deletions sdk/keyvault/keyvault/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,8 @@ add_executable (az_keyvault_test test/main.c)
target_link_libraries(az_keyvault_test PRIVATE az_keyvault az_core_internal)
target_include_directories (az_keyvault_test PRIVATE src)

# make key vault POC
add_executable (az_keyvault_poc test/client_key_poc.c)
target_link_libraries(az_keyvault_poc PRIVATE az_keyvault az_core az_core_internal az_curl)

if (UNIX)
target_link_libraries(az_keyvault PRIVATE m)
target_link_libraries(az_keyvault_poc PRIVATE m)
endif()

add_test(NAME az_keyvault_test COMMAND az_keyvault_test)
19 changes: 19 additions & 0 deletions sdk/keyvault/keyvault/samples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# SPDX-License-Identifier: MIT

cmake_minimum_required (VERSION 3.12)

project (az_keyvault_keys_samples LANGUAGES C)

set(CMAKE_C_STANDARD 99)

# make keys client example
add_executable (keys_client_example src/keys_client_example.c)
target_link_libraries(keys_client_example PRIVATE az_keyvault az_core az_core_internal az_curl)

if (UNIX)
target_link_libraries(keys_client_example PRIVATE m)
endif()

# TODO, Add tests for samples
# add_test(NAME az_keyvault_test COMMAND az_keyvault_test)
10 changes: 5 additions & 5 deletions sdk/keyvault/keyvault/samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ Getting started explained in detail [here][SDK_README_GETTING_STARTED].
This project welcomes contributions and suggestions. Find [more contributing][SDK_README_CONTRIBUTING] details here.

<!-- LINKS -->
[BLOB_SDK_README]: ../../README.md
[SDK_README_CONTRIBUTING]:../../README.md#contributing
[SDK_README_GETTING_STARTED]: ../../README.md#getting-started
[SDK_README_KEY_CONCEPTS]: ../../README.md#key-concepts
[samples_basic]: src/BasicExample.c
[BLOB_SDK_README]: https://github.com/Azure/azure-sdk-for-c/blob/master/sdk/storage/blobs/README.md
[SDK_README_CONTRIBUTING]: https://github.com/Azure/azure-sdk-for-c/blob/master/CONTRIBUTING.md
[SDK_README_GETTING_STARTED]: https://github.com/Azure/azure-sdk-for-c/blob/master/README.md#getting-started
[SDK_README_KEY_CONCEPTS]: ../README.md#key-concepts
[samples_basic]: src/keys_client_example.c

![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-c%2Fsdk%2Fkeyvault%2Fkeys%2Fsamples%2FREADME.png)
File renamed without changes.
4 changes: 0 additions & 4 deletions sdk/storage/blobs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ add_library (az::storage::blobs ALIAS az_storage_blobs)
add_executable (az_storage_blobs_test test/main.c)
target_link_libraries(az_storage_blobs_test PRIVATE az_storage_blobs az_core_internal)

# make Storage POC
add_executable (az_storage_blobs_poc test/storage_blobs_poc.c)
target_link_libraries(az_storage_blobs_poc PRIVATE az_storage_blobs)

if (UNIX)
target_link_libraries(az_storage_blobs PRIVATE m)
endif()
Expand Down
19 changes: 19 additions & 0 deletions sdk/storage/blobs/samples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# SPDX-License-Identifier: MIT

cmake_minimum_required (VERSION 3.12)

project (az_storage_blobs_samples LANGUAGES C)

set(CMAKE_C_STANDARD 99)

# make keys client example
add_executable (blobs_client_example src/blobs_client_example.c)
target_link_libraries(blobs_client_example PRIVATE az_storage_blobs az_core az_core_internal az_curl)

if (UNIX)
target_link_libraries(blobs_client_example PRIVATE m)
endif()

# TODO, Add tests for samples
# add_test(NAME az_storage_blobs_samples_test COMMAND az_storage_blobs_samples_test)
10 changes: 5 additions & 5 deletions sdk/storage/blobs/samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ For more extensive documentation on Azure Storage blob, see the [API reference d
This project welcomes contributions and suggestions. Find [more contributing][SDK_README_CONTRIBUTING] details here.

<!-- LINKS -->
[BLOB_SDK_README]: ../../README.md
[SDK_README_CONTRIBUTING]:../../README.md#contributing
[SDK_README_GETTING_STARTED]: ../../README.md#getting-started
[SDK_README_KEY_CONCEPTS]: ../../README.md#key-concepts
[samples_basic]: src/BasicExample.c
[BLOB_SDK_README]: ../README.md
[SDK_README_CONTRIBUTING]:../README.md#contributing
[SDK_README_GETTING_STARTED]: ../README.md#getting-started
[SDK_README_KEY_CONCEPTS]: ../README.md#key-concepts
[samples_basic]: src/blobs_client_example.c
[storageblob_rest]: https://docs.microsoft.com/en-us/rest/api/storageservices/blob-service-rest-api
[error_codes]: https://docs.microsoft.com/rest/api/storageservices/blob-service-error-codes

Expand Down
File renamed without changes.

0 comments on commit 3bfc7ee

Please sign in to comment.