mirror of
https://github.com/stenzek/duckstation.git
synced 2024-11-26 23:50:31 +00:00
Build: Use shared webp/zstd/zlib
This commit is contained in:
parent
d793dbf8b9
commit
c2c3eac749
9
.github/workflows/rolling-release.yml
vendored
9
.github/workflows/rolling-release.yml
vendored
@ -232,7 +232,8 @@ jobs:
|
||||
extra-cmake-modules libcurl4-openssl-dev libssl-dev libasound2-dev libpulse-dev libx11-xcb-dev build-essential git libclang-dev \
|
||||
libclang-11-dev libclang-12-dev patchelf libglib2.0-dev libfontconfig1-dev libharfbuzz-dev libjpeg-dev libpng-dev libfreetype-dev \
|
||||
libinput-dev libxcb-*-dev libxkbcommon-dev libxkbcommon-x11-dev libxrender-dev libwayland-dev libgl1-mesa-dev libegl-dev \
|
||||
libegl1-mesa-dev libgl1-mesa-dev libssl-dev libx11-dev libx11-xcb-dev libfuse2 llvm-16 lld-16 clang-16
|
||||
libwebp-dev libzstd-dev libegl1-mesa-dev libgl1-mesa-dev libssl-dev libx11-dev libx11-xcb-dev libfuse2 \
|
||||
llvm-16 lld-16 clang-16
|
||||
|
||||
- name: Cache Dependencies
|
||||
id: cache-deps
|
||||
@ -243,7 +244,7 @@ jobs:
|
||||
|
||||
- name: Build Dependencies
|
||||
if: steps.cache-deps.outputs.cache-hit != 'true'
|
||||
run: scripts/build-dependencies.sh
|
||||
run: scripts/build-dependencies.sh "$HOME/deps"
|
||||
|
||||
- name: Tag as preview build
|
||||
if: github.ref == 'refs/heads/master'
|
||||
@ -324,7 +325,7 @@ jobs:
|
||||
|
||||
|
||||
macos-build:
|
||||
runs-on: macos-11
|
||||
runs-on: macos-14
|
||||
timeout-minutes: 120
|
||||
steps:
|
||||
- uses: actions/checkout@v4.1.1
|
||||
@ -350,7 +351,7 @@ jobs:
|
||||
|
||||
- name: Build Dependencies
|
||||
if: steps.cache-deps-mac.outputs.cache-hit != 'true'
|
||||
run: scripts/build-dependencies-mac.sh
|
||||
run: scripts/build-dependencies-mac.sh "$HOME/deps"
|
||||
|
||||
- name: Tag as preview build
|
||||
if: github.ref == 'refs/heads/master'
|
||||
|
@ -44,32 +44,12 @@ if(NOT ANDROID)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# Required libraries.
|
||||
if(ENABLE_SDL2)
|
||||
find_package(SDL2 2.28.5 REQUIRED)
|
||||
endif()
|
||||
if(NOT WIN32 AND NOT ANDROID)
|
||||
find_package(CURL REQUIRED)
|
||||
if(NOT APPLE)
|
||||
find_package(Libbacktrace)
|
||||
if(NOT LIBBACKTRACE_FOUND)
|
||||
message(WARNING "libbacktrace not found, crashes will not produce backtraces.")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
if(BUILD_QT_FRONTEND)
|
||||
find_package(Qt6 6.5.3 COMPONENTS Core Gui Widgets Network LinguistTools REQUIRED)
|
||||
endif()
|
||||
|
||||
|
||||
# Everything except Windows/Mac use EGL.
|
||||
if(ENABLE_OPENGL AND (LINUX OR FREEBSD OR ANDROID))
|
||||
find_package(EGL REQUIRED)
|
||||
set(ENABLE_EGL TRUE)
|
||||
endif()
|
||||
|
||||
|
||||
if(ENABLE_X11)
|
||||
find_package(X11 REQUIRED)
|
||||
if (NOT X11_Xrandr_FOUND)
|
||||
@ -246,6 +226,7 @@ set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# Recursively include the source tree.
|
||||
include(DuckStationDependencies)
|
||||
add_subdirectory(dep)
|
||||
|
||||
# Use C++20 for building the main libraries.
|
||||
|
15
CMakeModules/DuckStationDependencies.cmake
Normal file
15
CMakeModules/DuckStationDependencies.cmake
Normal file
@ -0,0 +1,15 @@
|
||||
if(ENABLE_SDL2)
|
||||
find_package(SDL2 2.30.0 REQUIRED)
|
||||
endif()
|
||||
if(NOT WIN32 AND NOT ANDROID)
|
||||
find_package(CURL REQUIRED)
|
||||
find_package(Zstd REQUIRED)
|
||||
find_package(WebP REQUIRED)
|
||||
find_package(ZLIB REQUIRED)
|
||||
endif()
|
||||
if(UNIX AND NOT APPLE)
|
||||
find_package(Libbacktrace)
|
||||
if(NOT LIBBACKTRACE_FOUND)
|
||||
message(WARNING "libbacktrace not found, crashes will not produce backtraces.")
|
||||
endif()
|
||||
endif()
|
166
CMakeModules/FindWebP.cmake
Normal file
166
CMakeModules/FindWebP.cmake
Normal file
@ -0,0 +1,166 @@
|
||||
# Copyright (C) 2020 Sony Interactive Entertainment Inc.
|
||||
# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@webkit.org>
|
||||
# Copyright (C) 2013 Igalia S.L.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
|
||||
# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
FindWebP
|
||||
--------------
|
||||
|
||||
Find WebP headers and libraries.
|
||||
|
||||
Imported Targets
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
``WebP::libwebp``
|
||||
The WebP library, if found.
|
||||
|
||||
``WebP::demux``
|
||||
The WebP demux library, if found.
|
||||
|
||||
Result Variables
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This will define the following variables in your project:
|
||||
|
||||
``WebP_FOUND``
|
||||
true if (the requested version of) WebP is available.
|
||||
``WebP_VERSION``
|
||||
the version of WebP.
|
||||
``WebP_LIBRARIES``
|
||||
the libraries to link against to use WebP.
|
||||
``WebP_INCLUDE_DIRS``
|
||||
where to find the WebP headers.
|
||||
``WebP_COMPILE_OPTIONS``
|
||||
this should be passed to target_compile_options(), if the
|
||||
target is not used for linking
|
||||
|
||||
#]=======================================================================]
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(PC_WEBP QUIET libwebp)
|
||||
set(WebP_COMPILE_OPTIONS ${PC_WEBP_CFLAGS_OTHER})
|
||||
set(WebP_VERSION ${PC_WEBP_CFLAGS_VERSION})
|
||||
|
||||
find_path(WebP_INCLUDE_DIR
|
||||
NAMES webp/decode.h
|
||||
HINTS ${PC_WEBP_INCLUDEDIR} ${PC_WEBP_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
find_library(WebP_LIBRARY
|
||||
NAMES ${WebP_NAMES} webp libwebp
|
||||
HINTS ${PC_WEBP_LIBDIR} ${PC_WEBP_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
# There's nothing in the WebP headers that could be used to detect the exact
|
||||
# WebP version being used so don't attempt to do so. A version can only be found
|
||||
# through pkg-config
|
||||
if ("${WebP_FIND_VERSION}" VERSION_GREATER "${WebP_VERSION}")
|
||||
if (WebP_VERSION)
|
||||
message(FATAL_ERROR "Required version (" ${WebP_FIND_VERSION} ") is higher than found version (" ${WebP_VERSION} ")")
|
||||
else ()
|
||||
message(WARNING "Cannot determine WebP version without pkg-config")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Find components
|
||||
if (WebP_INCLUDE_DIR AND WebP_LIBRARY)
|
||||
set(_WebP_REQUIRED_LIBS_FOUND ON)
|
||||
set(WebP_LIBS_FOUND "WebP (required): ${WebP_LIBRARY}")
|
||||
else ()
|
||||
set(_WebP_REQUIRED_LIBS_FOUND OFF)
|
||||
set(WebP_LIBS_NOT_FOUND "WebP (required)")
|
||||
endif ()
|
||||
|
||||
if ("demux" IN_LIST WebP_FIND_COMPONENTS)
|
||||
find_library(WebP_DEMUX_LIBRARY
|
||||
NAMES ${WebP_DEMUX_NAMES} webpdemux libwebpdemux
|
||||
HINTS ${PC_WEBP_LIBDIR} ${PC_WEBP_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
if (WebP_DEMUX_LIBRARY)
|
||||
if (WebP_FIND_REQUIRED_demux)
|
||||
list(APPEND WebP_LIBS_FOUND "demux (required): ${WebP_DEMUX_LIBRARY}")
|
||||
else ()
|
||||
list(APPEND WebP_LIBS_FOUND "demux (optional): ${WebP_DEMUX_LIBRARY}")
|
||||
endif ()
|
||||
else ()
|
||||
if (WebP_FIND_REQUIRED_demux)
|
||||
set(_WebP_REQUIRED_LIBS_FOUND OFF)
|
||||
list(APPEND WebP_LIBS_NOT_FOUND "demux (required)")
|
||||
else ()
|
||||
list(APPEND WebP_LIBS_NOT_FOUND "demux (optional)")
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (NOT WebP_FIND_QUIETLY)
|
||||
if (WebP_LIBS_FOUND)
|
||||
message(STATUS "Found the following WebP libraries:")
|
||||
foreach (found ${WebP_LIBS_FOUND})
|
||||
message(STATUS " ${found}")
|
||||
endforeach ()
|
||||
endif ()
|
||||
if (WebP_LIBS_NOT_FOUND)
|
||||
message(STATUS "The following WebP libraries were not found:")
|
||||
foreach (found ${WebP_LIBS_NOT_FOUND})
|
||||
message(STATUS " ${found}")
|
||||
endforeach ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(WebP
|
||||
FOUND_VAR WebP_FOUND
|
||||
REQUIRED_VARS WebP_INCLUDE_DIR WebP_LIBRARY _WebP_REQUIRED_LIBS_FOUND
|
||||
VERSION_VAR WebP_VERSION
|
||||
)
|
||||
|
||||
if (WebP_LIBRARY AND NOT TARGET WebP::libwebp)
|
||||
add_library(WebP::libwebp UNKNOWN IMPORTED GLOBAL)
|
||||
set_target_properties(WebP::libwebp PROPERTIES
|
||||
IMPORTED_LOCATION "${WebP_LIBRARY}"
|
||||
INTERFACE_COMPILE_OPTIONS "${WebP_COMPILE_OPTIONS}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${WebP_INCLUDE_DIR}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
if (WebP_DEMUX_LIBRARY AND NOT TARGET WebP::demux)
|
||||
add_library(WebP::demux UNKNOWN IMPORTED GLOBAL)
|
||||
set_target_properties(WebP::demux PROPERTIES
|
||||
IMPORTED_LOCATION "${WebP_DEMUX_LIBRARY}"
|
||||
INTERFACE_COMPILE_OPTIONS "${WebP_COMPILE_OPTIONS}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${WebP_INCLUDE_DIR}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
mark_as_advanced(
|
||||
WebP_INCLUDE_DIR
|
||||
WebP_LIBRARY
|
||||
WebP_DEMUX_LIBRARY
|
||||
)
|
||||
|
||||
if (WebP_FOUND)
|
||||
set(WebP_LIBRARIES ${WebP_LIBRARY} ${WebP_DEMUX_LIBRARY})
|
||||
set(WebP_INCLUDE_DIRS ${WebP_INCLUDE_DIR})
|
||||
endif ()
|
45
CMakeModules/FindZstd.cmake
Normal file
45
CMakeModules/FindZstd.cmake
Normal file
@ -0,0 +1,45 @@
|
||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
#
|
||||
# - Try to find Facebook zstd library
|
||||
# This will define
|
||||
# Zstd_FOUND
|
||||
# Zstd_INCLUDE_DIR
|
||||
# Zstd_LIBRARY
|
||||
#
|
||||
|
||||
find_path(Zstd_INCLUDE_DIR NAMES zstd.h)
|
||||
|
||||
find_library(Zstd_LIBRARY_DEBUG NAMES zstdd zstd_staticd)
|
||||
find_library(Zstd_LIBRARY_RELEASE NAMES zstd zstd_static)
|
||||
|
||||
include(SelectLibraryConfigurations)
|
||||
SELECT_LIBRARY_CONFIGURATIONS(Zstd)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
|
||||
Zstd DEFAULT_MSG
|
||||
Zstd_LIBRARY Zstd_INCLUDE_DIR
|
||||
)
|
||||
|
||||
mark_as_advanced(Zstd_INCLUDE_DIR Zstd_LIBRARY)
|
||||
|
||||
if(Zstd_FOUND AND NOT (TARGET Zstd::Zstd))
|
||||
add_library (Zstd::Zstd UNKNOWN IMPORTED)
|
||||
set_target_properties(Zstd::Zstd
|
||||
PROPERTIES
|
||||
IMPORTED_LOCATION ${Zstd_LIBRARY}
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${Zstd_INCLUDE_DIR})
|
||||
endif()
|
@ -145,9 +145,9 @@ Requirements:
|
||||
### Linux
|
||||
Requirements (Debian/Ubuntu package names):
|
||||
- CMake (`cmake`)
|
||||
- SDL2 (at least version 2.28.5) (`libsdl2-dev` `libxrandr-dev`)
|
||||
- SDL2 (at least version 2.30.0) (`libsdl2-dev` `libxrandr-dev`)
|
||||
- pkgconfig (`pkg-config`)
|
||||
- Qt 6 (at least version 6.5.3) (`qt6-base-dev` `qt6-base-private-dev` `qt6-base-dev-tools` `qt6-tools-dev` `libqt6svg6`)
|
||||
- Qt 6 (at least version 6.6.0) (`qt6-base-dev` `qt6-base-private-dev` `qt6-base-dev-tools` `qt6-tools-dev` `libqt6svg6`)
|
||||
- git (`git`) (Note: needed to clone the repository and at build time)
|
||||
- When Wayland is enabled (default): (`libwayland-dev` `libwayland-egl-backend-dev` `extra-cmake-modules` `qt6-wayland`)
|
||||
- libcurl (`libcurl4-openssl-dev`)
|
||||
@ -163,8 +163,8 @@ Requirements (Debian/Ubuntu package names):
|
||||
|
||||
Requirements:
|
||||
- CMake
|
||||
- SDL2 (at least version 2.28.5)
|
||||
- Qt 6 (at least version 6.5.3)
|
||||
- SDL2 (at least version 2.30.0)
|
||||
- Qt 6 (at least version 6.6.0)
|
||||
|
||||
Optional (recommended for faster builds):
|
||||
- Ninja
|
||||
|
@ -3,10 +3,6 @@ add_subdirectory(fmt EXCLUDE_FROM_ALL)
|
||||
disable_compiler_warnings_for_target(fmt)
|
||||
add_subdirectory(stb EXCLUDE_FROM_ALL)
|
||||
disable_compiler_warnings_for_target(stb)
|
||||
add_subdirectory(zlib EXCLUDE_FROM_ALL)
|
||||
disable_compiler_warnings_for_target(zlib)
|
||||
add_subdirectory(zstd EXCLUDE_FROM_ALL)
|
||||
disable_compiler_warnings_for_target(zstd)
|
||||
add_subdirectory(minizip EXCLUDE_FROM_ALL)
|
||||
disable_compiler_warnings_for_target(minizip)
|
||||
add_subdirectory(lzma EXCLUDE_FROM_ALL)
|
||||
@ -34,6 +30,14 @@ disable_compiler_warnings_for_target(reshadefx)
|
||||
add_subdirectory(rcheevos EXCLUDE_FROM_ALL)
|
||||
disable_compiler_warnings_for_target(rcheevos)
|
||||
|
||||
# Build dependencies on Windows/Android.
|
||||
if(WIN32 OR ANDROID)
|
||||
add_subdirectory(zlib EXCLUDE_FROM_ALL)
|
||||
disable_compiler_warnings_for_target(zlib)
|
||||
add_subdirectory(zstd EXCLUDE_FROM_ALL)
|
||||
disable_compiler_warnings_for_target(zstd)
|
||||
endif()
|
||||
|
||||
if(ENABLE_CUBEB)
|
||||
add_subdirectory(cubeb EXCLUDE_FROM_ALL)
|
||||
disable_compiler_warnings_for_target(cubeb)
|
||||
|
@ -15,5 +15,5 @@ add_library(libchdr
|
||||
)
|
||||
|
||||
target_include_directories(libchdr PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
target_link_libraries(libchdr PRIVATE zlib lzma)
|
||||
target_link_libraries(libchdr PRIVATE ZLIB::ZLIB lzma)
|
||||
|
||||
|
@ -18,5 +18,5 @@ endif()
|
||||
|
||||
target_include_directories(minizip PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
target_include_directories(minizip INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
target_link_libraries(minizip zlib)
|
||||
target_link_libraries(minizip ZLIB::ZLIB)
|
||||
|
||||
|
@ -10,4 +10,4 @@ set(SRCS
|
||||
add_library(stb ${SRCS})
|
||||
target_include_directories(stb PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_SOURCE_DIR}/src")
|
||||
target_include_directories(stb INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
target_link_libraries(stb zlib Threads::Threads "${CMAKE_DL_LIBS}")
|
||||
target_link_libraries(stb ZLIB::ZLIB Threads::Threads "${CMAKE_DL_LIBS}")
|
||||
|
@ -29,3 +29,4 @@ add_library(zlib
|
||||
|
||||
target_include_directories(zlib PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
target_include_directories(zlib INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
add_library(ZLIB::ZLIB ALIAS zlib)
|
||||
|
@ -2,12 +2,35 @@
|
||||
|
||||
set -e
|
||||
|
||||
merge_binaries() {
|
||||
X86DIR=$1
|
||||
ARMDIR=$2
|
||||
echo "Merging ARM64 binaries from $ARMDIR into fat binaries at $X86DIR..."
|
||||
|
||||
IFS="
|
||||
"
|
||||
pushd "$X86DIR"
|
||||
for X86BIN in $(find . -type f \( -name '*.dylib' -o -name '*.a' -o -perm +111 \)); do
|
||||
ARMBIN="${ARMDIR}/${X86BIN}"
|
||||
echo "Merge $ARMBIN to $X86BIN..."
|
||||
lipo -create "$X86BIN" "$ARMBIN" -o "$X86BIN"
|
||||
done
|
||||
popd
|
||||
}
|
||||
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "Syntax: $0 <output directory>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export MACOSX_DEPLOYMENT_TARGET=11.0
|
||||
INSTALLDIR="$HOME/deps"
|
||||
INSTALLDIR="$1"
|
||||
NPROCS="$(getconf _NPROCESSORS_ONLN)"
|
||||
SDL=SDL2-2.30.0
|
||||
QT=6.6.0
|
||||
MOLTENVK=1.2.6
|
||||
ZSTD=1.5.5
|
||||
WEBP=1.3.2
|
||||
|
||||
mkdir -p deps-build
|
||||
cd deps-build
|
||||
@ -20,6 +43,8 @@ export CXXFLAGS="-I$INSTALLDIR/include -Os $CXXFLAGS"
|
||||
cat > SHASUMS <<EOF
|
||||
36e2e41557e0fa4a1519315c0f5958a87ccb27e25c51776beb6f1239526447b0 $SDL.tar.gz
|
||||
b6a3d179aa9c41275ed0e35e502e5e3fd347dbe5117a0435a26868b231cd6246 v$MOLTENVK.tar.gz
|
||||
9c4396cc829cfae319a6e2615202e82aad41372073482fce286fac78646d3ee4 zstd-$ZSTD.tar.gz
|
||||
2a499607df669e40258e53d0ade8035ba4ec0175244869d1025d460562aa09b4 libwebp-$WEBP.tar.gz
|
||||
039d53312acb5897a9054bd38c9ccbdab72500b71fdccdb3f4f0844b0dd39e0e qtbase-everywhere-src-$QT.tar.xz
|
||||
e1542cb50176e237809895c6549598c08587c63703d100be54ac2d806834e384 qtimageformats-everywhere-src-$QT.tar.xz
|
||||
33da25fef51102f564624a7ea3e57cb4a0a31b7b44783d1af5749ac36d3c72de qtsvg-everywhere-src-$QT.tar.xz
|
||||
@ -30,6 +55,8 @@ EOF
|
||||
curl -L \
|
||||
-O "https://libsdl.org/release/$SDL.tar.gz" \
|
||||
-O "https://github.com/KhronosGroup/MoltenVK/archive/refs/tags/v$MOLTENVK.tar.gz" \
|
||||
-O "https://github.com/facebook/zstd/releases/download/v$ZSTD/zstd-$ZSTD.tar.gz" \
|
||||
-O "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-$WEBP.tar.gz" \
|
||||
-O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qtbase-everywhere-src-$QT.tar.xz" \
|
||||
-O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qtsvg-everywhere-src-$QT.tar.xz" \
|
||||
-O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qttools-everywhere-src-$QT.tar.xz" \
|
||||
@ -42,52 +69,10 @@ echo "Installing SDL..."
|
||||
tar xf "$SDL.tar.gz"
|
||||
cd "$SDL"
|
||||
|
||||
# Patch clang wrappers to require 11.0 for x64.
|
||||
patch -u build-scripts/clang-fat.sh <<EOF
|
||||
--- clang-fat.bak 2023-02-05 13:22:17.032581300 +1000
|
||||
+++ clang-fat.sh 2023-02-05 13:23:15.668561400 +1000
|
||||
@@ -6,12 +6,12 @@
|
||||
|
||||
DEVELOPER="\`xcode-select -print-path\`/Platforms/MacOSX.platform/Developer"
|
||||
|
||||
-# Intel 64-bit compiler flags (10.9 runtime compatibility)
|
||||
-CLANG_COMPILE_X64="clang -arch x86_64 -mmacosx-version-min=10.9 \\
|
||||
--DMAC_OS_X_VERSION_MIN_REQUIRED=1070 \\
|
||||
+# Intel 64-bit compiler flags (11.0 runtime compatibility)
|
||||
+CLANG_COMPILE_X64="clang -arch x86_64 -mmacosx-version-min=11.0 \\
|
||||
+-DMAC_OS_X_VERSION_MIN_REQUIRED=101400 \\
|
||||
-I/usr/local/include"
|
||||
|
||||
-CLANG_LINK_X64="-mmacosx-version-min=10.9"
|
||||
+CLANG_LINK_X64="-mmacosx-version-min=11.0"
|
||||
|
||||
# ARM 64-bit compiler flags (11.0 runtime compatibility)
|
||||
CLANG_COMPILE_ARM64="clang -arch arm64 -mmacosx-version-min=11.0 \\
|
||||
EOF
|
||||
|
||||
patch -u build-scripts/clang++-fat.sh << EOF
|
||||
--- clang++-fat.bak 2023-02-05 13:22:23.744491600 +1000
|
||||
+++ clang++-fat.sh 2023-02-05 13:23:27.160575900 +1000
|
||||
@@ -6,11 +6,11 @@
|
||||
|
||||
DEVELOPER="\`xcode-select -print-path\`/Platforms/MacOSX.platform/Developer"
|
||||
|
||||
-# Intel 64-bit compiler flags (10.7 runtime compatibility)
|
||||
-CLANG_COMPILE_X64="clang++ -arch x86_64 -mmacosx-version-min=10.7 \\
|
||||
+# Intel 64-bit compiler flags (11.0 runtime compatibility)
|
||||
+CLANG_COMPILE_X64="clang++ -arch x86_64 -mmacosx-version-min=11.0 \\
|
||||
-I/usr/local/include"
|
||||
|
||||
-CLANG_LINK_X64="-mmacosx-version-min=10.7"
|
||||
+CLANG_LINK_X64="-mmacosx-version-min=11.0"
|
||||
|
||||
# ARM 64-bit compiler flags (11.0 runtime compatibility)
|
||||
CLANG_COMPILE_ARM64="clang++ -arch arm64 -mmacosx-version-min=11.0 \\
|
||||
EOF
|
||||
|
||||
CC="${PWD}/build-scripts/clang-fat.sh" CXX="${PWD}/build-scripts/clang++-fat.sh" ./configure --prefix "$INSTALLDIR" --without-x
|
||||
make "-j$NPROCS"
|
||||
make install
|
||||
# SDL seems fine with dual architectures.
|
||||
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DSDL_X11=OFF -DBUILD_SHARED_LIBS=ON
|
||||
make -C build "-j$NPROCS"
|
||||
make -C build install
|
||||
cd ..
|
||||
|
||||
# MoltenVK already builds universal binaries, nothing special to do here.
|
||||
@ -189,6 +174,33 @@ cmake --build . --parallel
|
||||
ninja install
|
||||
cd ../../
|
||||
|
||||
# Bit lame, but a custom install path breaks Qt's rcc :/
|
||||
echo "Installing Zstd..."
|
||||
tar xf "zstd-$ZSTD.tar.gz"
|
||||
cd "zstd-$ZSTD"
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DCMAKE_OSX_ARCHITECTURES="x86_64" -DBUILD_SHARED_LIBS=ON -DZSTD_BUILD_PROGRAMS=OFF -B build-dir build/cmake
|
||||
make -C build-dir "-j$NPROCS"
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DCMAKE_OSX_ARCHITECTURES="arm64" -DBUILD_SHARED_LIBS=ON -DZSTD_BUILD_PROGRAMS=OFF -B build-dir-arm64 build/cmake
|
||||
make -C build-dir-arm64 "-j$NPROCS"
|
||||
merge_binaries $(realpath build-dir) $(realpath build-dir-arm64)
|
||||
make -C build-dir install
|
||||
cd ..
|
||||
|
||||
echo "Installing WebP..."
|
||||
tar xf "libwebp-$WEBP.tar.gz"
|
||||
cd "libwebp-$WEBP"
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DCMAKE_OSX_ARCHITECTURES="x86_64" -B build \
|
||||
-DWEBP_BUILD_ANIM_UTILS=OFF -DWEBP_BUILD_CWEBP=OFF -DWEBP_BUILD_DWEBP=OFF -DWEBP_BUILD_GIF2WEBP=OFF -DWEBP_BUILD_IMG2WEBP=OFF \
|
||||
-DWEBP_BUILD_VWEBP=OFF -DWEBP_BUILD_WEBPINFO=OFF -DWEBP_BUILD_WEBPMUX=OFF -DWEBP_BUILD_EXTRAS=OFF -DBUILD_SHARED_LIBS=ON
|
||||
make -C build "-j$NPROCS"
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DCMAKE_OSX_ARCHITECTURES="arm64" -B build-arm64 \
|
||||
-DWEBP_BUILD_ANIM_UTILS=OFF -DWEBP_BUILD_CWEBP=OFF -DWEBP_BUILD_DWEBP=OFF -DWEBP_BUILD_GIF2WEBP=OFF -DWEBP_BUILD_IMG2WEBP=OFF \
|
||||
-DWEBP_BUILD_VWEBP=OFF -DWEBP_BUILD_WEBPINFO=OFF -DWEBP_BUILD_WEBPMUX=OFF -DWEBP_BUILD_EXTRAS=OFF -DBUILD_SHARED_LIBS=ON
|
||||
make -C build-arm64 "-j$NPROCS"
|
||||
merge_binaries $(realpath build) $(realpath build-arm64)
|
||||
make -C build install
|
||||
cd ..
|
||||
|
||||
echo "Cleaning up..."
|
||||
cd ..
|
||||
rm -fr deps-build
|
||||
|
@ -2,7 +2,12 @@
|
||||
|
||||
set -e
|
||||
|
||||
INSTALLDIR="$HOME/deps"
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "Syntax: $0 <output directory>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
INSTALLDIR="$1"
|
||||
NPROCS="$(getconf _NPROCESSORS_ONLN)"
|
||||
SDL=SDL2-2.30.0
|
||||
QT=6.6.1
|
||||
@ -45,7 +50,7 @@ cd ..
|
||||
echo "Building libbacktrace..."
|
||||
unzip "$LIBBACKTRACE.zip"
|
||||
cd "libbacktrace-$LIBBACKTRACE"
|
||||
./configure --prefix="$HOME/deps"
|
||||
./configure --prefix="$INSTALLDIR"
|
||||
make
|
||||
make install
|
||||
cd ..
|
||||
|
@ -61,7 +61,7 @@ add_library(common
|
||||
target_include_directories(common PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/..")
|
||||
target_include_directories(common PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
|
||||
target_link_libraries(common PUBLIC fmt Threads::Threads fast_float)
|
||||
target_link_libraries(common PRIVATE stb zlib minizip Zstd::Zstd "${CMAKE_DL_LIBS}")
|
||||
target_link_libraries(common PRIVATE stb ZLIB::ZLIB minizip Zstd::Zstd "${CMAKE_DL_LIBS}")
|
||||
|
||||
if(WIN32)
|
||||
target_sources(common PRIVATE
|
||||
|
@ -130,7 +130,7 @@ set(NEWREC_SOURCES
|
||||
target_precompile_headers(core PRIVATE "pch.h")
|
||||
target_include_directories(core PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/..")
|
||||
target_include_directories(core PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
|
||||
target_link_libraries(core PUBLIC Threads::Threads common util zlib)
|
||||
target_link_libraries(core PUBLIC Threads::Threads common util ZLIB::ZLIB)
|
||||
target_link_libraries(core PRIVATE stb xxhash imgui rapidjson rcheevos)
|
||||
|
||||
if(CPU_ARCH_X64)
|
||||
|
@ -1,3 +1,5 @@
|
||||
find_package(Qt6 6.6.0 COMPONENTS Core Gui Widgets Network LinguistTools REQUIRED)
|
||||
|
||||
include(CopyBaseTranslations)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
|
@ -3,7 +3,7 @@ add_executable(updater
|
||||
updater.h
|
||||
)
|
||||
|
||||
target_link_libraries(updater PRIVATE common minizip zlib)
|
||||
target_link_libraries(updater PRIVATE common minizip ZLIB::ZLIB)
|
||||
|
||||
if(WIN32)
|
||||
target_sources(updater PRIVATE
|
||||
|
@ -73,7 +73,7 @@ target_precompile_headers(util PRIVATE "pch.h")
|
||||
target_include_directories(util PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/..")
|
||||
target_include_directories(util PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
|
||||
target_link_libraries(util PUBLIC common simpleini imgui)
|
||||
target_link_libraries(util PRIVATE stb libchdr zlib soundtouch xxhash Zstd::Zstd reshadefx)
|
||||
target_link_libraries(util PRIVATE stb libchdr ZLIB::ZLIB soundtouch xxhash Zstd::Zstd reshadefx)
|
||||
|
||||
if(ENABLE_CUBEB)
|
||||
target_sources(util PRIVATE
|
||||
|
Loading…
Reference in New Issue
Block a user