[build] Prepare for Windows arm64 builds (#5390)

Builds aren't actually enabled yet due to a bug in Gradle.
This commit is contained in:
Thad House
2023-07-24 22:46:25 -07:00
committed by GitHub
parent 552f4b76b5
commit b8cdf97621
19 changed files with 636 additions and 1809 deletions

View File

@@ -63,6 +63,18 @@ jobs:
build-options: "-PciReleaseOnly --max-workers 1"
task: "copyAllOutputs"
outputs: "build/allOutputs"
# - os: windows-2022
# artifact-name: WinArm64Debug
# architecture: x64
# task: "build"
# build-options: "-PciDebugOnly -Pbuildwinarm64 -Ponlywindowsarm64 --max-workers 1"
# outputs: "build/allOutputs"
# - os: windows-2022
# artifact-name: WinArm64Release
# architecture: x64
# build-options: "-PciReleaseOnly -Pbuildwinarm64 -Ponlywindowsarm64 --max-workers 1"
# task: "copyAllOutputs"
# outputs: "build/allOutputs"
- os: macOS-12
artifact-name: macOS
architecture: x64

View File

@@ -7,7 +7,7 @@ include(FetchContent)
FetchContent_Declare(
apriltaglib
GIT_REPOSITORY https://github.com/wpilibsuite/apriltag.git
GIT_TAG ad31e33d20f9782b7239cb15cde57c56c91383ad
GIT_TAG 2f35517c63cdcbade1aff0dbba5262e615827494
)
# Don't use apriltag's CMakeLists.txt due to conflicting naming and JNI

View File

@@ -110,7 +110,7 @@ static AprilTagPoseEstimate DoEstimateOrthogonalIteration(
apriltag_pose_t pose1, pose2;
double err1, err2;
estimate_tag_pose_orthogonal_iteration(&info, &err1, &pose1, &err2, &pose2,
nIters);
nIters, 1e-7);
return {MakePose(pose1), MakePose(pose2), err1, err2};
}

View File

@@ -157,7 +157,7 @@ class AprilTagDetectorTest {
var estimator =
new AprilTagPoseEstimator(new AprilTagPoseEstimator.Config(0.2, 500, 500, 320, 240));
AprilTagPoseEstimate est = estimator.estimateOrthogonalIteration(results[0], 50);
AprilTagPoseEstimate est = estimator.estimateOrthogonalIteration(results[0], 200);
assertEquals(new Transform3d(), est.pose2);
Transform3d pose = estimator.estimate(results[0]);
assertEquals(est.pose1, pose);
@@ -189,7 +189,7 @@ class AprilTagDetectorTest {
new AprilTagPoseEstimator(
new AprilTagPoseEstimator.Config(
0.2, 500, 500, image.cols() / 2.0, image.rows() / 2.0));
AprilTagPoseEstimate est = estimator.estimateOrthogonalIteration(results[0], 50);
AprilTagPoseEstimate est = estimator.estimateOrthogonalIteration(results[0], 200);
assertEquals(Units.degreesToRadians(45), est.pose1.getRotation().getX(), 0.1);
assertEquals(Units.degreesToRadians(0), est.pose1.getRotation().getY(), 0.1);
@@ -222,7 +222,7 @@ class AprilTagDetectorTest {
new AprilTagPoseEstimator(
new AprilTagPoseEstimator.Config(
0.2, 500, 500, image.cols() / 2.0, image.rows() / 2.0));
AprilTagPoseEstimate est = estimator.estimateOrthogonalIteration(results[0], 50);
AprilTagPoseEstimate est = estimator.estimateOrthogonalIteration(results[0], 200);
assertEquals(Units.degreesToRadians(0), est.pose1.getRotation().getX(), 0.1);
assertEquals(Units.degreesToRadians(45), est.pose1.getRotation().getY(), 0.1);
@@ -252,7 +252,7 @@ class AprilTagDetectorTest {
new AprilTagPoseEstimator(
new AprilTagPoseEstimator.Config(
0.2, 500, 500, image.cols() / 2.0, image.rows() / 2.0));
AprilTagPoseEstimate est = estimator.estimateOrthogonalIteration(results[0], 50);
AprilTagPoseEstimate est = estimator.estimateOrthogonalIteration(results[0], 200);
assertEquals(Units.degreesToRadians(0), est.pose1.getRotation().getX(), 0.1);
assertEquals(Units.degreesToRadians(0), est.pose1.getRotation().getY(), 0.1);

View File

@@ -9,5 +9,5 @@ repositories {
}
}
dependencies {
implementation "edu.wpi.first:native-utils:2023.11.1"
implementation "edu.wpi.first:native-utils:2024.0.0"
}

View File

@@ -6,7 +6,7 @@ nativeUtils {
headerClassifier = "headers"
sourceClassifier = "sources"
ext = "zip"
version = '3.2.0-3'
version = '3.2.0-6'
targetPlatforms.addAll(nativeUtils.wpi.platforms.allPlatforms)
}
}

View File

@@ -14,8 +14,8 @@ nativeUtils {
wpi {
configureDependencies {
niLibVersion = "2023.3.0"
opencvVersion = "4.6.0-3"
googleTestVersion = "1.12.1-1"
opencvVersion = "4.6.0-5"
googleTestVersion = "1.12.1-2"
}
}
}

View File

@@ -6,7 +6,7 @@ nativeUtils {
headerClassifier = "headers"
sourceClassifier = "sources"
ext = "zip"
version = '1.89.1-1'
version = '1.89.1-2'
targetPlatforms.addAll(nativeUtils.wpi.platforms.allPlatforms)
}
}

View File

@@ -81,7 +81,7 @@ test {
finalizedBy jacocoTestReport
}
if (project.hasProperty('onlylinuxathena') || project.hasProperty('onlylinuxarm32') || project.hasProperty('onlylinuxarm64')) {
if (project.hasProperty('onlylinuxathena') || project.hasProperty('onlylinuxarm32') || project.hasProperty('onlylinuxarm64') || project.hasProperty('onlywindowsarm64')) {
test.enabled = false
}

View File

@@ -6,7 +6,7 @@ nativeUtils {
headerClassifier = "headers"
sourceClassifier = "sources"
ext = "zip"
version = '0.95-6'
version = '0.95-8'
targetPlatforms.addAll(nativeUtils.wpi.platforms.allPlatforms)
}
}

View File

@@ -1,4 +1,4 @@
def opencvVersion = '4.6.0-3'
def opencvVersion = '4.6.0-5'
if (project.hasProperty('useCpp') && project.useCpp) {
model {

View File

@@ -1,21 +1,21 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: PJ Reiniger <pj.reiniger@gmail.com>
Date: Tue, 24 May 2022 01:24:31 -0400
Subject: [PATCH 3/3] Add advapi pragma
From: Thad House <thadhouse1@gmail.com>
Date: Sat, 22 Jul 2023 13:03:13 -0700
Subject: [PATCH] Add advapi pragma
---
Main/StackWalker/StackWalker.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/Main/StackWalker/StackWalker.cpp b/Main/StackWalker/StackWalker.cpp
index 48c7c57c439dd8feb7ea88fda17d68a4bbbb3d68..6f0fbf28a61f13b796edee56c37737bf14f5a933 100644
index 89545f8612d0d099d48fcf4184a2f2a30cf8577f..b2bcbaa447c5db1a3bcc155fb317ebc8a8050e79 100644
--- a/Main/StackWalker/StackWalker.cpp
+++ b/Main/StackWalker/StackWalker.cpp
@@ -88,6 +88,7 @@
#include <stdlib.h>
#include <tchar.h>
@@ -91,6 +91,7 @@
#include <new>
#pragma comment(lib, "version.lib") // for "VerQueryValue"
+#pragma comment(lib, "Advapi32.lib") // for "GetUserName"
#pragma warning(disable : 4826)
#ifdef UNICODE
#if _MSC_VER >= 1900

File diff suppressed because it is too large Load Diff

View File

@@ -1,79 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: PJ Reiniger <pj.reiniger@gmail.com>
Date: Mon, 23 May 2022 00:06:45 -0400
Subject: [PATCH 2/3] Remove _M_IX86 checks
---
Main/StackWalker/StackWalker.h | 52 ----------------------------------
1 file changed, 52 deletions(-)
diff --git a/Main/StackWalker/StackWalker.h b/Main/StackWalker/StackWalker.h
index 03efcecf61638f78679e53c5db8ae6f1bc790dda..89be951624836f4cfaf37d713267dce855287ab9 100644
--- a/Main/StackWalker/StackWalker.h
+++ b/Main/StackWalker/StackWalker.h
@@ -179,57 +179,6 @@ protected:
friend StackWalkerInternal;
}; // class StackWalker
-// The "ugly" assembler-implementation is needed for systems before XP
-// If you have a new PSDK and you only compile for XP and later, then you can use
-// the "RtlCaptureContext"
-// Currently there is no define which determines the PSDK-Version...
-// So we just use the compiler-version (and assumes that the PSDK is
-// the one which was installed by the VS-IDE)
-
-// INFO: If you want, you can use the RtlCaptureContext if you only target XP and later...
-// But I currently use it in x64/IA64 environments...
-//#if defined(_M_IX86) && (_WIN32_WINNT <= 0x0500) && (_MSC_VER < 1400)
-
-#if defined(_M_IX86)
-#ifdef CURRENT_THREAD_VIA_EXCEPTION
-// TODO: The following is not a "good" implementation,
-// because the callstack is only valid in the "__except" block...
-#define GET_CURRENT_CONTEXT_STACKWALKER_CODEPLEX(c, contextFlags) \
- do \
- { \
- memset(&c, 0, sizeof(CONTEXT)); \
- EXCEPTION_POINTERS* pExp = NULL; \
- __try \
- { \
- throw 0; \
- } \
- __except (((pExp = GetExceptionInformation()) ? EXCEPTION_EXECUTE_HANDLER \
- : EXCEPTION_EXECUTE_HANDLER)) \
- { \
- } \
- if (pExp != NULL) \
- memcpy(&c, pExp->ContextRecord, sizeof(CONTEXT)); \
- c.ContextFlags = contextFlags; \
- } while (0);
-#else
-// clang-format off
-// The following should be enough for walking the callstack...
-#define GET_CURRENT_CONTEXT_STACKWALKER_CODEPLEX(c, contextFlags) \
- do \
- { \
- memset(&c, 0, sizeof(CONTEXT)); \
- c.ContextFlags = contextFlags; \
- __asm call x \
- __asm x: pop eax \
- __asm mov c.Eip, eax \
- __asm mov c.Ebp, ebp \
- __asm mov c.Esp, esp \
- } while (0)
-// clang-format on
-#endif
-
-#else
-
// The following is defined for x86 (XP and higher), x64 and IA64:
#define GET_CURRENT_CONTEXT_STACKWALKER_CODEPLEX(c, contextFlags) \
do \
@@ -238,7 +187,6 @@ protected:
c.ContextFlags = contextFlags; \
RtlCaptureContext(&c); \
} while (0);
-#endif
#endif //defined(_MSC_VER)

View File

@@ -38,7 +38,7 @@ def crlf_to_lf(stackwalker_dir):
def main():
upstream_root = clone_repo(
"https://github.com/JochenKalmbach/StackWalker",
"42e7a6e056a9e7aca911a7e9e54e2e4f90bc2652",
"5b0df7a4db8896f6b6dc45d36e383c52577e3c6b",
shallow=False,
)
wpilib_root = get_repo_root()
@@ -50,9 +50,7 @@ def main():
# Apply patches to upstream Git repo
os.chdir(upstream_root)
for f in [
"0001-Apply-PR-35.patch",
"0002-Remove-_M_IX86-checks.patch",
"0003-Add-advapi-pragma.patch",
"0001-Add-advapi-pragma.patch",
]:
git_am(
os.path.join(wpilib_root, "upstream_utils/stack_walker_patches", f),

View File

@@ -21,7 +21,7 @@ test {
finalizedBy jacocoTestReport
}
if (project.hasProperty('onlylinuxathena') || project.hasProperty('onlylinuxarm32') || project.hasProperty('onlylinuxarm64')) {
if (project.hasProperty('onlylinuxathena') || project.hasProperty('onlylinuxarm32') || project.hasProperty('onlylinuxarm64') || project.hasProperty('onlywindowsarm64')) {
test.enabled = false
}

View File

@@ -23,13 +23,7 @@ class StackTraceWalker : public StackWalker {
} // namespace
void StackTraceWalker::OnOutput(LPCTSTR szText) {
#ifdef _UNICODE
wpi::SmallString<128> utf8;
wpi::sys::windows::UTF16ToUTF8(szText, wcslen(szText), utf8);
m_output.append(utf8.data(), utf8.size());
#else
m_output.append(szText);
#endif
}
namespace wpi {

File diff suppressed because it is too large Load Diff

View File

@@ -43,14 +43,27 @@
#include <windows.h>
#if _MSC_VER >= 1900
#pragma warning(disable : 4091)
// special defines for VC5/6 (if no actual PSDK is installed):
#if _MSC_VER < 1300
typedef unsigned __int64 DWORD64, *PDWORD64;
#if defined(_WIN64)
typedef unsigned __int64 SIZE_T, *PSIZE_T;
#else
typedef unsigned long SIZE_T, *PSIZE_T;
#endif
#endif // _MSC_VER < 1300
class StackWalkerInternal; // forward
class StackWalker
{
public:
typedef enum ExceptType
{
NonExcept = 0, // RtlCaptureContext
AfterExcept = 1,
AfterCatch = 2, // get_current_exception_context
} ExceptType;
typedef enum StackWalkOptions
{
// No addition info will be retrieved
@@ -85,13 +98,28 @@ public:
OptionsAll = 0x3F
} StackWalkOptions;
StackWalker(ExceptType extype, int options = OptionsAll, PEXCEPTION_POINTERS exp = NULL);
StackWalker(int options = OptionsAll, // 'int' is by design, to combine the enum-flags
LPCTSTR szSymPath = NULL,
LPCSTR szSymPath = NULL,
DWORD dwProcessId = GetCurrentProcessId(),
HANDLE hProcess = GetCurrentProcess());
StackWalker(DWORD dwProcessId, HANDLE hProcess);
virtual ~StackWalker();
bool SetSymPath(LPCSTR szSymPath);
bool SetTargetProcess(DWORD dwProcessId, HANDLE hProcess);
PCONTEXT GetCurrentExceptionContext();
private:
bool Init(ExceptType extype, int options, LPCSTR szSymPath, DWORD dwProcessId,
HANDLE hProcess, PEXCEPTION_POINTERS exp = NULL);
public:
typedef BOOL(__stdcall* PReadProcessMemoryRoutine)(
HANDLE hProcess,
DWORD64 qwBaseAddress,
@@ -127,18 +155,18 @@ protected:
typedef struct CallstackEntry
{
DWORD64 offset; // if 0, we have no valid entry
TCHAR name[STACKWALK_MAX_NAMELEN];
TCHAR undName[STACKWALK_MAX_NAMELEN];
TCHAR undFullName[STACKWALK_MAX_NAMELEN];
CHAR name[STACKWALK_MAX_NAMELEN];
CHAR undName[STACKWALK_MAX_NAMELEN];
CHAR undFullName[STACKWALK_MAX_NAMELEN];
DWORD64 offsetFromSmybol;
DWORD offsetFromLine;
DWORD lineNumber;
TCHAR lineFileName[STACKWALK_MAX_NAMELEN];
CHAR lineFileName[STACKWALK_MAX_NAMELEN];
DWORD symType;
LPCSTR symTypeString;
TCHAR moduleName[STACKWALK_MAX_NAMELEN];
CHAR moduleName[STACKWALK_MAX_NAMELEN];
DWORD64 baseOfImage;
TCHAR loadedImageName[STACKWALK_MAX_NAMELEN];
CHAR loadedImageName[STACKWALK_MAX_NAMELEN];
} CallstackEntry;
typedef enum CallstackEntryType
@@ -148,24 +176,24 @@ protected:
lastEntry
} CallstackEntryType;
virtual void OnSymInit(LPCTSTR szSearchPath, DWORD symOptions, LPCTSTR szUserName);
virtual void OnLoadModule(LPCTSTR img,
LPCTSTR mod,
virtual void OnSymInit(LPCSTR szSearchPath, DWORD symOptions, LPCSTR szUserName);
virtual void OnLoadModule(LPCSTR img,
LPCSTR mod,
DWORD64 baseAddr,
DWORD size,
DWORD result,
LPCTSTR symType,
LPCTSTR pdbName,
LPCSTR symType,
LPCSTR pdbName,
ULONGLONG fileVersion);
virtual void OnCallstackEntry(CallstackEntryType eType, CallstackEntry& entry);
virtual void OnDbgHelpErr(LPCTSTR szFuncName, DWORD gle, DWORD64 addr);
virtual void OnOutput(LPCTSTR szText);
virtual void OnDbgHelpErr(LPCSTR szFuncName, DWORD gle, DWORD64 addr);
virtual void OnOutput(LPCSTR szText);
StackWalkerInternal* m_sw;
HANDLE m_hProcess;
DWORD m_dwProcessId;
BOOL m_modulesLoaded;
LPTSTR m_szSymPath;
LPSTR m_szSymPath;
int m_options;
int m_MaxRecursionCount;
@@ -179,6 +207,57 @@ protected:
friend StackWalkerInternal;
}; // class StackWalker
// The "ugly" assembler-implementation is needed for systems before XP
// If you have a new PSDK and you only compile for XP and later, then you can use
// the "RtlCaptureContext"
// Currently there is no define which determines the PSDK-Version...
// So we just use the compiler-version (and assumes that the PSDK is
// the one which was installed by the VS-IDE)
// INFO: If you want, you can use the RtlCaptureContext if you only target XP and later...
// But I currently use it in x64/IA64 environments...
//#if defined(_M_IX86) && (_WIN32_WINNT <= 0x0500) && (_MSC_VER < 1400)
#if defined(_M_IX86)
#ifdef CURRENT_THREAD_VIA_EXCEPTION
// TODO: The following is not a "good" implementation,
// because the callstack is only valid in the "__except" block...
#define GET_CURRENT_CONTEXT_STACKWALKER_CODEPLEX(c, contextFlags) \
do \
{ \
memset(&c, 0, sizeof(CONTEXT)); \
EXCEPTION_POINTERS* pExp = NULL; \
__try \
{ \
throw 0; \
} \
__except (((pExp = GetExceptionInformation()) ? EXCEPTION_EXECUTE_HANDLER \
: EXCEPTION_EXECUTE_HANDLER)) \
{ \
} \
if (pExp != NULL) \
memcpy(&c, pExp->ContextRecord, sizeof(CONTEXT)); \
c.ContextFlags = contextFlags; \
} while (0);
#else
// clang-format off
// The following should be enough for walking the callstack...
#define GET_CURRENT_CONTEXT_STACKWALKER_CODEPLEX(c, contextFlags) \
do \
{ \
memset(&c, 0, sizeof(CONTEXT)); \
c.ContextFlags = contextFlags; \
__asm call x \
__asm x: pop eax \
__asm mov c.Eip, eax \
__asm mov c.Ebp, ebp \
__asm mov c.Esp, esp \
} while (0)
// clang-format on
#endif
#else
// The following is defined for x86 (XP and higher), x64 and IA64:
#define GET_CURRENT_CONTEXT_STACKWALKER_CODEPLEX(c, contextFlags) \
do \
@@ -187,6 +266,7 @@ protected:
c.ContextFlags = contextFlags; \
RtlCaptureContext(&c); \
} while (0);
#endif
#endif //defined(_MSC_VER)