CMake: Fix building ARM64 on Windows

This commit is contained in:
spycrab 2020-02-12 00:07:56 +01:00
parent a9dc4ac3f0
commit 213a9adcff
6 changed files with 72 additions and 5 deletions

View File

@ -112,6 +112,11 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Binaries)
if (WIN32)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/Binary)
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
string(APPEND CMAKE_RUNTIME_OUTPUT_DIRECTORY /ARM64)
endif()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
@ -200,9 +205,7 @@ elseif(_ARCH_64 AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|AMD64")
add_definitions(-D_M_X86_64=1)
check_and_add_flag(HAVE_SSE2 -msse2)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
set(_M_ARM 1)
set(_M_ARM_64 1)
add_definitions(-D_M_ARM=1)
add_definitions(-D_M_ARM_64=1)
# CRC instruction set is used in the CRC32 hash function
check_and_add_flag(HAVE_ARCH_ARMV8 -march=armv8-a+crc)
@ -456,7 +459,7 @@ if(ENABLE_EGL)
endif()
if(ENCODE_FRAMEDUMPS)
if(WIN32)
if(WIN32 AND _M_X86_64)
set(FFMPEG_DIR Externals/ffmpeg)
endif()
find_package(FFmpeg COMPONENTS avcodec avformat avutil swscale)

View File

@ -29,6 +29,52 @@
"value": "${workspaceRoot}\\Externals\\Qt\\Qt5.14.1\\msvc2019_64\\lib\\cmake\\Qt5"
}
]
},
{
"name": "Release (arm64)",
"configurationType": "Release",
"generator": "Ninja",
"inheritEnvironments": [ "msvc_arm64_x64" ],
"buildCommandArgs": "",
"buildRoot": "${workspaceRoot}\\Build\\${name}",
"cmakeCommandArgs": "",
"variables": [
{
"name": "Qt5_DIR",
"value": "${workspaceRoot}\\Externals\\Qt\\Qt5.14.1\\msvc2019_arm64\\lib\\cmake\\Qt5"
},
{
"name": "CMAKE_SYSTEM_NAME",
"value": "Windows"
},
{
"name": "CMAKE_SYSTEM_PROCESSOR",
"value": "aarch64"
}
]
},
{
"name": "Debug (arm64)",
"configurationType": "Debug",
"generator": "Ninja",
"inheritEnvironments": [ "msvc_arm64_x64" ],
"buildCommandArgs": "",
"buildRoot": "${workspaceRoot}\\Build\\${name}",
"cmakeCommandArgs": "",
"variables": [
{
"name": "Qt5_DIR",
"value": "${workspaceRoot}\\Externals\\Qt\\Qt5.14.1\\msvc2019_arm64\\lib\\cmake\\Qt5"
},
{
"name": "CMAKE_SYSTEM_NAME",
"value": "Windows"
},
{
"name": "CMAKE_SYSTEM_PROCESSOR",
"value": "aarch64"
}
]
}
]
}

View File

@ -15,6 +15,10 @@
#include "Common/CommonTypes.h"
#include "Common/MathUtil.h"
#ifdef _WIN32
#include <Windows.h>
#endif
namespace Arm64Gen
{
namespace

View File

@ -156,9 +156,11 @@ elseif(WIN32)
PRIVATE
kernel32.lib
shlwapi.lib
opengl32.lib
winmm.lib
)
if (_M_X86_64)
target_link_libraries(common PRIVATE opengl32.lib)
endif()
endif()
if(ANDROID)

View File

@ -11,9 +11,13 @@
#include "Common/CommonFuncs.h"
#include "Common/Intrinsics.h"
#if defined(_M_ARM_64) && !defined(_MSC_VER)
#ifdef _M_ARM_64
#ifdef _MSC_VER
#include <intrin.h>
#else
#include <arm_acle.h>
#endif
#endif
namespace Common
{

View File

@ -296,6 +296,14 @@ PRIVATE
imgui
)
if (WIN32)
target_link_libraries(dolphin-emu
PRIVATE
gdi32.lib
shell32.lib
)
endif()
if(WIN32)
target_sources(dolphin-emu PRIVATE DolphinQt.manifest DolphinQt.rc)