[cmake] refactor: Use CPM over submodules #143

Merged
crueter merged 42 commits from refactor/cpm into master 2025-08-04 04:50:17 +02:00
6 changed files with 31 additions and 24 deletions
Showing only changes of commit 96ade13900 - Show all commits

3
.gitmodules vendored
View file

@ -1,9 +1,6 @@
# SPDX-FileCopyrightText: 2014 Citra Emulator Project # SPDX-FileCopyrightText: 2014 Citra Emulator Project
# SPDX-License-Identifier: GPL-2.0-or-later # SPDX-License-Identifier: GPL-2.0-or-later
[submodule "cubeb"]
path = externals/cubeb
url = https://github.com/mozilla/cubeb.git
[submodule "libusb"] [submodule "libusb"]
path = externals/libusb/libusb path = externals/libusb/libusb
url = https://github.com/libusb/libusb.git url = https://github.com/libusb/libusb.git

View file

@ -431,10 +431,6 @@ if (ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64)
find_package(dynarmic 6.4.0 CONFIG) find_package(dynarmic 6.4.0 CONFIG)
endif() endif()
if (ENABLE_CUBEB)
find_package(cubeb CONFIG)
endif()
if (USE_DISCORD_PRESENCE) if (USE_DISCORD_PRESENCE)
find_package(DiscordRPC MODULE) find_package(DiscordRPC MODULE)
endif() endif()

View file

@ -4,6 +4,9 @@
# SPDX-FileCopyrightText: 2016 Citra Emulator Project # SPDX-FileCopyrightText: 2016 Citra Emulator Project
# SPDX-License-Identifier: GPL-2.0-or-later # SPDX-License-Identifier: GPL-2.0-or-later
# cpm
include(CPM)
# Dynarmic has cmake_minimum_required(3.12) and we may want to override # Dynarmic has cmake_minimum_required(3.12) and we may want to override
# some of its variables, which is only possible in 3.13+ # some of its variables, which is only possible in 3.13+
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
@ -91,7 +94,6 @@ if (YUZU_USE_EXTERNAL_SDL2)
set(SDL_FILE ON) set(SDL_FILE ON)
endif() endif()
include(CPM)
set(CPM_USE_LOCAL_PACKAGES OFF) set(CPM_USE_LOCAL_PACKAGES OFF)
if ("${YUZU_SYSTEM_PROFILE}" STREQUAL "steamdeck") if ("${YUZU_SYSTEM_PROFILE}" STREQUAL "steamdeck")
@ -117,20 +119,6 @@ if (NOT TARGET enet::enet)
add_library(enet::enet ALIAS enet) add_library(enet::enet ALIAS enet)
endif() endif()
# Cubeb
if (ENABLE_CUBEB AND NOT TARGET cubeb::cubeb)
set(BUILD_TESTS OFF)
set(BUILD_TOOLS OFF)
add_subdirectory(cubeb)
add_library(cubeb::cubeb ALIAS cubeb)
if (NOT MSVC)
if (TARGET speex)
target_compile_options(speex PRIVATE -Wno-sign-compare)
endif()
target_compile_options(cubeb PRIVATE -Wno-implicit-const-int-float-conversion)
endif()
endif()
# DiscordRPC # DiscordRPC
if (USE_DISCORD_PRESENCE AND NOT TARGET DiscordRPC::discord-rpc) if (USE_DISCORD_PRESENCE AND NOT TARGET DiscordRPC::discord-rpc)
set(BUILD_EXAMPLES OFF) set(BUILD_EXAMPLES OFF)

1
externals/cubeb vendored

@ -1 +0,0 @@
Subproject commit fa021607121360af7c171d881dc5bc8af7bb56eb

View file

@ -232,12 +232,14 @@ if (ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64)
endif() endif()
if (ENABLE_CUBEB) if (ENABLE_CUBEB)
add_subdirectory(externals/cubeb)
target_sources(audio_core PRIVATE target_sources(audio_core PRIVATE
sink/cubeb_sink.cpp sink/cubeb_sink.cpp
sink/cubeb_sink.h sink/cubeb_sink.h
) )
target_link_libraries(audio_core PRIVATE cubeb::cubeb) target_link_libraries(audio_core PRIVATE cubeb)
target_compile_definitions(audio_core PRIVATE -DHAVE_CUBEB=1) target_compile_definitions(audio_core PRIVATE -DHAVE_CUBEB=1)
endif() endif()

View file

@ -0,0 +1,25 @@
# SPDX-FileCopyrightText: 2025 Eden Emulator Project
# SPDX-License-Identifier: GPL-3.0-or-later
include(CPM)
set(CPM_USE_LOCAL_PACKAGES ON)
CPMAddPackage(
URI "gh:mozilla/cubeb#fa02160712"
FIND_PACKAGE_ARGUMENTS "CONFIG" # not sure this works outside of gentoo
)
if (cubeb_ADDED)
set(BUILD_TESTS OFF)
set(BUILD_TOOLS OFF)
if (NOT MSVC)
if (TARGET speex)
target_compile_options(speex PRIVATE -Wno-sign-compare)
endif()
target_compile_options(cubeb PRIVATE
-Wno-implicit-const-int-float-conversion
-Wno-shadow
-Wno-missing-declarations -Wno-return-type
)
endif()
endif()