diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b7a16811..40ec4aa8f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,33 +48,9 @@ if(LINUX OR BSD) set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) endif() -# Release build optimizations for MSVC. -if(MSVC) - add_compile_definitions("_UNICODE" "UNICODE" "_CRT_NONSTDC_NO_DEPRECATE" "_CRT_SECURE_NO_WARNINGS") - 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() +# Force debug symbols for Linux builds. +add_debug_symbol_flag(CMAKE_C_FLAGS_RELEASE) +add_debug_symbol_flag(CMAKE_CXX_FLAGS_RELEASE) # Warning disables. 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() # We don't need exceptions, disable them to save a bit of code size. -if(MSVC) - 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() +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-rtti") # Rewrite paths in macros to be relative to the source directory. # Helpful for reproducible builds. diff --git a/CMakeModules/CheckCXXFlag.cmake b/CMakeModules/CheckCXXFlag.cmake index ef1b3ffcc..7dcfd1b2b 100644 --- a/CMakeModules/CheckCXXFlag.cmake +++ b/CMakeModules/CheckCXXFlag.cmake @@ -1,8 +1,14 @@ +# SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin +# 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) function(check_cxx_flag flag var) - CHECK_CXX_COMPILER_FLAG("-Werror ${flag}" ${var}) - if(${var}) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}" PARENT_SCOPE) - endif() + CHECK_CXX_COMPILER_FLAG("-Werror ${flag}" ${var}) + if(${var}) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}" PARENT_SCOPE) + endif() endfunction() diff --git a/CMakeModules/CopyBaseTranslations.cmake b/CMakeModules/CopyBaseTranslations.cmake index b8b37e46d..bb00d2090 100644 --- a/CMakeModules/CopyBaseTranslations.cmake +++ b/CMakeModules/CopyBaseTranslations.cmake @@ -1,3 +1,9 @@ +# SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin +# 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) get_target_property(MOC_EXECUTABLE_LOCATION Qt6::moc IMPORTED_LOCATION) get_filename_component(QT_BINARY_DIRECTORY "${MOC_EXECUTABLE_LOCATION}" DIRECTORY) diff --git a/CMakeModules/DuckStationBuildOptions.cmake b/CMakeModules/DuckStationBuildOptions.cmake index 5329ae848..3504d0338 100644 --- a/CMakeModules/DuckStationBuildOptions.cmake +++ b/CMakeModules/DuckStationBuildOptions.cmake @@ -1,3 +1,9 @@ +# SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin +# 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. option(ENABLE_OPENGL "Build with OpenGL renderer" ON) option(ENABLE_VULKAN "Build with Vulkan renderer" ON) diff --git a/CMakeModules/DuckStationBuildSummary.cmake b/CMakeModules/DuckStationBuildSummary.cmake index c66ed795f..f3ad0bc51 100644 --- a/CMakeModules/DuckStationBuildSummary.cmake +++ b/CMakeModules/DuckStationBuildSummary.cmake @@ -1,3 +1,9 @@ +# SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin +# 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}") string(TOUPPER "${CMAKE_BUILD_TYPE}" 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() -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) message(WARNING "*********************** WARNING *********************** SSE4 instructions are disabled. This will result in diff --git a/CMakeModules/DuckStationCompilerRequirement.cmake b/CMakeModules/DuckStationCompilerRequirement.cmake index b7fabbf86..54d3b1298 100644 --- a/CMakeModules/DuckStationCompilerRequirement.cmake +++ b/CMakeModules/DuckStationCompilerRequirement.cmake @@ -1,3 +1,9 @@ +# SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin +# 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. set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/CMakeModules/DuckStationDependencies.cmake b/CMakeModules/DuckStationDependencies.cmake index 52c3831b9..46baaa190 100644 --- a/CMakeModules/DuckStationDependencies.cmake +++ b/CMakeModules/DuckStationDependencies.cmake @@ -1,16 +1,11 @@ # SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin # 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. -if(WIN32) - 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) +if(APPLE) set(DEPS_PATH "${CMAKE_SOURCE_DIR}/dep/prebuilt/macos-universal") elseif(LINUX) if(CMAKE_CROSSCOMPILING) @@ -43,7 +38,7 @@ set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) # pkg-config gets pulled transitively on some platforms. -if(NOT WIN32 AND NOT APPLE) +if(NOT APPLE) find_package(PkgConfig REQUIRED) find_package(Libbacktrace REQUIRED) endif() @@ -86,19 +81,8 @@ find_package(spirv_cross_c_shared REQUIRED find_package(SDL3 3.4.4 REQUIRED 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. set(QT_NO_PRIVATE_MODULE_WARNING ON) - -# Should be prebuilt. if(LINUX) find_package(Qt6 6.11.1 REQUIRED NO_DEFAULT_PATH PATHS "${DEPS_PATH}/lib/cmake/Qt6" @@ -109,40 +93,38 @@ else() COMPONENTS Core Gui GuiPrivate Widgets LinguistTools) endif() -# Have to verify it down here, don't want users using unpatched Qt. -if(NOT Qt6_DIR MATCHES "^${DEPS_PATH}") -message(FATAL_ERROR "Using incorrect Qt library. Check your dependencies.") -endif() +# Verify dependency paths. +foreach(dep zstd WebP PNG libjpeg-turbo freetype harfbuzz plutosvg cpuinfo + DiscordRPC SoundTouch libzip Shaderc spirv_cross_c_shared SDL3 Qt6) + 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. -if(NOT WIN32) - find_package(CURL REQUIRED) - if(LINUX) - find_package(UDEV REQUIRED) +find_package(CURL REQUIRED) +if(LINUX) + find_package(UDEV REQUIRED) +endif() + +if(NOT APPLE) + if(ENABLE_X11) + find_package(X11 REQUIRED) + if (NOT X11_xcb_FOUND) + message(FATAL_ERROR "XCB is required") + endif() endif() - if(NOT APPLE) - if(ENABLE_X11) - find_package(X11 REQUIRED) - if (NOT X11_xcb_FOUND) - message(FATAL_ERROR "XCB is required") - endif() - endif() - - if(ENABLE_WAYLAND) - find_package(ECM REQUIRED NO_MODULE) - list(APPEND CMAKE_MODULE_PATH "${ECM_MODULE_PATH}") - find_package(Wayland REQUIRED Egl) - endif() + if(ENABLE_WAYLAND) + find_package(ECM REQUIRED NO_MODULE) + list(APPEND CMAKE_MODULE_PATH "${ECM_MODULE_PATH}") + find_package(Wayland REQUIRED Egl) endif() endif() -if(NOT WIN32) - 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() +find_package(FFMPEG 8.1.1 COMPONENTS avcodec avformat avutil swresample swscale) if(NOT FFMPEG_FOUND) + message(WARNING "FFmpeg not found, using bundled headers.") set(FFMPEG_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/dep/ffmpeg/include") endif() diff --git a/CMakeModules/DuckStationUtils.cmake b/CMakeModules/DuckStationUtils.cmake index 6d2c8c6d0..e81b42164 100644 --- a/CMakeModules/DuckStationUtils.cmake +++ b/CMakeModules/DuckStationUtils.cmake @@ -1,56 +1,52 @@ +# SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin +# 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) function(disable_compiler_warnings_for_target target) - if(MSVC) - target_compile_options(${target} PRIVATE "/W0") - else() - target_compile_options(${target} PRIVATE "-w") - endif() + target_compile_options(${target} PRIVATE "-w") endfunction() function(detect_operating_system) - message(STATUS "CMake Version: ${CMAKE_VERSION}") - message(STATUS "CMake System Name: ${CMAKE_SYSTEM_NAME}") + message(STATUS "CMake Version: ${CMAKE_VERSION}") + message(STATUS "CMake System Name: ${CMAKE_SYSTEM_NAME}") - # LINUX wasn't added until CMake 3.25. - if (CMAKE_VERSION VERSION_LESS 3.25.0 AND CMAKE_SYSTEM_NAME MATCHES "Linux") - # Have to make it visible in this scope as well for below. - set(LINUX TRUE PARENT_SCOPE) - set(LINUX TRUE) - endif() + # LINUX wasn't added until CMake 3.25. + if (CMAKE_VERSION VERSION_LESS 3.25.0 AND CMAKE_SYSTEM_NAME MATCHES "Linux") + # Have to make it visible in this scope as well for below. + set(LINUX TRUE PARENT_SCOPE) + set(LINUX TRUE) + endif() - if(WIN32) - message(STATUS "Building for Windows.") - elseif(APPLE AND NOT IOS) - message(STATUS "Building for MacOS.") - elseif(LINUX) - message(STATUS "Building for Linux.") - elseif(BSD) - message(STATUS "Building for *BSD.") - else() - message(FATAL_ERROR "Unsupported platform.") - endif() + if(WIN32) + message(FATAL_ERROR "Building for Windows with CMake is not supported. " + "Open the solution file with Visual Studio.") + elseif(APPLE AND NOT IOS) + message(STATUS "Building for MacOS.") + elseif(LINUX) + message(STATUS "Building for Linux.") + elseif(BSD) + message(STATUS "Building for *BSD.") + else() + message(FATAL_ERROR "Unsupported platform.") + endif() endfunction() function(detect_compiler) - if(MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - 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(IS_SUPPORTED_COMPILER TRUE PARENT_SCOPE) - message(STATUS "Building with Clang/LLVM.") - elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - set(COMPILER_GCC TRUE PARENT_SCOPE) - set(IS_SUPPORTED_COMPILER FALSE PARENT_SCOPE) - message(STATUS "Building with GNU GCC.") - elseif(MSVC) - set(IS_SUPPORTED_COMPILER TRUE PARENT_SCOPE) - message(STATUS "Building with MSVC.") - else() - message(FATAL_ERROR "Unknown compiler: ${CMAKE_CXX_COMPILER_ID}") - endif() + if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") + set(COMPILER_CLANG TRUE PARENT_SCOPE) + set(IS_SUPPORTED_COMPILER TRUE PARENT_SCOPE) + message(STATUS "Building with Clang/LLVM.") + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(COMPILER_GCC TRUE PARENT_SCOPE) + set(IS_SUPPORTED_COMPILER FALSE PARENT_SCOPE) + message(STATUS "Building with GNU GCC.") + else() + message(FATAL_ERROR "Unknown compiler: ${CMAKE_CXX_COMPILER_ID}") + endif() endfunction() function(detect_architecture) @@ -71,13 +67,9 @@ function(detect_architecture) CMAKE_SIZEOF_VOID_P EQUAL 8) message(STATUS "Building x86_64 binaries.") 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_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() 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. diff --git a/dep/CMakeLists.txt b/dep/CMakeLists.txt index 86d59ab6b..9366feda6 100644 --- a/dep/CMakeLists.txt +++ b/dep/CMakeLists.txt @@ -1,3 +1,9 @@ +# SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin +# 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(CMAKE_MESSAGE_LOG_LEVEL NOTICE) @@ -61,10 +67,4 @@ if(CPU_ARCH_LOONGARCH64) disable_compiler_warnings_for_target(lagoon) 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}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7dc4ceb41..f85b4d64c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -4,15 +4,10 @@ add_subdirectory(core) add_subdirectory(scmversion) add_subdirectory(duckstation-qt) -if(WIN32 OR APPLE) +if(APPLE) add_subdirectory(updater) endif() -if(WIN32) - add_subdirectory(installer) - add_subdirectory(uninstaller) -endif() - if(BUILD_REGTEST) add_subdirectory(duckstation-regtest) endif() diff --git a/src/common-tests/CMakeLists.txt b/src/common-tests/CMakeLists.txt index 7624bda14..ebd07e84d 100644 --- a/src/common-tests/CMakeLists.txt +++ b/src/common-tests/CMakeLists.txt @@ -1,3 +1,9 @@ +# SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin +# 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 binary_reader_writer_tests.cpp bitutils_tests.cpp diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index baee748a4..8d3c6e68c 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -1,3 +1,9 @@ +# SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin +# 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 align.h 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 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) set(MAC_SOURCES cocoa_tools.h @@ -113,7 +99,7 @@ if(APPLE) target_link_libraries(common PRIVATE ${COCOA_LIBRARY} ${QUARTZCORE_LIBRARY}) endif() -if(NOT WIN32 AND NOT ANDROID AND NOT APPLE) +if(NOT ANDROID AND NOT APPLE) target_link_libraries(common PRIVATE libbacktrace::libbacktrace) endif() diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index ca5e678af..7124c2de8 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -1,3 +1,9 @@ +# SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin +# 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 achievements.cpp achievements.h diff --git a/src/duckstation-qt/CMakeLists.txt b/src/duckstation-qt/CMakeLists.txt index 069f3301d..18627c0bb 100644 --- a/src/duckstation-qt/CMakeLists.txt +++ b/src/duckstation-qt/CMakeLists.txt @@ -1,3 +1,9 @@ +# SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin +# 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) set(CMAKE_AUTOUIC OFF) @@ -215,58 +221,7 @@ qt_wrap_ui(UI_SRCS SOURCES ${UI_FILES}) target_sources(duckstation-qt PRIVATE ${UI_SRCS}) target_include_directories(duckstation-qt PRIVATE "$") -if(WIN32) - 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" - $,--debug,--release> - --no-compiler-runtime - --no-system-d3d-compiler - --no-system-dxc-compiler - --no-translations - "$" - ) - 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) +if(APPLE) # Don't generate a bundle for XCode, it makes code signing fail... get_scm_version() set(BUNDLE_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/DuckStation.app) diff --git a/src/duckstation-regtest/CMakeLists.txt b/src/duckstation-regtest/CMakeLists.txt index 7c95983b8..9a7080255 100644 --- a/src/duckstation-regtest/CMakeLists.txt +++ b/src/duckstation-regtest/CMakeLists.txt @@ -1,3 +1,9 @@ +# SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin +# 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 regtest_host.cpp ) diff --git a/src/installer/CMakeLists.txt b/src/installer/CMakeLists.txt deleted file mode 100644 index 914e1c8e5..000000000 --- a/src/installer/CMakeLists.txt +++ /dev/null @@ -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) diff --git a/src/scmversion/CMakeLists.txt b/src/scmversion/CMakeLists.txt index dca122d21..7d8509b2a 100644 --- a/src/scmversion/CMakeLists.txt +++ b/src/scmversion/CMakeLists.txt @@ -1,16 +1,14 @@ -if(CMAKE_HOST_SYSTEM MATCHES "Windows") - add_custom_target(generate_scmversion - COMMAND cmd /k "${CMAKE_CURRENT_SOURCE_DIR}/gen_scmversion.bat" - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" - BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/scmversion.cpp" - COMMENT "Checking if scmversion.cpp needs to be updated") -else() - add_custom_target(generate_scmversion - COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/gen_scmversion.sh" - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" - BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/scmversion.cpp" - COMMENT "Checking if scmversion.cpp needs to be updated") -endif() +# SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin +# 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_custom_target(generate_scmversion + COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/gen_scmversion.sh" + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/scmversion.cpp" + COMMENT "Checking if scmversion.cpp needs to be updated") add_library(scmversion "${CMAKE_CURRENT_BINARY_DIR}/scmversion.cpp" diff --git a/src/uninstaller/CMakeLists.txt b/src/uninstaller/CMakeLists.txt deleted file mode 100644 index 218504c56..000000000 --- a/src/uninstaller/CMakeLists.txt +++ /dev/null @@ -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) diff --git a/src/updater/CMakeLists.txt b/src/updater/CMakeLists.txt index cfcf97cb0..af2d4ead7 100644 --- a/src/updater/CMakeLists.txt +++ b/src/updater/CMakeLists.txt @@ -1,3 +1,9 @@ +# SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin +# 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 updater.cpp updater.h @@ -6,23 +12,6 @@ add_executable(updater target_include_directories(updater PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/..") 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) set(MAC_SOURCES cocoa_main.mm diff --git a/src/util-tests/CMakeLists.txt b/src/util-tests/CMakeLists.txt index e3deb9bd9..27df4a764 100644 --- a/src/util-tests/CMakeLists.txt +++ b/src/util-tests/CMakeLists.txt @@ -1,3 +1,9 @@ +# SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin +# 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 animated_image_tests.cpp elf_parser_tests.cpp diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index e82131a19..8ecac0340 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -1,3 +1,9 @@ +# SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin +# 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 animated_image.cpp animated_image.h @@ -124,13 +130,6 @@ if(ENABLE_OPENGL) target_compile_definitions(util PUBLIC "ENABLE_OPENGL=1") 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) target_sources(util PRIVATE opengl_context_egl.cpp @@ -215,46 +214,7 @@ if(NOT ANDROID) target_include_directories(util PUBLIC ${FFMPEG_INCLUDE_DIRS}) endif() -if(WIN32) - 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) +if(APPLE) set(MAC_SOURCES metal_device.h metal_device.mm @@ -277,7 +237,7 @@ elseif(NOT ANDROID) endif() endif() -if(NOT WIN32 AND NOT ANDROID) +if(NOT ANDROID) target_sources(util PRIVATE http_downloader_curl.cpp )