Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
paho.mqtt.c
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
eclipse
paho.mqtt.c
Commits
e9b89be4
Commit
e9b89be4
authored
Mar 18, 2017
by
Ian Craggs
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'cmake-tests-appveyor' of
https://github.com/orpiske/paho.mqtt.c
into fixes
parents
19d0c91d
71d7b4f5
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
77 additions
and
16 deletions
+77
-16
CMakeLists.txt
CMakeLists.txt
+23
-6
appveyor.yml
appveyor.yml
+18
-0
CMakeLists.txt
src/CMakeLists.txt
+0
-2
Thread.h
src/Thread.h
+6
-5
CMakeLists.txt
test/CMakeLists.txt
+14
-1
dll-copy.cmake
test/dll-copy.cmake
+6
-0
test2.c
test/test2.c
+10
-2
No files found.
CMakeLists.txt
View file @
e9b89be4
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
# Note: on OS X you should install XCode and the associated command-line tools
# Note: on OS X you should install XCode and the associated command-line tools
PROJECT
(
"paho"
C
)
PROJECT
(
"paho"
C
)
CMAKE_MINIMUM_REQUIRED
(
VERSION
2.8
)
CMAKE_MINIMUM_REQUIRED
(
VERSION
3.0
)
MESSAGE
(
STATUS
"CMake version: "
${
CMAKE_VERSION
}
)
MESSAGE
(
STATUS
"CMake version: "
${
CMAKE_VERSION
}
)
## build settings
## build settings
...
@@ -26,12 +26,30 @@ SET(PAHO_VERSION_MINOR 1)
...
@@ -26,12 +26,30 @@ SET(PAHO_VERSION_MINOR 1)
SET
(
PAHO_VERSION_PATCH 0
)
SET
(
PAHO_VERSION_PATCH 0
)
SET
(
CLIENT_VERSION
${
PAHO_VERSION_MAJOR
}
.
${
PAHO_VERSION_MINOR
}
.
${
PAHO_VERSION_PATCH
}
)
SET
(
CLIENT_VERSION
${
PAHO_VERSION_MAJOR
}
.
${
PAHO_VERSION_MINOR
}
.
${
PAHO_VERSION_PATCH
}
)
IF
(
WIN32
)
EXECUTE_PROCESS
(
COMMAND
"cmd"
" /C date /T"
OUTPUT_VARIABLE BUILD_TIMESTAMP
)
EXECUTE_PROCESS
(
COMMAND date -u OUTPUT_VARIABLE BUILD_TIMESTAMP
)
ELSE
()
EXECUTE_PROCESS
(
COMMAND date -u OUTPUT_VARIABLE BUILD_TIMESTAMP
)
IF
(
BUILD_TIMESTAMP STREQUAL
""
)
MESSAGE
(
WARNING
"Unable to determine build timestamp via default mechanism."
)
IF
(
WIN32
)
EXECUTE_PROCESS
(
COMMAND
"cmd.exe"
"/c"
echo %DATE% %TIME% OUTPUT_VARIABLE BUILD_TIMESTAMP
)
ENDIF
()
ENDIF
()
ENDIF
()
STRING
(
STRIP
${
BUILD_TIMESTAMP
}
BUILD_TIMESTAMP
)
STRING
(
STRIP
${
BUILD_TIMESTAMP
}
BUILD_TIMESTAMP
)
MESSAGE
(
STATUS
"Timestamp is
${
BUILD_TIMESTAMP
}
"
)
# Uses the correct directory for libraries on Red Hat-based distributions.
SET
(
PAHO_LIBRARY_DIR_NAME
"lib"
)
IF
(
CMAKE_SYSTEM_NAME MATCHES
"Linux"
)
IF
(
EXISTS
"/etc/redhat-release"
)
IF
(
CMAKE_SIZEOF_VOID_P EQUAL 8
)
SET
(
PAHO_LIBRARY_DIR_NAME
"lib64"
)
ENDIF
()
ENDIF
()
ENDIF
()
# Uses the correct directory for libraries on Red Hat-based distributions.
# Uses the correct directory for libraries on Red Hat-based distributions.
SET
(
PAHO_LIBRARY_DIR_NAME
"lib"
)
SET
(
PAHO_LIBRARY_DIR_NAME
"lib"
)
...
@@ -74,4 +92,3 @@ ENABLE_TESTING()
...
@@ -74,4 +92,3 @@ ENABLE_TESTING()
INCLUDE_DIRECTORIES
(
test src
)
INCLUDE_DIRECTORIES
(
test src
)
ADD_SUBDIRECTORY
(
test
)
ADD_SUBDIRECTORY
(
test
)
appveyor.yml
0 → 100644
View file @
e9b89be4
version
:
1.0.{build}
image
:
Visual Studio 2015
configuration
:
Debug
install
:
-
cmd
:
cinst openssl.light
build_script
:
-
cmd
:
>
-
mkdir build.paho
cd build.paho
"
C:
\P
rogram
Files
(x86)
\
Microsoft
Visual
Studio
14.0
\
VC
\v
cvarsall.bat"
x64
cmake -G "NMake Makefiles" -DPAHO_WITH_SSL=FALSE -DPAHO_BUILD_DOCUMENTATION=FALSE -DPAHO_BUILD_SAMPLES=TRUE -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=TRUE ..
nmake
cd ..
\ No newline at end of file
src/CMakeLists.txt
View file @
e9b89be4
...
@@ -136,7 +136,6 @@ INSTALL(FILES MQTTAsync.h MQTTClient.h MQTTClientPersistence.h
...
@@ -136,7 +136,6 @@ INSTALL(FILES MQTTAsync.h MQTTClient.h MQTTClientPersistence.h
DESTINATION include
)
DESTINATION include
)
IF
(
PAHO_WITH_SSL
)
IF
(
PAHO_WITH_SSL
)
SET
(
OPENSSL_LIB_SEARCH_PATH
""
CACHE PATH
"Directory containing OpenSSL libraries"
)
SET
(
OPENSSL_INC_SEARCH_PATH
""
CACHE PATH
"Directory containing OpenSSL includes"
)
SET
(
OPENSSL_INC_SEARCH_PATH
""
CACHE PATH
"Directory containing OpenSSL includes"
)
IF
(
${
CMAKE_SYSTEM_NAME
}
STREQUAL
"Darwin"
)
IF
(
${
CMAKE_SYSTEM_NAME
}
STREQUAL
"Darwin"
)
...
@@ -200,5 +199,4 @@ SET(OPENSSL_LIB_SEARCH_PATH "" CACHE PATH "Directory containing OpenSSL librarie
...
@@ -200,5 +199,4 @@ SET(OPENSSL_LIB_SEARCH_PATH "" CACHE PATH "Directory containing OpenSSL librarie
ARCHIVE DESTINATION lib
ARCHIVE DESTINATION lib
LIBRARY DESTINATION
${
PAHO_LIBRARY_DIR_NAME
}
)
LIBRARY DESTINATION
${
PAHO_LIBRARY_DIR_NAME
}
)
ENDIF
()
ENDIF
()
ENDIF
()
ENDIF
()
src/Thread.h
View file @
e9b89be4
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
* Ian Craggs - fix for bug #420851
* Ian Craggs - fix for bug #420851
* Ian Craggs - change MacOS semaphore implementation
* Ian Craggs - change MacOS semaphore implementation
*******************************************************************************/
*******************************************************************************/
#include "MQTTClient.h"
#if !defined(THREAD_H)
#if !defined(THREAD_H)
#define THREAD_H
#define THREAD_H
...
@@ -53,14 +54,14 @@
...
@@ -53,14 +54,14 @@
int
Thread_destroy_cond
(
cond_type
);
int
Thread_destroy_cond
(
cond_type
);
#endif
#endif
thread_type
Thread_start
(
thread_fn
,
void
*
);
DLLExport
thread_type
Thread_start
(
thread_fn
,
void
*
);
mutex_type
Thread_create_mutex
(
void
);
DLLExport
mutex_type
Thread_create_mutex
(
);
int
Thread_lock_mutex
(
mutex_type
);
DLLExport
int
Thread_lock_mutex
(
mutex_type
);
int
Thread_unlock_mutex
(
mutex_type
);
DLLExport
int
Thread_unlock_mutex
(
mutex_type
);
void
Thread_destroy_mutex
(
mutex_type
);
void
Thread_destroy_mutex
(
mutex_type
);
thread_id_type
Thread_getid
(
void
);
DLLExport
thread_id_type
Thread_getid
(
);
sem_type
Thread_create_sem
(
void
);
sem_type
Thread_create_sem
(
void
);
int
Thread_wait_sem
(
sem_type
sem
,
int
timeout
);
int
Thread_wait_sem
(
sem_type
sem
,
int
timeout
);
...
...
test/CMakeLists.txt
View file @
e9b89be4
PROJECT
(
mqtt-tests
)
SET
(
MQTT_TEST_BROKER
"tcp://localhost:1883"
CACHE STRING
"Hostname of a test MQTT broker to use"
)
SET
(
MQTT_TEST_BROKER
"tcp://localhost:1883"
CACHE STRING
"Hostname of a test MQTT broker to use"
)
SET
(
MQTT_TEST_PROXY
"tcp://localhost:1884"
CACHE STRING
"Hostname of the test proxy to use"
)
SET
(
MQTT_TEST_PROXY
"tcp://localhost:1884"
CACHE STRING
"Hostname of the test proxy to use"
)
SET
(
MQTT_SSL_HOSTNAME
"localhost"
CACHE STRING
"Hostname of a test SSL MQTT broker to use"
)
SET
(
MQTT_SSL_HOSTNAME
"localhost"
CACHE STRING
"Hostname of a test SSL MQTT broker to use"
)
SET
(
CERTDIR $ENV{TRAVIS_BUILD_DIR}/test/ssl
)
SET
(
CERTDIR $ENV{TRAVIS_BUILD_DIR}/test/ssl
)
IF
(
WIN32
)
ADD_DEFINITIONS
(
/DCMAKE_BUILD
)
ENDIF
()
ADD_EXECUTABLE
(
ADD_EXECUTABLE
(
test1
test1
...
@@ -15,6 +20,14 @@ TARGET_LINK_LIBRARIES(
...
@@ -15,6 +20,14 @@ TARGET_LINK_LIBRARIES(
paho-mqtt3c
paho-mqtt3c
)
)
IF
(
WIN32
)
ADD_CUSTOM_COMMAND
(
TARGET test1 PRE_BUILD
COMMAND
${
CMAKE_COMMAND
}
-P
${
CMAKE_CURRENT_SOURCE_DIR
}
/dll-copy.cmake
COMMENT
"Copying DLLs to test directory"
)
ENDIF
()
ADD_TEST
(
ADD_TEST
(
NAME test1-1-single-thread-client
NAME test1-1-single-thread-client
COMMAND
"test1"
"--test_no"
"1"
"--connection"
${
MQTT_TEST_BROKER
}
COMMAND
"test1"
"--test_no"
"1"
"--connection"
${
MQTT_TEST_BROKER
}
...
@@ -221,7 +234,6 @@ ADD_TEST(
...
@@ -221,7 +234,6 @@ ADD_TEST(
ENDIF
()
ENDIF
()
ADD_EXECUTABLE
(
ADD_EXECUTABLE
(
test6
test6
test6.c
test6.c
...
@@ -302,3 +314,4 @@ ADD_TEST(
...
@@ -302,3 +314,4 @@ ADD_TEST(
COMMAND test9
"--test_no"
"5"
"--connection"
${
MQTT_TEST_BROKER
}
"--proxy_connection"
${
MQTT_TEST_PROXY
}
COMMAND test9
"--test_no"
"5"
"--connection"
${
MQTT_TEST_BROKER
}
"--proxy_connection"
${
MQTT_TEST_PROXY
}
)
)
test/dll-copy.cmake
0 → 100644
View file @
e9b89be4
FILE
(
GLOB dlls
${
CMAKE_BINARY_DIR
}
/../src/*.dll
)
MESSAGE
(
STATUS
"Files to copy:
${
dlls
}
. From:
${
CMAKE_BINARY_DIR
}
"
)
FOREACH
(
dll
${
dlls
}
)
MESSAGE
(
STATUS
"Copying dll runtime file
${
dll
}
to runtime dir
${
CMAKE_BINARY_DIR
}
"
)
FILE
(
COPY
${
dll
}
DESTINATION
${
CMAKE_BINARY_DIR
}
)
ENDFOREACH
(
dll
)
\ No newline at end of file
test/test2.c
View file @
e9b89be4
...
@@ -32,8 +32,15 @@
...
@@ -32,8 +32,15 @@
#include <errno.h>
#include <errno.h>
#define WINAPI
#define WINAPI
#else
#else
#include <winsock2.h>
#define WIN32_LEAN_AND_MEAN
#include <ws2tcpip.h>
#if !defined(CMAKE_BUILD)
/*
* These causes the cmake build to fail. In order to prevent affecting
* other builds, remove them only from CMAKE-related builds
*/
#include <winsock2.h>
#include <ws2tcpip.h>
#endif // CMAKE_BUILD
#define MAXHOSTNAMELEN 256
#define MAXHOSTNAMELEN 256
#define EAGAIN WSAEWOULDBLOCK
#define EAGAIN WSAEWOULDBLOCK
#define EINTR WSAEINTR
#define EINTR WSAEINTR
...
@@ -42,6 +49,7 @@
...
@@ -42,6 +49,7 @@
#define ENOTCONN WSAENOTCONN
#define ENOTCONN WSAENOTCONN
#define ECONNRESET WSAECONNRESET
#define ECONNRESET WSAECONNRESET
#define setenv(a, b, c) _putenv_s(a, b)
#define setenv(a, b, c) _putenv_s(a, b)
#endif
#endif
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment