Skip to content

Commit

Permalink
Fix windows
Browse files Browse the repository at this point in the history
  • Loading branch information
rzblue committed Aug 23, 2024
1 parent e342d3a commit bc4ba0f
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ int pthread_create(pthread_t *thread, pthread_attr_t *attr, void *(*start_routin
if (thread == NULL || start_routine == NULL)
return 1;

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-function-type"
*thread = (HANDLE) CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)start_routine, arg, 0, NULL);
#pragma GCC diagnostic pop
if (*thread == NULL)
return 1;
return 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Johnson <[email protected]>
Date: Sun, 4 Dec 2022 11:01:56 -0800
Subject: [PATCH 1/7] apriltag_pose.c: Set NULL when second solution could not
Subject: [PATCH 1/8] apriltag_pose.c: Set NULL when second solution could not
be determined

---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Johnson <[email protected]>
Date: Sun, 4 Dec 2022 11:42:13 -0800
Subject: [PATCH 2/7] Avoid unused variable warnings in release builds
Subject: [PATCH 2/8] Avoid unused variable warnings in release builds

---
common/matd.c | 4 +++-
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tyler Veness <[email protected]>
Date: Tue, 10 Jan 2023 18:36:36 -0800
Subject: [PATCH 3/7] Make orthogonal_iteration() exit early upon convergence
Subject: [PATCH 3/8] Make orthogonal_iteration() exit early upon convergence

The current approach wastes iterations doing no work. Exiting early can
give lower latencies and higher FPS.
Expand Down Expand Up @@ -86,7 +86,7 @@ index f0003a2d187df13236992026ee6ff7f9d6f7aff9..782729225c3555edcfebb7d8a21f847a
pose->R = pose1.R;
pose->t = pose1.t;
diff --git a/apriltag_pose.h b/apriltag_pose.h
index 07ee37b2cb4185bcbdb46d1c9ccec306f0f2e96d..72993f11514199754c452369bad32157b6d64eb1 100644
index 07ee37b2cb4185bcbdb46d1c9ccec306f0f2e96d..6bbe4a4e000402f990b0a13b8b87e6becc8c48a8 100644
--- a/apriltag_pose.h
+++ b/apriltag_pose.h
@@ -63,7 +63,8 @@ void estimate_tag_pose_orthogonal_iteration(
Expand All @@ -100,7 +100,7 @@ index 07ee37b2cb4185bcbdb46d1c9ccec306f0f2e96d..72993f11514199754c452369bad32157
/**
* Estimate tag pose.
diff --git a/example/apriltag_demo.c b/example/apriltag_demo.c
index 6de90540fe2f22f5160f725bce03d50bb3967c74..841d7788756011b0c7237e989242d87de76b14ef 100644
index 6de90540fe2f22f5160f725bce03d50bb3967c74..ccd55cdceeaf46712891a7fab971b8b3c6afa950 100644
--- a/example/apriltag_demo.c
+++ b/example/apriltag_demo.c
@@ -42,6 +42,7 @@ either expressed or implied, of the Regents of The University of Michigan.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Johnson <[email protected]>
Date: Wed, 19 Jul 2023 20:48:21 -0700
Subject: [PATCH 4/7] Fix signed left shift warning
Subject: [PATCH 4/8] Fix signed left shift warning

---
common/pjpeg.c | 4 ++--
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Johnson <[email protected]>
Date: Wed, 19 Jul 2023 21:28:43 -0700
Subject: [PATCH 5/7] Avoid incompatible pointer warning
Subject: [PATCH 5/8] Avoid incompatible pointer warning

---
common/getopt.c | 3 ++-
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tyler Veness <[email protected]>
Date: Fri, 19 Jul 2024 21:45:29 -0700
Subject: [PATCH 6/7] Remove calls to postscript_image()
Subject: [PATCH 6/8] Remove calls to postscript_image()

---
apriltag.c | 5 -----
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Johnson <[email protected]>
Date: Thu, 29 Jun 2023 22:14:05 -0700
Subject: [PATCH 7/7] Fix clang 16 warnings
Subject: [PATCH 7/8] Fix clang 16 warnings

---
apriltag.c | 2 +-
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ryan Blue <[email protected]>
Date: Fri, 23 Aug 2024 02:50:24 -0400
Subject: [PATCH 8/8] Remove GCC diagnostic pragmas on windows

---
common/pthreads_cross.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/common/pthreads_cross.c b/common/pthreads_cross.c
index d48b81a1bbafa15f1c8a5b4fec6a755847947ce6..4c30def848cdfbe49dd3cec1785a343fbab908eb 100644
--- a/common/pthreads_cross.c
+++ b/common/pthreads_cross.c
@@ -44,10 +44,7 @@ int pthread_create(pthread_t *thread, pthread_attr_t *attr, void *(*start_routin
if (thread == NULL || start_routine == NULL)
return 1;

-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wcast-function-type"
*thread = (HANDLE) CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)start_routine, arg, 0, NULL);
-#pragma GCC diagnostic pop
if (*thread == NULL)
return 1;
return 0;
@@ -218,7 +215,7 @@ int pthread_rwlock_unlock(pthread_rwlock_t *rwlock)
return 0;
}

-int sched_yield(void) {
+int sched_yield(void) {
return (int)SwitchToThread();
}

@@ -238,7 +235,7 @@ unsigned int timespec_to_ms(const struct timespec *abstime)
return ((abstime->tv_sec - time(NULL)) * 1000) + (abstime->tv_nsec / 1000000);
}

-unsigned int pcthread_get_num_procs(void)
+unsigned int pcthread_get_num_procs(void)
{
SYSTEM_INFO sysinfo;

@@ -249,7 +246,7 @@ unsigned int pcthread_get_num_procs(void)
#else

#include <unistd.h>
-unsigned int pcthread_get_num_procs(void)
+unsigned int pcthread_get_num_procs(void)
{
return (unsigned int)sysconf(_SC_NPROCESSORS_ONLN);
}

0 comments on commit bc4ba0f

Please sign in to comment.