|
| 1 | +#!/bin/sh -e |
| 2 | + |
| 3 | +echo "Starting RPCS3 build (Bash script)" |
| 4 | + |
| 5 | +# Automatically find clang_rt.builtins-x86_64.lib |
| 6 | +echo "Searching for clang_rt.builtins-x86_64.lib ..." |
| 7 | +clangBuiltinsLibPath=$(find "C:\Program Files\LLVM\lib\clang" -name "clang_rt.builtins-x86_64.lib" | sed 's|Program Files|PROGRA~1|g') |
| 8 | + |
| 9 | +if [ -z "$clangBuiltinsLibPath" ]; then |
| 10 | + echo "ERROR: Could not find clang_rt.builtins-x86_64.lib in LLVM installation." |
| 11 | + exit 1 |
| 12 | +fi |
| 13 | + |
| 14 | +clangBuiltinsDir=$(dirname "$clangBuiltinsLibPath") |
| 15 | +clangBuiltinsLib=$(basename "$clangBuiltinsLibPath") |
| 16 | +# shellcheck disable=SC2028 |
| 17 | +clangPath=$(echo "C:\Program Files\LLVM\bin" | sed 's|Program Files|PROGRA~1|g') |
| 18 | + |
| 19 | +echo "Found Clang builtins library: $clangBuiltinsLib in $clangBuiltinsDir" |
| 20 | +echo "Found Clang Path: $clangPath" |
| 21 | + |
| 22 | +# Search for mt.exe in SDK bin directories |
| 23 | +echo "Searching for llvm-mt.exe ..." |
| 24 | +mtPath=$(find "$clangPath" -name "llvm-mt.exe") |
| 25 | + |
| 26 | +if [ -z "$mtPath" ]; then |
| 27 | + echo "ERROR: Could not find llvm-mt.exe in SDK directories." |
| 28 | + exit 1 |
| 29 | +fi |
| 30 | + |
| 31 | +echo "Found llvm-mt.exe at: $mtPath" |
| 32 | + |
| 33 | +VcpkgRoot="$(pwd)/vcpkg" |
| 34 | +VcpkgTriplet="$VCPKG_TRIPLET" |
| 35 | +VcpkgInstall="$VcpkgRoot/installed/$VcpkgTriplet" |
| 36 | +VcpkgInclude="$VcpkgInstall/include" |
| 37 | +VcpkgLib="$VcpkgInstall/lib" |
| 38 | + |
| 39 | +# Configure git safe directory |
| 40 | +echo "Configuring git safe directory" |
| 41 | +git config --global --add safe.directory '*' |
| 42 | + |
| 43 | +# Initialize submodules except certain ones |
| 44 | +echo "Initializing submodules" |
| 45 | +# shellcheck disable=SC2046 |
| 46 | +git submodule -q update --init $(awk '/path/ && !/llvm/ && !/opencv/ && !/FAudio/ && !/libpng/ && !/zlib/ && !/feralinteractive/ { print $3 }' .gitmodules) |
| 47 | + |
| 48 | +# Create and enter build directory |
| 49 | +echo "Creating build directory" |
| 50 | +mkdir -p build |
| 51 | +cd build || exit |
| 52 | +echo "Changed directory to: $(pwd)" |
| 53 | + |
| 54 | +# Run CMake with Ninja generator and required flags |
| 55 | +echo "Running CMake configuration" |
| 56 | +cmake .. \ |
| 57 | + -G Ninja \ |
| 58 | + -DCMAKE_BUILD_TYPE=Release \ |
| 59 | + -DCMAKE_C_COMPILER="${clangPath}/clang-cl.exe" \ |
| 60 | + -DCMAKE_CXX_COMPILER="${clangPath}/clang-cl.exe" \ |
| 61 | + -DCMAKE_LINKER="${clangPath}/lld-link.exe" \ |
| 62 | + -DCMAKE_INSTALL_PREFIX=/usr \ |
| 63 | + -DCMAKE_TOOLCHAIN_FILE="$VcpkgRoot/scripts/buildsystems/vcpkg.cmake" \ |
| 64 | + -DCMAKE_EXE_LINKER_FLAGS="/LIBPATH:${clangBuiltinsDir} /defaultlib:${clangBuiltinsLib}" \ |
| 65 | + -DCMAKE_MT="${mtPath}" \ |
| 66 | + -DUSE_NATIVE_INSTRUCTIONS=OFF \ |
| 67 | + -DUSE_PRECOMPILED_HEADERS=OFF \ |
| 68 | + -DVCPKG_TARGET_TRIPLET="$VcpkgTriplet" \ |
| 69 | + -DFFMPEG_INCLUDE_DIR="$VcpkgInclude" \ |
| 70 | + -DFFMPEG_LIBAVCODEC="$VcpkgLib/avcodec.lib" \ |
| 71 | + -DFFMPEG_LIBAVFORMAT="$VcpkgLib/avformat.lib" \ |
| 72 | + -DFFMPEG_LIBAVUTIL="$VcpkgLib/avutil.lib" \ |
| 73 | + -DFFMPEG_LIBSWSCALE="$VcpkgLib/swscale.lib" \ |
| 74 | + -DFFMPEG_LIBSWRESAMPLE="$VcpkgLib/swresample.lib" \ |
| 75 | + -DUSE_SYSTEM_CURL=OFF \ |
| 76 | + -DUSE_FAUDIO=OFF \ |
| 77 | + -DUSE_SDL=ON \ |
| 78 | + -DUSE_SYSTEM_SDL=OFF \ |
| 79 | + -DUSE_SYSTEM_FFMPEG=ON \ |
| 80 | + -DUSE_SYSTEM_OPENCV=ON \ |
| 81 | + -DUSE_SYSTEM_OPENAL=OFF \ |
| 82 | + -DUSE_SYSTEM_LIBPNG=ON \ |
| 83 | + -DUSE_DISCORD_RPC=ON \ |
| 84 | + -DUSE_SYSTEM_ZSTD=ON \ |
| 85 | + -DWITH_LLVM=ON \ |
| 86 | + -DSTATIC_LINK_LLVM=ON \ |
| 87 | + -DBUILD_RPCS3_TESTS=OFF |
| 88 | + |
| 89 | +echo "CMake configuration complete" |
| 90 | + |
| 91 | +# Build with ninja |
| 92 | +echo "Starting build with Ninja..." |
| 93 | +ninja |
| 94 | + |
| 95 | +echo "Build succeeded" |
| 96 | + |
| 97 | +# Go back to root directory |
| 98 | +cd .. |
| 99 | +echo "Returned to root directory: $(pwd)" |
0 commit comments