Skip to content

Commit

Permalink
svutil.cpp: fix windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
zdenop committed Apr 23, 2019
1 parent 7bacc88 commit 129fe95
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
36 changes: 14 additions & 22 deletions src/viewer/svutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,23 @@
// SVUtil contains the SVSync and SVNetwork classes, which are used for
// thread/process creation & synchronization and network connection.

// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H
# include "config_auto.h"
#endif

#include "svutil.h"
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <memory>
#include <string>
#include <vector>

#ifdef _WIN32
#pragma comment(lib, "Ws2_32.lib")
struct addrinfo {
struct sockaddr* ai_addr;
int ai_addrlen;
int ai_family;
int ai_socktype;
int ai_protocol;
};
#include <winsock2.h> // for fd_set, send, ...
# include <WinSock2.h> // for fd_set, send, ..

This comment has been minimized.

Copy link
@stweil

stweil Apr 24, 2019

Member

What was the reason for this commit? It now breaks cross compilation for Windows on Linux, because Linux is case sensitive and the filename is winsock2.h.

This comment has been minimized.

Copy link
@stweil

stweil Apr 24, 2019

Member

The Windows CI builds with AppVeyor are still broken.

This comment has been minimized.

Copy link
@zdenop

zdenop Apr 24, 2019

Author Contributor

I am sorry about that - it was result of include formater installed in my VS 2017. You can change it to lowercase.
BTW: there was reported conflict of addrinfo in VS 2017.

This comment has been minimized.

Copy link
@zdenop

zdenop Apr 24, 2019

Author Contributor

@egorpugin: can you switch AppVeyor to cppan build until sw build is fixed? We need to see result of build for VS 2015 and VS 2017 for current code changes...

This comment has been minimized.

Copy link
@stweil

stweil Apr 24, 2019

Member

The cross build is fixed now (see commit b7bc71e), hopefully without breaking the native build.

This comment has been minimized.

Copy link
@zdenop

zdenop Apr 24, 2019

Author Contributor

Thanks - I check it and build fine.

This comment has been minimized.

Copy link
@egorpugin

egorpugin Apr 30, 2019

Contributor

Build is restored for another between-feature sw cycle. :)

#else
#include <arpa/inet.h>
#include <netdb.h>
Expand All @@ -45,20 +51,6 @@ struct addrinfo {
#include <unistd.h>
#endif

#include <cstdlib>
#include <cstring>
#include <iostream>
#include <memory>
#include <string>
#include <vector>

// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif

#include "svutil.h"

SVMutex::SVMutex() {
#ifdef _WIN32
mutex_ = CreateMutex(0, FALSE, 0);
Expand Down
2 changes: 1 addition & 1 deletion src/viewer/svutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#define TESSERACT_VIEWER_SVUTIL_H_

#ifdef _WIN32
#include "host.h" // also includes windows.h
# include "host.h" // also includes windows.h
#else
#include <pthread.h>
#include <semaphore.h>
Expand Down

0 comments on commit 129fe95

Please sign in to comment.