Skip to content

Commit 6a42a93

Browse files
committed
Windows build shell script
1 parent 42a8f7d commit 6a42a93

File tree

4 files changed

+118
-154
lines changed

4 files changed

+118
-154
lines changed

.ci/build-windows-clang-cl.ps1

Lines changed: 0 additions & 141 deletions
This file was deleted.

.ci/build-windows-clang-cl.sh

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
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+
clangPath=$(echo "C:\Program Files\LLVM\bin" | sed 's|Program Files|PROGRA~1|g')
17+
18+
echo "Found Clang builtins library: $clangBuiltinsLib in $clangBuiltinsDir"
19+
echo "Found Clang Path: $clangPath"
20+
21+
# Search for mt.exe in SDK bin directories
22+
echo "Searching for llvm-mt.exe ..."
23+
mtPath=$(find "$clangPath" -name "llvm-mt.exe")
24+
25+
if [[ -z "$mtPath" ]]; then
26+
echo "ERROR: Could not find llvm-mt.exe in SDK directories."
27+
exit 1
28+
fi
29+
30+
echo "Found llvm-mt.exe at: $mtPath"
31+
32+
VcpkgRoot="$(pwd)/vcpkg"
33+
VcpkgTriplet="$VCPKG_TRIPLET"
34+
VcpkgInstall="$VcpkgRoot/installed/$VcpkgTriplet"
35+
VcpkgInclude="$VcpkgInstall/include"
36+
VcpkgLib="$VcpkgInstall/lib"
37+
VcpkgBin="$VcpkgInstall/bin"
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+
excludedSubs=("llvm" "opencv" "ffmpeg" "FAudio" "zlib" "libpng" "feralinteractive")
46+
47+
# Get submodule paths excluding those in excludedSubs
48+
readarray -t submodules < <(grep 'path = ' .gitmodules | sed 's/path = //' | grep -v -E "$(IFS=\|; echo "${excludedSubs[*]}")")
49+
50+
echo "Updating submodules: ${submodules[*]}"
51+
git submodule update --init --quiet ${submodules[@]}
52+
53+
# Create and enter build directory
54+
echo "Creating build directory"
55+
mkdir -p build
56+
cd build || exit
57+
echo "Changed directory to: $(pwd)"
58+
59+
# Run CMake with Ninja generator and required flags
60+
echo "Running CMake configuration"
61+
cmake .. \
62+
-G Ninja \
63+
-DCMAKE_BUILD_TYPE=Release \
64+
-DCMAKE_C_COMPILER="${clangPath}/clang-cl.exe" \
65+
-DCMAKE_CXX_COMPILER="${clangPath}/clang-cl.exe" \
66+
-DCMAKE_LINKER="${clangPath}/lld-link.exe" \
67+
-DCMAKE_INSTALL_PREFIX=/usr \
68+
-DCMAKE_TOOLCHAIN_FILE="$VcpkgRoot/scripts/buildsystems/vcpkg.cmake" \
69+
-DCMAKE_EXE_LINKER_FLAGS="/LIBPATH:${clangBuiltinsDir} /defaultlib:${clangBuiltinsLib}" \
70+
-DCMAKE_MT="${mtPath}" \
71+
-DUSE_NATIVE_INSTRUCTIONS=OFF \
72+
-DUSE_PRECOMPILED_HEADERS=OFF \
73+
-DVCPKG_TARGET_TRIPLET="$VcpkgTriplet" \
74+
-DFFMPEG_INCLUDE_DIR="$VcpkgInclude" \
75+
-DFFMPEG_LIBAVCODEC="$VcpkgLib/avcodec.lib" \
76+
-DFFMPEG_LIBAVFORMAT="$VcpkgLib/avformat.lib" \
77+
-DFFMPEG_LIBAVUTIL="$VcpkgLib/avutil.lib" \
78+
-DFFMPEG_LIBSWSCALE="$VcpkgLib/swscale.lib" \
79+
-DFFMPEG_LIBSWRESAMPLE="$VcpkgLib/swresample.lib" \
80+
-DUSE_SYSTEM_CURL=OFF \
81+
-DUSE_FAUDIO=OFF \
82+
-DUSE_SDL=ON \
83+
-DUSE_SYSTEM_SDL=OFF \
84+
-DUSE_SYSTEM_FFMPEG=ON \
85+
-DUSE_SYSTEM_OPENCV=ON \
86+
-DUSE_SYSTEM_OPENAL=OFF \
87+
-DUSE_SYSTEM_LIBPNG=ON \
88+
-DUSE_DISCORD_RPC=ON \
89+
-DUSE_SYSTEM_ZSTD=ON \
90+
-DWITH_LLVM=ON \
91+
-DSTATIC_LINK_LLVM=ON \
92+
-DBUILD_RPCS3_TESTS=OFF
93+
94+
echo "CMake configuration complete"
95+
96+
# Build with ninja
97+
echo "Starting build with Ninja..."
98+
ninja
99+
100+
if [[ $? -ne 0 ]]; then
101+
echo "Build failed with exit code $?"
102+
exit 1
103+
fi
104+
105+
echo "Build succeeded"
106+
107+
# Go back to root directory
108+
cd ..
109+
echo "Returned to root directory: $(pwd)"

.github/workflows/rpcs3.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,6 @@ jobs:
392392
id: restore-vcpkg-cache
393393
with:
394394
path: |
395-
vcpkg/vcpkg.exe
396395
vcpkg/installed
397396
vcpkg/buildtrees
398397
key: vcpkg-${{ runner.os }}-${{ matrix.compiler }}-${{ runner.arch }}-${{ hashFiles('**/vcpkg') }}
@@ -422,7 +421,6 @@ jobs:
422421
uses: actions/cache/save@main
423422
with:
424423
path: |
425-
vcpkg/vcpkg.exe
426424
vcpkg/installed
427425
vcpkg/buildtrees
428426
key: ${{ steps.restore-vcpkg-cache.outputs.cache-primary-key }}
@@ -481,13 +479,12 @@ jobs:
481479
run: |
482480
mkdir -p "C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional" || true
483481
cp -r "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/DIA SDK" "C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/DIA SDK"
482+
"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
484483
485484
- name: Build RPCS3
486485
if: ${{ matrix.compiler == 'clang-cl' }}
487486
shell: cmd
488-
run: |
489-
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
490-
powershell -ExecutionPolicy Bypass -File .ci/build-windows-clang-cl.ps1
487+
run: .ci/build-windows-clang-cl.sh
491488

492489
- name: Save build Ccache
493490
#if: github.ref == 'refs/heads/master'

3rdparty/zstd/CMakeLists.txt

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
# zstd
2-
# Select the version of zstd to use, default is builtin
3-
if(NOT USE_SYSTEM_ZSTD)
1+
if(USE_SYSTEM_ZSTD)
2+
message(STATUS "RPCS3: using shared zstd")
3+
pkg_check_modules(zstd REQUIRED IMPORTED_TARGET libzstd)
4+
add_library(3rdparty_zstd INTERFACE)
5+
target_link_libraries(3rdparty_zstd INTERFACE PkgConfig::zstd)
6+
target_include_directories(3rdparty_zstd INTERFACE PkgConfig::RtMidi)
7+
else()
48
option(ZSTD_BUILD_PROGRAMS "BUILD PROGRAMS" OFF)
59
option(ZSTD_BUILD_SHARED "BUILD SHARED LIBRARIES" OFF)
610
option(ZSTD_BUILD_STATIC "BUILD STATIC LIBRARIES" ON)
711
option(ZSTD_BUILD_TESTS "BUILD TESTS" OFF)
812
add_subdirectory(zstd/build/cmake EXLUDE_FROM_ALL)
913
add_library(3rdparty_zstd INTERFACE)
1014
target_link_libraries(3rdparty_zstd INTERFACE libzstd_static)
11-
else()
12-
message(STATUS "RPCS3: using VCPKG zstd")
13-
find_package(zstd CONFIG REQUIRED)
14-
add_library(3rdparty_zstd INTERFACE)
15-
target_link_libraries(3rdparty_zstd INTERFACE zstd::libzstd)
1615
endif()

0 commit comments

Comments
 (0)