mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-20 23:01:16 +00:00
Try entropy build
This commit is contained in:
parent
347da7d555
commit
4d8ee6a0a4
68
.github/workflows/build.yml
vendored
68
.github/workflows/build.yml
vendored
@ -59,6 +59,67 @@ jobs:
|
||||
-Werror=dev
|
||||
cmake --build build -- -k0
|
||||
|
||||
build-with-entropy:
|
||||
name: 'MSVC 4.20 with additional entropy'
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
matrix:
|
||||
instance: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: itsmattkc/msvc420
|
||||
path: msvc420
|
||||
|
||||
- name: Setup cmake
|
||||
uses: jwlawson/actions-setup-cmake@v2
|
||||
with:
|
||||
# Use minimum supported version
|
||||
cmake-version: '3.15.x'
|
||||
|
||||
- name: Patch MSVC 4.2
|
||||
run: |
|
||||
tools/patch_c2.py msvc420/bin/C2.EXE
|
||||
|
||||
- name: Generate Entropy
|
||||
shell: bash
|
||||
run: |
|
||||
tools/entropy.sh
|
||||
|
||||
- name: Build
|
||||
shell: cmd
|
||||
run: |
|
||||
call .\msvc420\bin\VCVARS32.BAT x86
|
||||
cmake -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -ISLE_INCLUDE_ENTROPY=ON -G "NMake Makefiles"
|
||||
cmake --build build
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@main
|
||||
with:
|
||||
name: Win32-Entropy-${{ matrix.instance }}
|
||||
path: |
|
||||
build/CONFIG.EXE
|
||||
build/CONFIG.PDB
|
||||
build/ISLE.EXE
|
||||
build/ISLE.PDB
|
||||
build/LEGO1.DLL
|
||||
build/LEGO1.PDB
|
||||
|
||||
merge-entropy-artifacts:
|
||||
name: 'Merge entropy artifacts'
|
||||
runs-on: ubuntu-latest
|
||||
needs: build-with-entropy
|
||||
steps:
|
||||
- name: Merge Artifacts
|
||||
uses: actions/upload-artifact/merge@v4
|
||||
with:
|
||||
name: Win32-Entropy
|
||||
pattern: Win32-Entropy-*
|
||||
separate-directories: true
|
||||
|
||||
build:
|
||||
name: 'MSVC 4.20'
|
||||
runs-on: windows-latest
|
||||
@ -102,7 +163,7 @@ jobs:
|
||||
|
||||
compare:
|
||||
name: Compare with master
|
||||
needs: [build, fetch-deps]
|
||||
needs: [build, merge-entropy-artifacts, fetch-deps]
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@main
|
||||
@ -116,6 +177,11 @@ jobs:
|
||||
name: Win32
|
||||
path: build
|
||||
|
||||
- uses: actions/download-artifact@main
|
||||
with:
|
||||
name: Win32-Entropy
|
||||
path: build-entropy
|
||||
|
||||
- name: Restore cached original binaries
|
||||
id: cache-original-binaries
|
||||
uses: actions/cache/restore@v4
|
||||
|
||||
@ -66,6 +66,7 @@ option(ISLE_DECOMP_ASSERT "Assert struct size" ${MSVC_FOR_DECOMP})
|
||||
cmake_dependent_option(ISLE_USE_DX5_LIBS "Build with internal DirectX 5 SDK Libraries" ON ISLE_USE_DX5 OFF)
|
||||
option(ISLE_BUILD_LEGO1 "Build LEGO1.DLL library" ON)
|
||||
option(ISLE_BUILD_BETA10 "Build BETA10.DLL library" OFF)
|
||||
option(ISLE_INCLUDE_ENTROPY "Build with entropy.h" OFF)
|
||||
|
||||
if(NOT (ISLE_BUILD_LEGO1 OR ISLE_BUILD_BETA10))
|
||||
message(FATAL_ERROR "ISLE_BUILD_LEGO1 AND ISLE_BUILD_BETA10 cannot be both disabled")
|
||||
@ -585,6 +586,12 @@ if (MSVC_FOR_DECOMP)
|
||||
set_property(TARGET isle ${lego1_targets} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||
endif()
|
||||
|
||||
if (ISLE_INCLUDE_ENTROPY)
|
||||
foreach(tgt IN LISTS lego1_targets beta10_targets)
|
||||
target_compile_options(${tgt} PRIVATE /FI${PROJECT_SOURCE_DIR}/tools/entropy.h)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if(TARGET lego1)
|
||||
target_link_options(lego1 PRIVATE "/OPT:REF")
|
||||
# Equivalent to target_compile_options(... PRIVATE "/MT$<$<CONFIG:Debug>:d>")
|
||||
|
||||
1
tools/entropy.h
Normal file
1
tools/entropy.h
Normal file
@ -0,0 +1 @@
|
||||
|
||||
31
tools/entropy.sh
Normal file
31
tools/entropy.sh
Normal file
@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Output file
|
||||
OUTPUT_FILE="entropy.h"
|
||||
|
||||
# Function to generate a random CamelCase string of given length
|
||||
generate_name() {
|
||||
cat /dev/urandom | tr -dc 'a-z' | fold -w "$1" | head -n 1 | sed -E 's/(^|_)([a-z])/\U\2/g'
|
||||
}
|
||||
|
||||
# Generate a random number of classes (between 1 and 10)
|
||||
NUM_CLASSES=$((RANDOM % 10 + 1))
|
||||
|
||||
> "$OUTPUT_FILE" # Clear or create the output file
|
||||
|
||||
for ((i=0; i<NUM_CLASSES; i++)); do
|
||||
CLASS_NAME="Class$(generate_name 6)"
|
||||
echo "class $CLASS_NAME {" >> "$OUTPUT_FILE"
|
||||
|
||||
# Generate a random number of methods (between 1 and 10)
|
||||
NUM_METHODS=$((RANDOM % 10 + 1))
|
||||
for ((j=0; j<NUM_METHODS; j++)); do
|
||||
METHOD_NAME="Function$(generate_name 8)"
|
||||
echo "inline void $METHOD_NAME() {}" >> "$OUTPUT_FILE"
|
||||
done
|
||||
|
||||
echo "};" >> "$OUTPUT_FILE"
|
||||
echo >> "$OUTPUT_FILE" # Add an empty line for readability
|
||||
done
|
||||
|
||||
echo "Generated $NUM_CLASSES classes in $OUTPUT_FILE"
|
||||
Loading…
Reference in New Issue
Block a user