From fc05dab3389fe089d148f375d9b1921c5da95a69 Mon Sep 17 00:00:00 2001 From: Jeremy Gunawan Date: Wed, 18 Sep 2024 12:24:59 -0700 Subject: [PATCH 1/2] Add cmake flag for iot creds --- samples/CMakeLists.txt | 7 ++++++- samples/Samples.h | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index c37f243d0a..b1e97f55d3 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -6,6 +6,11 @@ project(KinesisVideoWebRTCClientSamples LANGUAGES C) message("OPEN_SRC_INSTALL_PREFIX=${OPEN_SRC_INSTALL_PREFIX}") +if(IOT_CORE_ENABLE_CREDENTIALS) + add_definitions(-DIOT_CORE_ENABLE_CREDENTIALS) + message("Use IoT credentials in the samples") +endif() + if (WIN32) if(NOT DEFINED PKG_CONFIG_EXECUTABLE) if(EXISTS "C:\\gstreamer\\1.0\\x86_64\\bin\\pkg-config.exe") @@ -17,7 +22,7 @@ if (WIN32) message(FATAL_ERROR "Gstreamer not found in default path. Set the appropriate path with -DPKG_CONFIG_EXECUTABLE=") endif() endif() - + find_package(PkgConfig REQUIRED) pkg_check_modules(GST gstreamer-1.0) diff --git a/samples/Samples.h b/samples/Samples.h index 5998043e54..785229cd19 100644 --- a/samples/Samples.h +++ b/samples/Samples.h @@ -64,7 +64,8 @@ extern "C" { #define IOT_CORE_THING_NAME ((PCHAR) "AWS_IOT_CORE_THING_NAME") #define IOT_CORE_CERTIFICATE_ID ((PCHAR) "AWS_IOT_CORE_CERTIFICATE_ID") -/* Uncomment the following line in order to enable IoT credentials checks in the provided samples */ +/* Uncomment the following line in order to enable IoT credentials checks in the provided samples + Or, you pass specify this through the CMake flag: cmake .. -DIOT_CORE_ENABLE_CREDENTIALS=ON */ // #define IOT_CORE_ENABLE_CREDENTIALS 1 #define MASTER_DATA_CHANNEL_MESSAGE "This message is from the KVS Master" From db266c3a10a4f6327a82346fcb3048237ab63d7b Mon Sep 17 00:00:00 2001 From: Jeremy Gunawan Date: Wed, 18 Sep 2024 13:06:09 -0700 Subject: [PATCH 2/2] Remove the manual uncomment required line --- samples/Samples.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/samples/Samples.h b/samples/Samples.h index 785229cd19..f99de6224d 100644 --- a/samples/Samples.h +++ b/samples/Samples.h @@ -57,6 +57,8 @@ extern "C" { #define RTSP_PIPELINE_MAX_CHAR_COUNT 1000 +/* To enable IoT credentials checks in the provided samples, specify + this through the CMake flag: cmake .. -DIOT_CORE_ENABLE_CREDENTIALS=ON */ #define IOT_CORE_CREDENTIAL_ENDPOINT ((PCHAR) "AWS_IOT_CORE_CREDENTIAL_ENDPOINT") #define IOT_CORE_CERT ((PCHAR) "AWS_IOT_CORE_CERT") #define IOT_CORE_PRIVATE_KEY ((PCHAR) "AWS_IOT_CORE_PRIVATE_KEY") @@ -64,10 +66,6 @@ extern "C" { #define IOT_CORE_THING_NAME ((PCHAR) "AWS_IOT_CORE_THING_NAME") #define IOT_CORE_CERTIFICATE_ID ((PCHAR) "AWS_IOT_CORE_CERTIFICATE_ID") -/* Uncomment the following line in order to enable IoT credentials checks in the provided samples - Or, you pass specify this through the CMake flag: cmake .. -DIOT_CORE_ENABLE_CREDENTIALS=ON */ -// #define IOT_CORE_ENABLE_CREDENTIALS 1 - #define MASTER_DATA_CHANNEL_MESSAGE "This message is from the KVS Master" #define VIEWER_DATA_CHANNEL_MESSAGE "This message is from the KVS Viewer"