-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#### *Issue #, if available:* #147 #### *Description of changes:* - Added stand-alone sample - CI will build the stand-alone samples for testing as well
- Loading branch information
Showing
7 changed files
with
1,179 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,61 @@ | ||
{ | ||
"name": "aws-iot-device-sdk-cpp-v2", | ||
"!cmake_args": [ | ||
"-DBUILD_DEPS=ON", | ||
"-DPERFORM_HEADER_CHECK=OFF", | ||
"-DS2N_NO_PQ_ASM=ON" | ||
], | ||
"targets": { | ||
"linux" : { | ||
"imports": [ | ||
"s2n" | ||
] | ||
} | ||
}, | ||
"search_dirs": ["crt"], | ||
"hosts": { | ||
"manylinux": { | ||
"architectures": { | ||
"x86": { | ||
"!yum_compiler_packages": [] | ||
} | ||
} | ||
"name": "aws-iot-device-sdk-cpp-v2", | ||
"!cmake_args": [ | ||
"-DBUILD_DEPS=ON", | ||
"-DPERFORM_HEADER_CHECK=OFF", | ||
"-DS2N_NO_PQ_ASM=ON" | ||
], | ||
"targets": { | ||
"linux": { | ||
"imports": ["s2n"] | ||
} | ||
}, | ||
"search_dirs": ["crt"], | ||
"hosts": { | ||
"manylinux": { | ||
"architectures": { | ||
"x86": { | ||
"!yum_compiler_packages": [] | ||
} | ||
} | ||
} | ||
}, | ||
"test_steps": [ | ||
[ | ||
"mkdir", | ||
"build_shadow" | ||
], | ||
[ | ||
"cmake", | ||
"--version" | ||
], | ||
[ | ||
"cmake", | ||
"-Bbuild_shadow", | ||
"-Hsamples/stand-alone-samples/shadow/shadow_sync/", | ||
"-DCMAKE_INSTALL_PREFIX={install_dir}", | ||
"-DCMAKE_PREFIX_PATH={install_dir}", | ||
"-DCMAKE_BUILD_TYPE=Release", | ||
"-DLibCrypto_INCLUDE_DIR={deps_dir}/libcrypto/include", | ||
"-DLibCrypto_SHARED_LIBRARY={deps_dir}/libcrypto/lib/libcrypto.so", | ||
"-DLibCrypto_STATIC_LIBRARY={deps_dir}/libcrypto/lib/libcrypto.a" | ||
], | ||
[ "cmake", "--build", "build_shadow", "--config", "Release" ], | ||
[ | ||
"mkdir", | ||
"build_pubsub" | ||
], | ||
[ | ||
"cmake", | ||
"-Bbuild_pubsub", | ||
"-Hsamples/stand-alone-samples/basic_pub_sub/", | ||
"-DCMAKE_INSTALL_PREFIX={install_dir}", | ||
"-DCMAKE_PREFIX_PATH={install_dir}", | ||
"-DCMAKE_BUILD_TYPE=Release", | ||
"-DLibCrypto_INCLUDE_DIR={deps_dir}/libcrypto/include", | ||
"-DLibCrypto_SHARED_LIBRARY={deps_dir}/libcrypto/lib/libcrypto.so", | ||
"-DLibCrypto_STATIC_LIBRARY={deps_dir}/libcrypto/lib/libcrypto.a" | ||
], | ||
[ "cmake", "--build", "build_pubsub", "--config", "Release" ] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Stand-alone Samples | ||
|
||
## building instruction | ||
|
||
Firstly, build the project with the following instruction. | ||
|
||
``` sh | ||
mkdir sdk-cpp-workspace | ||
cd sdk-cpp-workspace | ||
git clone --recursive https://github.com/aws/aws-iot-device-sdk-cpp-v2.git | ||
mkdir aws-iot-device-sdk-cpp-v2-build | ||
cd aws-iot-device-sdk-cpp-v2-build | ||
cmake -DCMAKE_INSTALL_PREFIX="<absolute path sdk-cpp-workspace dir>" -DBUILD_DEPS=ON -DCMAKE_BUILD_TYPE=Release ../aws-iot-device-sdk-cpp-v2 | ||
cmake --build . --config Release --target install | ||
``` | ||
|
||
Then, change directory into stand-alone-samples. | ||
|
||
In stand-alone-samples/shadow/shadow_sync/ or stand-alone-samples/basic_pub_sub/: | ||
|
||
``` sh | ||
mkdir build | ||
cd build | ||
cmake -DCMAKE_INSTALL_PREFIX="<absolute path sdk-cpp-workspace dir>" -DCMAKE_BUILD_TYPE=Release .. | ||
cmake --build . --config Release | ||
``` | ||
|
||
Note: for linux machine, you may need to indicate the path to libcrypto, because of the dependency of S2N. Following commands as below: | ||
|
||
``` sh | ||
mkdir build | ||
cd build | ||
cmake -DCMAKE_PREFIX_PATH="<absolute path sdk-cpp-workspace dir>" -DLibCrypto_INCLUDE_DIR="<path to include dir>" -DLibCrypto_STATIC_LIBRARY="<path to libcrypto.a file>" -DCMAKE_BUILD_TYPE=Release .. | ||
cmake --build . --config Release | ||
``` | ||
|
||
To debug, just change every mentioned `Release` to `Debug`. | ||
The binary executable file will be under build/. for Linux/Mac, and under build/release for Windows. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(basic-pub-sub CXX) | ||
|
||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_INSTALL_PREFIX}/lib/cmake") | ||
|
||
file(GLOB PUB_SUB_SRC | ||
"*.cpp" | ||
) | ||
|
||
add_executable(${PROJECT_NAME} ${PUB_SUB_SRC}) | ||
|
||
set_target_properties(${PROJECT_NAME} PROPERTIES | ||
LINKER_LANGUAGE CXX | ||
CXX_STANDARD 11) | ||
|
||
if(COMMAND cmake_policy) | ||
cmake_policy(SET CMP0003 NEW) | ||
endif(COMMAND cmake_policy) | ||
|
||
#set warnings | ||
if (MSVC) | ||
target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX /wd4068) | ||
else () | ||
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wno-long-long -pedantic -Werror) | ||
endif () | ||
|
||
find_package(aws-crt-cpp REQUIRED) | ||
|
||
target_link_libraries(${PROJECT_NAME} AWS::aws-crt-cpp) |
Oops, something went wrong.