mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-01 23:45:48 +03:00
cmake: Fix multi-thread support building
This commit is contained in:
1 parent
d97e7f39d8
commit
5fa14f6a74
4 files changed
+20
-7
No files matched your search
@@ -200,7 +200,7 @@ jobs:
|
||||
- name: MS CMake configure
|
||||
run: |
|
||||
cd build_test
|
||||
cmake .. -DWARNING_TO_ERROR=ON -DWITH_OPENSSL=YES
|
||||
cmake .. -DWARNING_TO_ERROR=ON -DWITH_OPENSSL=YES -DENABLE_THREAD_SAFE=OFF
|
||||
- name: MS CMake build
|
||||
run: |
|
||||
cd build_test
|
||||
|
||||
+15
-5
@@ -306,7 +306,13 @@ check_function_exists(memset HAVE_MEMSET)
|
||||
check_function_exists(select HAVE_SELECT)
|
||||
check_function_exists(socket HAVE_SOCKET)
|
||||
check_function_exists(strcasecmp HAVE_STRCASECMP)
|
||||
if(MINGW OR WIN32)
|
||||
set(CMAKE_REQUIRED_LIBRARIES pthread)
|
||||
endif()
|
||||
check_function_exists(pthread_mutex_lock HAVE_PTHREAD_MUTEX_LOCK)
|
||||
if(MINGW OR WIN32)
|
||||
set(CMAKE_REQUIRED_LIBRARIES "")
|
||||
endif()
|
||||
check_function_exists(getaddrinfo HAVE_GETADDRINFO)
|
||||
check_function_exists(strnlen HAVE_STRNLEN)
|
||||
check_function_exists(strrchr HAVE_STRRCHR)
|
||||
@@ -428,22 +434,25 @@ else()
|
||||
endif()
|
||||
|
||||
if(${ENABLE_THREAD_SAFE})
|
||||
set(COAP_THREAD_SAFE "${ENABLE_THREAD_SAFE}")
|
||||
set(COAP_THREAD_SAFE "1")
|
||||
message(STATUS "compiling with thread safe support")
|
||||
else()
|
||||
set(ENABLE_THREAD_RECURSIVE_LOCK_CHECK OFF)
|
||||
set(ENABLE_THREAD_NUM_LOGGING OFF)
|
||||
endif()
|
||||
|
||||
if(${ENABLE_THREAD_RECURSIVE_LOCK_CHECK})
|
||||
set(COAP_THREAD_RECURSIVE_CHECK "${ENABLE_THREAD_RECURSIVE_LOCK_CHECK}")
|
||||
set(COAP_THREAD_RECURSIVE_CHECK "1")
|
||||
message(STATUS "compiling with thread recursive lock detection support")
|
||||
endif()
|
||||
|
||||
if(${ENABLE_THREAD_NUM_LOGGING})
|
||||
set(COAP_THREAD_NUM_LOGGING "${ENABLE_THREAD_NUM_LOGGING}")
|
||||
set(COAP_THREAD_NUM_LOGGING "1")
|
||||
message(STATUS "compiling with thread number logging support")
|
||||
endif()
|
||||
|
||||
if(${ENABLE_SMALL_STACK})
|
||||
set(COAP_CONSTRAINED_STACK "${ENABLE_SMALL_STACK}")
|
||||
set(COAP_CONSTRAINED_STACK "1")
|
||||
message(STATUS "compiling with small stack support")
|
||||
endif()
|
||||
|
||||
@@ -738,7 +747,8 @@ target_link_libraries(
|
||||
$<$<BOOL:${COAP_WITH_LIBMBEDTLS}>:MbedTLS::mbedtls>
|
||||
$<$<BOOL:${COAP_WITH_LIBWOLFSSL}>:wolfssl::wolfssl>
|
||||
$<$<BOOL:${WIN32}>:ws2_32>
|
||||
$<$<BOOL:${WIN32}>:iphlpapi>)
|
||||
$<$<BOOL:${WIN32}>:iphlpapi>
|
||||
$<$<BOOL:${MINGW}>:pthread>)
|
||||
|
||||
target_compile_options(
|
||||
${COAP_LIBRARY_NAME}
|
||||
|
||||
@@ -85,6 +85,9 @@
|
||||
/* Define to 1 if you have the `select' function. */
|
||||
#cmakedefine HAVE_SELECT @HAVE_SELECT@
|
||||
|
||||
/* Define to 1 if you have the <signal.h> header file. */
|
||||
#cmakedefine HAVE_SIGNAL_H @HAVE_SIGNAL_H@
|
||||
|
||||
/* Define to 1 if you have the `socket' function. */
|
||||
#cmakedefine HAVE_SOCKET @HAVE_SOCKET@
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ coap_io_process_worker_thread(void *arg) {
|
||||
coap_thread_param_t *thread_param = (coap_thread_param_t *)arg;
|
||||
coap_context_t *context = thread_param->context;
|
||||
#if (COAP_MAX_LOGGING_LEVEL >= _COAP_LOG_DEBUG)
|
||||
long unsigned int thread_pid = coap_thread_pid;
|
||||
long unsigned int thread_pid = (long unsigned int)coap_thread_pid;
|
||||
#endif
|
||||
|
||||
thread_no = thread_param->thread_no;
|
||||
|
||||
Reference in new issue
Block a user