From 75b2dfa66dcece88899f6046fa5d3dccb58a983a Mon Sep 17 00:00:00 2001 From: oltolm Date: Mon, 18 Mar 2024 00:34:08 +0100 Subject: [PATCH] cmake: fix MSVC build --- 3rdparty/libpng/CMakeLists.txt | 5 +++++ 3rdparty/zlib/CMakeLists.txt | 4 +++- rpcs3/Emu/CMakeLists.txt | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/3rdparty/libpng/CMakeLists.txt b/3rdparty/libpng/CMakeLists.txt index f24c2c9709..c65f8b078f 100644 --- a/3rdparty/libpng/CMakeLists.txt +++ b/3rdparty/libpng/CMakeLists.txt @@ -4,6 +4,11 @@ if (NOT USE_SYSTEM_LIBPNG) # We use libpng's static library and don't need to build the shared library and run the tests set(PNG_SHARED OFF CACHE BOOL "Build shared lib") set(PNG_TESTS OFF CACHE BOOL "Build libpng tests") + if (NOT USE_SYSTEM_ZLIB) + set(PNG_BUILD_ZLIB ON CACHE BOOL "Custom zlib location, else find_package is used") + add_library(ZLIB::ZLIB INTERFACE IMPORTED) + target_link_libraries(ZLIB::ZLIB INTERFACE 3rdparty_zlib) + endif() set(SKIP_INSTALL_ALL ON) add_subdirectory(libpng EXCLUDE_FROM_ALL) target_include_directories(png_static INTERFACE "${libpng_BINARY_DIR}" "${libpng_SOURCE_DIR}") diff --git a/3rdparty/zlib/CMakeLists.txt b/3rdparty/zlib/CMakeLists.txt index 9559d12c00..243a883654 100644 --- a/3rdparty/zlib/CMakeLists.txt +++ b/3rdparty/zlib/CMakeLists.txt @@ -15,5 +15,7 @@ else() target_include_directories(3rdparty_zlib INTERFACE zlib ${CMAKE_CURRENT_BINARY_DIR}/zlib) target_compile_definitions(3rdparty_zlib INTERFACE -DZLIB_CONST=1) - set(ZLIB_ROOT ${CMAKE_CURRENT_BINARY_DIR}/zlib PARENT_SCOPE) + if(NOT MSVC) + set(ZLIB_ROOT ${CMAKE_CURRENT_BINARY_DIR}/zlib PARENT_SCOPE) + endif() endif() diff --git a/rpcs3/Emu/CMakeLists.txt b/rpcs3/Emu/CMakeLists.txt index d6e1f44405..2ab9fef652 100644 --- a/rpcs3/Emu/CMakeLists.txt +++ b/rpcs3/Emu/CMakeLists.txt @@ -148,7 +148,7 @@ if(WIN32) Audio/XAudio2/XAudio2Backend.cpp Audio/XAudio2/xaudio2_enumerator.cpp ) - target_compile_definitions(rpcs3_emu PRIVATE UNICODE _UNICODE _WIN32_WINNT=0x0602) + target_compile_definitions(rpcs3_emu PRIVATE UNICODE _UNICODE _WIN32_WINNT=0x0A00) endif() target_link_libraries(rpcs3_emu