From fc13826457cf7e36d3f0a808f6a7360a3499d7f3 Mon Sep 17 00:00:00 2001 From: Vladislav Rassokhin Date: Mon, 19 Sep 2022 12:17:13 +0200 Subject: [PATCH] Support windows-aarch64, different name is used for .dll --- CMakeLists.txt | 14 ++++++++++++++ publish/build.gradle | 2 +- test_runner.py | 2 ++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 67c4739..ddaef61 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,3 +46,17 @@ if ((UNIX OR MINGW) AND NOT APPLE) target_link_libraries(memory_agent PRIVATE -static-libstdc++ -static-libgcc) set_target_properties(memory_agent PROPERTIES LINK_FLAGS "-Wl,--exclude-libs,ALL") endif () + +if(WIN32) + include(CheckSymbolExists) + check_symbol_exists("_M_ARM64" "" TARGET_ARM64) + check_symbol_exists("_M_AMD64" "" TARGET_X64) + if(TARGET_ARM64) + set(FILE_NAME "memory_agent64a") + elseif(TARGET_X64) + set(FILE_NAME "memory_agent") # Consider using '64' suffix + else() + set(FILE_NAME "memory_agent32") + endif() + set_target_properties(memory_agent PROPERTIES OUTPUT_NAME ${FILE_NAME}) +endif() diff --git a/publish/build.gradle b/publish/build.gradle index 8db5177..3a66738 100644 --- a/publish/build.gradle +++ b/publish/build.gradle @@ -20,7 +20,7 @@ def binariesPath = "$projectDir/../bin" def libraryClassesPath = "$projectDir/../classes/" static def checkBinaries(String binPath) { - def expectedFiles = ['libmemory_agent.dylib', 'libmemory_agent.so', 'memory_agent.dll', 'memory_agent32.dll'] + def expectedFiles = ['libmemory_agent.dylib', 'libmemory_agent.so', 'memory_agent.dll', 'memory_agent64a.dll', 'memory_agent32.dll'] expectedFiles.collect { new File(binPath, it) }.each { file -> if (!file.exists()) { throw new GradleException("Binary dependency not found: ${file.path}") diff --git a/test_runner.py b/test_runner.py index 964fc49..66351e2 100644 --- a/test_runner.py +++ b/test_runner.py @@ -55,6 +55,8 @@ def dynamic_lib_format() -> str: if os_type == "Windows": if get_java_bitness() == 32: return '{}32.dll' + elif os_arch == 'aarch64': + return '{}64a.dll' else: return '{}.dll' if os_type == "Darwin":