Merge pull request #8800 from def-/pr-winarm

Add arm64 windows support
This commit is contained in:
Dennis Felsing 2024-08-26 12:08:22 +00:00 committed by GitHub
commit 6e3b0910e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 73 additions and 23 deletions

View file

@ -40,7 +40,9 @@ else()
set(TARGET_BITS "64") set(TARGET_BITS "64")
endif() endif()
if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm" OR "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "aarch64") if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm"
OR "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "aarch64"
OR "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "ARM64")
if(TARGET_BITS STREQUAL "32") if(TARGET_BITS STREQUAL "32")
set(TARGET_CPU_ARCHITECTURE "arm") set(TARGET_CPU_ARCHITECTURE "arm")
else() else()
@ -3112,6 +3114,8 @@ set(CPACK_GENERATOR TGZ TXZ)
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON) set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
if(TARGET_OS STREQUAL "mac") if(TARGET_OS STREQUAL "mac")
set(CPACK_STRIP_FILES FALSE) set(CPACK_STRIP_FILES FALSE)
elseif(TARGET_OS STREQUAL "windows" AND TARGET_CPU_ARCHITECTURE STREQUAL "arm64")
set(CPACK_STRIP_FILES FALSE)
else() else()
set(CPACK_STRIP_FILES TRUE) set(CPACK_STRIP_FILES TRUE)
endif() endif()
@ -3125,7 +3129,11 @@ set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME})
if(TARGET_OS AND TARGET_BITS) if(TARGET_OS AND TARGET_BITS)
if(TARGET_OS STREQUAL "windows") if(TARGET_OS STREQUAL "windows")
if (TARGET_CPU_ARCHITECTURE STREQUAL "arm64")
set(CPACK_SYSTEM_NAME "win-arm64")
else()
set(CPACK_SYSTEM_NAME "win${TARGET_BITS}") set(CPACK_SYSTEM_NAME "win${TARGET_BITS}")
endif()
set(CPACK_GENERATOR ZIP) set(CPACK_GENERATOR ZIP)
elseif(TARGET_OS STREQUAL "linux") elseif(TARGET_OS STREQUAL "linux")
# Let compiler tell its arch # Let compiler tell its arch
@ -3386,7 +3394,7 @@ foreach(ext zip tar.gz tar.xz)
endforeach() endforeach()
foreach(target ${CPACK_TARGETS}) foreach(target ${CPACK_TARGETS})
list(APPEND COPY_TARGET_COMMANDS COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${target}> ${TMPDIR}/) list(APPEND COPY_TARGET_COMMANDS COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${target}> ${TMPDIR}/)
if(NOT TARGET_OS STREQUAL "mac") if(NOT TARGET_OS STREQUAL "mac" AND NOT (TARGET_OS STREQUAL "windows" AND TARGET_CPU_ARCHITECTURE STREQUAL "arm64"))
list(APPEND STRIP_TARGET_COMMANDS COMMAND strip -s ${TMPDIR}/$<TARGET_FILE_NAME:${target}>) list(APPEND STRIP_TARGET_COMMANDS COMMAND strip -s ${TMPDIR}/$<TARGET_FILE_NAME:${target}>)
endif() endif()
endforeach() endforeach()

View file

@ -26,8 +26,11 @@ if(CURL_FOUND)
is_bundled(CURL_BUNDLED "${CURL_LIBRARY}") is_bundled(CURL_BUNDLED "${CURL_LIBRARY}")
set(CURL_LIBRARIES ${CURL_LIBRARY}) set(CURL_LIBRARIES ${CURL_LIBRARY})
set(CURL_INCLUDE_DIRS ${CURL_INCLUDEDIR}) set(CURL_INCLUDE_DIRS ${CURL_INCLUDEDIR})
if (CURL_BUNDLED AND TARGET_OS STREQUAL "windows" AND TARGET_CPU_ARCHITECTURE STREQUAL "arm64")
if(CURL_BUNDLED AND TARGET_OS STREQUAL "windows") set(CURL_COPY_FILES
"${EXTRA_CURL_LIBDIR}/libcurl-4.dll"
)
elseif(CURL_BUNDLED AND TARGET_OS STREQUAL "windows")
set(CURL_COPY_FILES set(CURL_COPY_FILES
"${EXTRA_CURL_LIBDIR}/libcurl.dll" "${EXTRA_CURL_LIBDIR}/libcurl.dll"
"${EXTRA_CURL_LIBDIR}/zlib1.dll" "${EXTRA_CURL_LIBDIR}/zlib1.dll"

View file

@ -11,6 +11,12 @@ if(TARGET_OS STREQUAL "windows")
if(NOT EXCEPTION_HANDLING_BUNDLED) if(NOT EXCEPTION_HANDLING_BUNDLED)
message(FATAL_ERROR "could not find exception handling paths") message(FATAL_ERROR "could not find exception handling paths")
endif() endif()
if(TARGET_CPU_ARCHITECTURE STREQUAL "arm64")
set(EXCEPTION_HANDLING_COPY_FILES
"${EXTRA_EXCEPTION_HANDLING_LIBDIR}/exchndl.dll"
"${EXTRA_EXCEPTION_HANDLING_LIBDIR}/mgwhelp.dll"
)
else()
set(EXCEPTION_HANDLING_COPY_FILES set(EXCEPTION_HANDLING_COPY_FILES
"${EXTRA_EXCEPTION_HANDLING_LIBDIR}/exchndl.dll" "${EXTRA_EXCEPTION_HANDLING_LIBDIR}/exchndl.dll"
"${EXTRA_EXCEPTION_HANDLING_LIBDIR}/dbgcore.dll" "${EXTRA_EXCEPTION_HANDLING_LIBDIR}/dbgcore.dll"
@ -18,4 +24,5 @@ if(TARGET_OS STREQUAL "windows")
"${EXTRA_EXCEPTION_HANDLING_LIBDIR}/mgwhelp.dll" "${EXTRA_EXCEPTION_HANDLING_LIBDIR}/mgwhelp.dll"
"${EXTRA_EXCEPTION_HANDLING_LIBDIR}/symsrv.dll" "${EXTRA_EXCEPTION_HANDLING_LIBDIR}/symsrv.dll"
) )
endif()
endif() endif()

View file

@ -31,7 +31,9 @@ if(FREETYPE_FOUND)
is_bundled(FREETYPE_BUNDLED "${FREETYPE_LIBRARY}") is_bundled(FREETYPE_BUNDLED "${FREETYPE_LIBRARY}")
set(FREETYPE_COPY_FILES) set(FREETYPE_COPY_FILES)
if(FREETYPE_BUNDLED) if(FREETYPE_BUNDLED)
if(TARGET_OS STREQUAL "windows") if(TARGET_OS STREQUAL "windows" AND TARGET_CPU_ARCHITECTURE STREQUAL "arm64")
set(FREETYPE_COPY_FILES "${EXTRA_FREETYPE_LIBDIR}/libfreetype-6.dll")
elseif(TARGET_OS STREQUAL "windows")
set(FREETYPE_COPY_FILES "${EXTRA_FREETYPE_LIBDIR}/libfreetype.dll") set(FREETYPE_COPY_FILES "${EXTRA_FREETYPE_LIBDIR}/libfreetype.dll")
elseif(TARGET_OS STREQUAL "mac") elseif(TARGET_OS STREQUAL "mac")
set(FREETYPE_COPY_FILES "${EXTRA_FREETYPE_LIBDIR}/libfreetype.6.dylib") set(FREETYPE_COPY_FILES "${EXTRA_FREETYPE_LIBDIR}/libfreetype.6.dylib")

View file

@ -29,12 +29,21 @@ set(OPUSFILE_INCLUDE_DIRS ${OPUSFILE_INCLUDEDIR})
if(OPUSFILE_FOUND) if(OPUSFILE_FOUND)
is_bundled(OPUSFILE_BUNDLED "${OPUSFILE_LIBRARY}") is_bundled(OPUSFILE_BUNDLED "${OPUSFILE_LIBRARY}")
if(OPUSFILE_BUNDLED AND TARGET_OS STREQUAL "windows") if(OPUSFILE_BUNDLED AND TARGET_OS STREQUAL "windows")
if (TARGET_CPU_ARCHITECTURE STREQUAL "arm64")
set(OPUSFILE_COPY_FILES
"${EXTRA_OPUSFILE_LIBDIR}/libopusfile-0.dll"
"${EXTRA_OPUSFILE_LIBDIR}/libopus-0.dll"
"${EXTRA_OPUSFILE_LIBDIR}/libogg-0.dll"
"${EXTRA_OPUSFILE_LIBDIR}/libwinpthread-1.dll"
)
else()
set(OPUSFILE_COPY_FILES set(OPUSFILE_COPY_FILES
"${EXTRA_OPUSFILE_LIBDIR}/libogg.dll" "${EXTRA_OPUSFILE_LIBDIR}/libogg.dll"
"${EXTRA_OPUSFILE_LIBDIR}/libopus.dll" "${EXTRA_OPUSFILE_LIBDIR}/libopus.dll"
"${EXTRA_OPUSFILE_LIBDIR}/libopusfile.dll" "${EXTRA_OPUSFILE_LIBDIR}/libopusfile.dll"
"${EXTRA_OPUSFILE_LIBDIR}/libwinpthread-1.dll" "${EXTRA_OPUSFILE_LIBDIR}/libwinpthread-1.dll"
) )
endif()
if(TARGET_BITS EQUAL 32) if(TARGET_BITS EQUAL 32)
list(APPEND OPUSFILE_COPY_FILES list(APPEND OPUSFILE_COPY_FILES
"${EXTRA_OPUSFILE_LIBDIR}/libgcc_s_sjlj-1.dll" "${EXTRA_OPUSFILE_LIBDIR}/libgcc_s_sjlj-1.dll"

View file

@ -40,6 +40,12 @@ if(SQLite3_FOUND)
is_bundled(SQLite3_BUNDLED "${SQLite3_LIBRARY}") is_bundled(SQLite3_BUNDLED "${SQLite3_LIBRARY}")
set(SQLite3_COPY_FILES) set(SQLite3_COPY_FILES)
if(SQLite3_BUNDLED AND TARGET_OS STREQUAL "windows") if(SQLite3_BUNDLED AND TARGET_OS STREQUAL "windows")
if (TARGET_CPU_ARCHITECTURE STREQUAL "arm64")
set(SQLite3_COPY_FILES
"${EXTRA_SQLite3_LIBDIR}/libsqlite3-0.dll"
)
else()
set(SQLite3_COPY_FILES "${EXTRA_SQLite3_LIBDIR}/sqlite3.dll") set(SQLite3_COPY_FILES "${EXTRA_SQLite3_LIBDIR}/sqlite3.dll")
endif() endif()
endif()
endif() endif()

View file

@ -1,4 +1,7 @@
if(TARGET_OS STREQUAL "windows") # only find ssp when toolchain is gcc
if(TARGET_OS STREQUAL "windows"
AND NOT CMAKE_C_COMPILER_ID STREQUAL "Clang"
AND NOT CMAKE_C_COMPILER_ID STREQUAL "MSVC")
set_extra_dirs_lib(SSP ssp) set_extra_dirs_lib(SSP ssp)
find_file(SSP_LIBRARY find_file(SSP_LIBRARY
NAMES libssp-0.dll NAMES libssp-0.dll

View file

@ -0,0 +1,12 @@
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR aarch64)
set(CMAKE_C_COMPILER aarch64-w64-mingw32-clang)
set(CMAKE_CXX_COMPILER aarch64-w64-mingw32-clang++)
set(CMAKE_RC_COMPILER aarch64-w64-mingw32-windres)
set(CMAKE_RUST_COMPILER_TARGET aarch64-pc-windows-gnullvm)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

@ -1 +1 @@
Subproject commit d5f0cd9194936d1ab5bd19952645b8dffe9ae06c Subproject commit e78f350e7898fc6b0702cdc3b7ce6ee347c97d49

View file

@ -171,7 +171,7 @@
#define CONF_ARCH_ENDIAN_LITTLE 1 #define CONF_ARCH_ENDIAN_LITTLE 1
#endif #endif
#if defined(__aarch64__) || defined(__arm64__) #if defined(__aarch64__) || defined(__arm64__) || defined(__ARM_ARCH)
#define CONF_ARCH_ARM64 1 #define CONF_ARCH_ARM64 1
#define CONF_ARCH_STRING "arm64" #define CONF_ARCH_STRING "arm64"
#define CONF_ARCH_ENDIAN_LITTLE 1 #define CONF_ARCH_ENDIAN_LITTLE 1