From 201be08a8552347ff351e3c5f6938f6576e271d4 Mon Sep 17 00:00:00 2001 From: overwriter <9856mmm@gmail.com> Date: Tue, 12 Nov 2024 08:37:09 +0800 Subject: [PATCH] fix: cannot copy OpenAl32.dll with CMake --- 3rdparty/OpenAL/CMakeLists.txt | 22 +++++++++++++--------- rpcs3/CMakeLists.txt | 5 +---- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/3rdparty/OpenAL/CMakeLists.txt b/3rdparty/OpenAL/CMakeLists.txt index 2100de3b4f..f37a776a1f 100644 --- a/3rdparty/OpenAL/CMakeLists.txt +++ b/3rdparty/OpenAL/CMakeLists.txt @@ -1,13 +1,17 @@ # OpenAL if(USE_SYSTEM_OPENAL) - find_package(OpenAL REQUIRED) - add_library(3rdparty_openal INTERFACE) - target_include_directories(3rdparty_openal INTERFACE ${OPENAL_INCLUDE_DIR}) - target_link_libraries(3rdparty_openal INTERFACE ${OPENAL_LIBRARY}) + if(WIN32) + find_package(OpenAL CONFIG REQUIRED) + else() + find_package(OpenAL REQUIRED) + endif() + add_library(3rdparty_openal INTERFACE) + target_link_libraries(3rdparty_openal INTERFACE OpenAL::OpenAL) + set_target_properties(OpenAL::OpenAL PROPERTIES IMPORTED_GLOBAL ON) else() - option(ALSOFT_UTILS "Build utility programs" OFF) - option(ALSOFT_EXAMPLES "Build example programs" OFF) - add_subdirectory(openal-soft EXCLUDE_FROM_ALL) - add_library(3rdparty_openal INTERFACE) - target_link_libraries(3rdparty_openal INTERFACE OpenAL::OpenAL) + option(ALSOFT_UTILS "Build utility programs" OFF) + option(ALSOFT_EXAMPLES "Build example programs" OFF) + add_subdirectory(openal-soft EXCLUDE_FROM_ALL) + add_library(3rdparty_openal INTERFACE) + target_link_libraries(3rdparty_openal INTERFACE OpenAL::OpenAL) endif() diff --git a/rpcs3/CMakeLists.txt b/rpcs3/CMakeLists.txt index edd9dcf59d..1512de77de 100644 --- a/rpcs3/CMakeLists.txt +++ b/rpcs3/CMakeLists.txt @@ -143,11 +143,8 @@ elseif(UNIX) COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/bin/GuiConfigs $/GuiConfigs COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/bin/git $/git) elseif(WIN32) - if(MSVC) - add_custom_command(TARGET rpcs3 POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/3rdparty/OpenAL/openal-soft/$/OpenAL32.dll $) - endif() add_custom_command(TARGET rpcs3 POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy $ $ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/bin/Icons $/Icons COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/bin/GuiConfigs $/GuiConfigs COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/bin/git $/git