Skip to content

Updated CI to use build deps, updated readme, and aws-crt-cpp version. #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 8, 2019
Merged
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
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ elseif(NOT DEFINED CMAKE_INSTALL_LIBDIR)
set(CMAKE_INSTALL_LIBDIR "lib")
endif()

if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
endif()

if (BUILD_DEPS)
set(AWS_DEPS_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/deps CACHE STRING "If BUILD_DEPS is on, aws common runtime dependencies build in this directory.")
if (DEFINED CMAKE_INSTALL_PREFIX)
Expand Down Expand Up @@ -37,6 +41,7 @@ if (BUILD_DEPS)
-DCMAKE_PREFIX_PATH=${AWS_DEPS_INSTALL_DIR}
-DGIT_EXECUTABLE=${GIT_EXECUTABLE}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
${CMAKE_CURRENT_SOURCE_DIR}/aws-common-runtime
WORKING_DIRECTORY ${AWS_DEPS_BUILD_DIR}
)
Expand All @@ -53,6 +58,7 @@ if (BUILD_DEPS)
-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${CMAKE_CURRENT_BINARY_DIR}/bin
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
${CMAKE_CURRENT_SOURCE_DIR}/aws-common-runtime
WORKING_DIRECTORY ${AWS_DEPS_BUILD_DIR}
RESULT_VARIABLE BUILD_AWSCRT_EXIT_CODE
Expand Down
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ Until this project is promoted to General Availability, we advise you use the
for a stable development environment.

This SDK is built on the AWS Common Runtime, a collection of libraries
([1](https://github.com/awslabs/aws-c-common),
[2](https://github.com/awslabs/aws-c-io),
[3](https://github.com/awslabs/aws-c-mqtt),
[4](https://github.com/awslabs/aws-c-http),
[5](https://github.com/awslabs/aws-c-cal)...) written in C to be
([aws-c-common](https://github.com/awslabs/aws-c-common),
[aws-c-io](https://github.com/awslabs/aws-c-io),
[aws-c-mqtt](https://github.com/awslabs/aws-c-mqtt),
[aws-c-http](https://github.com/awslabs/aws-c-http),
[aws-c-cal](https://github.com/awslabs/aws-c-cal),
[aws-c-auth](https://github.com/awslabs/aws-c-auth),
[s2n](https://github.com/awslabs/s2n)...) written in C to be
cross-platform, high-performance, secure, and reliable. The libraries are bound
to C++ by the [aws-crt-cpp](https://github.com/awslabs/aws-crt-cpp) package.

Expand All @@ -30,22 +32,22 @@ is provided by code that been generated from a model of the service.
* Clang 3.9+ or GCC 4.4+ or MSVC 2015+

## Build from source
### Automatically Build and Install AWS Dependencies
```
git clone --branch v0.6.1 https://github.com/awslabs/aws-crt-cpp.git
git clone https://github.com/awslabs/aws-iot-device-sdk-cpp-v2.git
mkdir aws-crt-cpp-build
cd aws-crt-cpp-build
cmake -DCMAKE_INSTALL_PREFIX="<path to where you install>" -DCMAKE_PREFIX_PATH="<path to where you install>" -DBUILD_SHARED_LIBS=ON -DBUILD_DEPS=ON ../aws-crt-cpp
cmake --build . --target install
cd ..
mkdir aws-iot-device-sdk-cpp-v2-build
cd aws-iot-device-sdk-cpp-v2-build
cmake -DCMAKE_INSTALL_PREFIX="<path to where you install>" -DCMAKE_PREFIX_PATH="<path to where you install>" -DBUILD_SHARED_LIBS=ON ../aws-iot-device-sdk-cpp-v2
cmake -DCMAKE_INSTALL_PREFIX="<path to where you install>" -DBUILD_DEPS=ON ../aws-iot-device-sdk-cpp-v2
cmake --build . --target install
```
### Using a Pre-Built aws-crt-cpp (Most useful for development of this package)

Note: If you are updating an existing installation of `aws-crt-cpp`, you must delete and recreate `aws-crt-cpp-build` or it will not build correctly.

```
mkdir aws-iot-device-sdk-cpp-v2-build
cd aws-iot-device-sdk-cpp-v2-build
cmake -DCMAKE_INSTALL_PREFIX="<path to where you install>" -DCMAKE_PREFIX_PATH="<path to where you install>" -DBUILD_DEPS=OFF ../aws-iot-device-sdk-cpp-v2
cmake --build . --target install
```
# Samples

## Shadow
Expand Down Expand Up @@ -199,7 +201,6 @@ and receive.
## Greengrass Discovery
This sample is intended for direct usage with the Greengrass tutorial found [here](https://docs.aws.amazon.com/greengrass/latest/developerguide/gg-gs.html).


# License

This library is licensed under the Apache 2.0 License.
2 changes: 1 addition & 1 deletion aws-common-runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ set(AWS_DEPS_DOWNLOAD_DIR "${AWS_DEPS_BUILD_DIR}/downloads" CACHE PATH "Dependen
message("install dir ${AWS_DEPS_INSTALL_DIR}")

set(AWS_CRT_CPP_URL "https://github.com/awslabs/aws-crt-cpp.git")
set(AWS_CRT_CPP_SHA "v0.6.1")
set(AWS_CRT_CPP_SHA "v0.6.2")
include(BuildAwsCrtCpp)
3 changes: 3 additions & 0 deletions aws-common-runtime/cmake/BuildAwsCrtCpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ if("${TARGET_ARCH}" STREQUAL ANDROID)
-DANDROID_STL=${ANDROID_STL}
-DENABLE_HW_OPTIMIZATION=OFF
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-DBUILD_DEPS=ON
)
elseif(MSVC)
Expand All @@ -35,6 +36,7 @@ elseif(MSVC)
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-DBUILD_DEPS=ON
)
else()
Expand All @@ -51,6 +53,7 @@ else()
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-DBUILD_DEPS=ON
)
endif()
10 changes: 1 addition & 9 deletions codebuild/common-posix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,13 @@ BUILD_PATH=/tmp/builds
mkdir -p $BUILD_PATH
INSTALL_PATH=$BUILD_PATH/install
mkdir -p $INSTALL_PATH
CMAKE_ARGS="-DCMAKE_PREFIX_PATH=$INSTALL_PATH -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH $@"
CMAKE_ARGS="-DCMAKE_PREFIX_PATH=$INSTALL_PATH -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH -DBUILD_DEPS=ON $@"

# If TRAVIS_OS_NAME is OSX, skip this step (will resolve to empty string on CodeBuild)
if [ "$TRAVIS_OS_NAME" != "osx" ]; then
sudo apt-get install libssl-dev -y
fi

# build aws-crt-cpp
pushd $BUILD_PATH
git clone --branch v0.5.4 https://github.com/awslabs/aws-crt-cpp.git
cd aws-crt-cpp
cmake $CMAKE_ARGS -DBUILD_DEPS=ON ./
cmake --build . --target install
popd

# build SDK
mkdir -p build
pushd build
Expand Down
9 changes: 1 addition & 8 deletions codebuild/common-windows.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,10 @@ set INSTALL_DIR=%BUILDS_DIR%\install
mkdir %BUILDS_DIR%
mkdir %INSTALL_DIR%

@rem build aws-crt-cpp
mkdir %BUILDS_DIR%\aws-crt-cpp-build
cd %BUILDS_DIR%\aws-crt-cpp-build
git clone --branch v0.5.4 https://github.com/awslabs/aws-crt-cpp.git
cmake %CMAKE_ARGS% -DCMAKE_INSTALL_PREFIX="%INSTALL_DIR%" -DCMAKE_PREFIX_PATH="%INSTALL_DIR%" -DCMAKE_BUILD_TYPE="Release" -DBUILD_DEPS=ON aws-crt-cpp || goto error
cmake --build . --target install || goto error

@rem build SDK
mkdir %BUILDS_DIR%\aws-iot-device-sdk-cpp-v2-build
cd %BUILDS_DIR%\aws-iot-device-sdk-cpp-v2-build
cmake %CMAKE_ARGS% -DCMAKE_INSTALL_PREFIX="%INSTALL_DIR%" -DCMAKE_PREFIX_PATH="%INSTALL_DIR%" -DCMAKE_BUILD_TYPE="Release" %CODEBUILD_SRC_DIR% || goto error
cmake %CMAKE_ARGS% -DCMAKE_INSTALL_PREFIX="%INSTALL_DIR%" -DCMAKE_PREFIX_PATH="%INSTALL_DIR%" -DBUILD_DEPS=ON %CODEBUILD_SRC_DIR% || goto error
cmake --build . || goto error

goto :EOF
Expand Down