forked from SoftFever/OrcaSlicer
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
22236fe
commit d45385d
Showing
127 changed files
with
44,241 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
# CMakeLists.txt | ||
# | ||
# Top-level CMake file for the Paho C++ library. | ||
# | ||
#******************************************************************************* | ||
# This is part of the Paho MQTT C++ client library. | ||
# | ||
# Copyright (c) 2016-2017, Guilherme Maciel Ferreira | ||
# Copyright (c) 2017-2023, Frank Pagliughi | ||
# | ||
# All rights reserved. This program and the accompanying materials | ||
# are made available under the terms of the Eclipse Public License v2.0 | ||
# and Eclipse Distribution License v1.0 which accompany this distribution. | ||
# | ||
# The Eclipse Public License is available at | ||
# http://www.eclipse.org/legal/epl-v20.html | ||
# and the Eclipse Distribution License is available at | ||
# http://www.eclipse.org/org/documents/edl-v10.php. | ||
# | ||
# Contributors: | ||
# Guilherme Maciel Ferreira - initial version | ||
# Frank Pagliughi | ||
#*******************************************************************************/ | ||
|
||
cmake_minimum_required(VERSION 3.5) | ||
|
||
project(PahoMqttCpp VERSION "1.4.0") | ||
|
||
## --- Build options --- | ||
|
||
if(WIN32) | ||
option(PAHO_BUILD_STATIC "Build static library" TRUE) | ||
option(PAHO_BUILD_SHARED "Build shared library (DLL)" FALSE) | ||
option(PAHO_WITH_SSL "Build SSL-enabled library" FALSE) | ||
else() | ||
option(PAHO_BUILD_STATIC "Build static library" FALSE) | ||
option(PAHO_BUILD_SHARED "Build shared library" TRUE) | ||
option(PAHO_WITH_SSL "Build SSL-enabled library" TRUE) | ||
option(PAHO_BUILD_DEB_PACKAGE "Build debian package" FALSE) | ||
endif() | ||
|
||
option(PAHO_BUILD_SAMPLES "Build sample/example programs" FALSE) | ||
option(PAHO_BUILD_EXAMPLES "Build sample/example programs" FALSE) | ||
option(PAHO_BUILD_TESTS "Build tests (requires Catch2)" FALSE) | ||
option(PAHO_BUILD_DOCUMENTATION "Create and install the API documentation (requires Doxygen)" FALSE) | ||
option(PAHO_WITH_MQTT_C "Build Paho C from the internal GIT submodule." TRUE) | ||
|
||
if(NOT PAHO_BUILD_SHARED AND NOT PAHO_BUILD_STATIC) | ||
message(FATAL_ERROR "You must set either PAHO_BUILD_SHARED, PAHO_BUILD_STATIC, or both") | ||
endif() | ||
|
||
## --- Find Paho C or build it, if reqested --- | ||
|
||
if(PAHO_WITH_SSL) | ||
find_package(OpenSSL REQUIRED) | ||
set(PAHO_MQTT_C_LIB paho-mqtt3as) | ||
else() | ||
set(PAHO_MQTT_C_LIB paho-mqtt3a) | ||
endif() | ||
|
||
if(PAHO_WITH_MQTT_C) | ||
message(STATUS "Paho C: Bundled") | ||
|
||
## Build the Paho C library from the submodule | ||
set(PAHO_ENABLE_TESTING FALSE CACHE BOOL "No Paho C tests") | ||
set(PAHO_HIGH_PERFORMANCE TRUE CACHE BOOL "Paho C high performance") | ||
|
||
# TODO: Remove this when the next Paho C update is released. | ||
set(CMAKE_POLICY_DEFAULT_CMP0048 NEW) | ||
|
||
add_subdirectory(${PROJECT_SOURCE_DIR}/externals/paho-mqtt-c) | ||
|
||
## Alias namespace so that the full names can be used with the subdir. | ||
if(PAHO_BUILD_SHARED) | ||
add_library(eclipse-paho-mqtt-c::paho-mqtt3a ALIAS paho-mqtt3a) | ||
list(APPEND PAHO_MQTT_C_LIBS paho-mqtt3a) | ||
if(PAHO_WITH_SSL) | ||
add_library(eclipse-paho-mqtt-c::paho-mqtt3as ALIAS paho-mqtt3as) | ||
list(APPEND PAHO_MQTT_C_LIBS paho-mqtt3as) | ||
endif() | ||
endif() | ||
|
||
if(PAHO_BUILD_STATIC) | ||
add_library(eclipse-paho-mqtt-c::paho-mqtt3a-static ALIAS paho-mqtt3a-static) | ||
list(APPEND PAHO_MQTT_C_LIBS paho-mqtt3a-static) | ||
if(PAHO_WITH_SSL) | ||
add_library(eclipse-paho-mqtt-c::paho-mqtt3as-static ALIAS paho-mqtt3as-static) | ||
list(APPEND PAHO_MQTT_C_LIBS paho-mqtt3as-static) | ||
endif() | ||
endif() | ||
|
||
## install paho.mqtt.c library (appending to PahoMqttCpp export) | ||
install(TARGETS ${PAHO_MQTT_C_LIBS} | ||
EXPORT PahoMqttCpp | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
) | ||
else() | ||
find_package(eclipse-paho-mqtt-c REQUIRED) | ||
endif() | ||
|
||
## --- C++11 build flags --- | ||
|
||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
|
||
# Generate position-independent code (-fPIC on UNIX) | ||
set(CMAKE_POSITION_INDEPENDENT_CODE ON) | ||
|
||
# --- System Details --- | ||
|
||
include(GNUInstallDirs) | ||
|
||
if(WIN32) | ||
add_definitions(-D_CRT_SECURE_NO_WARNINGS) | ||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) | ||
set(LIBS_SYSTEM ws2_32) | ||
endif() | ||
|
||
## --- Build directories --- | ||
|
||
# --- The headers --- | ||
|
||
add_subdirectory(include/mqtt) | ||
|
||
# For the paho_mqtt_c module | ||
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) | ||
add_subdirectory(src) | ||
|
||
# --- Documentation --- | ||
|
||
if(PAHO_BUILD_DOCUMENTATION) | ||
add_subdirectory(doc) | ||
endif() | ||
|
||
# --- Default library for samples and unit tests --- | ||
|
||
if(PAHO_BUILD_SHARED) | ||
set(PAHO_CPP_LIB paho-mqttpp3) | ||
else() | ||
set(PAHO_CPP_LIB paho-mqttpp3-static) | ||
endif() | ||
|
||
# --- Example Apps --- | ||
|
||
if(PAHO_BUILD_SAMPLES OR PAHO_BUILD_EXAMPLES) | ||
add_subdirectory(examples) | ||
endif() | ||
|
||
# --- Unit Tests --- | ||
|
||
if(PAHO_BUILD_TESTS) | ||
add_subdirectory(test/unit) | ||
endif() | ||
|
||
## --- Packaging settings --- | ||
|
||
if(WIN32) | ||
set(CPACK_GENERATOR "ZIP") | ||
elseif(UNIX) | ||
if(PAHO_BUILD_DEB_PACKAGE) | ||
set(CPACK_GENERATOR "DEB") | ||
include(cmake/CPackDebConfig.cmake) | ||
else() | ||
set(CPACK_GENERATOR "TGZ") | ||
endif() | ||
endif() | ||
|
||
include(CPack) | ||
|
||
add_subdirectory(cmake) |
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,46 @@ | ||
# CMakeLists.txt | ||
# | ||
# CMake export file for the Paho C++ library. | ||
# | ||
#******************************************************************************* | ||
# This is part of the Paho MQTT C++ client library. | ||
# | ||
# Copyright (c) 2017-2023, Frank Pagliughi | ||
# | ||
# All rights reserved. This program and the accompanying materials | ||
# are made available under the terms of the Eclipse Public License v2.0 | ||
# and Eclipse Distribution License v1.0 which accompany this distribution. | ||
# | ||
# The Eclipse Public License is available at | ||
# http://www.eclipse.org/legal/epl-v20.html | ||
# and the Eclipse Distribution License is available at | ||
# http://www.eclipse.org/org/documents/edl-v10.php. | ||
#*******************************************************************************/ | ||
|
||
set(package_name PahoMqttCpp) | ||
configure_file(${package_name}Config.cmake.in ${package_name}Config.cmake @ONLY) | ||
|
||
include(CMakePackageConfigHelpers) | ||
|
||
write_basic_package_version_file( | ||
"${CMAKE_CURRENT_BINARY_DIR}/${package_name}ConfigVersion.cmake" | ||
VERSION ${PROJECT_VERSION} | ||
COMPATIBILITY SameMajorVersion | ||
) | ||
|
||
export(EXPORT ${package_name} | ||
FILE "${CMAKE_CURRENT_BINARY_DIR}/${package_name}Targets.cmake" | ||
NAMESPACE ${package_name}:: | ||
) | ||
|
||
install(EXPORT ${package_name} | ||
DESTINATION lib/cmake/${package_name} | ||
FILE ${package_name}Targets.cmake | ||
NAMESPACE ${package_name}:: | ||
) | ||
|
||
install(FILES | ||
"${CMAKE_CURRENT_BINARY_DIR}/${package_name}Config.cmake" | ||
"${CMAKE_CURRENT_BINARY_DIR}/${package_name}ConfigVersion.cmake" | ||
DESTINATION lib/cmake/${package_name} | ||
) |
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,10 @@ | ||
if(CPACK_GENERATOR MATCHES "DEB") | ||
set(CPACK_PACKAGE_NAME "libpaho-mqtt.cpp") | ||
set(CPACK_DEBIAN_PACKAGE_NAME ${CPACK_PACKAGE_NAME}) | ||
set(CPACK_PACKAGE_CONTACT "Eclipse") | ||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Eclipse Paho MQTT C++ client") | ||
set(CPACK_DEBIAN_PACKAGE_MAINTAINER " <>") | ||
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) | ||
set(CPACK_DEBIAN_PACKAGE_VERSION ${PACKAGE_VERSION}) | ||
set(CPACK_DEBIAN_PACKAGE_SECTION "net") | ||
endif() |
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,19 @@ | ||
# save build-time options | ||
set(PAHO_BUILD_STATIC @PAHO_BUILD_STATIC@) | ||
set(PAHO_BUILD_SHARED @PAHO_BUILD_SHARED@) | ||
set(PAHO_WITH_SSL @PAHO_WITH_SSL@) | ||
set(PAHO_WITH_MQTT_C @PAHO_WITH_MQTT_C@) | ||
|
||
include(CMakeFindDependencyMacro) | ||
|
||
find_dependency(Threads REQUIRED) | ||
|
||
if (NOT PAHO_WITH_MQTT_C) | ||
find_dependency(eclipse-paho-mqtt-c REQUIRED) | ||
endif() | ||
|
||
if (PAHO_WITH_SSL) | ||
find_dependency(OpenSSL REQUIRED) | ||
endif() | ||
|
||
include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]") |
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,130 @@ | ||
#******************************************************************************* | ||
# Copyright (c) 2015, 2023 logi.cals GmbH and others | ||
# | ||
# All rights reserved. This program and the accompanying materials | ||
# are made available under the terms of the Eclipse Public License v2.0 | ||
# and Eclipse Distribution License v1.0 which accompany this distribution. | ||
# | ||
# The Eclipse Public License is available at | ||
# https://www.eclipse.org/legal/epl-2.0/ | ||
# and the Eclipse Distribution License is available at | ||
# http://www.eclipse.org/org/documents/edl-v10.php. | ||
# | ||
# Contributors: | ||
# Rainer Poisel - initial version | ||
# Genis Riera Perez - Add support for building debian package | ||
#*******************************************************************************/ | ||
|
||
# Note: on OS X you should install XCode and the associated command-line tools | ||
|
||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12) | ||
PROJECT("Eclipse Paho C" C) | ||
MESSAGE(STATUS "CMake version: " ${CMAKE_VERSION}) | ||
MESSAGE(STATUS "CMake system name: " ${CMAKE_SYSTEM_NAME}) | ||
|
||
SET(CMAKE_SCRIPTS "${CMAKE_SOURCE_DIR}/cmake") | ||
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules") | ||
|
||
## build settings | ||
file(READ version.major PAHO_VERSION_MAJOR) | ||
file(READ version.minor PAHO_VERSION_MINOR) | ||
file(READ version.patch PAHO_VERSION_PATCH) | ||
SET(CLIENT_VERSION ${PAHO_VERSION_MAJOR}.${PAHO_VERSION_MINOR}.${PAHO_VERSION_PATCH}) | ||
|
||
INCLUDE(GNUInstallDirs) | ||
|
||
STRING(TIMESTAMP BUILD_TIMESTAMP UTC) | ||
MESSAGE(STATUS "Timestamp is ${BUILD_TIMESTAMP}") | ||
|
||
IF(WIN32) | ||
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE -DWIN32_LEAN_AND_MEAN) | ||
ELSEIF(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") | ||
ADD_DEFINITIONS(-DOSX) | ||
ENDIF() | ||
|
||
## build options | ||
SET(PAHO_WITH_SSL FALSE CACHE BOOL "Flag that defines whether to build ssl-enabled binaries too. ") | ||
SET(PAHO_WITH_LIBUUID FALSE CACHE BOOL "Flag that defines whether libuuid or a custom uuid implementation should be used") | ||
SET(PAHO_BUILD_SHARED TRUE CACHE BOOL "Build shared library") | ||
SET(PAHO_BUILD_STATIC FALSE CACHE BOOL "Build static library") | ||
SET(PAHO_BUILD_DOCUMENTATION FALSE CACHE BOOL "Create and install the HTML based API documentation (requires Doxygen)") | ||
SET(PAHO_BUILD_SAMPLES FALSE CACHE BOOL "Build sample programs") | ||
SET(PAHO_BUILD_DEB_PACKAGE FALSE CACHE BOOL "Build debian package") | ||
SET(PAHO_ENABLE_TESTING TRUE CACHE BOOL "Build tests and run") | ||
SET(PAHO_ENABLE_CPACK TRUE CACHE BOOL "Enable CPack") | ||
SET(PAHO_HIGH_PERFORMANCE FALSE CACHE BOOL "Disable tracing and heap tracking") | ||
SET(PAHO_USE_SELECT FALSE CACHE BOOL "Revert to select system call instead of poll") | ||
|
||
IF (PAHO_HIGH_PERFORMANCE) | ||
ADD_DEFINITIONS(-DHIGH_PERFORMANCE=1) | ||
ENDIF() | ||
|
||
IF (PAHO_USE_SELECT) | ||
ADD_DEFINITIONS(-DUSE_SELECT=1) | ||
ENDIF() | ||
|
||
IF (PAHO_WITH_LIBUUID) | ||
ADD_DEFINITIONS(-DUSE_LIBUUID=1) | ||
ENDIF() | ||
|
||
IF (NOT PAHO_BUILD_SHARED AND NOT PAHO_BUILD_STATIC) | ||
MESSAGE(FATAL_ERROR "You must set either PAHO_BUILD_SHARED, PAHO_BUILD_STATIC, or both") | ||
ENDIF() | ||
|
||
IF (PAHO_BUILD_SAMPLES AND NOT PAHO_WITH_SSL) | ||
MESSAGE(FATAL_ERROR "You must build with SSL to build the samples") | ||
ENDIF() | ||
|
||
IF(PAHO_BUILD_DEB_PACKAGE) | ||
set(CMAKE_INSTALL_DOCDIR share/doc/libpaho-mqtt) | ||
set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON) | ||
set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY ">=") | ||
ENDIF() | ||
|
||
ADD_SUBDIRECTORY(src) | ||
IF(PAHO_BUILD_SAMPLES) | ||
ADD_SUBDIRECTORY(src/samples) | ||
ENDIF() | ||
|
||
IF(PAHO_BUILD_DOCUMENTATION) | ||
ADD_SUBDIRECTORY(doc) | ||
ENDIF() | ||
|
||
IF (PAHO_ENABLE_CPACK) | ||
### packaging settings | ||
FILE(GLOB samples "src/samples/*.c") | ||
INSTALL(FILES ${samples} DESTINATION ${CMAKE_INSTALL_DOCDIR}/samples) | ||
|
||
SET(CPACK_PACKAGE_VENDOR "Eclipse Paho") | ||
SET(CPACK_PACKAGE_NAME "Eclipse-Paho-MQTT-C") | ||
INSTALL(FILES CONTRIBUTING.md epl-v20 edl-v10 README.md notice.html DESTINATION ${CMAKE_INSTALL_DOCDIR}) | ||
|
||
IF (WIN32) | ||
SET(CPACK_GENERATOR "ZIP") | ||
ELSEIF(PAHO_BUILD_DEB_PACKAGE) | ||
INSTALL(FILES CONTRIBUTING.md epl-v20 edl-v10 README.md notice.html DESTINATION ${CMAKE_INSTALL_DOCDIR}) | ||
|
||
SET(CPACK_GENERATOR "DEB") | ||
CONFIGURE_FILE(${CMAKE_SCRIPTS}/CPackDebConfig.cmake.in | ||
${CMAKE_BINARY_DIR}/CPackDebConfig.cmake @ONLY) | ||
SET(CPACK_PROJECT_CONFIG_FILE ${CMAKE_BINARY_DIR}/CPackDebConfig.cmake) | ||
ELSE() | ||
SET(CPACK_GENERATOR "TGZ") | ||
ENDIF() | ||
ELSE() | ||
FILE(GLOB samples "src/samples/*.c") | ||
INSTALL(FILES ${samples} DESTINATION ${CMAKE_INSTALL_DOCDIR}) | ||
ENDIF() | ||
|
||
SET(CPACK_PACKAGE_VERSION_MAJOR ${PAHO_VERSION_MAJOR}) | ||
SET(CPACK_PACKAGE_VERSION_MINOR ${PAHO_VERSION_MINOR}) | ||
SET(CPACK_PACKAGE_VERSION_PATCH ${PAHO_VERSION_PATCH}) | ||
INCLUDE(CPack) | ||
|
||
IF(PAHO_ENABLE_TESTING) | ||
ENABLE_TESTING() | ||
INCLUDE_DIRECTORIES(test src) | ||
ADD_SUBDIRECTORY(test) | ||
ELSE() | ||
INCLUDE_DIRECTORIES(src) | ||
ENDIF() |
Oops, something went wrong.