-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
3 changed files
with
57 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) | ||
|
||
project(coreMQTT) | ||
cmake_minimum_required(VERSION 3.5) | ||
|
||
set(PROJECT_ROOT ${CMAKE_CURRENT_SOURCE_DIR}) | ||
set(COREMQTT "coreMQTT-2.3.0") | ||
set(CMAKE_C_FLAGS $ENV{EXPORT_CFLAGS}) | ||
|
||
set(SRC_FILES | ||
"${PROJECT_ROOT}/${COREMQTT}/source/core_mqtt.c" | ||
"${PROJECT_ROOT}/${COREMQTT}/source/core_mqtt_state.c" | ||
"${PROJECT_ROOT}/${COREMQTT}/source/core_mqtt_serializer.c" | ||
) | ||
|
||
set(INCLUDE_PATHS "${PROJECT_ROOT}/${COREMQTT}/source/include" "${PROJECT_ROOT}/${COREMQTT}/source/interface") | ||
|
||
add_library(${PROJECT_NAME} STATIC ${SRC_FILES}) | ||
|
||
if (DEFINED ENV{COREMQTT_CONFIG_DIR}) | ||
target_include_directories(${PROJECT_NAME} PRIVATE $ENV{COREMQTT_CONFIG_DIR}) | ||
else() | ||
add_compile_definitions(MQTT_DO_NOT_USE_CUSTOM_CONFIG) | ||
endif() | ||
|
||
target_include_directories(${PROJECT_NAME} PRIVATE ${INCLUDE_PATHS}) |
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 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
COREMQTT_VERSION="2.3.0" | ||
COREMQTT="coreMQTT-${COREMQTT_VERSION}" | ||
PKG_URL="https://github.com/FreeRTOS/coreMQTT/archive/refs/tags/v${COREMQTT_VERSION}.tar.gz" | ||
|
||
b_log "Building coreMQTT" | ||
PREFIX_COREMQTT="${PREFIX_PROJECT}/phoenix-rtos-ports/coreMQTT" | ||
PREFIX_COREMQTT_BUILD="${PREFIX_BUILD}/coreMQTT" | ||
PREFIX_COREMQTT_SRC="${PREFIX_COREMQTT_BUILD}/${COREMQTT}/source" | ||
PREFIX_COREMQTT_INSTALL="${PREFIX_COREMQTT_BUILD}/install" | ||
|
||
mkdir -p "$PREFIX_COREMQTT_BUILD" "$PREFIX_COREMQTT_INSTALL" | ||
if [ ! -f "$PREFIX_COREMQTT/v${COREMQTT_VERSION}.tar.gz" ]; then | ||
wget "$PKG_URL" -P "${PREFIX_COREMQTT}" --no-check-certificate; | ||
fi | ||
|
||
[ -d "$PREFIX_COREMQTT_SRC" ] || tar zxf "$PREFIX_COREMQTT/v${COREMQTT_VERSION}.tar.gz" -C "$PREFIX_COREMQTT_BUILD" | ||
|
||
cp "${PREFIX_COREMQTT}/CMakeLists.txt" "${PREFIX_COREMQTT_BUILD}/CMakeLists.txt" | ||
|
||
cmake -S "$PREFIX_COREMQTT_BUILD" -B "$PREFIX_COREMQTT_INSTALL" | ||
make -C "$PREFIX_COREMQTT_INSTALL" | ||
|
||
cp -a "$PREFIX_COREMQTT_SRC/include/"*".h" "$PREFIX_H" | ||
cp -a "$PREFIX_COREMQTT_SRC/interface/"*".h" "$PREFIX_H" | ||
cp -a "$PREFIX_COREMQTT_INSTALL/libcoreMQTT.a" "$PREFIX_A" |