Skip to content

Commit

Permalink
Fixed Makefile for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
djupdal committed Jan 14, 2020
1 parent 7d35aa2 commit 6e3966d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ bin/lynsyn_xvc:
mkdir -p lynsyn_xvc/build
cd lynsyn_xvc/build && $(QMAKE) ..
cd lynsyn_xvc/build && $(MAKE)
ifeq ($(OS),Windows_NT)
cp lynsyn_xvc/build/release/lynsyn_xvc bin
else
cp lynsyn_xvc/build/lynsyn_xvc bin
endif

.PHONY: bin/lynsyn_xsvf
bin/lynsyn_xsvf:
Expand Down
15 changes: 14 additions & 1 deletion lynsyn_xvc/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ int XvcServer::handleData() {
#ifdef VERBOSE
printf("%u : Received command: 'getinfo'\n", (int)time(NULL));
printf("\t Replied with %s\n", xvcInfo);
fflush(stdout);
#endif
return 0;
} else if (memcmp(cmd, "se", 2) == 0) {
Expand All @@ -76,6 +77,7 @@ int XvcServer::handleData() {
#ifdef VERBOSE
printf("%u : Received command: 'settck'\n", (int)time(NULL));
printf("\t Replied with %d\n\n", newPeriod);
fflush(stdout);
#endif
return 0;
} else if (memcmp(cmd, "sh", 2) == 0) {
Expand All @@ -84,26 +86,31 @@ int XvcServer::handleData() {
}
#ifdef VERBOSE
printf("%u : Received command: 'shift'\n", (int)time(NULL));
fflush(stdout);
#endif
} else {
fprintf(stderr, "invalid cmd '%s'\n", cmd);
fflush(stderr);
return 1;
}

int len;
if (sread(tcpSocket, &len, 4) != 1) {
fprintf(stderr, "reading length failed\n");
fflush(stderr);
return 1;
}

int nr_bytes = (len + 7) / 8;
if (nr_bytes * 2 > (int)sizeof(buffer)) {
fprintf(stderr, "buffer size exceeded\n");
fflush(stderr);
return 1;
}

if (sread(tcpSocket, buffer, nr_bytes * 2) != 1) {
fprintf(stderr, "reading data failed\n");
fflush(stderr);
return 1;
}
memset(result, 0, nr_bytes);
Expand All @@ -112,6 +119,7 @@ int XvcServer::handleData() {
printf("\tNumber of Bits : %d\n", len);
printf("\tNumber of Bytes : %d \n", nr_bytes);
printf("\n");
fflush(stdout);
#endif

lynsyn_shift(len, &buffer[0], &buffer[nr_bytes], result);
Expand All @@ -128,11 +136,13 @@ void XvcServer::run() {
tcpServer = new QTcpServer();

if (!tcpServer->listen(QHostAddress::Any, XVC_PORT)) {
printf("Unable to start the server\n");
fprintf(stderr, "Unable to start the server\n");
fflush(stderr);
exit(1);
}

printf("INFO: To connect to this lynsyn_xvc instance, use url: TCP:%s:%u\n\n", QHostInfo::localHostName().toUtf8().constData(), XVC_PORT);
fflush(stdout);

connect(tcpServer, &QTcpServer::newConnection, this, &XvcServer::newConnection);
}
Expand All @@ -144,9 +154,11 @@ void XvcServer::newConnection() {
connect(tcpSocket, SIGNAL(disconnected()), tcpSocket, SLOT(deleteLater()));

printf("Connection accepted\n");
fflush(stdout);

if(!lynsyn_init()) {
fprintf(stderr, "Failed to init lynsyn\n");
fflush(stderr);
exit(-1);
}

Expand All @@ -157,6 +169,7 @@ void XvcServer::newConnection() {

void XvcServer::disconnected() {
printf("Disconnected\n");
fflush(stdout);
lynsyn_release();
}

Expand Down
3 changes: 2 additions & 1 deletion windeploy.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

windeployqt bin/lynsyn_viewer.exe
windeployqt bin/lynsyn_xvc.exe
cp /c/msys64/mingw64/bin/libbz2-1.dll bin/
cp /c/msys64/mingw64/bin/libdouble-conversion.dll bin/
cp /c/msys64/mingw64/bin/libfreetype-6.dll bin/
Expand All @@ -23,6 +24,6 @@ cp /c/msys64/mingw64/bin/libzstd.dll bin/
cp /c/msys64/mingw64/bin/zlib1.dll bin/
cp /mingw64/bin/addr2line bin/
cp /mingw64/bin/nm bin/
cp .jtagdevices bin/jtagdevices
cp jtagdevices bin/jtagdevices
cp ../zadig-2.4.exe bin/
cp COPYING bin/COPYING.txt

0 comments on commit 6e3966d

Please sign in to comment.