CMake: Drop Win32/MSVC specific paths. Use MSBuild.

This was never supported, and hasn't been updated in a while anyway.
pull/3745/head
Stenzek 4 months ago
parent 77ecf99398
commit 2307ad9b0f
No known key found for this signature in database

@ -48,33 +48,9 @@ if(LINUX OR BSD)
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
endif() endif()
# Release build optimizations for MSVC. # Force debug symbols for Linux builds.
if(MSVC) add_debug_symbol_flag(CMAKE_C_FLAGS_RELEASE)
add_compile_definitions("_UNICODE" "UNICODE" "_CRT_NONSTDC_NO_DEPRECATE" "_CRT_SECURE_NO_WARNINGS") add_debug_symbol_flag(CMAKE_CXX_FLAGS_RELEASE)
foreach(config CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
# Enable intrinsic functions, disable minimal rebuild, UTF-8 source, set __cplusplus version.
set(${config} "${${config}} /Oi /Gm- /utf-8 /Zc:__cplusplus")
endforeach()
# RelWithDebInfo is set to Ob1 instead of Ob2.
string(REPLACE "/Ob1" "/Ob2" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
string(REPLACE "/Ob1" "/Ob2" CMAKE_C_FLAGS_DEVEL "${CMAKE_C_FLAGS_DEVEL}")
string(REPLACE "/Ob1" "/Ob2" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
string(REPLACE "/Ob1" "/Ob2" CMAKE_CXX_FLAGS_DEVEL "${CMAKE_CXX_FLAGS_DEVEL}")
# Disable incremental linking in RelWithDebInfo.
string(REPLACE "/INCREMENTAL" "/INCREMENTAL:NO" CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO}")
string(REPLACE "/INCREMENTAL" "/INCREMENTAL:NO" CMAKE_EXE_LINKER_FLAGS_DEVEL "${CMAKE_EXE_LINKER_FLAGS_DEVEL}")
# COMDAT folding/remove unused functions.
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /OPT:REF /OPT:ICF")
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /OPT:REF /OPT:ICF")
set(CMAKE_EXE_LINKER_FLAGS_DEVEL "${CMAKE_EXE_LINKER_FLAGS_DEVEL} /OPT:REF /OPT:ICF")
else()
# Force debug symbols for Linux builds.
add_debug_symbol_flag(CMAKE_C_FLAGS_RELEASE)
add_debug_symbol_flag(CMAKE_CXX_FLAGS_RELEASE)
endif()
# Warning disables. # Warning disables.
if(COMPILER_CLANG OR COMPILER_CLANG_CL OR COMPILER_GCC) if(COMPILER_CLANG OR COMPILER_CLANG_CL OR COMPILER_GCC)
@ -84,17 +60,7 @@ if(COMPILER_CLANG OR COMPILER_CLANG_CL OR COMPILER_GCC)
endif() endif()
# We don't need exceptions, disable them to save a bit of code size. # We don't need exceptions, disable them to save a bit of code size.
if(MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-rtti")
string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D_HAS_EXCEPTIONS=0 /permissive-")
if(COMPILER_CLANG_CL)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /clang:-fno-rtti")
endif()
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-rtti")
endif()
# Rewrite paths in macros to be relative to the source directory. # Rewrite paths in macros to be relative to the source directory.
# Helpful for reproducible builds. # Helpful for reproducible builds.

@ -1,3 +1,9 @@
# SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin <stenzek@gmail.com>
# SPDX-License-Identifier: CC-BY-NC-ND-4.0 + Packaging Restriction
#
# NOTE: In addition to the terms of CC-BY-NC-ND-4.0, you may not use this file to create
# packages or build recipes without explicit permission from the copyright holder.
include(CheckCXXCompilerFlag) include(CheckCXXCompilerFlag)
function(check_cxx_flag flag var) function(check_cxx_flag flag var)

@ -1,3 +1,9 @@
# SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin <stenzek@gmail.com>
# SPDX-License-Identifier: CC-BY-NC-ND-4.0 + Packaging Restriction
#
# NOTE: In addition to the terms of CC-BY-NC-ND-4.0, you may not use this file to create
# packages or build recipes without explicit permission from the copyright holder.
function(copy_base_translations target) function(copy_base_translations target)
get_target_property(MOC_EXECUTABLE_LOCATION Qt6::moc IMPORTED_LOCATION) get_target_property(MOC_EXECUTABLE_LOCATION Qt6::moc IMPORTED_LOCATION)
get_filename_component(QT_BINARY_DIRECTORY "${MOC_EXECUTABLE_LOCATION}" DIRECTORY) get_filename_component(QT_BINARY_DIRECTORY "${MOC_EXECUTABLE_LOCATION}" DIRECTORY)

@ -1,3 +1,9 @@
# SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin <stenzek@gmail.com>
# SPDX-License-Identifier: CC-BY-NC-ND-4.0 + Packaging Restriction
#
# NOTE: In addition to the terms of CC-BY-NC-ND-4.0, you may not use this file to create
# packages or build recipes without explicit permission from the copyright holder.
# Renderer options. # Renderer options.
option(ENABLE_OPENGL "Build with OpenGL renderer" ON) option(ENABLE_OPENGL "Build with OpenGL renderer" ON)
option(ENABLE_VULKAN "Build with Vulkan renderer" ON) option(ENABLE_VULKAN "Build with Vulkan renderer" ON)

@ -1,3 +1,9 @@
# SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin <stenzek@gmail.com>
# SPDX-License-Identifier: CC-BY-NC-ND-4.0 + Packaging Restriction
#
# NOTE: In addition to the terms of CC-BY-NC-ND-4.0, you may not use this file to create
# packages or build recipes without explicit permission from the copyright holder.
message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}") message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")
string(TOUPPER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_UPPER) string(TOUPPER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_UPPER)
message(STATUS "C Flags: ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UPPER}}") message(STATUS "C Flags: ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UPPER}}")
@ -59,15 +65,6 @@ No support will be provided, continue at your own risk.
*********************************************************") *********************************************************")
endif() endif()
if(WIN32)
message(WARNING "*************** UNSUPPORTED CONFIGURATION ***************
You are compiling DuckStation with CMake on Windows.
It may not even build successfully.
DuckStation only supports MSBuild on Windows.
No support will be provided, continue at your own risk.
*********************************************************")
endif()
if(CPU_ARCH_X64 AND DISABLE_SSE4) if(CPU_ARCH_X64 AND DISABLE_SSE4)
message(WARNING "*********************** WARNING *********************** message(WARNING "*********************** WARNING ***********************
SSE4 instructions are disabled. This will result in SSE4 instructions are disabled. This will result in

@ -1,3 +1,9 @@
# SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin <stenzek@gmail.com>
# SPDX-License-Identifier: CC-BY-NC-ND-4.0 + Packaging Restriction
#
# NOTE: In addition to the terms of CC-BY-NC-ND-4.0, you may not use this file to create
# packages or build recipes without explicit permission from the copyright holder.
# Use C++20. # Use C++20.
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)

@ -1,16 +1,11 @@
# SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin <stenzek@gmail.com> # SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin <stenzek@gmail.com>
# SPDX-License-Identifier: CC-BY-NC-ND-4.0 + Packaging Restriction # SPDX-License-Identifier: CC-BY-NC-ND-4.0 + Packaging Restriction
#
# NOTE: In addition to the terms of CC-BY-NC-ND-4.0, you may not use this file to create
# packages or build recipes without explicit permission from the copyright holder.
# Get prebuilt dependencies for the current platform and architecture. # Get prebuilt dependencies for the current platform and architecture.
if(WIN32) if(APPLE)
if (CPU_ARCH_X64)
set(DEPS_PATH "${CMAKE_SOURCE_DIR}/dep/prebuilt/windows-x64")
elseif(CPU_ARCH_ARM64)
set(DEPS_PATH "${CMAKE_SOURCE_DIR}/dep/prebuilt/windows-arm64")
else()
message(FATAL_ERROR "Unsupported architecture")
endif()
elseif(APPLE)
set(DEPS_PATH "${CMAKE_SOURCE_DIR}/dep/prebuilt/macos-universal") set(DEPS_PATH "${CMAKE_SOURCE_DIR}/dep/prebuilt/macos-universal")
elseif(LINUX) elseif(LINUX)
if(CMAKE_CROSSCOMPILING) if(CMAKE_CROSSCOMPILING)
@ -43,7 +38,7 @@ set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
# pkg-config gets pulled transitively on some platforms. # pkg-config gets pulled transitively on some platforms.
if(NOT WIN32 AND NOT APPLE) if(NOT APPLE)
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
find_package(Libbacktrace REQUIRED) find_package(Libbacktrace REQUIRED)
endif() endif()
@ -86,19 +81,8 @@ find_package(spirv_cross_c_shared REQUIRED
find_package(SDL3 3.4.4 REQUIRED find_package(SDL3 3.4.4 REQUIRED
NO_DEFAULT_PATH PATHS "${DEPS_PATH}/lib/cmake/SDL3") NO_DEFAULT_PATH PATHS "${DEPS_PATH}/lib/cmake/SDL3")
# Verify dependency paths.
foreach(dep zstd WebP PNG libjpeg-turbo freetype harfbuzz plutosvg cpuinfo
DiscordRPC SoundTouch libzip Shaderc spirv_cross_c_shared SDL3)
if((${dep}_LIBRARY AND NOT "${${dep}_LIBRARY}" MATCHES "^${DEPS_PATH}") OR
(${dep}_DIR AND NOT "${${dep}_DIR}" MATCHES "^${DEPS_PATH}"))
message(FATAL_ERROR "Using incorrect ${dep} library. Check your dependencies.")
endif()
endforeach()
# All our builds include Qt, so this is not a problem. # All our builds include Qt, so this is not a problem.
set(QT_NO_PRIVATE_MODULE_WARNING ON) set(QT_NO_PRIVATE_MODULE_WARNING ON)
# Should be prebuilt.
if(LINUX) if(LINUX)
find_package(Qt6 6.11.1 REQUIRED find_package(Qt6 6.11.1 REQUIRED
NO_DEFAULT_PATH PATHS "${DEPS_PATH}/lib/cmake/Qt6" NO_DEFAULT_PATH PATHS "${DEPS_PATH}/lib/cmake/Qt6"
@ -109,19 +93,22 @@ else()
COMPONENTS Core Gui GuiPrivate Widgets LinguistTools) COMPONENTS Core Gui GuiPrivate Widgets LinguistTools)
endif() endif()
# Have to verify it down here, don't want users using unpatched Qt. # Verify dependency paths.
if(NOT Qt6_DIR MATCHES "^${DEPS_PATH}") foreach(dep zstd WebP PNG libjpeg-turbo freetype harfbuzz plutosvg cpuinfo
message(FATAL_ERROR "Using incorrect Qt library. Check your dependencies.") DiscordRPC SoundTouch libzip Shaderc spirv_cross_c_shared SDL3 Qt6)
endif() if((${dep}_LIBRARY AND NOT "${${dep}_LIBRARY}" MATCHES "^${DEPS_PATH}") OR
(${dep}_DIR AND NOT "${${dep}_DIR}" MATCHES "^${DEPS_PATH}"))
message(FATAL_ERROR "Using incorrect ${dep} library. Check your dependencies.")
endif()
endforeach()
# Libraries that are pulled in from host. # Libraries that are pulled in from host.
if(NOT WIN32) find_package(CURL REQUIRED)
find_package(CURL REQUIRED) if(LINUX)
if(LINUX)
find_package(UDEV REQUIRED) find_package(UDEV REQUIRED)
endif() endif()
if(NOT APPLE) if(NOT APPLE)
if(ENABLE_X11) if(ENABLE_X11)
find_package(X11 REQUIRED) find_package(X11 REQUIRED)
if (NOT X11_xcb_FOUND) if (NOT X11_xcb_FOUND)
@ -134,15 +121,10 @@ if(NOT WIN32)
list(APPEND CMAKE_MODULE_PATH "${ECM_MODULE_PATH}") list(APPEND CMAKE_MODULE_PATH "${ECM_MODULE_PATH}")
find_package(Wayland REQUIRED Egl) find_package(Wayland REQUIRED Egl)
endif() endif()
endif()
endif() endif()
if(NOT WIN32) find_package(FFMPEG 8.1.1 COMPONENTS avcodec avformat avutil swresample swscale)
find_package(FFMPEG 8.1.1 COMPONENTS avcodec avformat avutil swresample swscale)
if(NOT FFMPEG_FOUND)
message(WARNING "FFmpeg not found, using bundled headers.")
endif()
endif()
if(NOT FFMPEG_FOUND) if(NOT FFMPEG_FOUND)
message(WARNING "FFmpeg not found, using bundled headers.")
set(FFMPEG_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/dep/ffmpeg/include") set(FFMPEG_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/dep/ffmpeg/include")
endif() endif()

@ -1,11 +1,13 @@
# SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin <stenzek@gmail.com>
# SPDX-License-Identifier: CC-BY-NC-ND-4.0 + Packaging Restriction
#
# NOTE: In addition to the terms of CC-BY-NC-ND-4.0, you may not use this file to create
# packages or build recipes without explicit permission from the copyright holder.
include(CheckSourceCompiles) include(CheckSourceCompiles)
function(disable_compiler_warnings_for_target target) function(disable_compiler_warnings_for_target target)
if(MSVC)
target_compile_options(${target} PRIVATE "/W0")
else()
target_compile_options(${target} PRIVATE "-w") target_compile_options(${target} PRIVATE "-w")
endif()
endfunction() endfunction()
function(detect_operating_system) function(detect_operating_system)
@ -20,7 +22,8 @@ function(detect_operating_system)
endif() endif()
if(WIN32) if(WIN32)
message(STATUS "Building for Windows.") message(FATAL_ERROR "Building for Windows with CMake is not supported. "
"Open the solution file with Visual Studio.")
elseif(APPLE AND NOT IOS) elseif(APPLE AND NOT IOS)
message(STATUS "Building for MacOS.") message(STATUS "Building for MacOS.")
elseif(LINUX) elseif(LINUX)
@ -33,11 +36,7 @@ function(detect_operating_system)
endfunction() endfunction()
function(detect_compiler) function(detect_compiler)
if(MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang") if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
set(COMPILER_CLANG_CL TRUE PARENT_SCOPE)
set(IS_SUPPORTED_COMPILER TRUE PARENT_SCOPE)
message(STATUS "Building with Clang-CL.")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
set(COMPILER_CLANG TRUE PARENT_SCOPE) set(COMPILER_CLANG TRUE PARENT_SCOPE)
set(IS_SUPPORTED_COMPILER TRUE PARENT_SCOPE) set(IS_SUPPORTED_COMPILER TRUE PARENT_SCOPE)
message(STATUS "Building with Clang/LLVM.") message(STATUS "Building with Clang/LLVM.")
@ -45,9 +44,6 @@ function(detect_compiler)
set(COMPILER_GCC TRUE PARENT_SCOPE) set(COMPILER_GCC TRUE PARENT_SCOPE)
set(IS_SUPPORTED_COMPILER FALSE PARENT_SCOPE) set(IS_SUPPORTED_COMPILER FALSE PARENT_SCOPE)
message(STATUS "Building with GNU GCC.") message(STATUS "Building with GNU GCC.")
elseif(MSVC)
set(IS_SUPPORTED_COMPILER TRUE PARENT_SCOPE)
message(STATUS "Building with MSVC.")
else() else()
message(FATAL_ERROR "Unknown compiler: ${CMAKE_CXX_COMPILER_ID}") message(FATAL_ERROR "Unknown compiler: ${CMAKE_CXX_COMPILER_ID}")
endif() endif()
@ -71,13 +67,9 @@ function(detect_architecture)
CMAKE_SIZEOF_VOID_P EQUAL 8) CMAKE_SIZEOF_VOID_P EQUAL 8)
message(STATUS "Building x86_64 binaries.") message(STATUS "Building x86_64 binaries.")
set(CPU_ARCH_X64 TRUE PARENT_SCOPE) set(CPU_ARCH_X64 TRUE PARENT_SCOPE)
if(NOT MSVC OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT DISABLE_SSE4) if(NOT DISABLE_SSE4)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.1" PARENT_SCOPE) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.1" PARENT_SCOPE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1" PARENT_SCOPE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1" PARENT_SCOPE)
elseif(MSVC AND NOT DISABLE_SSE4)
# Clang defines these macros, MSVC does not.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D__SSE3__ /D__SSE4_1__" PARENT_SCOPE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D__SSE3__ /D__SSE4_1__" PARENT_SCOPE)
endif() endif()
elseif(("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "arm64") AND elseif(("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "arm64") AND
CMAKE_SIZEOF_VOID_P EQUAL 8) # Might have an A64 kernel, e.g. Raspbian. CMAKE_SIZEOF_VOID_P EQUAL 8) # Might have an A64 kernel, e.g. Raspbian.

@ -1,3 +1,9 @@
# SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin <stenzek@gmail.com>
# SPDX-License-Identifier: CC-BY-NC-ND-4.0 + Packaging Restriction
#
# NOTE: In addition to the terms of CC-BY-NC-ND-4.0, you may not use this file to create
# packages or build recipes without explicit permission from the copyright holder.
set(_saved_CMAKE_MESSAGE_LOG_LEVEL ${CMAKE_MESSAGE_LOG_LEVEL}) set(_saved_CMAKE_MESSAGE_LOG_LEVEL ${CMAKE_MESSAGE_LOG_LEVEL})
set(CMAKE_MESSAGE_LOG_LEVEL NOTICE) set(CMAKE_MESSAGE_LOG_LEVEL NOTICE)
@ -61,10 +67,4 @@ if(CPU_ARCH_LOONGARCH64)
disable_compiler_warnings_for_target(lagoon) disable_compiler_warnings_for_target(lagoon)
endif() endif()
if(WIN32)
add_subdirectory(d3d12ma EXCLUDE_FROM_ALL)
disable_compiler_warnings_for_target(d3d12ma)
add_subdirectory(winpixeventruntime EXCLUDE_FROM_ALL)
endif()
set(CMAKE_MESSAGE_LOG_LEVEL ${_saved_CMAKE_MESSAGE_LOG_LEVEL}) set(CMAKE_MESSAGE_LOG_LEVEL ${_saved_CMAKE_MESSAGE_LOG_LEVEL})

@ -4,15 +4,10 @@ add_subdirectory(core)
add_subdirectory(scmversion) add_subdirectory(scmversion)
add_subdirectory(duckstation-qt) add_subdirectory(duckstation-qt)
if(WIN32 OR APPLE) if(APPLE)
add_subdirectory(updater) add_subdirectory(updater)
endif() endif()
if(WIN32)
add_subdirectory(installer)
add_subdirectory(uninstaller)
endif()
if(BUILD_REGTEST) if(BUILD_REGTEST)
add_subdirectory(duckstation-regtest) add_subdirectory(duckstation-regtest)
endif() endif()

@ -1,3 +1,9 @@
# SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin <stenzek@gmail.com>
# SPDX-License-Identifier: CC-BY-NC-ND-4.0 + Packaging Restriction
#
# NOTE: In addition to the terms of CC-BY-NC-ND-4.0, you may not use this file to create
# packages or build recipes without explicit permission from the copyright holder.
add_executable(common-tests add_executable(common-tests
binary_reader_writer_tests.cpp binary_reader_writer_tests.cpp
bitutils_tests.cpp bitutils_tests.cpp

@ -1,3 +1,9 @@
# SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin <stenzek@gmail.com>
# SPDX-License-Identifier: CC-BY-NC-ND-4.0 + Packaging Restriction
#
# NOTE: In addition to the terms of CC-BY-NC-ND-4.0, you may not use this file to create
# packages or build recipes without explicit permission from the copyright holder.
add_library(common add_library(common
align.h align.h
assert.cpp assert.cpp
@ -81,26 +87,6 @@ target_include_directories(common PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/..")
target_link_libraries(common PUBLIC fmt Threads::Threads) target_link_libraries(common PUBLIC fmt Threads::Threads)
target_link_libraries(common PRIVATE fast_float "${CMAKE_DL_LIBS}") target_link_libraries(common PRIVATE fast_float "${CMAKE_DL_LIBS}")
if(WIN32)
target_sources(common PRIVATE
thirdparty/StackWalker.cpp
thirdparty/StackWalker.h
windows_headers.h
)
target_link_libraries(common PRIVATE OneCore.lib)
endif()
if(MSVC)
if(CPU_ARCH_X64)
enable_language(ASM_MASM)
target_sources(common PRIVATE fastjmp_x86.asm)
set_source_files_properties(fastjmp_x86.asm PROPERTIES COMPILE_FLAGS "/D_M_X86_64")
elseif(CPU_ARCH_ARM32 OR CPU_ARCH_ARM64)
enable_language(ASM_MARMASM)
target_sources(common PRIVATE fastjmp_arm.asm)
endif()
endif()
if(APPLE) if(APPLE)
set(MAC_SOURCES set(MAC_SOURCES
cocoa_tools.h cocoa_tools.h
@ -113,7 +99,7 @@ if(APPLE)
target_link_libraries(common PRIVATE ${COCOA_LIBRARY} ${QUARTZCORE_LIBRARY}) target_link_libraries(common PRIVATE ${COCOA_LIBRARY} ${QUARTZCORE_LIBRARY})
endif() endif()
if(NOT WIN32 AND NOT ANDROID AND NOT APPLE) if(NOT ANDROID AND NOT APPLE)
target_link_libraries(common PRIVATE libbacktrace::libbacktrace) target_link_libraries(common PRIVATE libbacktrace::libbacktrace)
endif() endif()

@ -1,3 +1,9 @@
# SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin <stenzek@gmail.com>
# SPDX-License-Identifier: CC-BY-NC-ND-4.0 + Packaging Restriction
#
# NOTE: In addition to the terms of CC-BY-NC-ND-4.0, you may not use this file to create
# packages or build recipes without explicit permission from the copyright holder.
add_library(core add_library(core
achievements.cpp achievements.cpp
achievements.h achievements.h

@ -1,3 +1,9 @@
# SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin <stenzek@gmail.com>
# SPDX-License-Identifier: CC-BY-NC-ND-4.0 + Packaging Restriction
#
# NOTE: In addition to the terms of CC-BY-NC-ND-4.0, you may not use this file to create
# packages or build recipes without explicit permission from the copyright holder.
include(CopyBaseTranslations) include(CopyBaseTranslations)
set(CMAKE_AUTOUIC OFF) set(CMAKE_AUTOUIC OFF)
@ -215,58 +221,7 @@ qt_wrap_ui(UI_SRCS SOURCES ${UI_FILES})
target_sources(duckstation-qt PRIVATE ${UI_SRCS}) target_sources(duckstation-qt PRIVATE ${UI_SRCS})
target_include_directories(duckstation-qt PRIVATE "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>") target_include_directories(duckstation-qt PRIVATE "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>")
if(WIN32) if(APPLE)
target_sources(duckstation-qt PRIVATE
duckstation-qt.manifest
duckstation-qt.rc
vcruntimecheck.cpp
)
# Needed to enable RAIntegration.
target_link_libraries(duckstation-qt PRIVATE rcheevos)
# We want a Windows subsystem application not console.
set_target_properties(duckstation-qt PROPERTIES
WIN32_EXECUTABLE TRUE
DEBUG_POSTFIX "-debug")
# Copy in Qt DLLs. Borrowed from Dolphin.
get_target_property(MOC_EXECUTABLE_LOCATION Qt6::moc IMPORTED_LOCATION)
get_filename_component(QT_BINARY_DIRECTORY "${MOC_EXECUTABLE_LOCATION}" DIRECTORY)
find_program(WINDEPLOYQT_EXE windeployqt HINTS "${QT_BINARY_DIRECTORY}")
add_custom_command(TARGET duckstation-qt POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E env PATH="${QT_BINARY_DIRECTORY}"
"${WINDEPLOYQT_EXE}" --libdir="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
--plugindir="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/QtPlugins"
$<IF:$<CONFIG:Debug>,--debug,--release>
--no-compiler-runtime
--no-system-d3d-compiler
--no-system-dxc-compiler
--no-translations
"$<TARGET_FILE:duckstation-qt>"
)
add_custom_command(TARGET duckstation-qt POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/qt.conf.win" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/qt.conf"
)
#set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/translations")
set(DEPS_TO_COPY cpuinfo.dll discord-rpc.dll dxcompiler.dll dxil.dll freetype.dll harfbuzz.dll jpeg62.dll libpng16.dll
libsharpyuv.dll libwebp.dll libwebpdemux.dll libwebpmux.dll plutosvg.dll SDL3.dll shaderc_shared.dll
soundtouch.dll spirv-cross-c-shared.dll zip.dll zlib1.dll zstd.dll)
foreach(DEP ${DEPS_TO_COPY})
list(APPEND DEP_BINS "${CMAKE_PREFIX_PATH}/bin/${DEP}")
endforeach()
add_custom_command(TARGET duckstation-qt POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DEP_BINS} "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
)
if(CMAKE_BUILD_TYPE MATCHES "Debug|Devel")
get_property(WINPIXEVENTRUNTIME_DLL TARGET WinPixEventRuntime::WinPixEventRuntime PROPERTY IMPORTED_LOCATION)
message(STATUS WP "${WINPIXEVENTRUNTIME_DLL}")
add_custom_command(TARGET duckstation-qt POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${WINPIXEVENTRUNTIME_DLL}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
)
endif()
elseif(APPLE)
# Don't generate a bundle for XCode, it makes code signing fail... # Don't generate a bundle for XCode, it makes code signing fail...
get_scm_version() get_scm_version()
set(BUNDLE_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/DuckStation.app) set(BUNDLE_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/DuckStation.app)

@ -1,3 +1,9 @@
# SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin <stenzek@gmail.com>
# SPDX-License-Identifier: CC-BY-NC-ND-4.0 + Packaging Restriction
#
# NOTE: In addition to the terms of CC-BY-NC-ND-4.0, you may not use this file to create
# packages or build recipes without explicit permission from the copyright holder.
add_executable(duckstation-regtest add_executable(duckstation-regtest
regtest_host.cpp regtest_host.cpp
) )

@ -1,21 +0,0 @@
add_executable(installer
installer.cpp
installer.h
installer.manifest
installer.rc
installer_params.h
installer_ui.cpp
installer_ui.h
resource.h
../updater/updater_progress_callback.h
../updater/win32_progress_callback.cpp
../updater/win32_progress_callback.h
../updater/win32_window_util.cpp
../updater/win32_window_util.h
../duckstation-qt/vcruntimecheck.cpp
)
target_include_directories(installer PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/..")
target_link_libraries(installer PRIVATE common fmt lzma)
target_link_libraries(installer PRIVATE "Comctl32.lib")
set_target_properties(installer PROPERTIES WIN32_EXECUTABLE TRUE)

@ -1,16 +1,14 @@
if(CMAKE_HOST_SYSTEM MATCHES "Windows") # SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin <stenzek@gmail.com>
add_custom_target(generate_scmversion # SPDX-License-Identifier: CC-BY-NC-ND-4.0 + Packaging Restriction
COMMAND cmd /k "${CMAKE_CURRENT_SOURCE_DIR}/gen_scmversion.bat" #
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" # NOTE: In addition to the terms of CC-BY-NC-ND-4.0, you may not use this file to create
BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/scmversion.cpp" # packages or build recipes without explicit permission from the copyright holder.
COMMENT "Checking if scmversion.cpp needs to be updated")
else() add_custom_target(generate_scmversion
add_custom_target(generate_scmversion
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/gen_scmversion.sh" COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/gen_scmversion.sh"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/scmversion.cpp" BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/scmversion.cpp"
COMMENT "Checking if scmversion.cpp needs to be updated") COMMENT "Checking if scmversion.cpp needs to be updated")
endif()
add_library(scmversion add_library(scmversion
"${CMAKE_CURRENT_BINARY_DIR}/scmversion.cpp" "${CMAKE_CURRENT_BINARY_DIR}/scmversion.cpp"

@ -1,11 +0,0 @@
add_executable(uninstaller
main.cpp
resource.h
uninstaller.manifest
uninstaller.rc
)
target_include_directories(uninstaller PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/..")
target_link_libraries(uninstaller PRIVATE common fmt)
target_link_libraries(uninstaller PRIVATE "Comctl32.lib")
set_target_properties(uninstaller PROPERTIES WIN32_EXECUTABLE TRUE)

@ -1,3 +1,9 @@
# SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin <stenzek@gmail.com>
# SPDX-License-Identifier: CC-BY-NC-ND-4.0 + Packaging Restriction
#
# NOTE: In addition to the terms of CC-BY-NC-ND-4.0, you may not use this file to create
# packages or build recipes without explicit permission from the copyright holder.
add_executable(updater add_executable(updater
updater.cpp updater.cpp
updater.h updater.h
@ -6,23 +12,6 @@ add_executable(updater
target_include_directories(updater PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/..") target_include_directories(updater PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/..")
target_link_libraries(updater PRIVATE common minizip ZLIB::ZLIB) target_link_libraries(updater PRIVATE common minizip ZLIB::ZLIB)
if(WIN32)
target_sources(updater PRIVATE
resource.h
updater.manifest
updater.rc
updater_progress_callback.h
win32_main.cpp
win32_progress_callback.cpp
win32_progress_callback.h
win32_window_util.cpp
win32_window_util.h
../duckstation-qt/vcruntimecheck.cpp
)
target_link_libraries(updater PRIVATE "Comctl32.lib")
set_target_properties(updater PROPERTIES WIN32_EXECUTABLE TRUE)
endif()
if(APPLE) if(APPLE)
set(MAC_SOURCES set(MAC_SOURCES
cocoa_main.mm cocoa_main.mm

@ -1,3 +1,9 @@
# SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin <stenzek@gmail.com>
# SPDX-License-Identifier: CC-BY-NC-ND-4.0 + Packaging Restriction
#
# NOTE: In addition to the terms of CC-BY-NC-ND-4.0, you may not use this file to create
# packages or build recipes without explicit permission from the copyright holder.
add_executable(util-tests add_executable(util-tests
animated_image_tests.cpp animated_image_tests.cpp
elf_parser_tests.cpp elf_parser_tests.cpp

@ -1,3 +1,9 @@
# SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin <stenzek@gmail.com>
# SPDX-License-Identifier: CC-BY-NC-ND-4.0 + Packaging Restriction
#
# NOTE: In addition to the terms of CC-BY-NC-ND-4.0, you may not use this file to create
# packages or build recipes without explicit permission from the copyright holder.
add_library(util add_library(util
animated_image.cpp animated_image.cpp
animated_image.h animated_image.h
@ -124,13 +130,6 @@ if(ENABLE_OPENGL)
target_compile_definitions(util PUBLIC "ENABLE_OPENGL=1") target_compile_definitions(util PUBLIC "ENABLE_OPENGL=1")
target_link_libraries(util PRIVATE glad) target_link_libraries(util PRIVATE glad)
if(WIN32)
target_sources(util PRIVATE
opengl_context_wgl.cpp
opengl_context_wgl.h
)
endif()
if(LINUX OR BSD OR ANDROID) if(LINUX OR BSD OR ANDROID)
target_sources(util PRIVATE target_sources(util PRIVATE
opengl_context_egl.cpp opengl_context_egl.cpp
@ -215,46 +214,7 @@ if(NOT ANDROID)
target_include_directories(util PUBLIC ${FFMPEG_INCLUDE_DIRS}) target_include_directories(util PUBLIC ${FFMPEG_INCLUDE_DIRS})
endif() endif()
if(WIN32) if(APPLE)
target_sources(util PRIVATE
d3d_common.cpp
d3d_common.h
d3d11_device.cpp
d3d11_device.h
d3d11_pipeline.cpp
d3d11_pipeline.h
d3d11_stream_buffer.cpp
d3d11_stream_buffer.h
d3d11_texture.cpp
d3d11_texture.h
d3d12_builders.cpp
d3d12_builders.h
d3d12_descriptor_heap_manager.cpp
d3d12_descriptor_heap_manager.h
d3d12_device.cpp
d3d12_device.h
d3d12_pipeline.cpp
d3d12_pipeline.h
d3d12_stream_buffer.cpp
d3d12_stream_buffer.h
d3d12_texture.cpp
d3d12_texture.h
dinput_source.cpp
dinput_source.h
http_downloader_winhttp.cpp
win32_raw_input_source.cpp
win32_raw_input_source.h
xaudio2_audio_stream.cpp
xinput_source.cpp
xinput_source.h
)
target_link_libraries(util PRIVATE d3d12ma)
target_link_libraries(util PRIVATE Cfgmgr32.lib Dwmapi.lib winhttp.lib)
if(CMAKE_BUILD_TYPE MATCHES "Debug|Devel")
target_link_libraries(util PRIVATE WinPixEventRuntime::WinPixEventRuntime)
endif()
elseif(APPLE)
set(MAC_SOURCES set(MAC_SOURCES
metal_device.h metal_device.h
metal_device.mm metal_device.mm
@ -277,7 +237,7 @@ elseif(NOT ANDROID)
endif() endif()
endif() endif()
if(NOT WIN32 AND NOT ANDROID) if(NOT ANDROID)
target_sources(util PRIVATE target_sources(util PRIVATE
http_downloader_curl.cpp http_downloader_curl.cpp
) )

Loading…
Cancel
Save