Skip to content

Commit c902134

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

File tree

4 files changed

+108
-154
lines changed

4 files changed

+108
-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: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
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)"

.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)