Adds CMake build support

This commit is contained in:
sardylan 2020-03-01 10:28:36 +01:00
parent 4ba94cbfe0
commit 90d8034264
8 changed files with 262 additions and 1597 deletions

60
.gitignore vendored
View file

@ -1,4 +1,64 @@
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps
*.d
*.slo
*.lo
*.o
*.obj
*.gch
*.pch
*.so
*.dylib
*.dll
*.mod
*.smod
*.lai
*.la
*.a
*.lib
*.exe
*.out
*.app
*.ko
*.elf
*.ilk
*.map
*.exp
*.so.*
*.i*86
*.x86_64
*.hex
*.dSYM/
*.su
*.idb
*.pdb
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf
.idea
cmake-build-*/
*.iml
*.iws
out/
.idea_modules/
atlassian-ide-plugin.xml
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
src/xlxd
ambed/ambed
ambedtest/ambedtest

16
CMakeLists.txt Normal file
View file

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.1)
project(xlxd)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
find_package(Threads REQUIRED)
message("Threads flags: ${CMAKE_THREAD_LIBS_INIT}")
add_subdirectory(src)
add_subdirectory(ambed)
add_subdirectory(ambedtest)

35
ambed/CMakeLists.txt Normal file
View file

@ -0,0 +1,35 @@
find_package(FTD2XX)
add_executable(ambed
cambepacket.cpp cambepacket.h
cambeserver.cpp cambeserver.h
cbuffer.cpp cbuffer.h
ccallsign.cpp ccallsign.h
ccontroller.cpp ccontroller.h
cftdidevicedescr.cpp cftdidevicedescr.h
cip.cpp cip.h
cpacket.cpp cpacket.h
cpacketqueue.cpp cpacketqueue.h
cstream.cpp cstream.h
ctimepoint.cpp ctimepoint.h
cudpsocket.cpp cudpsocket.h
cusb3000interface.cpp cusb3000interface.h
cusb3003df2etinterface.cpp cusb3003df2etinterface.h
cusb3003hrinterface.cpp cusb3003hrinterface.h
cusb3003interface.cpp cusb3003interface.h
cusb3xxxinterface.cpp cusb3xxxinterface.h
cvocodecchannel.cpp cvocodecchannel.h
cvocodecinterface.cpp cvocodecinterface.h
cvocodecs.cpp cvocodecs.h
cvoicepacket.cpp cvoicepacket.h
main.cpp main.h
syslog.h)
target_link_libraries(ambed
LINK_PUBLIC
Threads::Threads
ftd2xx)
target_compile_options(ambed
PRIVATE
-Wall)

View file

@ -1,154 +0,0 @@
#ifndef __WINDOWS_TYPES__
#define __WINDOWS_TYPES__
#define WINAPI
typedef unsigned int DWORD;
typedef unsigned int ULONG;
typedef unsigned short USHORT;
typedef unsigned short SHORT;
typedef unsigned char UCHAR;
typedef unsigned short WORD;
typedef unsigned short WCHAR;
typedef unsigned char BYTE;
typedef BYTE *LPBYTE;
typedef unsigned int BOOL;
typedef unsigned char BOOLEAN;
typedef unsigned char CHAR;
typedef BOOL *LPBOOL;
typedef UCHAR *PUCHAR;
typedef const char *LPCSTR;
typedef char *PCHAR;
typedef void *PVOID;
typedef void *HANDLE;
typedef unsigned int LONG;
typedef int INT;
typedef unsigned int UINT;
typedef char *LPSTR;
typedef char *LPTSTR;
typedef const char *LPCTSTR;
typedef DWORD *LPDWORD;
typedef WORD *LPWORD;
typedef ULONG *PULONG;
typedef LONG *LPLONG;
typedef PVOID LPVOID;
typedef void VOID;
typedef USHORT *PUSHORT;
typedef unsigned long long int ULONGLONG;
typedef struct _OVERLAPPED {
DWORD Internal;
DWORD InternalHigh;
union {
struct{
DWORD Offset;
DWORD OffsetHigh;
};
PVOID Pointer;
};
HANDLE hEvent;
} OVERLAPPED, *LPOVERLAPPED;
typedef struct _SECURITY_ATTRIBUTES {
DWORD nLength;
LPVOID lpSecurityDescriptor;
BOOL bInheritHandle;
} SECURITY_ATTRIBUTES , *LPSECURITY_ATTRIBUTES;
#include <pthread.h>
// Substitute for HANDLE returned by Windows CreateEvent API.
// FT_SetEventNotification expects parameter 3 to be the address
// of one of these structures.
typedef struct _EVENT_HANDLE
{
pthread_cond_t eCondVar;
pthread_mutex_t eMutex;
int iVar;
} EVENT_HANDLE;
typedef struct timeval SYSTEMTIME;
typedef struct timeval FILETIME;
// WaitForSingleObject return values.
#define WAIT_ABANDONED 0x00000080L
#define WAIT_OBJECT_0 0x00000000L
#define WAIT_TIMEOUT 0x00000102L
#define WAIT_FAILED 0xFFFFFFFF
// Special value for WaitForSingleObject dwMilliseconds parameter
#define INFINITE 0xFFFFFFFF // Infinite timeout
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef CONST
#define CONST const
#endif
//
// Modem Status Flags
//
#define MS_CTS_ON ((DWORD)0x0010)
#define MS_DSR_ON ((DWORD)0x0020)
#define MS_RING_ON ((DWORD)0x0040)
#define MS_RLSD_ON ((DWORD)0x0080)
//
// Error Flags
//
#define CE_RXOVER 0x0001 // Receive Queue overflow
#define CE_OVERRUN 0x0002 // Receive Overrun Error
#define CE_RXPARITY 0x0004 // Receive Parity Error
#define CE_FRAME 0x0008 // Receive Framing error
#define CE_BREAK 0x0010 // Break Detected
#define CE_TXFULL 0x0100 // TX Queue is full
#define CE_PTO 0x0200 // LPTx Timeout
#define CE_IOE 0x0400 // LPTx I/O Error
#define CE_DNS 0x0800 // LPTx Device not selected
#define CE_OOP 0x1000 // LPTx Out-Of-Paper
#define CE_MODE 0x8000 // Requested mode unsupported
//
// Events
//
#define EV_RXCHAR 0x0001 // Any Character received
#define EV_RXFLAG 0x0002 // Received certain character
#define EV_TXEMPTY 0x0004 // Transmit Queue Empty
#define EV_CTS 0x0008 // CTS changed state
#define EV_DSR 0x0010 // DSR changed state
#define EV_RLSD 0x0020 // RLSD changed state
#define EV_BREAK 0x0040 // BREAK received
#define EV_ERR 0x0080 // Line status error occurred
#define EV_RING 0x0100 // Ring signal detected
#define EV_PERR 0x0200 // Printer error occured
#define EV_RX80FULL 0x0400 // Receive buffer is 80 percent full
#define EV_EVENT1 0x0800 // Provider specific event 1
#define EV_EVENT2 0x1000 // Provider specific event 2
//
// Escape Functions
//
#define SETXOFF 1 // Simulate XOFF received
#define SETXON 2 // Simulate XON received
#define SETRTS 3 // Set RTS high
#define CLRRTS 4 // Set RTS low
#define SETDTR 5 // Set DTR high
#define CLRDTR 6 // Set DTR low
#define RESETDEV 7 // Reset device if possible
#define SETBREAK 8 // Set the device break line.
#define CLRBREAK 9 // Clear the device break line.
//
// PURGE function flags.
//
#define PURGE_TXABORT 0x0001 // Kill the pending/current writes to the comm port.
#define PURGE_RXABORT 0x0002 // Kill the pending/current reads to the comm port.
#define PURGE_TXCLEAR 0x0004 // Kill the transmit queue if there.
#define PURGE_RXCLEAR 0x0008 // Kill the typeahead buffer if there.
#ifndef INVALID_HANDLE_VALUE
#define INVALID_HANDLE_VALUE 0xFFFFFFFF
#endif
#endif /* __WINDOWS_TYPES__ */

File diff suppressed because it is too large Load diff

22
ambedtest/CMakeLists.txt Normal file
View file

@ -0,0 +1,22 @@
add_executable(ambedtest
cambe.cpp cambe.h
cbuffer.cpp cbuffer.h
ccodecstream.cpp ccodecstream.h
cip.cpp cip.h
csemaphore.cpp csemaphore.h
ctimepoint.cpp ctimepoint.h
ctranscoder.cpp ctranscoder.h
cudpsocket.cpp cudpsocket.h
main.cpp main.h
samples.h)
target_link_libraries(ambedtest
LINK_PUBLIC
Threads::Threads)
target_compile_options(ambed
PRIVATE
-Wall)
add_test(ambedtest
ambedtest)

View file

@ -0,0 +1,45 @@
find_path(FTD2XX_INCLUDE_DIR
NAMES ftd2xx.h WinTypes.h
PATHS
/usr/local/include
/usr/local/include/libftd2xx
/usr/include
/usr/include/libftd2xx
/opt/libftd2xx/include)
set(FTD2XX_LIBNAME ftd2xx)
find_library(FTD2XX_LIBRARY
NAMES ftd2xx
PATHS
/usr/local/lib
/usr/lib
/opt/libftd2xx/lib)
if (FTD2XX_LIBRARY)
if (FTD2XX_INCLUDE_DIR)
set(FTD2XX_FOUND TRUE)
message(STATUS "Found libFTD2XX: ${FTD2XX_INCLUDE_DIR}, ${FTD2XX_LIBRARY}")
else (FTD2XX_INCLUDE_DIR)
set(FTD2XX_FOUND FALSE)
message(STATUS "libFTD2XX headers NOT FOUND. Make sure to install the development headers! Please refer to the documentation for instructions.")
endif (FTD2XX_INCLUDE_DIR)
add_library(ftd2xx
SHARED IMPORTED GLOBAL)
set_target_properties(ftd2xx
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${FTD2XX_INCLUDE_DIR})
set_target_properties(ftd2xx
PROPERTIES
IMPORTED_LOCATION ${FTD2XX_LIBRARY})
else (FTD2XX_LIBRARY)
set(FTD2XX_FOUND FALSE)
message(STATUS "libFTD2XX NOT FOUND.")
endif (FTD2XX_LIBRARY)
set(FTD2XX_INCLUDE_DIR
${FTD2XX_INCLUDE_DIR})

84
src/CMakeLists.txt Normal file
View file

@ -0,0 +1,84 @@
add_executable(xlxd
cbmclient.cpp cbmclient.h
cbmpeer.cpp cbmpeer.h
cbptc19696.cpp cbptc19696.h
cbuffer.cpp cbuffer.h
ccallsign.cpp ccallsign.h
ccallsignlist.cpp ccallsignlist.h
ccallsignlistitem.cpp ccallsignlistitem.h
cclient.cpp cclient.h
cclients.cpp cclients.h
ccodecstream.cpp ccodecstream.h
ccrc.cpp ccrc.h
cdcsclient.cpp cdcsclient.h
cdcsprotocol.cpp cdcsprotocol.h
cdextraclient.cpp cdextraclient.h
cdextraprotocol.cpp cdextraprotocol.h
cdmriddir.cpp cdmriddir.h
cdmriddirfile.cpp cdmriddirfile.h
cdmriddirhttp.cpp cdmriddirhttp.h
cdmrmmdvmclient.cpp cdmrmmdvmclient.h
cdmrmmdvmprotocol.cpp cdmrmmdvmprotocol.h
cdmrplusclient.cpp cdmrplusclient.h
cdmrplusprotocol.cpp cdmrplusprotocol.h
cdplusclient.cpp cdplusclient.h
cdplusprotocol.cpp cdplusprotocol.h
cdvframepacket.cpp cdvframepacket.h
cdvheaderpacket.cpp cdvheaderpacket.h
cdvlastframepacket.cpp cdvlastframepacket.h
cgatekeeper.cpp cgatekeeper.h
cgolay2087.cpp cgolay2087.h
cgolay24128.cpp cgolay24128.h
chamming.cpp chamming.h
cip.cpp cip.h
cnotification.cpp cnotification.h
cnotificationqueue.h
cpacket.cpp cpacket.h
cpacketqueue.h
cpacketstream.cpp cpacketstream.h
cpeercallsignlist.cpp cpeercallsignlist.h
cpeer.cpp cpeer.h
cpeers.cpp cpeers.h
cprotocol.cpp cprotocol.h
cprotocols.cpp cprotocols.h
cqr1676.cpp cqr1676.h
creflector.cpp creflector.h
crs129.cpp crs129.h
csemaphore.cpp csemaphore.h
ctimepoint.cpp ctimepoint.h
ctranscoder.cpp ctranscoder.h
cudpsocket.cpp cudpsocket.h
cuser.cpp cuser.h
cusers.cpp cusers.h
cutils.cpp cutils.h
cversion.cpp cversion.h
cwiresxcmd.cpp cwiresxcmd.h
cwiresxcmdhandler.cpp cwiresxcmdhandler.h
cwiresxcmdqueue.h
cwiresxinfo.cpp cwiresxinfo.h
cwiresxpacket.h
cwiresxpacketqueue.h
cxlxclient.cpp cxlxclient.h
cxlxpeer.cpp cxlxpeer.h
cxlxprotocol.cpp cxlxprotocol.h
cysfclient.cpp cysfclient.h
cysfconvolution.cpp cysfconvolution.h
cysffich.cpp cysffich.h
cysfnode.cpp cysfnode.h
cysfnodedir.cpp cysfnodedir.h
cysfnodedirfile.cpp cysfnodedirfile.h
cysfnodedirhttp.cpp cysfnodedirhttp.h
cysfpayload.cpp cysfpayload.h
cysfprotocol.cpp cysfprotocol.h
cysfutils.cpp cysfutils.h
main.cpp main.h
syslog.h
ysfdefines.h)
target_link_libraries(xlxd
LINK_PUBLIC
Threads::Threads)
target_compile_options(xlxd
PRIVATE
-Wall)