Skip to content

Commit

Permalink
Fix build on appveyor ci with mingw
Browse files Browse the repository at this point in the history
C:/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/c++.exe  (ver 8.1.0)
pthreads_cross.h:37:26: error: conflicting declaration 'typedef CRITICAL_SECTION pthread_mutex_t'
pthreads_cross.c:110:5: warning: implicit declaration of function 'InitializeConditionVariable'
  • Loading branch information
fspindle committed Jul 24, 2024
1 parent b91ea97 commit 6a2968c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
15 changes: 8 additions & 7 deletions 3rdparty/apriltag/common/pthreads_cross.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ SOFTWARE.

#include "common/pthreads_cross.h"

#ifdef _WIN32
//#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)

typedef struct {
SRWLOCK lock;
Expand Down Expand Up @@ -246,11 +247,11 @@ unsigned int pcthread_get_num_procs()
return sysinfo.dwNumberOfProcessors;
}

#else
//#else

#include <unistd.h>
unsigned int pcthread_get_num_procs()
{
return (unsigned int)sysconf(_SC_NPROCESSORS_ONLN);
}
//#include <unistd.h>
//unsigned int pcthread_get_num_procs()
//{
// return (unsigned int)sysconf(_SC_NPROCESSORS_ONLN);
//}
#endif
6 changes: 4 additions & 2 deletions 3rdparty/apriltag/common/pthreads_cross.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ SOFTWARE.
#ifndef __CPTHREAD_H__
#define __CPTHREAD_H__

#ifdef _WIN32
//#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include <stdbool.h>
#include <windows.h>
#else
Expand All @@ -32,7 +33,8 @@ SOFTWARE.
#endif
#include <time.h>

#ifdef _WIN32
//#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)

typedef CRITICAL_SECTION pthread_mutex_t;
typedef void pthread_mutexattr_t;
Expand Down
3 changes: 2 additions & 1 deletion 3rdparty/apriltag/common/time_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ either expressed or implied, of the Regents of The University of Michigan.
typedef long long suseconds_t;
#endif

#ifdef _MSC_VER
//#ifdef _MSC_VER
#if defined(_MSC_VER) && defined(__MINGW32__)

inline int gettimeofday(struct timeval* tp, void* tzp)
{
Expand Down

0 comments on commit 6a2968c

Please sign in to comment.