[channels,serial] only build on linux

* Guard by CMake
* Remove code #ifdef to ease porting
This commit is contained in:
akallabeth 2024-08-26 12:44:34 +02:00
parent eb7d8fdeb0
commit d08e44d883
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5
7 changed files with 6 additions and 27 deletions

View File

@ -24,4 +24,8 @@ set(${MODULE_PREFIX}_SRCS
set(${MODULE_PREFIX}_LIBS set(${MODULE_PREFIX}_LIBS
winpr freerdp winpr freerdp
) )
add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} TRUE "DeviceServiceEntry")
# Serial implementation is currently linux only. BSD* might also work but untested
if (UNIX AND NOT APPLE AND NOT ANDROID)
add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} TRUE "DeviceServiceEntry")
endif()

View File

@ -44,11 +44,6 @@
#define TAG CHANNELS_TAG("serial.client") #define TAG CHANNELS_TAG("serial.client")
/* TODO: all #ifdef __linux__ could be removed once only some generic
* functions will be used. Replace CommReadFile by ReadFile,
* CommWriteFile by WriteFile etc.. */
#if defined __linux__ && !defined ANDROID
#define MAX_IRP_THREADS 5 #define MAX_IRP_THREADS 5
typedef struct typedef struct
@ -806,8 +801,6 @@ static UINT serial_free(DEVICE* device)
return CHANNEL_RC_OK; return CHANNEL_RC_OK;
} }
#endif /* __linux__ */
static void serial_message_free(void* obj) static void serial_message_free(void* obj)
{ {
wMessage* msg = obj; wMessage* msg = obj;
@ -847,10 +840,8 @@ static void irp_thread_close(void* arg)
*/ */
FREERDP_ENTRY_POINT(UINT serial_DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)) FREERDP_ENTRY_POINT(UINT serial_DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints))
{ {
#if defined __linux__ && !defined ANDROID
size_t len = 0; size_t len = 0;
SERIAL_DEVICE* serial = NULL; SERIAL_DEVICE* serial = NULL;
#endif /* __linux__ */
UINT error = CHANNEL_RC_OK; UINT error = CHANNEL_RC_OK;
WINPR_ASSERT(pEntryPoints); WINPR_ASSERT(pEntryPoints);

View File

@ -18,7 +18,7 @@
set(MODULE_NAME "winpr-comm") set(MODULE_NAME "winpr-comm")
set(MODULE_PREFIX "WINPR_COMM") set(MODULE_PREFIX "WINPR_COMM")
if(UNIX AND NOT WIN32 AND NOT APPLE) if(UNIX AND NOT ANDROID AND NOT APPLE)
set(${MODULE_PREFIX}_SRCS set(${MODULE_PREFIX}_SRCS
comm.c comm.c
comm.h comm.h

View File

@ -22,8 +22,6 @@
#include <winpr/config.h> #include <winpr/config.h>
#if defined __linux__ && !defined ANDROID
#include <winpr/assert.h> #include <winpr/assert.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
@ -1412,5 +1410,3 @@ int eventfd_write(int fd, eventfd_t value)
return (write(fd, &value, sizeof(value)) == sizeof(value)) ? 0 : -1; return (write(fd, &value, sizeof(value)) == sizeof(value)) ? 0 : -1;
} }
#endif #endif
#endif /* __linux__ */

View File

@ -19,8 +19,6 @@
#include <winpr/config.h> #include <winpr/config.h>
#if defined __linux__ && !defined ANDROID
#include <winpr/assert.h> #include <winpr/assert.h>
#include <errno.h> #include <errno.h>
#include <termios.h> #include <termios.h>
@ -545,5 +543,3 @@ return_false:
LeaveCriticalSection(&pComm->WriteLock); LeaveCriticalSection(&pComm->WriteLock);
return FALSE; return FALSE;
} }
#endif /* __linux__ */

View File

@ -20,8 +20,6 @@
* limitations under the License. * limitations under the License.
*/ */
#if defined __linux__ && !defined ANDROID
#include <winpr/assert.h> #include <winpr/assert.h>
#include <winpr/wlog.h> #include <winpr/wlog.h>
@ -210,5 +208,3 @@ SERIAL_DRIVER* SerCx2Sys_s(void)
return &SerCx2Sys; return &SerCx2Sys;
} }
#endif /* __linux__ */

View File

@ -20,8 +20,6 @@
* limitations under the License. * limitations under the License.
*/ */
#if defined __linux__ && !defined ANDROID
#include <winpr/assert.h> #include <winpr/assert.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
@ -1680,5 +1678,3 @@ SERIAL_DRIVER* SerialSys_s(void)
{ {
return &SerialSys; return &SerialSys;
} }
#endif /* __linux__ */