Merge pull request #8087 from spycrab/cmake_win2019
Support CMake on Windows
This commit is contained in:
commit
ec734065db
|
@ -107,6 +107,14 @@ endif()
|
|||
# as defined above.
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Binaries)
|
||||
|
||||
if (MSVC)
|
||||
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})
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
||||
|
||||
endif()
|
||||
|
||||
# setup CCache
|
||||
include(CCache)
|
||||
|
||||
|
@ -361,6 +369,11 @@ if(ENABLE_VTUNE)
|
|||
)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
message(STATUS "Building for Windows, disabling NoGUI frontend.")
|
||||
set(ENABLE_NOGUI OFF)
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
message(STATUS "Building for Android")
|
||||
if(NOT ENABLE_HEADLESS)
|
||||
|
@ -596,7 +609,7 @@ endif()
|
|||
message(STATUS "Using static FreeSurround from Externals")
|
||||
add_subdirectory(Externals/FreeSurround)
|
||||
|
||||
if (APPLE)
|
||||
if (APPLE OR WIN32)
|
||||
message(STATUS "Using ed25519 from Externals")
|
||||
add_subdirectory(Externals/ed25519)
|
||||
endif()
|
||||
|
|
|
@ -1,20 +1,38 @@
|
|||
{
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "x64-Debug",
|
||||
"generator": "Visual Studio 15 2017 Win64",
|
||||
"configurationType": "Debug",
|
||||
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
|
||||
"name": "Release",
|
||||
"configurationType": "Release",
|
||||
"generator": "Visual Studio 16 2019 Win64",
|
||||
"inheritEnvironments": [ "msvc_x64_x64" ],
|
||||
"buildCommandArgs": "-m -p:PreferredToolArchitecture=x64",
|
||||
"buildRoot": "${workspaceRoot}\\build",
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "-m -p:PreferredToolArchitecture=x64"
|
||||
"variables": [
|
||||
{
|
||||
"name": "Qt5_DIR",
|
||||
"value": "${workspaceRoot}\\Externals\\Qt\\Qt5.11.1\\5.11.1\\msvc2017_64\\lib\\cmake\\Qt5"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "x64-Release",
|
||||
"generator": "Visual Studio 15 2017 Win64",
|
||||
"configurationType": "Release",
|
||||
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
|
||||
"name": "Debug",
|
||||
"generator": "Visual Studio 16 2019 Win64",
|
||||
"configurationType": "Debug",
|
||||
"inheritEnvironments": [ "msvc_x64_x64" ],
|
||||
"buildCommandArgs": "-m -p:PreferredToolArchitecture=x64",
|
||||
"buildRoot": "${workspaceRoot}\\build",
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "-m -p:PreferredToolArchitecture=x64"
|
||||
"variables": [
|
||||
{
|
||||
"name": "CMAKE_BUILD_TYPE",
|
||||
"value": "Debug"
|
||||
},
|
||||
{
|
||||
"name": "Qt5_DIR",
|
||||
"value": "${workspaceRoot}\\Externals\\Qt\\Qt5.11.1\\5.11.1\\msvc2017_64\\lib\\cmake\\Qt5"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -1 +1 @@
|
|||
Subproject commit b344ea0961dba93a1a38502ac4cc77b981cfc681
|
||||
Subproject commit e5b972af9368c8498546151a6961cd0fe87f13b2
|
|
@ -23,6 +23,8 @@ PUBLIC
|
|||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
target_link_libraries(png PUBLIC z)
|
||||
|
||||
if(NOT MSVC)
|
||||
target_compile_options(png
|
||||
PRIVATE
|
||||
|
|
|
@ -13,4 +13,6 @@ endif()
|
|||
add_library(minizip STATIC ${SRCS})
|
||||
target_include_directories(minizip PUBLIC .)
|
||||
|
||||
target_link_libraries(minizip PUBLIC z)
|
||||
|
||||
add_library(MiniZip::minizip ALIAS minizip)
|
||||
|
|
|
@ -7,12 +7,47 @@ if(CMAKE_SYSTEM_NAME MATCHES "Windows")
|
|||
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
||||
add_definitions(-D_CRT_NONSTDC_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
if (MSVC)
|
||||
# Set warning level to 4
|
||||
add_compile_options(/W4)
|
||||
|
||||
# Disable some warnings
|
||||
add_compile_options(
|
||||
/wd4201 # nonstandard extension used : nameless struct/union
|
||||
/wd4127 # conditional expression is constant
|
||||
/wd4100 # 'identifier' : unreferenced formal parameter
|
||||
/wd4200 # InputCommon fix temp.
|
||||
/wd4244 # 'conversion' conversion from 'type1' to 'type2', possible loss of data
|
||||
/wd4121 # 'symbol' : alignment of a member was sensitive to packing
|
||||
/wd4324 # Padding was added at the end of a structure because you specified a __declspec(align) value.
|
||||
/wd4714 # function 'function' marked as __forceinline not inlined
|
||||
/wd4351 # new behavior: elements of array 'array' will be default initialized
|
||||
# TODO: Enable this warning once possible
|
||||
/wd4245 # conversion from 'type1' to 'type2', signed/unsigned mismatch
|
||||
# Currently jits use some annoying code patterns which makes this common
|
||||
)
|
||||
|
||||
# Additional warnings
|
||||
add_compile_options(
|
||||
/w44263 # Non-virtual member function hides base class virtual function
|
||||
/w44265 # Class has virtual functions, but destructor is not virtual
|
||||
)
|
||||
|
||||
# Treat all warnings as errors
|
||||
add_compile_options(/WX)
|
||||
|
||||
# All files are encoded as UTF-8
|
||||
add_compile_options(/utf-8)
|
||||
|
||||
endif()
|
||||
|
||||
# These aren't actually needed for C11/C++11
|
||||
# but some dependencies require them (LLVM, libav).
|
||||
add_definitions(-D__STDC_LIMIT_MACROS)
|
||||
|
|
|
@ -57,16 +57,8 @@ if(WIN32)
|
|||
)
|
||||
target_link_libraries(audiocommon PRIVATE audiocommon_xaudio27)
|
||||
|
||||
set(ENV{OPENALDIR} ${PROJECT_SOURCE_DIR}/Externals/OpenAL)
|
||||
# Dolphin loads openal32.dll at runtime
|
||||
find_package(OpenAL)
|
||||
if(OPENAL_FOUND)
|
||||
message(STATUS "OpenAL found, enabling OpenAL sound backend")
|
||||
target_sources(audiocommon PRIVATE OpenALStream.cpp)
|
||||
target_link_libraries(audiocommon PRIVATE OpenAL::OpenAL)
|
||||
else()
|
||||
message(STATUS "OpenAL NOT found in Externals")
|
||||
endif()
|
||||
target_sources(audiocommon PRIVATE OpenALStream.cpp)
|
||||
endif()
|
||||
|
||||
target_link_libraries(audiocommon PRIVATE cubeb SoundTouch FreeSurround)
|
||||
|
|
|
@ -15,7 +15,15 @@ if(ENABLE_QT)
|
|||
add_subdirectory(DolphinQt)
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
if (APPLE OR WIN32)
|
||||
add_subdirectory(UpdaterCommon)
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
add_subdirectory(MacUpdater)
|
||||
endif()
|
||||
|
||||
|
||||
if (WIN32)
|
||||
add_subdirectory(WinUpdater)
|
||||
endif()
|
||||
|
|
|
@ -69,6 +69,14 @@ if (APPLE)
|
|||
${COREFOUNDATION_LIBRARY}
|
||||
${IOK_LIBRARY}
|
||||
)
|
||||
elseif(WIN32)
|
||||
target_link_libraries(common
|
||||
PRIVATE
|
||||
kernel32.lib
|
||||
shlwapi.lib
|
||||
opengl32.lib
|
||||
winmm.lib
|
||||
)
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
|
@ -78,6 +86,7 @@ if(ANDROID)
|
|||
)
|
||||
elseif(WIN32)
|
||||
target_sources(common PRIVATE
|
||||
LdrWatcher.cpp
|
||||
Logging/ConsoleListenerWin.cpp
|
||||
)
|
||||
else()
|
||||
|
|
|
@ -343,6 +343,7 @@ if(WIN32)
|
|||
setupapi.lib
|
||||
iphlpapi.lib
|
||||
)
|
||||
target_compile_definitions(core PRIVATE "-D_WINSOCK_DEPRECATED_NO_WARNINGS")
|
||||
elseif(APPLE)
|
||||
target_sources(core PRIVATE
|
||||
HW/EXI/BBA-TAP/TAP_Apple.cpp
|
||||
|
|
|
@ -9,6 +9,11 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#ifdef _WIN32
|
||||
// TODO: Horrible hack, remove ASAP!
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Result.h"
|
||||
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
if (NOT Qt5_DIR AND MSVC)
|
||||
set(Qt5_DIR "${CMAKE_SOURCE_DIR}/Externals/Qt5.11.1/5.11.1/msvc2017_64/lib/cmake/Qt5")
|
||||
endif()
|
||||
|
||||
find_package(Qt5 5.9 REQUIRED COMPONENTS Gui Widgets)
|
||||
|
||||
set_property(TARGET Qt5::Core PROPERTY INTERFACE_COMPILE_FEATURES "")
|
||||
|
@ -107,7 +111,6 @@ add_executable(dolphin-emu
|
|||
QtUtils/FlowLayout.cpp
|
||||
QtUtils/ModalMessageBox.cpp
|
||||
QtUtils/ImageConverter.cpp
|
||||
QtUtils/SignalDaemon.cpp
|
||||
QtUtils/WindowActivationEventFilter.cpp
|
||||
QtUtils/WinIconHelper.cpp
|
||||
QtUtils/WrapInScrollArea.cpp
|
||||
|
@ -130,6 +133,10 @@ add_executable(dolphin-emu
|
|||
Updater.cpp
|
||||
)
|
||||
|
||||
if (NOT WIN32)
|
||||
target_sources(dolphin-emu PRIVATE QtUtils/SignalDaemon.cpp)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(dolphin-emu
|
||||
PRIVATE
|
||||
-DQT_USE_QSTRINGBUILDER
|
||||
|
@ -152,11 +159,71 @@ PRIVATE
|
|||
)
|
||||
|
||||
if(WIN32)
|
||||
target_sources(dolphin-emu PRIVATE DolphinQt.manifest)
|
||||
target_sources(dolphin-emu PRIVATE DolphinQt.manifest DolphinQt.rc)
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(Dolphin_NAME "DolphinD")
|
||||
else()
|
||||
set(Dolphin_NAME "Dolphin")
|
||||
endif()
|
||||
|
||||
set_target_properties(dolphin-emu PROPERTIES
|
||||
WIN32_EXECUTABLE TRUE
|
||||
OUTPUT_NAME ${Dolphin_NAME}
|
||||
)
|
||||
|
||||
target_compile_options(dolphin-emu PRIVATE "-D_SILENCE_CXX17_RESULT_OF_DEPRECATION_WARNING")
|
||||
|
||||
# Copy Sys dir
|
||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/Data/Sys")
|
||||
file(GLOB_RECURSE resources RELATIVE "${CMAKE_SOURCE_DIR}/Data" "${CMAKE_SOURCE_DIR}/Data/Sys/*")
|
||||
|
||||
foreach(res ${resources})
|
||||
configure_file("${CMAKE_SOURCE_DIR}/Data/${res}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${res}" COPYONLY)
|
||||
endforeach()
|
||||
|
||||
# Copy qt.conf
|
||||
configure_file(qt.conf.win "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/qt.conf" COPYONLY)
|
||||
|
||||
# Copy plugins
|
||||
set (Qt5_PLUGINS_DIR "${Qt5_DIR}/../../../plugins")
|
||||
file(GLOB_RECURSE plugins RELATIVE "${Qt5_PLUGINS_DIR}" "${Qt5_PLUGINS_DIR}/*.dll")
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
list(FILTER plugins INCLUDE REGEX ".*d.dll")
|
||||
else()
|
||||
list(FILTER plugins EXCLUDE REGEX ".*d.dll")
|
||||
endif()
|
||||
|
||||
foreach(plugin ${plugins})
|
||||
configure_file("${Qt5_PLUGINS_DIR}/${plugin}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/QtPlugins/${plugin}" COPYONLY)
|
||||
endforeach()
|
||||
|
||||
# Copy DLLs
|
||||
set (Qt5_DLL_DIR "${Qt5_DIR}/../../../bin")
|
||||
|
||||
file(GLOB_RECURSE dlls RELATIVE "${Qt5_DLL_DIR}" "${Qt5_DLL_DIR}/*.dll")
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
list(FILTER dlls INCLUDE REGEX ".*d.dll")
|
||||
else()
|
||||
list(FILTER dlls EXCLUDE REGEX ".*d.dll")
|
||||
endif()
|
||||
|
||||
foreach(dll ${dlls})
|
||||
configure_file("${Qt5_DLL_DIR}/${dll}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${dll}" COPYONLY)
|
||||
endforeach()
|
||||
|
||||
endif()
|
||||
|
||||
# Handle localization
|
||||
find_package(Gettext)
|
||||
|
||||
if(WIN32 AND NOT Gettext_FOUND)
|
||||
message(STATUS "Using Gettext from Externals")
|
||||
set(GETTEXT_MSGFMT_EXECUTABLE "${CMAKE_SOURCE_DIR}/Externals/gettext/msgfmt.exe")
|
||||
endif()
|
||||
|
||||
if(GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE)
|
||||
set(pot_file "${CMAKE_SOURCE_DIR}/Languages/po/dolphin-emu.pot")
|
||||
file(GLOB LINGUAS ${CMAKE_SOURCE_DIR}/Languages/po/*.po)
|
||||
|
@ -179,12 +246,21 @@ if(GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE)
|
|||
install(FILES ${mo} DESTINATION share/locale/${lang}/LC_MESSAGES)
|
||||
endif()
|
||||
|
||||
add_custom_command(OUTPUT ${mo}
|
||||
COMMAND cmake -E make_directory ${mo_dir}
|
||||
COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${po} ${pot_file}
|
||||
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo} ${po}
|
||||
DEPENDS ${po}
|
||||
)
|
||||
if(WIN32)
|
||||
add_custom_command(OUTPUT ${mo}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${mo_dir}
|
||||
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo} ${po}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${mo} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Languages/${lang}/dolphin-emu.mo
|
||||
DEPENDS ${po}
|
||||
)
|
||||
else()
|
||||
add_custom_command(OUTPUT ${mo}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${mo_dir}
|
||||
COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${po} ${pot_file}
|
||||
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo} ${po}
|
||||
DEPENDS ${po}
|
||||
)
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
[Paths]
|
||||
Plugins = ./QtPlugins
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <windows.h>
|
||||
#include <list>
|
||||
#include <string>
|
||||
|
||||
#include "InputCommon/ControllerInterface/DInput/DInput8.h"
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "InputCommon/ControllerInterface/Device.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
|
|
|
@ -7,6 +7,10 @@
|
|||
#include "Common/Assert.h"
|
||||
#include "VideoCommon/VideoConfig.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
||||
#include "UICommon/X11Utils.h"
|
||||
#endif
|
||||
|
|
|
@ -17,6 +17,7 @@ add_library(videod3d
|
|||
PerfQuery.h
|
||||
Render.cpp
|
||||
Render.h
|
||||
SwapChain.cpp
|
||||
VertexManager.cpp
|
||||
VertexManager.h
|
||||
VideoBackend.h
|
||||
|
|
|
@ -11,5 +11,4 @@ target_link_libraries(videod3dcommon
|
|||
PUBLIC
|
||||
common
|
||||
videocommon
|
||||
videod3dcommon
|
||||
)
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
set (MANIFEST_FILE Updater.exe.manifest)
|
||||
|
||||
add_executable(winupdater WIN32
|
||||
Main.cpp
|
||||
WinUI.cpp
|
||||
${MANIFEST_FILE})
|
||||
|
||||
target_link_libraries(winupdater PRIVATE
|
||||
uicommon
|
||||
updatercommon
|
||||
Comctl32
|
||||
)
|
||||
|
||||
set_target_properties(winupdater PROPERTIES OUTPUT_NAME "Updater")
|
Loading…
Reference in New Issue